summary refs log tree commit diff
path: root/pkgs/build-support/ocaml/topkg.nix
blob: 73be5815e44c730f178da62ab756523846a6f307 (plain) (blame)
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
{ lib, stdenv, fetchurl, ocaml, findlib, topkg, ocamlbuild, cmdliner, odoc, b0
}:

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

lib.throwIf (args ? minimalOCamlVersion
  && lib.versionOlder ocaml.version args.minimalOCamlVersion)
"${pname}-${version} is not available for OCaml ${ocaml.version}"

stdenv.mkDerivation ({

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

} // (builtins.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;
  };

})