summary refs log tree commit diff
path: root/pkgs/tools/compression/xdelta/default.nix
blob: 2420f3fab61cfcc275c0ee9e6569bc3d3f4da308 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ stdenv, fetchFromGitHub, autoreconfHook
, lzmaSupport ? true, xz ? null
}:

assert lzmaSupport -> xz != null;

let
  mkWith = flag: name: if flag
    then "--with-${name}"
    else "--without-${name}";
in stdenv.mkDerivation rec {
  pname = "xdelta";
  version = "3.1.0";

  src = fetchFromGitHub {
    sha256 = "09mmsalc7dwlvgrda56s2k927rpl3a5dzfa88aslkqcjnr790wjy";
    rev = "v${version}";
    repo = "xdelta-devel";
    owner = "jmacd";
  };

  nativeBuildInputs = [ autoreconfHook ];
  buildInputs = []
    ++ stdenv.lib.optionals lzmaSupport [ xz ];

  postPatch = ''
    cd xdelta3
  '';

  configureFlags = [
    (mkWith lzmaSupport "liblzma")
  ];

  enableParallelBuilding = true;

  doCheck = true;
  checkPhase = ''
    mkdir $PWD/tmp
    for i in testing/file.h xdelta3-test.h; do
      substituteInPlace $i --replace /tmp $PWD/tmp
    done
    ./xdelta3regtest
  '';

  installPhase = ''
    install -D -m755 xdelta3 $out/bin/xdelta3
    install -D -m644 xdelta3.1 $out/share/man/man1/xdelta3.1
  '';

  meta = with stdenv.lib; {
    description = "Binary differential compression in VCDIFF (RFC 3284) format";
    longDescription = ''
      xdelta is a command line program for delta encoding, which generates two
      file differences. This is similar to diff and patch, but it is targeted
      for binary files and does not generate human readable output.
    '';
    homepage = "http://xdelta.org/";
    license = licenses.gpl2Plus;
    platforms = platforms.linux;
  };
}