nixpkgs-suyu/pkgs/development/ocaml-modules/janestreet/buildOcamlJane.nix

36 lines
993 B
Nix
Raw Normal View History

2016-09-24 19:08:51 +02:00
{ buildOcaml, opam, js_build_tools, ocaml_oasis_46, fetchurl } :
2016-09-13 23:42:26 +02:00
{ 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;
2016-09-24 19:08:51 +02:00
buildInputs = [ ocaml_oasis_46 js_build_tools opam ] ++ buildInputs;
2016-09-13 23:42:26 +02:00
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
2016-09-14 18:00:45 +02:00
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
2016-09-13 23:42:26 +02:00
'';
})