fork
Configure Feed
Select the types of activity you want to include in your feed.
lol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{ lib, stdenv
2, fetchurl, autoreconfHook, gettext, freebsd, netbsd
3}:
4
5# Note: this package is used for bootstrapping fetchurl, and thus
6# cannot use fetchpatch! All mutable patches (generated by GitHub or
7# cgit) that are needed here should be included directly in Nixpkgs as
8# files.
9
10stdenv.mkDerivation rec {
11 pname = "libelf";
12 version = "0.8.13";
13
14 src = fetchurl {
15 url = "https://fossies.org/linux/misc/old/${pname}-${version}.tar.gz";
16 sha256 = "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr";
17 };
18
19 patches = [
20 ./dont-hardcode-ar.patch
21 # Fix warnings from preprocessor instructions.
22 # https://github.com/NixOS/nixpkgs/issues/59929
23 ./preprocessor-warnings.patch
24 # `configure` defines a test `main` with an implicit `int` return, which clang 16 disallows.
25 ./fix-configure-main.patch
26 ];
27
28 enableParallelBuilding = true;
29 # Lacks dependencies:
30 # mkdir ...-libelf-0.8.13/lib
31 # mkdir ...-libelf-0.8.13/lib
32 # mkdir: cannot create directory '...-libelf-0.8.13/lib': File exists
33 enableParallelInstalling = false;
34
35 doCheck = true;
36
37 preConfigure = if !stdenv.hostPlatform.useAndroidPrebuilt then null else ''
38 sed -i 's|DISTSUBDIRS = lib po|DISTSUBDIRS = lib|g' Makefile.in
39 sed -i 's|SUBDIRS = lib @POSUB@|SUBDIRS = lib|g' Makefile.in
40 '';
41
42 configureFlags = []
43 # Configure check for dynamic lib support is broken, see
44 # http://lists.uclibc.org/pipermail/uclibc-cvs/2005-August/019383.html
45 ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "mr_cv_target_elf=yes"
46 # Libelf's custom NLS macros fail to determine the catalog file extension
47 # on Darwin, so disable NLS for now.
48 ++ lib.optional stdenv.hostPlatform.isDarwin "--disable-nls";
49
50 strictDeps = true;
51 nativeBuildInputs =
52 (if stdenv.hostPlatform.isFreeBSD then [ freebsd.gencat ]
53 else if stdenv.hostPlatform.isNetBSD then [ netbsd.gencat ]
54 else [ gettext ])
55 # Need to regenerate configure script with newer version in order to pass
56 # "mr_cv_target_elf=yes" and determine integer sizes correctly when
57 # cross-compiling, but `autoreconfHook` brings in `makeWrapper` which
58 # doesn't work with the bootstrapTools bash, so can only do this for
59 # cross builds when `stdenv.shell` is a newer bash.
60 ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform
61 # The provided `configure` script fails on clang 16 because some tests have a `main`
62 # returning an implicit `int`, which clang 16 treats as an error. Running `autoreconf` fixes
63 # the test and allows `configure` to detect clang properly.
64 # This is done only for clang on Darwin because the Darwin stdenv bootstrap does not use
65 # libelf, so should be safe because it will always be run with a compatible version of bash.
66 || (stdenv.cc.isClang && stdenv.isDarwin)) autoreconfHook;
67
68 meta = {
69 description = "ELF object file access library";
70
71 homepage = "https://github.com/Distrotech/libelf";
72
73 license = lib.licenses.lgpl2Plus;
74
75 platforms = lib.platforms.all;
76 maintainers = [ ];
77 };
78}