2021-01-24 00:40:18 +00:00
|
|
|
{ lib, stdenv, ocaml_oasis, ocaml, findlib, ocamlbuild }:
|
2019-08-01 08:44:04 +00:00
|
|
|
|
2022-02-22 09:59:04 +00:00
|
|
|
{ pname, version, nativeBuildInputs ? [], meta ? { platforms = ocaml.meta.platforms or []; },
|
2019-08-07 07:50:46 +00:00
|
|
|
minimumOCamlVersion ? null,
|
2019-08-06 15:54:09 +00:00
|
|
|
createFindlibDestdir ? true,
|
|
|
|
dontStrip ? true,
|
|
|
|
...
|
2019-08-01 08:44:04 +00:00
|
|
|
}@args:
|
|
|
|
|
2019-08-07 07:50:46 +00:00
|
|
|
if args ? minimumOCamlVersion &&
|
2022-04-25 20:35:24 +00:00
|
|
|
lib.versionOlder ocaml.version args.minimumOCamlVersion
|
2019-08-07 07:50:46 +00:00
|
|
|
then throw "${pname}-${version} is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
2019-08-06 15:54:09 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation (args // {
|
2019-08-07 07:50:46 +00:00
|
|
|
name = "ocaml${ocaml.version}-${pname}-${version}";
|
2019-08-06 15:54:09 +00:00
|
|
|
|
2022-02-22 09:59:04 +00:00
|
|
|
nativeBuildInputs = [ ocaml findlib ocamlbuild ocaml_oasis ] ++ nativeBuildInputs;
|
2019-08-06 15:54:09 +00:00
|
|
|
|
|
|
|
inherit createFindlibDestdir;
|
|
|
|
inherit dontStrip;
|
2019-08-01 08:44:04 +00:00
|
|
|
|
2022-02-22 09:59:04 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2019-08-01 08:44:04 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
oasis setup
|
2020-06-25 05:49:44 +00:00
|
|
|
ocaml setup.ml -configure --prefix $OCAMLFIND_DESTDIR --exec-prefix $out
|
2019-08-01 08:44:04 +00:00
|
|
|
ocaml setup.ml -build
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
ocaml setup.ml -test
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out
|
2020-06-25 05:49:44 +00:00
|
|
|
ocaml setup.ml -install
|
2019-08-01 08:44:04 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
2019-08-06 15:54:09 +00:00
|
|
|
|
2019-08-01 08:44:04 +00:00
|
|
|
})
|