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