lol
at 25.11-pre 99 lines 2.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 zlib, 6 ocaml, 7 findlib, 8}: 9 10let 11 common = { 12 patches = [ ]; 13 postPatchInit = '' 14 cp META-zip META-camlzip 15 echo 'directory="../zip"' >> META-camlzip 16 ''; 17 }; 18 param = 19 if lib.versionAtLeast ocaml.version "4.07" then 20 common 21 // { 22 version = "1.11"; 23 url = "https://github.com/xavierleroy/camlzip/archive/rel111.tar.gz"; 24 sha256 = "sha256-/7vF3j4cE9wOWScjdtIy0u3pGzJ1UQY9R/3bdPHV7Tc="; 25 } 26 else if lib.versionAtLeast ocaml.version "4.02" then 27 common 28 // { 29 version = "1.10"; 30 url = "https://github.com/xavierleroy/camlzip/archive/rel110.tar.gz"; 31 sha256 = "X0YcczaQ3lFeJEiTIgjSSZ1zi32KFMtmZsP0FFpyfbI="; 32 } 33 else 34 { 35 version = "1.05"; 36 download_id = "1037"; 37 url = "http://forge.ocamlcore.org/frs/download.php/${param.download_id}/camlzip-${param.version}.tar.gz"; 38 sha256 = "930b70c736ab5a7ed1b05220102310a0a2241564786657abe418e834a538d06b"; 39 patches = [ ./makefile_1_05.patch ]; 40 postPatchInit = '' 41 substitute ${./META} META --subst-var-by VERSION "${param.version}" 42 ''; 43 }; 44in 45 46stdenv.mkDerivation { 47 pname = "ocaml${ocaml.version}-camlzip"; 48 version = param.version; 49 50 src = fetchurl { 51 inherit (param) url; 52 inherit (param) sha256; 53 }; 54 55 nativeBuildInputs = [ 56 ocaml 57 findlib 58 ]; 59 60 propagatedBuildInputs = [ zlib ]; 61 62 strictDeps = true; 63 64 inherit (param) patches; 65 66 postPatch = 67 param.postPatchInit 68 + '' 69 substituteInPlace Makefile \ 70 --subst-var-by ZLIB_LIBDIR "${zlib.out}/lib" \ 71 --subst-var-by ZLIB_INCLUDE "${zlib.dev}/include" 72 ''; 73 74 buildFlags = [ 75 "all" 76 "allopt" 77 ]; 78 79 preInstall = '' 80 mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs 81 ''; 82 83 postInstall = '' 84 ln -s $out/lib/ocaml/${ocaml.version}/site-lib/{,caml}zip 85 ''; 86 87 meta = with lib; { 88 homepage = "http://cristal.inria.fr/~xleroy/software.html#camlzip"; 89 description = "Library for handling ZIP and GZIP files in OCaml"; 90 longDescription = '' 91 This Objective Caml library provides easy access to compressed files in 92 ZIP and GZIP format, as well as to Java JAR files. It provides functions 93 for reading from and writing to compressed files in these formats. 94 ''; 95 license = "LGPL+linking exceptions"; 96 inherit (ocaml.meta) platforms; 97 maintainers = with maintainers; [ maggesi ]; 98 }; 99}