2016-10-08 06:44:25 +00:00
|
|
|
{ stdenv, writeText, ocaml, findlib, ocamlbuild, camlp4 }:
|
2015-05-21 16:03:57 +00:00
|
|
|
|
|
|
|
{ name, version, buildInputs ? [],
|
|
|
|
createFindlibDestdir ? true,
|
|
|
|
dontStrip ? true,
|
|
|
|
minimumSupportedOcamlVersion ? null,
|
|
|
|
hasSharedObjects ? false,
|
|
|
|
setupHook ? null,
|
|
|
|
meta ? {}, ...
|
|
|
|
}@args:
|
|
|
|
let
|
|
|
|
defaultMeta = {
|
2015-12-24 17:49:07 +00:00
|
|
|
platforms = ocaml.meta.platforms or [];
|
2015-05-21 16:03:57 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
assert minimumSupportedOcamlVersion != null ->
|
2016-10-05 07:32:30 +00:00
|
|
|
stdenv.lib.versionOlder minimumSupportedOcamlVersion ocaml.version;
|
2015-05-21 16:03:57 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation (args // {
|
|
|
|
name = "ocaml-${name}-${version}";
|
|
|
|
|
2016-10-08 06:44:25 +00:00
|
|
|
buildInputs = [ ocaml findlib ocamlbuild camlp4 ] ++ buildInputs;
|
2015-05-21 16:03:57 +00:00
|
|
|
|
|
|
|
setupHook = if setupHook == null && hasSharedObjects
|
|
|
|
then writeText "setupHook.sh" ''
|
2019-11-14 18:44:07 +00:00
|
|
|
export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/"
|
2015-05-21 16:03:57 +00:00
|
|
|
''
|
|
|
|
else setupHook;
|
|
|
|
|
|
|
|
inherit createFindlibDestdir;
|
|
|
|
inherit dontStrip;
|
|
|
|
|
|
|
|
meta = defaultMeta // meta;
|
|
|
|
})
|