summary refs log tree commit diff
path: root/pkgs/tools/compression
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2016-01-19 09:55:31 +0100
committerVladimír Čunát <vcunat@gmail.com>2016-01-19 09:55:31 +0100
commit716aac2519a7571e7f5fd984a886d579a4a051c5 (patch)
tree53cf89cf764d787f4dc8f08474479892b9733177 /pkgs/tools/compression
parentf8472457a440de3c44f6f604142d678b6ae2a762 (diff)
parent53b389327e34de319dc0dbda2b6bcab1a69db69d (diff)
downloadnixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar
nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.gz
nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.bz2
nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.lz
nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.xz
nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.zst
nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.zip
Merge branch 'staging' into closure-size
Diffstat (limited to 'pkgs/tools/compression')
-rw-r--r--pkgs/tools/compression/bzip2/default.nix5
-rw-r--r--pkgs/tools/compression/lz4/default.nix4
-rw-r--r--pkgs/tools/compression/lz4/install-on-freebsd.patch54
-rw-r--r--pkgs/tools/compression/xdelta/default.nix29
-rw-r--r--pkgs/tools/compression/xdelta/unstable.nix67
-rw-r--r--pkgs/tools/compression/zopfli/default.nix61
6 files changed, 196 insertions, 24 deletions
diff --git a/pkgs/tools/compression/bzip2/default.nix b/pkgs/tools/compression/bzip2/default.nix
index 675a44b838bb..ea2ee660a2ce 100644
--- a/pkgs/tools/compression/bzip2/default.nix
+++ b/pkgs/tools/compression/bzip2/default.nix
@@ -63,8 +63,9 @@ in stdenv.mkDerivation {
     mv "$bin/lib" "$static/"
   '';
 
-  patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
-    substituteInPlace Makefile --replace 'CC=gcc' 'CC=clang'
+  patchPhase = ''
+    substituteInPlace Makefile --replace CC=gcc CC=cc
+    substituteInPlace Makefile-libbz2_so --replace CC=gcc CC=cc
   '';
 
   preConfigure = ''
diff --git a/pkgs/tools/compression/lz4/default.nix b/pkgs/tools/compression/lz4/default.nix
index e91fae778fdb..13236da5ab44 100644
--- a/pkgs/tools/compression/lz4/default.nix
+++ b/pkgs/tools/compression/lz4/default.nix
@@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
   doCheck = false; # tests take a very long time
   checkTarget = "test";
 
+  patches = [ ./install-on-freebsd.patch ] ;
+
   meta = with stdenv.lib; {
     inherit version;
     description = "Extremely fast compression algorithm";
@@ -32,7 +34,7 @@ stdenv.mkDerivation rec {
     '';
     homepage = https://code.google.com/p/lz4/;
     license = with licenses; [ bsd2 gpl2Plus ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
     maintainers = with maintainers; [ nckx ];
   };
 }
diff --git a/pkgs/tools/compression/lz4/install-on-freebsd.patch b/pkgs/tools/compression/lz4/install-on-freebsd.patch
new file mode 100644
index 000000000000..12a2bf72f4ed
--- /dev/null
+++ b/pkgs/tools/compression/lz4/install-on-freebsd.patch
@@ -0,0 +1,54 @@
+diff --git a/Makefile b/Makefile
+index d1b0d0c..f8d6a2d 100644
+--- a/Makefile
++++ b/Makefile
+@@ -80,8 +80,6 @@ clean:
+ 
+ 
+ #------------------------------------------------------------------------
+-#make install is validated only for Linux, OSX, kFreeBSD and Hurd targets
+-ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU))
+ 
+ install:
+ 	@cd $(LZ4DIR); $(MAKE) -e install
+@@ -129,4 +127,3 @@ examples:
+ prg-travis:
+ 	@cd $(PRGDIR); $(MAKE) -e test-travis
+ 
+-endif
+diff --git a/lib/Makefile b/lib/Makefile
+index 02ddd3b..26ed18f 100644
+--- a/lib/Makefile
++++ b/lib/Makefile
+@@ -80,8 +80,6 @@ clean:
+ 
+ 
+ #------------------------------------------------------------------------
+-#make install is validated only for Linux, OSX, kFreeBSD and Hurd targets
+-ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU))
+ 
+ liblz4.pc: liblz4.pc.in Makefile
+ 	@echo creating pkgconfig
+@@ -114,4 +112,3 @@ uninstall:
+ 	@[ -f $(DESTDIR)$(INCLUDEDIR)/lz4frame.h ] && rm -f $(DESTDIR)$(INCLUDEDIR)/lz4frame.h
+ 	@echo lz4 libraries successfully uninstalled
+ 
+-endif
+diff --git a/programs/Makefile b/programs/Makefile
+index f422902..6943363 100644
+--- a/programs/Makefile
++++ b/programs/Makefile
+@@ -113,8 +113,6 @@ clean:
+ 
+ 
+ #------------------------------------------------------------------------
+-#make install is validated only for Linux, OSX, kFreeBSD and Hurd targets
+-ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU))
+ 
+ install: lz4 lz4c
+ 	@echo Installing binaries
+@@ -307,4 +305,3 @@ test-mem: lz4 datagen fuzzer frametest fullbench
+ test-mem32: lz4c32 datagen
+ # unfortunately, valgrind doesn't seem to work with non-native binary. If someone knows how to do a valgrind-test on a 32-bits exe with a 64-bits system...
+ 
+-endif
diff --git a/pkgs/tools/compression/xdelta/default.nix b/pkgs/tools/compression/xdelta/default.nix
index 6fdf555986b9..396099df41cc 100644
--- a/pkgs/tools/compression/xdelta/default.nix
+++ b/pkgs/tools/compression/xdelta/default.nix
@@ -1,22 +1,36 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ stdenv, fetchFromGitHub, autoreconfHook
+, lzmaSupport ? true, xz ? null
+}:
 
-let version = "3.0.10"; in
-stdenv.mkDerivation {
+assert lzmaSupport -> xz != null;
+
+let
+  version = "3.0.11";
+  mkWith = flag: name: if flag
+    then "--with-${name}"
+    else "--without-${name}";
+in stdenv.mkDerivation {
   name = "xdelta-${version}";
-  
+
   src = fetchFromGitHub {
-    sha256 = "0wwxdr01var3f90iwi1lgjpsa4y549g850hyyix5cm0qk67ck4rg";
+    sha256 = "1c7xym7xr26phyf4wb9hh2w88ybzbzh2w3h1kyqq3da0ndidmf2r";
     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;
@@ -36,6 +50,11 @@ stdenv.mkDerivation {
   meta = with stdenv.lib; {
     inherit version;
     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;
diff --git a/pkgs/tools/compression/xdelta/unstable.nix b/pkgs/tools/compression/xdelta/unstable.nix
new file mode 100644
index 000000000000..a19fb4de68a4
--- /dev/null
+++ b/pkgs/tools/compression/xdelta/unstable.nix
@@ -0,0 +1,67 @@
+{ stdenv, fetchFromGitHub, autoreconfHook
+, lzmaSupport ? true, xz ? null
+}:
+
+assert lzmaSupport -> xz != null;
+
+let
+  version = "3.1.0";
+  mkWith = flag: name: if flag
+    then "--with-${name}"
+    else "--without-${name}";
+in stdenv.mkDerivation {
+  name = "xdelta-${version}";
+
+  src = fetchFromGitHub {
+    sha256 = "09mmsalc7dwlvgrda56s2k927rpl3a5dzfa88aslkqcjnr790wjy";
+    rev = "v${version}";
+    repo = "xdelta-devel";
+    owner = "jmacd";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = []
+    ++ stdenv.lib.optionals lzmaSupport [ xz ];
+
+  postPatch = ''
+    cd xdelta3
+
+    substituteInPlace Makefile.am --replace \
+      "common_CFLAGS =" \
+      "common_CFLAGS = -DXD3_USE_LARGESIZET=1"
+  '';
+
+  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; {
+    inherit version;
+    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;
+    maintainers = with maintainers; [ nckx ];
+  };
+}
diff --git a/pkgs/tools/compression/zopfli/default.nix b/pkgs/tools/compression/zopfli/default.nix
index 354afb8d1787..3c455ca5635f 100644
--- a/pkgs/tools/compression/zopfli/default.nix
+++ b/pkgs/tools/compression/zopfli/default.nix
@@ -1,33 +1,62 @@
-{ stdenv, fetchFromGitHub }:
+{ stdenv, fetchFromGitHub, fetchpatch }:
 
+let version = "1.0.1"; in
 stdenv.mkDerivation rec {
   name = "zopfli-${version}";
-  version = "1.0.0";
 
   src = fetchFromGitHub {
     owner = "google";
     repo = "zopfli";
     rev = name;
     name = "${name}-src";
-    sha256 = "0r2k3md24y5laslzsph7kh4synm5az4ppv64idrvjk5yh2qwwb62";
+    sha256 = "1dclll3b5azy79jfb8vhb21drivi7vaay5iw0lzs4lrh6dgyvg6y";
   };
 
+  patches = [
+    (fetchpatch {
+      sha256 = "07z6df1ahx40hnsrcs5mx3fc58rqv8fm0pvyc7gb7kc5mwwghvvp";
+      name = "Fix-invalid-read-outside-allocated-memory.patch";
+      url = "https://github.com/google/zopfli/commit/9429e20de3885c0e0d9beac23f703fce58461021.patch";
+    })
+    (fetchpatch {
+      sha256 = "07m8q5kipr84cg8i1l4zd22ai9bmdrblpdrsc96llg7cm51vqdqy";
+      name = "zopfli-bug-and-typo-fixes.patch";
+      url = "https://github.com/google/zopfli/commit/7190e08ecac2446c7c9157cfbdb7157b18912a92.patch";
+    })
+  ];
+
+  enableParallelBuilding = true;
+  buildFlags = [
+    "zopfli"
+    "libzopfli"
+    "zopflipng"
+    "libzopflipng"
+  ];
+
   installPhase = ''
-    install -D zopfli $out/bin/zopfli
+    mkdir -p $out/bin
+    install -m755 zopfli{,png} $out/bin
+
+    mkdir -p $out/lib
+    install -m755 libzopfli{,png}.so* $out/lib
+
+    mkdir -p $out/share/doc/zopfli
+    install -m644 README* $out/share/doc/zopfli
   '';
 
   meta = with stdenv.lib; {
-    homepage = https://github.com/google/zopfli;
-    description = "A compression tool to perform very good, but slow, deflate or zlib compression";
-    longDescription =
-      ''Zopfli Compression Algorithm is a compression library programmed
-        in C to perform very good, but slow, deflate or zlib compression.
-
-        This library can only compress, not decompress. Existing zlib or
-        deflate libraries can decompress the data.
-      '';
-    platforms = stdenv.lib.platforms.linux;
-    license = stdenv.lib.licenses.asl20;
-    maintainers = with maintainers; [ bobvanderlinden ];
+    inherit version;
+    inherit (src.meta) homepage;
+    description = "Very good, but slow, deflate or zlib compression";
+    longDescription = ''
+      Zopfli Compression Algorithm is a compression library programmed
+      in C to perform very good, but slow, deflate or zlib compression.
+
+      This library can only compress, not decompress. Existing zlib or
+      deflate libraries can decompress the data.
+    '';
+    platforms = platforms.linux;
+    license = licenses.asl20;
+    maintainers = with maintainers; [ bobvanderlinden nckx ];
   };
 }