2015-05-21 18:03:57 +02:00
|
|
|
{ stdenv, writeText, ocaml, findlib, camlp4 }:
|
|
|
|
|
|
|
|
{ name, version, buildInputs ? [],
|
|
|
|
createFindlibDestdir ? true,
|
|
|
|
dontStrip ? true,
|
|
|
|
minimumSupportedOcamlVersion ? null,
|
|
|
|
hasSharedObjects ? false,
|
|
|
|
setupHook ? null,
|
|
|
|
meta ? {}, ...
|
|
|
|
}@args:
|
|
|
|
let
|
|
|
|
ocaml_version = (builtins.parseDrvName ocaml.name).version;
|
|
|
|
defaultMeta = {
|
2015-12-24 18:49:07 +01:00
|
|
|
platforms = ocaml.meta.platforms or [];
|
2015-05-21 18:03:57 +02:00
|
|
|
};
|
|
|
|
in
|
|
|
|
assert minimumSupportedOcamlVersion != null ->
|
|
|
|
stdenv.lib.versionOlder minimumSupportedOcamlVersion ocaml_version;
|
|
|
|
|
|
|
|
stdenv.mkDerivation (args // {
|
|
|
|
name = "ocaml-${name}-${version}";
|
|
|
|
|
|
|
|
buildInputs = [ ocaml findlib camlp4 ] ++ buildInputs;
|
|
|
|
|
|
|
|
setupHook = if setupHook == null && hasSharedObjects
|
|
|
|
then writeText "setupHook.sh" ''
|
|
|
|
export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml_version}/site-lib/${name}/"
|
|
|
|
''
|
|
|
|
else setupHook;
|
|
|
|
|
|
|
|
inherit ocaml_version;
|
|
|
|
inherit createFindlibDestdir;
|
|
|
|
inherit dontStrip;
|
|
|
|
|
|
|
|
meta = defaultMeta // meta;
|
|
|
|
})
|