diff options
author | Vincent Laporte <Vincent.Laporte@gmail.com> | 2018-04-04 15:09:04 +0000 |
---|---|---|
committer | Vincent Laporte <Vincent.Laporte@gmail.com> | 2018-04-04 15:20:20 +0000 |
commit | 50b0afa269c221577e78e3dc9ed6095be5d5a4b3 (patch) | |
tree | 021796042ded2f4b47965a7263b2111567ec0a21 | |
parent | b76f0ed3ed15ebef17fb927c0ebfaccd5d3b6c43 (diff) |
ocamlPackages.optcomp: fix build with OCaml 4.06
-rw-r--r-- | pkgs/development/ocaml-modules/optcomp/META | 12 | ||||
-rw-r--r-- | pkgs/development/ocaml-modules/optcomp/default.nix | 24 |
2 files changed, 35 insertions, 1 deletions
diff --git a/pkgs/development/ocaml-modules/optcomp/META b/pkgs/development/ocaml-modules/optcomp/META new file mode 100644 index 0000000000000..8a942288f752c --- /dev/null +++ b/pkgs/development/ocaml-modules/optcomp/META @@ -0,0 +1,12 @@ +# OASIS_START +# DO NOT EDIT (digest: ec844fa3189acb2a866b89a69d111ba4) +version = "1.6" +description = "Optional compilation with cpp-like directives" +requires = "camlp4" +archive(syntax, preprocessor) = "optcomp.cma" +archive(syntax, toploop) = "optcomp.cma" +archive(syntax, preprocessor, native) = "optcomp.cmxa" +archive(syntax, preprocessor, native, plugin) = "optcomp.cmxs" +exists_if = "optcomp.cma" +# OASIS_STOP + diff --git a/pkgs/development/ocaml-modules/optcomp/default.nix b/pkgs/development/ocaml-modules/optcomp/default.nix index 8953373954a57..5b56613774713 100644 --- a/pkgs/development/ocaml-modules/optcomp/default.nix +++ b/pkgs/development/ocaml-modules/optcomp/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, camlp4 }: +{ stdenv, fetchurl, fetchpatch, ocaml, findlib, ocamlbuild, camlp4 }: stdenv.mkDerivation { name = "ocaml-optcomp-1.6"; @@ -6,11 +6,33 @@ stdenv.mkDerivation { url = https://github.com/diml/optcomp/archive/1.6.tar.gz; sha256 = "0hhhb2gisah1h22zlg5iszbgqxdd7x85cwd57bd4mfkx9l7dh8jh"; }; + + patches = + let inherit (stdenv.lib) optional versionAtLeast; in + optional (versionAtLeast ocaml.version "4.02") (fetchpatch { + url = "https://github.com/diml/optcomp/commit/b7f809360c9794b383a4bc0492f6df381276b429.patch"; + sha256 = "1n095lk94jq1rwi0l24g2wbgms7249wdd31n0ji895dr6755s93y"; + }) + ; createFindlibDestdir = true; buildInputs = [ ocaml findlib ocamlbuild camlp4 ]; + configurePhase = '' + cp ${./META} META + ''; + + buildPhase = '' + ocamlbuild src/optcomp.cmxs src/optcomp.cma src/optcomp_o.native src/optcomp_r.native + ''; + + installPhase = '' + mkdir -p $out/bin + cp _build/src/optcomp_o.native $out/bin/optcomp-o + cp _build/src/optcomp_r.native $out/bin/optcomp-r + ocamlfind install optcomp META _build/src/optcomp.{a,cma,cmxa,cmxs} _build/src/pa_optcomp.{cmi,cmx,mli} + ''; meta = { homepage = https://github.com/diml/optcomp; |