Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 101 lines 3.7 kB view raw
1{ lib, stdenv, buildPackages, fetchurl, fetchpatch, autoreconfHook, which, pkg-config, perl, guile, libxml2 }: 2 3stdenv.mkDerivation rec { 4 pname = "autogen"; 5 version = "5.18.16"; 6 7 src = fetchurl { 8 url = "mirror://gnu/autogen/rel${version}/autogen-${version}.tar.xz"; 9 sha256 = "16mlbdys8q4ckxlvxyhwkdnh1ay9f6g0cyp1kylkpalgnik398gq"; 10 }; 11 12 patches = let 13 dp = { ver ? "1%255.18.16-4", pname, name ? (pname + ".diff"), sha256 }: fetchurl { 14 url = "https://salsa.debian.org/debian/autogen/-/raw/debian/${ver}" 15 + "/debian/patches/${pname}.diff?inline=false"; 16 inherit name sha256; 17 }; 18 in [ 19 (dp { 20 pname = "20_no_Werror"; 21 sha256 = "08z4s2ifiqyaacjpd9pzr59w8m4j3548kkaq1bwvp2gjn29m680x"; 22 }) 23 (dp { 24 pname = "30_ag_macros.m4_syntax_error"; 25 sha256 = "1z8vmbwbkz3505wd33i2xx91mlf8rwsa7klndq37nw821skxwyh3"; 26 }) 27 (dp { 28 pname = "31_allow_overriding_AGexe_for_crossbuild"; 29 sha256 = "0h9wkc9bqb509knh8mymi43hg6n6sxg2lixvjlchcx7z0j7p8xkf"; 30 }) 31 # Next upstream release will contain guile-3 support. We apply non-invasive 32 # patch meanwhile. 33 (fetchpatch { 34 name = "guile-3.patch"; 35 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-devel/autogen/files/autogen-5.18.16-guile-3.patch?id=43bcc61c56a5a7de0eaf806efec7d8c0e4c01ae7"; 36 sha256 = "18d7y1f6164dm1wlh7rzbacfygiwrmbc35a7qqsbdawpkhydm5lr"; 37 }) 38 ]; 39 40 outputs = [ "bin" "dev" "lib" "out" "man" "info" ]; 41 42 nativeBuildInputs = [ 43 which pkg-config perl autoreconfHook/*patches applied*/ 44 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 45 # autogen needs a build autogen when cross-compiling 46 buildPackages.buildPackages.autogen buildPackages.texinfo 47 ]; 48 buildInputs = [ 49 guile libxml2 50 ]; 51 52 preConfigure = '' 53 export MAN_PAGE_DATE=$(date '+%Y-%m-%d' -d "@$SOURCE_DATE_EPOCH") 54 ''; 55 56 configureFlags = [ 57 "--with-libxml2=${libxml2.dev}" 58 "--with-libxml2-cflags=-I${libxml2.dev}/include/libxml2" 59 # Make sure to use a static value for the timeout. If we do not set a value 60 # here autogen will select one based on the execution time of the configure 61 # phase which is not really reproducible. 62 # 63 # If you are curious about the number 78, it has been cargo-culted from 64 # Debian: https://salsa.debian.org/debian/autogen/-/blob/master/debian/rules#L21 65 "--enable-timeout=78" 66 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 67 # the configure check for regcomp wants to run a host program 68 "libopts_cv_with_libregex=yes" 69 #"MAKEINFO=${buildPackages.texinfo}/bin/makeinfo" 70 ] 71 # See: https://sourceforge.net/p/autogen/bugs/187/ 72 ++ lib.optionals stdenv.isDarwin [ "ac_cv_func_utimensat=no" ]; 73 74 #doCheck = true; # not reliable 75 76 postInstall = '' 77 mkdir -p $dev/bin 78 mv $bin/bin/autoopts-config $dev/bin 79 80 for f in $lib/lib/autogen/tpl-config.tlib $out/share/autogen/tpl-config.tlib; do 81 sed -e "s|$dev/include|/no-such-autogen-include-path|" -i $f 82 sed -e "s|$bin/bin|/no-such-autogen-bin-path|" -i $f 83 sed -e "s|$lib/lib|/no-such-autogen-lib-path|" -i $f 84 done 85 86 '' + lib.optionalString (!stdenv.hostPlatform.isDarwin) '' 87 # remove build directory (/build/**, or /tmp/nix-build-**) from RPATHs 88 for f in "$bin"/bin/*; do 89 local nrp="$(patchelf --print-rpath "$f" | sed -E 's@(:|^)'$NIX_BUILD_TOP'[^:]*:@\1@g')" 90 patchelf --set-rpath "$nrp" "$f" 91 done 92 ''; 93 94 meta = with lib; { 95 description = "Automated text and program generation tool"; 96 license = with licenses; [ gpl3Plus lgpl3Plus ]; 97 homepage = "https://www.gnu.org/software/autogen/"; 98 platforms = platforms.all; 99 maintainers = [ ]; 100 }; 101}