Don't use buildOcaml

This commit is contained in:
Merlin Göttlinger 2019-08-06 17:54:09 +02:00
parent 6ef367a5e8
commit 961b83a99d
No known key found for this signature in database
GPG Key ID: F3DD4A06EDED86E5
3 changed files with 27 additions and 6 deletions

View File

@ -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;
})

View File

@ -4,7 +4,7 @@ buildOasisPackage rec {
name = "tcslib";
version = "0.3";
minimumSupportedOCamlVersion = "4.03.0";
minimumOCamlVersion = "4.03.0";
src = fetchFromGitHub {
owner = "tcsprojects";

View File

@ -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 {};