core/pkgs/build-support/ocaml/topkg.nix

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

54 lines
964 B
Nix
Raw Normal View History

2024-05-02 00:46:19 +00:00
{
lib,
stdenv,
fetchurl,
ocaml,
findlib,
topkg,
ocamlbuild,
cmdliner,
odoc,
b0,
}:
{
pname,
version,
nativeBuildInputs ? [ ],
buildInputs ? [ ],
...
}@args:
2024-06-30 08:16:52 +00:00
2024-05-02 00:46:19 +00:00
lib.throwIf (args ? minimalOCamlVersion && lib.versionOlder ocaml.version args.minimalOCamlVersion)
"${pname}-${version} is not available for OCaml ${ocaml.version}"
2024-06-30 08:16:52 +00:00
2024-05-02 00:46:19 +00:00
stdenv.mkDerivation
(
{
2024-06-30 08:16:52 +00:00
2024-05-02 00:46:19 +00:00
dontAddStaticConfigureFlags = true;
configurePlatforms = [ ];
strictDeps = true;
inherit (topkg) buildPhase installPhase;
2024-06-30 08:16:52 +00:00
2024-05-02 00:46:19 +00:00
}
// (builtins.removeAttrs args [ "minimalOCamlVersion" ])
// {
2024-06-30 08:16:52 +00:00
2024-05-02 00:46:19 +00:00
name = "ocaml${ocaml.version}-${pname}-${version}";
2024-06-30 08:16:52 +00:00
2024-05-02 00:46:19 +00:00
nativeBuildInputs = [
ocaml
findlib
ocamlbuild
topkg
] ++ nativeBuildInputs;
buildInputs = [ topkg ] ++ buildInputs;
2024-06-30 08:16:52 +00:00
2024-05-02 00:46:19 +00:00
meta = (args.meta or { }) // {
platforms = args.meta.platforms or ocaml.meta.platforms;
};
2024-06-30 08:16:52 +00:00
2024-05-02 00:46:19 +00:00
}
)