diff options
Diffstat (limited to 'pkgs/development/ocaml-modules/janestreet/buildOcamlJane.nix')
-rw-r--r-- | pkgs/development/ocaml-modules/janestreet/buildOcamlJane.nix | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pkgs/development/ocaml-modules/janestreet/buildOcamlJane.nix b/pkgs/development/ocaml-modules/janestreet/buildOcamlJane.nix new file mode 100644 index 000000000000..61b2038bfd29 --- /dev/null +++ b/pkgs/development/ocaml-modules/janestreet/buildOcamlJane.nix @@ -0,0 +1,35 @@ +{ buildOcaml, opam, js_build_tools, ocaml_oasis, fetchurl } : + +{ name, version ? "113.33.03", buildInputs ? [], + hash ? "", + minimumSupportedOcamlVersion ? "4.02", ... +}@args: + +buildOcaml (args // { + inherit name version minimumSupportedOcamlVersion; + src = fetchurl { + url = "https://github.com/janestreet/${name}/archive/${version}.tar.gz"; + sha256 = hash; + }; + + hasSharedObjects = true; + + buildInputs = [ ocaml_oasis js_build_tools opam ] ++ buildInputs; + + dontAddPrefix = true; + + configurePhase = "./configure --prefix $out"; + + buildPhase = "OCAML_TOPLEVEL_PATH=`ocamlfind query findlib`/.. make"; + + installPhase = '' + opam-installer -i --prefix $prefix --libdir `ocamlfind printconf destdir` --stubsdir `ocamlfind printconf destdir`/${name} ${name}.install + if [ -d $out/lib/${name} ] + then if [ "$(ls -A $out/lib/${name})" ] + then mv $out/lib/${name}/* `ocamlfind printconf destdir`/${name} + fi + rmdir $out/lib/${name} + fi + ''; + +}) |