1{ lib, stdenv, fetchFromGitHub, autoreconfHook
2, lzmaSupport ? true, xz ? null
3}:
4
5assert lzmaSupport -> xz != null;
6
7let
8 mkWith = flag: name: if flag
9 then "--with-${name}"
10 else "--without-${name}";
11in stdenv.mkDerivation rec {
12 pname = "xdelta";
13 version = "3.1.0";
14
15 src = fetchFromGitHub {
16 sha256 = "09mmsalc7dwlvgrda56s2k927rpl3a5dzfa88aslkqcjnr790wjy";
17 rev = "v${version}";
18 repo = "xdelta-devel";
19 owner = "jmacd";
20 };
21
22 nativeBuildInputs = [ autoreconfHook ];
23 buildInputs = []
24 ++ lib.optionals lzmaSupport [ xz ];
25
26 postPatch = ''
27 cd xdelta3
28 '';
29
30 configureFlags = [
31 (mkWith lzmaSupport "liblzma")
32 ];
33
34 enableParallelBuilding = true;
35
36 doCheck = true;
37 checkPhase = ''
38 mkdir $PWD/tmp
39 for i in testing/file.h xdelta3-test.h; do
40 substituteInPlace $i --replace /tmp $PWD/tmp
41 done
42 ./xdelta3regtest
43 '';
44
45 installPhase = ''
46 install -D -m755 xdelta3 $out/bin/xdelta3
47 install -D -m644 xdelta3.1 $out/share/man/man1/xdelta3.1
48 '';
49
50 meta = with lib; {
51 description = "Binary differential compression in VCDIFF (RFC 3284) format";
52 longDescription = ''
53 xdelta is a command line program for delta encoding, which generates two
54 file differences. This is similar to diff and patch, but it is targeted
55 for binary files and does not generate human readable output.
56 '';
57 homepage = "http://xdelta.org/";
58 license = licenses.gpl2Plus;
59 mainProgram = "xdelta3";
60 platforms = platforms.unix;
61 };
62}