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