2 , fetchurl, autoreconfHook, gettext, netbsd
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
10 stdenv.mkDerivation rec {
15 url = "https://fossies.org/linux/misc/old/${pname}-${version}.tar.gz";
16 sha256 = "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr";
20 ./dont-hardcode-ar.patch
21 # Fix warnings from preprocessor instructions.
22 # https://github.com/NixOS/nixpkgs/issues/59929
23 ./preprocessor-warnings.patch
26 enableParallelBuilding = true;
30 preConfigure = if !stdenv.hostPlatform.useAndroidPrebuilt then null else ''
31 sed -i 's|DISTSUBDIRS = lib po|DISTSUBDIRS = lib|g' Makefile.in
32 sed -i 's|SUBDIRS = lib @POSUB@|SUBDIRS = lib|g' Makefile.in
36 # Configure check for dynamic lib support is broken, see
37 # http://lists.uclibc.org/pipermail/uclibc-cvs/2005-August/019383.html
38 ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "mr_cv_target_elf=yes"
39 # Libelf's custom NLS macros fail to determine the catalog file extension
40 # on Darwin, so disable NLS for now.
41 ++ lib.optional stdenv.hostPlatform.isDarwin "--disable-nls";
45 if stdenv.hostPlatform.isNetBSD then [ netbsd.gencat ] else [ gettext ]
46 # Need to regenerate configure script with newer version in order to pass
47 # "mr_cv_target_elf=yes", but `autoreconfHook` brings in `makeWrapper`
48 # which doesn't work with the bootstrapTools bash, so can only do this
49 # for cross builds when `stdenv.shell` is a newer bash.
50 ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) autoreconfHook;
53 description = "ELF object file access library";
55 homepage = "https://github.com/Distrotech/libelf";
57 license = lib.licenses.lgpl2Plus;
59 platforms = lib.platforms.all;