1 { lib, stdenv, fetchurl, fetchpatch, bzip2 }:
3 stdenv.mkDerivation rec {
8 url = "https://www.daemonology.net/bsdiff/${pname}-${version}.tar.gz";
9 sha256 = "0j2zm3z271x5aw63mwhr3vymzn45p2vvrlrpm9cz2nywna41b0hq";
12 buildInputs = [ bzip2 ];
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=";
18 ./CVE-2020-14315.patch
19 ./include-systypes.patch
20 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
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=";
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=";
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=";
36 $CC -O3 -lbz2 bspatch.c -o bspatch
37 $CC -O3 -lbz2 bsdiff.c -o bsdiff
42 mkdir -p $out/share/man/man1
46 cp bsdiff.1 $out/share/man/man1
47 cp bspatch.1 $out/share/man/man1
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 ];