summary refs log tree commit diff
path: root/pkgs/tools/compression
diff options
context:
space:
mode:
authorAustin Seipp <aseipp@pobox.com>2014-03-24 00:02:00 -0500
committerAustin Seipp <aseipp@pobox.com>2014-03-28 18:52:37 -0500
commit960690e9316488579cdda9b0419c9462d25dc47f (patch)
treed76e7a788bc6d1eb6687e2597eb1c3ae36e202f2 /pkgs/tools/compression
parent3f577799afca6238ac9f576c6047044ddf8271fe (diff)
downloadnixlib-960690e9316488579cdda9b0419c9462d25dc47f.tar
nixlib-960690e9316488579cdda9b0419c9462d25dc47f.tar.gz
nixlib-960690e9316488579cdda9b0419c9462d25dc47f.tar.bz2
nixlib-960690e9316488579cdda9b0419c9462d25dc47f.tar.lz
nixlib-960690e9316488579cdda9b0419c9462d25dc47f.tar.xz
nixlib-960690e9316488579cdda9b0419c9462d25dc47f.tar.zst
nixlib-960690e9316488579cdda9b0419c9462d25dc47f.zip
bsdiff: adopt and clean up
Bonus: simpler build, and should fix the build of bsdiff for Darwin
(patch taken from homebrew).

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Diffstat (limited to 'pkgs/tools/compression')
-rw-r--r--pkgs/tools/compression/bsdiff/builder.sh8
-rw-r--r--pkgs/tools/compression/bsdiff/default.nix37
-rw-r--r--pkgs/tools/compression/bsdiff/include-systypes.patch12
3 files changed, 42 insertions, 15 deletions
diff --git a/pkgs/tools/compression/bsdiff/builder.sh b/pkgs/tools/compression/bsdiff/builder.sh
deleted file mode 100644
index f2792a40a60c..000000000000
--- a/pkgs/tools/compression/bsdiff/builder.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-source $stdenv/setup
-
-installFlags="PREFIX=$out INSTALL=install"
-
-mkdir -p "$out/bin"
-mkdir -p "$out/man/man1"
-
-genericBuild
diff --git a/pkgs/tools/compression/bsdiff/default.nix b/pkgs/tools/compression/bsdiff/default.nix
index 81210490883f..1d693f781e6c 100644
--- a/pkgs/tools/compression/bsdiff/default.nix
+++ b/pkgs/tools/compression/bsdiff/default.nix
@@ -1,14 +1,37 @@
-{stdenv, fetchurl, bzip2}:
+{ stdenv, fetchurl, bzip2 }:
+
+stdenv.mkDerivation rec {
+  name    = "bsdiff-${version}";
+  version = "4.3";
 
-stdenv.mkDerivation {
-  name = "bsdiff-4.3";
-  builder = ./builder.sh;
   src = fetchurl {
-    url = http://www.daemonology.net/bsdiff/bsdiff-4.3.tar.gz;
+    url    = "http://www.daemonology.net/bsdiff/${name}.tar.gz";
     sha256 = "0j2zm3z271x5aw63mwhr3vymzn45p2vvrlrpm9cz2nywna41b0hq";
   };
+
   buildInputs = [ bzip2 ];
-  patchPhase = ''
-    sed 's/^\.//g' -i Makefile
+  patches = [ ./include-systypes.patch ];
+
+  buildPhase = ''
+    cc -O3 -lbz2 bspatch.c -o bspatch
+    cc -O3 -lbz2 bsdiff.c  -o bsdiff
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    mkdir -p $out/share/man/man1
+
+    cp bsdiff    $out/bin
+    cp bspatch   $out/bin
+    cp bsdiff.1  $out/share/man/man1
+    cp bspatch.1 $out/share/man/man1
   '';
+
+  meta = {
+    description = "An efficient binary diff/patch tool";
+    homepage    = "http://www.daemonology.net/bsdiff";
+    license     = stdenv.lib.licenses.bsd2;
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+  };
 }
diff --git a/pkgs/tools/compression/bsdiff/include-systypes.patch b/pkgs/tools/compression/bsdiff/include-systypes.patch
new file mode 100644
index 000000000000..d070a8bb0f85
--- /dev/null
+++ b/pkgs/tools/compression/bsdiff/include-systypes.patch
@@ -0,0 +1,12 @@
+diff --git a/bspatch.c b/bspatch.c
+index 643c60b..543379c 100644
+--- a/bspatch.c
++++ b/bspatch.c
+@@ -28,6 +28,7 @@
+ __FBSDID("$FreeBSD: src/usr.bin/bsdiff/bspatch/bspatch.c,v 1.1 2005/08/06 01:59:06 cperciva Exp $");
+ #endif
+ 
++#include <sys/types.h>
+ #include <bzlib.h>
+ #include <stdlib.h>
+ #include <stdio.h>