summaryrefslogtreecommitdiffstats
path: root/pkgs/build-support/ocaml/topkg.nix
blob: 779b45fb4f33e95d92b0900eb3a0c72251aab6b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
  lib,
  stdenv,
  fetchurl,
  ocaml,
  findlib,
  topkg,
  ocamlbuild,
  cmdliner,
  b0,
}:

{
  pname,
  version,
  nativeBuildInputs ? [ ],
  buildInputs ? [ ],
  ...
}@args:

if (args ? minimalOCamlVersion && lib.versionOlder ocaml.version args.minimalOCamlVersion) then
  throw "${pname}-${version} is not available for OCaml ${ocaml.version}"
else
  stdenv.mkDerivation (
    {

      dontAddStaticConfigureFlags = true;
      configurePlatforms = [ ];
      strictDeps = true;
      inherit (topkg) buildPhase installPhase;

    }
    // (removeAttrs args [ "minimalOCamlVersion" ])
    // {

      name = "ocaml${ocaml.version}-${pname}-${version}";

      nativeBuildInputs = [
        ocaml
        findlib
        ocamlbuild
        topkg
      ]
      ++ nativeBuildInputs;
      buildInputs = [ topkg ] ++ buildInputs;

      meta = (args.meta or { }) // {
        platforms = args.meta.platforms or ocaml.meta.platforms;
      };

    }
  )