biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / tools / compression / bsdiff / default.nix
blobe5be1e515b5aeb0a8eff643d045eaf1548709351
1 { lib, stdenv, fetchurl, fetchpatch, bzip2 }:
3 stdenv.mkDerivation rec {
4   pname = "bsdiff";
5   version = "4.3";
7   src = fetchurl {
8     url = "https://www.daemonology.net/bsdiff/${pname}-${version}.tar.gz";
9     sha256 = "0j2zm3z271x5aw63mwhr3vymzn45p2vvrlrpm9cz2nywna41b0hq";
10   };
12   buildInputs = [ bzip2 ];
13   patches = [
14     (fetchpatch {
15       url = "https://sources.debian.org/data/main/b/bsdiff/4.3-22/debian/patches/20-CVE-2014-9862.patch";
16       sha256 = "sha256-3UuUfNvShQ8fLqxCKUTb/n4BmjL4+Nl7aEqCxYrrERQ=";
17     })
18     ./CVE-2020-14315.patch
19     ./include-systypes.patch
20   ] ++ lib.optionals stdenv.hostPlatform.isLinux [
21     (fetchpatch {
22       url = "https://sources.debian.org/data/main/b/bsdiff/4.3-22/debian/patches/30-bug-632585-mmap-src-file-instead-of-malloc-read-it.patch";
23       sha256 = "sha256-esbhz2/efUiuQDuF7LGfSeEn3/f1WbqCxQpTs2A0ulI=";
24     })
25     (fetchpatch {
26       url = "https://sources.debian.org/data/main/b/bsdiff/4.3-22/debian/patches/31-bug-632585-mmap-dst-file-instead-of-malloc-read-it.patch";
27       sha256 = "sha256-Of4aOcI0rsgdRzPqyw2VRn2p9wQuo3hdlgDTBdXGzoc=";
28     })
29     (fetchpatch {
30       url = "https://sources.debian.org/data/main/b/bsdiff/4.3-22/debian/patches/32-bug-632585-use-int32_t-instead-off_t-for-file-size.patch";
31       sha256 = "sha256-SooFnFK4uKNXvXQb/LEcH8GocnRtkryExI4b3BZTsAY=";
32     })
33   ];
35   buildPhase = ''
36     $CC -O3 -lbz2 bspatch.c -o bspatch
37     $CC -O3 -lbz2 bsdiff.c  -o bsdiff
38   '';
40   installPhase = ''
41     mkdir -p $out/bin
42     mkdir -p $out/share/man/man1
44     cp bsdiff    $out/bin
45     cp bspatch   $out/bin
46     cp bsdiff.1  $out/share/man/man1
47     cp bspatch.1 $out/share/man/man1
48   '';
50   meta = with lib; {
51     description = "Efficient binary diff/patch tool";
52     homepage = "https://www.daemonology.net/bsdiff/";
53     license = licenses.bsd2;
54     platforms = platforms.unix;
55     maintainers = [ maintainers.thoughtpolice ];
56   };