Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-19.03 47 lines 1.4 kB view raw
1{ stdenv, fetchurl, fetchpatch, ocaml, findlib, ocamlbuild, camlp4 }: 2 3stdenv.mkDerivation { 4 name = "ocaml-optcomp-1.6"; 5 src = fetchurl { 6 url = https://github.com/diml/optcomp/archive/1.6.tar.gz; 7 sha256 = "0hhhb2gisah1h22zlg5iszbgqxdd7x85cwd57bd4mfkx9l7dh8jh"; 8 }; 9 10 patches = 11 let inherit (stdenv.lib) optional versionAtLeast; in 12 optional (versionAtLeast ocaml.version "4.02") (fetchpatch { 13 url = "https://github.com/diml/optcomp/commit/b7f809360c9794b383a4bc0492f6df381276b429.patch"; 14 sha256 = "1n095lk94jq1rwi0l24g2wbgms7249wdd31n0ji895dr6755s93y"; 15 }) 16 ; 17 18 createFindlibDestdir = true; 19 20 buildInputs = [ ocaml findlib ocamlbuild camlp4 ]; 21 22 configurePhase = '' 23 cp ${./META} META 24 ''; 25 26 buildPhase = '' 27 ocamlbuild src/optcomp.cmxs src/optcomp.cma src/optcomp_o.native src/optcomp_r.native 28 ''; 29 30 installPhase = '' 31 mkdir -p $out/bin 32 cp _build/src/optcomp_o.native $out/bin/optcomp-o 33 cp _build/src/optcomp_r.native $out/bin/optcomp-r 34 ocamlfind install optcomp META _build/src/optcomp.{a,cma,cmxa,cmxs} _build/src/pa_optcomp.{cmi,cmx,mli} 35 ''; 36 37 meta = { 38 homepage = https://github.com/diml/optcomp; 39 description = "Optional compilation for OCaml with cpp-like directives"; 40 license = stdenv.lib.licenses.bsd3; 41 platforms = ocaml.meta.platforms or []; 42 maintainers = [ 43 stdenv.lib.maintainers.gal_bolle 44 ]; 45 }; 46 47}