2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, ocaml_oasis, ocaml, findlib, ocamlbuild }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
{ pname, version, nativeBuildInputs ? [], meta ? { platforms = ocaml.meta.platforms or []; },
|
2020-04-24 23:36:52 +00:00
|
|
|
minimumOCamlVersion ? null,
|
|
|
|
createFindlibDestdir ? true,
|
|
|
|
dontStrip ? true,
|
|
|
|
...
|
|
|
|
}@args:
|
|
|
|
|
|
|
|
if args ? minimumOCamlVersion &&
|
2021-02-05 17:12:51 +00:00
|
|
|
! lib.versionAtLeast ocaml.version args.minimumOCamlVersion
|
2020-04-24 23:36:52 +00:00
|
|
|
then throw "${pname}-${version} is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
|
|
|
stdenv.mkDerivation (args // {
|
|
|
|
name = "ocaml${ocaml.version}-${pname}-${version}";
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
nativeBuildInputs = [ ocaml findlib ocamlbuild ocaml_oasis ] ++ nativeBuildInputs;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
inherit createFindlibDestdir;
|
|
|
|
inherit dontStrip;
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
oasis setup
|
2020-07-18 16:06:22 +00:00
|
|
|
ocaml setup.ml -configure --prefix $OCAMLFIND_DESTDIR --exec-prefix $out
|
2020-04-24 23:36:52 +00:00
|
|
|
ocaml setup.ml -build
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
ocaml setup.ml -test
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out
|
2020-07-18 16:06:22 +00:00
|
|
|
ocaml setup.ml -install
|
2020-04-24 23:36:52 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
})
|