1 { lib, stdenv, fetchurl, updateAutotoolsGnuConfigScriptsHook, xz, coreutils ? null }:
3 # Note: this package is used for bootstrapping fetchurl, and thus
4 # cannot use fetchpatch! All mutable patches (generated by GitHub or
5 # cgit) that are needed here should be included directly in Nixpkgs as
8 stdenv.mkDerivation rec {
13 url = "mirror://gnu/diffutils/diffutils-${version}.tar.xz";
14 hash = "sha256-kOXpPMck5OvhLt6A3xY0Bjx6hVaSaFkZv+YLVWyb0J4=";
17 outputs = [ "out" "info" ];
19 nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook (lib.getBin xz) ];
20 /* If no explicit coreutils is given, use the one from stdenv. */
21 buildInputs = [ coreutils ];
23 # Disable stack-related gnulib tests on x86_64-darwin because they have problems running under
24 # Rosetta 2: test-c-stack hangs, test-sigsegv-catch-stackoverflow fails.
25 postPatch = if (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) then ''
26 sed -i -E 's:test-c-stack2?\.sh::g' gnulib-tests/Makefile.in
27 sed -i -E 's:test-sigsegv-catch-stackoverflow[12]::g' gnulib-tests/Makefile.in
31 # "pr" need not be on the PATH as a run-time dep, so we need to tell
32 # configure where it is. Covers the cross and native case alike.
33 lib.optional (coreutils != null) "PR_PROGRAM=${coreutils}/bin/pr"
34 ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "gl_cv_func_getopt_gnu=yes";
36 # Test failure on QEMU only (#300550)
37 doCheck = !stdenv.buildPlatform.isRiscV64;
40 homepage = "https://www.gnu.org/software/diffutils/diffutils.html";
41 description = "Commands for showing the differences between files (diff, cmp, etc.)";
42 license = licenses.gpl3;
43 platforms = platforms.unix;
44 maintainers = with maintainers; [ das_j ];