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 postInstall = ''
19 for bin in $out/bin/{splitdiff,rediff,editdiff,dehtmldiff}; do
20 wrapProgram "$bin" \
21 --prefix PATH : "$out/bin"
22 done
23 '';
24
25 doCheck = lib.versionAtLeast version "0.3.4";
26
27 preCheck = ''
28 patchShebangs tests
29 chmod +x scripts/*
30 '' + lib.optionalString (lib.versionOlder version "0.4.2") ''
31 find tests -type f -name 'run-test' \
32 -exec sed -i '{}' -e 's|/bin/echo|echo|g' \;
33 '';
34
35 meta = with lib; {
36 description = "Tools to manipulate patch files";
37 homepage = "http://cyberelk.net/tim/software/patchutils";
38 license = licenses.gpl2Plus;
39 platforms = platforms.all;
40 maintainers = with maintainers; [ artturin ];
41 };
42}