lol
1{ stdenv, writeText, ocaml, findlib, camlp4 }:
2
3{ name, version, buildInputs ? [],
4 createFindlibDestdir ? true,
5 dontStrip ? true,
6 minimumSupportedOcamlVersion ? null,
7 hasSharedObjects ? false,
8 setupHook ? null,
9 meta ? {}, ...
10}@args:
11let
12 ocaml_version = (builtins.parseDrvName ocaml.name).version;
13 defaultMeta = {
14 platforms = ocaml.meta.platforms or [];
15 };
16in
17 assert minimumSupportedOcamlVersion != null ->
18 stdenv.lib.versionOlder minimumSupportedOcamlVersion ocaml_version;
19
20stdenv.mkDerivation (args // {
21 name = "ocaml-${name}-${version}";
22
23 buildInputs = [ ocaml findlib camlp4 ] ++ buildInputs;
24
25 setupHook = if setupHook == null && hasSharedObjects
26 then writeText "setupHook.sh" ''
27 export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml_version}/site-lib/${name}/"
28 ''
29 else setupHook;
30
31 inherit ocaml_version;
32 inherit createFindlibDestdir;
33 inherit dontStrip;
34
35 meta = defaultMeta // meta;
36})