about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/text/diffutils/default.nix
blob: fb0a95c49e139821952415abeb55680a335a5b54 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{ lib, stdenv, fetchurl, xz, coreutils ? null }:

# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as
# files.

stdenv.mkDerivation rec {
  pname = "diffutils";
  version = "3.9";

  src = fetchurl {
    url = "mirror://gnu/diffutils/diffutils-${version}.tar.xz";
    hash = "sha256-2A076QogGGjeg9eNrTQTrYgWDMU7zDbrnq98INvwI/E=";
  };

  patches = [
    # Backport of a fix for 'diff -D' output.
    # TODO: remove when updating to 3.10.
    ./fix-diff-D.patch
  ];

  postPatch = ''
    # avoid the need for help2man
    # TODO: can be removed when fix-diff-D.patch is removed.
    touch man/diff.1
  '';

  outputs = [ "out" "info" ];

  nativeBuildInputs = [ xz.bin ];
  /* If no explicit coreutils is given, use the one from stdenv. */
  buildInputs = [ coreutils ];

  configureFlags =
    # "pr" need not be on the PATH as a run-time dep, so we need to tell
    # configure where it is. Covers the cross and native case alike.
    lib.optional (coreutils != null) "PR_PROGRAM=${coreutils}/bin/pr"
    ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "gl_cv_func_getopt_gnu=yes";

  meta = with lib; {
    homepage = "https://www.gnu.org/software/diffutils/diffutils.html";
    description = "Commands for showing the differences between files (diff, cmp, etc.)";
    license = licenses.gpl3;
    platforms = platforms.unix;
  };
}