Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at master 2.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 updateAutotoolsGnuConfigScriptsHook, 6 xz, 7 coreutils ? null, 8}: 9 10# Note: this package is used for bootstrapping fetchurl, and thus 11# cannot use fetchpatch! All mutable patches (generated by GitHub or 12# cgit) that are needed here should be included directly in Nixpkgs as 13# files. 14 15stdenv.mkDerivation rec { 16 pname = "diffutils"; 17 version = "3.12"; 18 19 src = fetchurl { 20 url = "mirror://gnu/diffutils/diffutils-${version}.tar.xz"; 21 hash = "sha256-fIt/n8hgkUH96pzs6FJJ0whiQ5H/Yd7a9Sj8szdyff0="; 22 }; 23 24 outputs = [ 25 "out" 26 "info" 27 ]; 28 29 patches = [ 30 # Fixes test-float-h failure on ppc64 with C23 31 # https://lists.gnu.org/archive/html/bug-gnulib/2025-07/msg00021.html 32 # Multiple upstream commits squashed with adjustments, see header 33 ./gnulib-float-h-tests-port-to-C23-PowerPC-GCC.patch 34 ] 35 ++ lib.optionals stdenv.hostPlatform.useLLVM [ 36 ./musl-llvm.patch 37 ]; 38 39 nativeBuildInputs = [ 40 updateAutotoolsGnuConfigScriptsHook 41 (lib.getBin xz) 42 ]; 43 # If no explicit coreutils is given, use the one from stdenv. 44 buildInputs = [ coreutils ]; 45 46 # Disable stack-related gnulib tests on x86_64-darwin because they have problems running under 47 # Rosetta 2: test-c-stack hangs, test-sigsegv-catch-stackoverflow and test-sigaction fail. 48 postPatch = 49 if 50 ((stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) || (stdenv.hostPlatform.isAarch32)) 51 then 52 '' 53 sed -i -E 's:[[:space:]]test-c-stack2?\.sh::g' gnulib-tests/Makefile.in 54 sed -i -E 's:[[:space:]]test-sigsegv-catch-stackoverflow[12]\$\(EXEEXT\)::g' gnulib-tests/Makefile.in 55 sed -i -E 's:[[:space:]]test-sigaction\$\(EXEEXT\)::g' gnulib-tests/Makefile.in 56 '' 57 else if stdenv.hostPlatform.isFreeBSD then 58 '' 59 sed -i -E 's:test-time::g' gnulib-tests/Makefile.in 60 '' 61 else 62 null; 63 64 configureFlags = 65 # "pr" need not be on the PATH as a run-time dep, so we need to tell 66 # configure where it is. Covers the cross and native case alike. 67 lib.optional (coreutils != null) "PR_PROGRAM=${coreutils}/bin/pr" 68 ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ 69 "gl_cv_func_getopt_gnu=yes" 70 "gl_cv_func_strcasecmp_works=yes" 71 ]; 72 73 # Test failure on QEMU only (#300550) 74 doCheck = !stdenv.buildPlatform.isRiscV64; 75 76 meta = with lib; { 77 homepage = "https://www.gnu.org/software/diffutils/diffutils.html"; 78 description = "Commands for showing the differences between files (diff, cmp, etc.)"; 79 license = licenses.gpl3; 80 platforms = platforms.unix; 81 maintainers = lib.teams.helsinki-systems.members; 82 }; 83}