From 2ea2643b13530b53384adf664e4d6af459e8db30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Merlin=20G=C3=B6ttlinger?= Date: Thu, 1 Aug 2019 10:44:04 +0200 Subject: [PATCH] OCaml build support: add oasis build system --- pkgs/build-support/ocaml/oasis.nix | 31 ++++++++++++++++++++++++++++++ pkgs/top-level/ocaml-packages.nix | 2 ++ 2 files changed, 33 insertions(+) create mode 100644 pkgs/build-support/ocaml/oasis.nix diff --git a/pkgs/build-support/ocaml/oasis.nix b/pkgs/build-support/ocaml/oasis.nix new file mode 100644 index 00000000000..2ada920338e --- /dev/null +++ b/pkgs/build-support/ocaml/oasis.nix @@ -0,0 +1,31 @@ +{ buildOcaml, ocaml_oasis }: + +{ name, version, buildInputs ? [], ... +}@args: + +buildOcaml (args // { + buildInputs = [ ocaml_oasis ] ++ buildInputs; + + buildPhase = '' + runHook preBuild + oasis setup + ocaml setup.ml -configure + ocaml setup.ml -build + runHook postBuild + ''; + + checkPhase = '' + runHook preCheck + ocaml setup.ml -test + runHook postCheck + ''; + + installPhase = '' + runHook preInstall + mkdir -p $out + sed -i s+/usr/local+$out+g setup.ml + sed -i s+/usr/local+$out+g setup.data + prefix=$OCAMLFIND_DESTDIR ocaml setup.ml -install + runHook postInstall + ''; +}) diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 949c5b6a308..bac8e411bbd 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -12,6 +12,8 @@ let buildOcaml = callPackage ../build-support/ocaml { }; + buildOasisPackage = callPackage ../build-support/ocaml/oasis.nix { buildOcaml = buildOcaml; }; + buildDunePackage = callPackage ../build-support/ocaml/dune.nix {}; alcotest = callPackage ../development/ocaml-modules/alcotest {};