2024-05-02 00:46:19 +00:00
|
|
|
{ lib, stdenv, ocaml_oasis, ocaml, findlib, ocamlbuild }:
|
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
{ pname, version, nativeBuildInputs ? [ ]
|
|
|
|
, meta ? { platforms = ocaml.meta.platforms or [ ]; }
|
|
|
|
, minimumOCamlVersion ? null, createFindlibDestdir ? true, dontStrip ? true, ...
|
2024-05-02 00:46:19 +00:00
|
|
|
}@args:
|
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
if args ? minimumOCamlVersion
|
|
|
|
&& lib.versionOlder ocaml.version args.minimumOCamlVersion then
|
|
|
|
throw "${pname}-${version} is not available for OCaml ${ocaml.version}"
|
2024-05-02 00:46:19 +00:00
|
|
|
else
|
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
stdenv.mkDerivation (args // {
|
|
|
|
name = "ocaml${ocaml.version}-${pname}-${version}";
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
nativeBuildInputs = [ ocaml findlib ocamlbuild ocaml_oasis ]
|
|
|
|
++ nativeBuildInputs;
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
inherit createFindlibDestdir;
|
|
|
|
inherit dontStrip;
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
strictDeps = true;
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
oasis setup
|
|
|
|
ocaml setup.ml -configure --prefix $OCAMLFIND_DESTDIR --exec-prefix $out
|
|
|
|
ocaml setup.ml -build
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
ocaml setup.ml -test
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out
|
|
|
|
ocaml setup.ml -install
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
})
|