Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 81 lines 2.3 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 autoreconfHook, 6 gettext, 7 freebsd, 8 netbsd, 9}: 10 11stdenv.mkDerivation rec { 12 pname = "libelf"; 13 version = "0.8.13"; 14 15 src = fetchurl { 16 url = "https://fossies.org/linux/misc/old/${pname}-${version}.tar.gz"; 17 sha256 = "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr"; 18 }; 19 20 patches = [ 21 ./dont-hardcode-ar.patch 22 # Fix warnings from preprocessor instructions. 23 # https://github.com/NixOS/nixpkgs/issues/59929 24 ./preprocessor-warnings.patch 25 # `configure` defines a test `main` with an implicit `int` return, which clang 16 disallows. 26 ./fix-configure-main.patch 27 ]; 28 29 enableParallelBuilding = true; 30 # Lacks dependencies: 31 # mkdir ...-libelf-0.8.13/lib 32 # mkdir ...-libelf-0.8.13/lib 33 # mkdir: cannot create directory '...-libelf-0.8.13/lib': File exists 34 enableParallelInstalling = false; 35 36 doCheck = true; 37 38 preConfigure = 39 if !stdenv.hostPlatform.useAndroidPrebuilt then 40 null 41 else 42 '' 43 sed -i 's|DISTSUBDIRS = lib po|DISTSUBDIRS = lib|g' Makefile.in 44 sed -i 's|SUBDIRS = lib @POSUB@|SUBDIRS = lib|g' Makefile.in 45 ''; 46 47 configureFlags = 48 [ ] 49 # Configure check for dynamic lib support is broken, see 50 # http://lists.uclibc.org/pipermail/uclibc-cvs/2005-August/019383.html 51 ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "mr_cv_target_elf=yes" 52 # Libelf's custom NLS macros fail to determine the catalog file extension 53 # on Darwin, so disable NLS for now. 54 ++ lib.optional stdenv.hostPlatform.isDarwin "--disable-nls"; 55 56 strictDeps = true; 57 nativeBuildInputs = 58 ( 59 if stdenv.hostPlatform.isFreeBSD then 60 [ freebsd.gencat ] 61 else if stdenv.hostPlatform.isNetBSD then 62 [ netbsd.gencat ] 63 else 64 [ gettext ] 65 ) 66 # The provided `configure` script fails on clang 16 because some tests have a `main` 67 # returning an implicit `int`, which clang 16 treats as an error. Running `autoreconf` fixes 68 # the test and allows `configure` to detect clang properly. 69 ++ [ autoreconfHook ]; 70 71 meta = { 72 description = "ELF object file access library"; 73 74 homepage = "https://github.com/Distrotech/libelf"; 75 76 license = lib.licenses.lgpl2Plus; 77 78 platforms = lib.platforms.all; 79 maintainers = [ ]; 80 }; 81}