about summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/camlzip
diff options
context:
space:
mode:
authorvbgl <vbgl@users.noreply.github.com>2016-07-07 15:29:13 +0200
committerGitHub <noreply@github.com>2016-07-07 15:29:13 +0200
commita2ac3683ce9eb271a865f59a670e03d5ac236df9 (patch)
tree5db5a3430c9272e9895942ef037d5c06c7d4ce79 /pkgs/development/ocaml-modules/camlzip
parentc22af7fb4d3ac2b0783a5b57691a908fa7e09e3d (diff)
camlzip: 1.05 -> 1.06 (#16443)
Diffstat (limited to 'pkgs/development/ocaml-modules/camlzip')
-rw-r--r--pkgs/development/ocaml-modules/camlzip/default.nix33
-rw-r--r--pkgs/development/ocaml-modules/camlzip/makefile_1_05.patch (renamed from pkgs/development/ocaml-modules/camlzip/makefile.patch)2
-rw-r--r--pkgs/development/ocaml-modules/camlzip/makefile_1_06.patch22
3 files changed, 48 insertions, 9 deletions
diff --git a/pkgs/development/ocaml-modules/camlzip/default.nix b/pkgs/development/ocaml-modules/camlzip/default.nix
index 9025d94b8d5f1..9e2ef8ef46893 100644
--- a/pkgs/development/ocaml-modules/camlzip/default.nix
+++ b/pkgs/development/ocaml-modules/camlzip/default.nix
@@ -2,26 +2,39 @@
 
 let
   ocaml_version = (builtins.parseDrvName ocaml.name).version;
-  version = "1.05";
+  param =
+    if stdenv.lib.versionAtLeast ocaml_version "4.02"
+    then {
+      version = "1.06";
+      url = "1616";
+      sha256 = "0m6gyjw46w3qnhxfsyqyag42znl5lwargks7w7rfchr9jzwpff68";
+      patch = ./makefile_1_06.patch;
+      installTargets = "install-findlib";
+    } else {
+      version = "1.05";
+      url = "1037";
+      sha256 = "930b70c736ab5a7ed1b05220102310a0a2241564786657abe418e834a538d06b";
+      patch = ./makefile_1_05.patch;
+      installTargets = "install";
+    };
 in
 
 stdenv.mkDerivation {
-  name = "camlzip-${version}";
+  name = "camlzip-${param.version}";
 
   src = fetchurl {
-    url = "http://forge.ocamlcore.org/frs/download.php/1037/" +
-          "camlzip-${version}.tar.gz";
-    sha256 = "930b70c736ab5a7ed1b05220102310a0a2241564786657abe418e834a538d06b";
+    url = "http://forge.ocamlcore.org/frs/download.php/${param.url}/camlzip-${param.version}.tar.gz";
+    inherit (param) sha256;
   };
 
   buildInputs = [zlib ocaml findlib];
 
-  patches = [ ./makefile.patch ];
+  patches = [ param.patch ];
 
   createFindlibDestdir = true;
 
   postPatch = ''
-    substitute ${./META} META --subst-var-by VERSION "${version}"
+    substitute ${./META} META --subst-var-by VERSION "${param.version}"
     substituteInPlace Makefile \
       --subst-var-by ZLIB_LIBDIR "${zlib.out}/lib" \
       --subst-var-by ZLIB_INCLUDE "${zlib.dev}/include"
@@ -29,7 +42,11 @@ stdenv.mkDerivation {
 
   buildFlags = "all allopt";
 
-  installTargets = "install";
+  inherit (param) installTargets;
+
+  postInstall = ''
+    ln -s $out/lib/ocaml/${ocaml_version}/site-lib/{,caml}zip
+  '';
 
   meta = {
     homepage = "http://cristal.inria.fr/~xleroy/software.html#camlzip";
diff --git a/pkgs/development/ocaml-modules/camlzip/makefile.patch b/pkgs/development/ocaml-modules/camlzip/makefile_1_05.patch
index 07637100d0361..87d0c8bec3346 100644
--- a/pkgs/development/ocaml-modules/camlzip/makefile.patch
+++ b/pkgs/development/ocaml-modules/camlzip/makefile_1_05.patch
@@ -48,7 +48,7 @@ diff -Nuar camlzip-1.04/Makefile camlzip-1.04.nixpkgs/Makefile
 -
 -installopt:
 -	cp zip.cmxa zip.a zip.cmx gzip.cmx $(INSTALLDIR)
-+	$(OCAMLFIND) install camlzip META $(LIBINSTALL_FILES)
++	$(OCAMLFIND) install zip META $(LIBINSTALL_FILES)
  
  depend:
  	gcc -MM -I$(ZLIB_INCLUDE) *.c > .depend
diff --git a/pkgs/development/ocaml-modules/camlzip/makefile_1_06.patch b/pkgs/development/ocaml-modules/camlzip/makefile_1_06.patch
new file mode 100644
index 0000000000000..ab0d3528c8c28
--- /dev/null
+++ b/pkgs/development/ocaml-modules/camlzip/makefile_1_06.patch
@@ -0,0 +1,22 @@
+--- a/Makefile	2016-06-10 14:37:48.000000000 +0200
++++ b/Makefile	2016-06-23 05:10:26.000000000 +0200
+@@ -4,17 +4,13 @@
+ ZLIB_LIB=-lz
+ 
+ # The directory containing the Zlib library (libz.a or libz.so)
+-ZLIB_LIBDIR=/usr/lib
++ZLIB_LIBDIR=@ZLIB_LIBDIR@
+ # ZLIB_LIBDIR=/usr/local/lib
+ 
+ # The directory containing the Zlib header file (zlib.h)
+-ZLIB_INCLUDE=/usr/include
++ZLIB_INCLUDE=@ZLIB_INCLUDE@
+ # ZLIB_INCLUDE=/usr/local/include
+ 
+-# Where to install the library.  By default: sub-directory 'zip' of
+-# OCaml's standard library directory.
+-INSTALLDIR=`$(OCAMLC) -where`/zip
+-
+ ### End of configuration section
+ 
+ OCAMLC=ocamlc -g -safe-string