2021-01-24 00:40:18 +00:00
|
|
|
{ lib, stdenv, writeText, ocaml, findlib, ocamlbuild, camlp4 }:
|
2015-05-21 17:03:57 +01:00
|
|
|
|
2021-10-31 12:35:20 +00:00
|
|
|
{ pname ? args.name, version, nativeBuildInputs ? [],
|
2015-05-21 17:03:57 +01:00
|
|
|
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 17:03:57 +01:00
|
|
|
};
|
|
|
|
in
|
|
|
|
assert minimumSupportedOcamlVersion != null ->
|
2021-01-24 00:40:18 +00:00
|
|
|
lib.versionOlder minimumSupportedOcamlVersion ocaml.version;
|
2015-05-21 17:03:57 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation (args // {
|
2021-10-31 12:35:20 +00:00
|
|
|
name = "ocaml-${pname}-${version}";
|
2015-05-21 17:03:57 +01:00
|
|
|
|
2021-08-07 13:00:00 +01:00
|
|
|
nativeBuildInputs = [ ocaml findlib ocamlbuild camlp4 ] ++ nativeBuildInputs;
|
2015-05-21 17:03:57 +01:00
|
|
|
|
2022-02-22 09:59:04 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2015-05-21 17:03:57 +01:00
|
|
|
setupHook = if setupHook == null && hasSharedObjects
|
|
|
|
then writeText "setupHook.sh" ''
|
2021-10-31 12:35:20 +00:00
|
|
|
export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${pname}/"
|
2015-05-21 17:03:57 +01:00
|
|
|
''
|
|
|
|
else setupHook;
|
|
|
|
|
|
|
|
inherit createFindlibDestdir;
|
|
|
|
inherit dontStrip;
|
|
|
|
|
|
|
|
meta = defaultMeta // meta;
|
|
|
|
})
|