zoekt: 3.7.2-2-unstable-2024-10-24 -> 3.7.2-2-unstable-2024-12-09 (#363818)
[NixPkgs.git] / pkgs / build-support / ocaml / oasis.nix
blobf4319fcd99cea25685712ab6806911655531a196
2   lib,
3   stdenv,
4   ocaml_oasis,
5   ocaml,
6   findlib,
7   ocamlbuild,
8 }:
11   pname,
12   version,
13   nativeBuildInputs ? [ ],
14   meta ? {
15     platforms = ocaml.meta.platforms or [ ];
16   },
17   minimumOCamlVersion ? null,
18   createFindlibDestdir ? true,
19   dontStrip ? true,
20   ...
21 }@args:
23 if args ? minimumOCamlVersion && lib.versionOlder ocaml.version args.minimumOCamlVersion then
24   throw "${pname}-${version} is not available for OCaml ${ocaml.version}"
25 else
27   stdenv.mkDerivation (
28     args
29     // {
30       name = "ocaml${ocaml.version}-${pname}-${version}";
32       nativeBuildInputs = [
33         ocaml
34         findlib
35         ocamlbuild
36         ocaml_oasis
37       ] ++ nativeBuildInputs;
39       inherit createFindlibDestdir;
40       inherit dontStrip;
42       strictDeps = true;
44       buildPhase = ''
45         runHook preBuild
46         oasis setup
47         ocaml setup.ml -configure --prefix $OCAMLFIND_DESTDIR --exec-prefix $out
48         ocaml setup.ml -build
49         runHook postBuild
50       '';
52       checkPhase = ''
53         runHook preCheck
54         ocaml setup.ml -test
55         runHook postCheck
56       '';
58       installPhase = ''
59         runHook preInstall
60         mkdir -p $out
61         ocaml setup.ml -install
62         runHook postInstall
63       '';
65     }
66   )