about summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/camlzip
diff options
context:
space:
mode:
authorMarco Maggesi <maggesi@math.unifi.it>2010-12-12 17:45:57 +0000
committerMarco Maggesi <maggesi@math.unifi.it>2010-12-12 17:45:57 +0000
commiteaf8b73517dd52cc2e8569c77e59cc6eca2deca5 (patch)
tree7b8a9a8775e27904cb0284cbe29a038fde5e1c82 /pkgs/development/ocaml-modules/camlzip
parent0b701b824be98dcfc1cb59c47e42670ff95df0cc (diff)
downloadnixlib-eaf8b73517dd52cc2e8569c77e59cc6eca2deca5.tar
nixlib-eaf8b73517dd52cc2e8569c77e59cc6eca2deca5.tar.gz
nixlib-eaf8b73517dd52cc2e8569c77e59cc6eca2deca5.tar.bz2
nixlib-eaf8b73517dd52cc2e8569c77e59cc6eca2deca5.tar.lz
nixlib-eaf8b73517dd52cc2e8569c77e59cc6eca2deca5.tar.xz
nixlib-eaf8b73517dd52cc2e8569c77e59cc6eca2deca5.tar.zst
nixlib-eaf8b73517dd52cc2e8569c77e59cc6eca2deca5.zip
* Fix installation of camlzip
svn path=/nixpkgs/trunk/; revision=25071
Diffstat (limited to 'pkgs/development/ocaml-modules/camlzip')
-rw-r--r--pkgs/development/ocaml-modules/camlzip/META3
-rw-r--r--pkgs/development/ocaml-modules/camlzip/default.nix17
-rw-r--r--pkgs/development/ocaml-modules/camlzip/makefile.patch50
3 files changed, 43 insertions, 27 deletions
diff --git a/pkgs/development/ocaml-modules/camlzip/META b/pkgs/development/ocaml-modules/camlzip/META
index 328b40022822..72f5a3b8bd02 100644
--- a/pkgs/development/ocaml-modules/camlzip/META
+++ b/pkgs/development/ocaml-modules/camlzip/META
@@ -1,5 +1,4 @@
-name="camlzip"
-version="1.04"
+version="@VERSION@"
 description="reading and writing ZIP, JAR and GZIP files"
 requires="unix"
 archive(byte)="camlzip.cma"
diff --git a/pkgs/development/ocaml-modules/camlzip/default.nix b/pkgs/development/ocaml-modules/camlzip/default.nix
index 1a13d6049568..9e991a811e6b 100644
--- a/pkgs/development/ocaml-modules/camlzip/default.nix
+++ b/pkgs/development/ocaml-modules/camlzip/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, zlib, ocaml}:
+{stdenv, fetchurl, zlib, ocaml, findlib}:
 
 let
   ocaml_version = (builtins.parseDrvName ocaml.name).version;
@@ -14,25 +14,20 @@ stdenv.mkDerivation {
     sha256 = "1zpchmp199x7f4mzmapvfywgy7f6wy9yynd9nd8yh8l78s5gixbn";
   };
 
-  buildInputs = [zlib ocaml];
+  buildInputs = [zlib ocaml findlib];
 
   patches = [ ./makefile.patch ];
 
-  configurePhase = ''
-    export INSTALLDIR="$out/lib/ocaml/${ocaml_version}/site-lib/zip"
+  postPatch = ''
+    substitute ${./META} META --subst-var-by VERSION "${version}"
     substituteInPlace Makefile \
       --subst-var-by ZLIB_LIBDIR "${zlib}/lib" \
-      --subst-var-by ZLIB_INCLUDE "${zlib}/include" \
-      --subst-var INSTALLDIR
+      --subst-var-by ZLIB_INCLUDE "${zlib}/include"
   '';
 
   buildFlags = "all allopt";
 
-  installTargets = "install installopt";
-
-  postInstall = ''
-    substitute ${./META} $INSTALLDIR/META --subst-var INSTALLDIR
-  '';
+  installTargets = "install";
 
   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.patch
index 10adcd6687b0..07637100d036 100644
--- a/pkgs/development/ocaml-modules/camlzip/makefile.patch
+++ b/pkgs/development/ocaml-modules/camlzip/makefile.patch
@@ -1,7 +1,7 @@
-diff -Naur camlzip-1.04/Makefile camlzip-1.04.nixos/Makefile
+diff -Nuar camlzip-1.04/Makefile camlzip-1.04.nixpkgs/Makefile
 --- camlzip-1.04/Makefile	2002-04-22 17:28:57.000000000 +0200
-+++ camlzip-1.04.nixos/Makefile	2010-08-17 14:40:07.000000000 +0200
-@@ -4,14 +4,14 @@
++++ camlzip-1.04.nixpkgs/Makefile	2010-12-12 18:30:49.000000000 +0100
+@@ -4,14 +4,10 @@
  ZLIB_LIB=-lz
  
  # The directory containing the Zlib library (libz.a or libz.so)
@@ -10,23 +10,45 @@ diff -Naur camlzip-1.04/Makefile camlzip-1.04.nixos/Makefile
  
  # The directory containing the Zlib header file (zlib.h)
 -ZLIB_INCLUDE=/usr/local/include
-+ZLIB_INCLUDE=@ZLIB_INCLUDE@
- 
- # Where to install the library.  By default: sub-directory 'zip' of
- # OCaml's standard library directory.
+-
+-# Where to install the library.  By default: sub-directory 'zip' of
+-# OCaml's standard library directory.
 -INSTALLDIR=`$(OCAMLC) -where`/zip
-+INSTALLDIR=@INSTALLDIR@
++ZLIB_INCLUDE=@ZLIB_INCLUDE@
  
  ### End of configuration section
  
-@@ -59,10 +59,6 @@
- 	cp zip.cma zip.cmi gzip.cmi zip.mli gzip.mli libcamlzip.a $(INSTALLDIR)
- 	if test -f dllcamlzip.so; then \
- 	  cp dllcamlzip.so $(INSTALLDIR); \
+@@ -19,10 +15,13 @@
+ OCAMLOPT=ocamlopt
+ OCAMLDEP=ocamldep
+ OCAMLMKLIB=ocamlmklib
++OCAMLFIND=ocamlfind 
+ 
+ OBJS=zlib.cmo zip.cmo gzip.cmo
+ C_OBJS=zlibstubs.o
+ 
++LIBINSTALL_FILES = $(wildcard *.mli *.cmi *.cma *.cmxa *.a *.so)
++
+ all: libcamlzip.a zip.cma
+ 
+ allopt: libcamlzip.a zip.cmxa
+@@ -55,18 +54,7 @@
+ 	rm -f *.o *.a
+ 
+ install:
+-	mkdir -p $(INSTALLDIR)
+-	cp zip.cma zip.cmi gzip.cmi zip.mli gzip.mli libcamlzip.a $(INSTALLDIR)
+-	if test -f dllcamlzip.so; then \
+-	  cp dllcamlzip.so $(INSTALLDIR); \
 -          ldconf=`$(OCAMLC) -where`/ld.conf; \
 -          installdir=$(INSTALLDIR); \
 -          if test `grep -s -c $$installdir'$$' $$ldconf || :` = 0; \
 -          then echo $$installdir >> $$ldconf; fi \
-         fi
+-        fi
+-
+-installopt:
+-	cp zip.cmxa zip.a zip.cmx gzip.cmx $(INSTALLDIR)
++	$(OCAMLFIND) install camlzip META $(LIBINSTALL_FILES)
  
- installopt:
+ depend:
+ 	gcc -MM -I$(ZLIB_INCLUDE) *.c > .depend