at master 2.6 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 36 nativeBuildInputs = [ 37 updateAutotoolsGnuConfigScriptsHook 38 (lib.getBin xz) 39 ]; 40 # If no explicit coreutils is given, use the one from stdenv. 41 buildInputs = [ coreutils ]; 42 43 # Disable stack-related gnulib tests on x86_64-darwin because they have problems running under 44 # Rosetta 2: test-c-stack hangs, test-sigsegv-catch-stackoverflow and test-sigaction fail. 45 postPatch = 46 if 47 ((stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) || (stdenv.hostPlatform.isAarch32)) 48 then 49 '' 50 sed -i -E 's:[[:space:]]test-c-stack2?\.sh::g' gnulib-tests/Makefile.in 51 sed -i -E 's:[[:space:]]test-sigsegv-catch-stackoverflow[12]\$\(EXEEXT\)::g' gnulib-tests/Makefile.in 52 sed -i -E 's:[[:space:]]test-sigaction\$\(EXEEXT\)::g' gnulib-tests/Makefile.in 53 '' 54 else if stdenv.hostPlatform.isFreeBSD then 55 '' 56 sed -i -E 's:test-time::g' gnulib-tests/Makefile.in 57 '' 58 else 59 null; 60 61 configureFlags = 62 # "pr" need not be on the PATH as a run-time dep, so we need to tell 63 # configure where it is. Covers the cross and native case alike. 64 lib.optional (coreutils != null) "PR_PROGRAM=${coreutils}/bin/pr" 65 ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ 66 "gl_cv_func_getopt_gnu=yes" 67 "gl_cv_func_strcasecmp_works=yes" 68 ]; 69 70 # Test failure on QEMU only (#300550) 71 doCheck = !stdenv.buildPlatform.isRiscV64; 72 73 meta = with lib; { 74 homepage = "https://www.gnu.org/software/diffutils/diffutils.html"; 75 description = "Commands for showing the differences between files (diff, cmp, etc.)"; 76 license = licenses.gpl3; 77 platforms = platforms.unix; 78 maintainers = lib.teams.helsinki-systems.members; 79 }; 80}