From 961b83a99de37e31530272cce066ecd2a32a58c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Merlin=20G=C3=B6ttlinger?= Date: Tue, 6 Aug 2019 17:54:09 +0200 Subject: [PATCH] Don't use buildOcaml --- pkgs/build-support/ocaml/oasis.nix | 29 ++++++++++++++++--- .../ocaml-modules/tcslib/default.nix | 2 +- pkgs/top-level/ocaml-packages.nix | 2 +- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/pkgs/build-support/ocaml/oasis.nix b/pkgs/build-support/ocaml/oasis.nix index 7ad761bde283..ad1ba065ef72 100644 --- a/pkgs/build-support/ocaml/oasis.nix +++ b/pkgs/build-support/ocaml/oasis.nix @@ -1,10 +1,24 @@ -{ buildOcaml, ocaml_oasis }: +{ stdenv, ocaml_oasis, ocaml, findlib, ocamlbuild, camlp4 }: -{ buildInputs ? [], ... +{ name, version, buildInputs ? [], meta ? { platforms = ocaml.meta.platforms or []; }, + minimumOcamlVersion ? null, + createFindlibDestdir ? true, + dontStrip ? true, + hasSharedObjects ? false, + setupHook ? null, + ... }@args: -buildOcaml (args // { - buildInputs = [ ocaml_oasis ] ++ buildInputs; + assert minimumOcamlVersion != null -> + stdenv.lib.versionOlder minimumOcamlVersion ocaml.version; + +stdenv.mkDerivation (args // { + name = "ocaml-${name}-${version}"; + + buildInputs = [ ocaml findlib ocamlbuild camlp4 ocaml_oasis ] ++ buildInputs; + + inherit createFindlibDestdir; + inherit dontStrip; buildPhase = '' runHook preBuild @@ -28,4 +42,11 @@ buildOcaml (args // { prefix=$OCAMLFIND_DESTDIR ocaml setup.ml -install runHook postInstall ''; + + setupHook = if setupHook == null && hasSharedObjects + then stdenv.writeText "setupHook.sh" '' + export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/" + '' + else setupHook; + }) diff --git a/pkgs/development/ocaml-modules/tcslib/default.nix b/pkgs/development/ocaml-modules/tcslib/default.nix index 7eafb2e69930..5e7a7864462a 100644 --- a/pkgs/development/ocaml-modules/tcslib/default.nix +++ b/pkgs/development/ocaml-modules/tcslib/default.nix @@ -4,7 +4,7 @@ buildOasisPackage rec { name = "tcslib"; version = "0.3"; - minimumSupportedOCamlVersion = "4.03.0"; + minimumOCamlVersion = "4.03.0"; src = fetchFromGitHub { owner = "tcsprojects"; diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 1ca56235c659..8eed3e740923 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -12,7 +12,7 @@ let buildOcaml = callPackage ../build-support/ocaml { }; - buildOasisPackage = callPackage ../build-support/ocaml/oasis.nix { buildOcaml = buildOcaml; }; + buildOasisPackage = callPackage ../build-support/ocaml/oasis.nix { }; buildDunePackage = callPackage ../build-support/ocaml/dune.nix {};