1{
2 lib,
3 stdenv,
4 fetchurl,
5 perl,
6 makeWrapper,
7 version,
8 sha256,
9 patches ? [ ],
10 extraBuildInputs ? [ ],
11 ...
12}:
13stdenv.mkDerivation rec {
14 pname = "patchutils";
15 inherit version patches;
16
17 src = fetchurl {
18 url = "http://cyberelk.net/tim/data/patchutils/stable/${pname}-${version}.tar.xz";
19 inherit sha256;
20 };
21
22 nativeBuildInputs = [ makeWrapper ];
23 buildInputs = [ perl ] ++ extraBuildInputs;
24 hardeningDisable = [ "format" ];
25
26 # tests fail when building in parallel
27 enableParallelBuilding = false;
28
29 postInstall = ''
30 for bin in $out/bin/{splitdiff,rediff,editdiff,dehtmldiff}; do
31 wrapProgram "$bin" \
32 --prefix PATH : "$out/bin"
33 done
34 '';
35
36 doCheck = lib.versionAtLeast version "0.3.4";
37
38 preCheck = ''
39 patchShebangs tests
40 chmod +x scripts/*
41 ''
42 + lib.optionalString (lib.versionOlder version "0.4.2") ''
43 find tests -type f -name 'run-test' \
44 -exec sed -i '{}' -e 's|/bin/echo|echo|g' \;
45 '';
46
47 meta = with lib; {
48 description = "Tools to manipulate patch files";
49 homepage = "http://cyberelk.net/tim/software/patchutils";
50 license = licenses.gpl2Plus;
51 platforms = platforms.all;
52 maintainers = with maintainers; [ artturin ];
53 };
54}