Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 97 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 = param.postPatchInit + '' 67 substituteInPlace Makefile \ 68 --subst-var-by ZLIB_LIBDIR "${zlib.out}/lib" \ 69 --subst-var-by ZLIB_INCLUDE "${zlib.dev}/include" 70 ''; 71 72 buildFlags = [ 73 "all" 74 "allopt" 75 ]; 76 77 preInstall = '' 78 mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs 79 ''; 80 81 postInstall = '' 82 ln -s $out/lib/ocaml/${ocaml.version}/site-lib/{,caml}zip 83 ''; 84 85 meta = with lib; { 86 homepage = "http://cristal.inria.fr/~xleroy/software.html#camlzip"; 87 description = "Library for handling ZIP and GZIP files in OCaml"; 88 longDescription = '' 89 This Objective Caml library provides easy access to compressed files in 90 ZIP and GZIP format, as well as to Java JAR files. It provides functions 91 for reading from and writing to compressed files in these formats. 92 ''; 93 license = "LGPL+linking exceptions"; 94 inherit (ocaml.meta) platforms; 95 maintainers = with maintainers; [ maggesi ]; 96 }; 97}