nixpkgs/pkgs/build-support/ocaml/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
993 B
Nix
Raw Normal View History

2021-01-24 00:40:18 +00:00
{ lib, stdenv, writeText, ocaml, findlib, ocamlbuild, camlp4 }:
2021-10-31 12:35:20 +00:00
{ pname ? args.name, version, nativeBuildInputs ? [],
createFindlibDestdir ? true,
dontStrip ? true,
minimumSupportedOcamlVersion ? null,
hasSharedObjects ? false,
setupHook ? null,
meta ? {}, ...
}@args:
let
defaultMeta = {
platforms = ocaml.meta.platforms or [];
};
in
assert minimumSupportedOcamlVersion != null ->
2021-01-24 00:40:18 +00:00
lib.versionOlder minimumSupportedOcamlVersion ocaml.version;
stdenv.mkDerivation (args // {
2021-10-31 12:35:20 +00:00
name = "ocaml-${pname}-${version}";
nativeBuildInputs = [ ocaml findlib ocamlbuild camlp4 ] ++ nativeBuildInputs;
strictDeps = true;
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}/"
''
else setupHook;
inherit createFindlibDestdir;
inherit dontStrip;
meta = defaultMeta // meta;
})