2019-08-07 00:51:36 -04:00
|
|
|
{ stdenv, ocaml_oasis, ocaml, findlib, ocamlbuild }:
|
2019-08-01 04:44:04 -04:00
|
|
|
|
2019-08-06 11:54:09 -04:00
|
|
|
{ name, version, buildInputs ? [], meta ? { platforms = ocaml.meta.platforms or []; },
|
|
|
|
minimumOcamlVersion ? null,
|
|
|
|
createFindlibDestdir ? true,
|
|
|
|
dontStrip ? true,
|
|
|
|
...
|
2019-08-01 04:44:04 -04:00
|
|
|
}@args:
|
|
|
|
|
2019-08-06 11:54:09 -04:00
|
|
|
assert minimumOcamlVersion != null ->
|
|
|
|
stdenv.lib.versionOlder minimumOcamlVersion ocaml.version;
|
|
|
|
|
|
|
|
stdenv.mkDerivation (args // {
|
2019-08-07 00:51:36 -04:00
|
|
|
name = "ocaml${ocaml.version}-${name}-${version}";
|
2019-08-06 11:54:09 -04:00
|
|
|
|
2019-08-07 00:51:36 -04:00
|
|
|
buildInputs = [ ocaml findlib ocamlbuild ocaml_oasis ] ++ buildInputs;
|
2019-08-06 11:54:09 -04:00
|
|
|
|
|
|
|
inherit createFindlibDestdir;
|
|
|
|
inherit dontStrip;
|
2019-08-01 04:44:04 -04:00
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
oasis setup
|
|
|
|
ocaml setup.ml -configure
|
|
|
|
ocaml setup.ml -build
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
ocaml setup.ml -test
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out
|
|
|
|
sed -i s+/usr/local+$out+g setup.ml
|
|
|
|
sed -i s+/usr/local+$out+g setup.data
|
|
|
|
prefix=$OCAMLFIND_DESTDIR ocaml setup.ml -install
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
2019-08-06 11:54:09 -04:00
|
|
|
|
2019-08-01 04:44:04 -04:00
|
|
|
})
|