ocaml-modules: replace buildInputs with nativeBuildInputs where appropriate

The default has been to use buildInputs for build dependencies.
This doesn't work when cross-compiling.
This commit is contained in:
Yorick van Pelt
2019-10-31 17:16:15 +07:00
committed by Alexander Bantyev
parent 173bf3473c
commit 4550405ac9
22 changed files with 65 additions and 31 deletions

View File

@@ -1,11 +1,19 @@
{ stdenv, fetchurl, fetchpatch, ocaml, findlib, ocamlbuild, topkg
, cpuid, ocb-stubblr, sexplib
, cstruct, zarith, ppx_sexp_conv, ppx_deriving
, cstruct, zarith, ppx_sexp_conv, writeScriptBin
, cstruct-lwt ? null
}:
with stdenv.lib;
let withLwt = cstruct-lwt != null; in
let
withLwt = cstruct-lwt != null;
# the build system will call 'cc' with no way to override
# this is wrong when we're cross-compiling, so insert a wrapper
cc-wrapper = writeScriptBin "cc" ''
set -e
$CC "$@"
'';
in
stdenv.mkDerivation rec {
name = "ocaml${ocaml.version}-nocrypto-${version}";
@@ -43,8 +51,9 @@ stdenv.mkDerivation rec {
})
];
buildInputs = [ ocaml findlib ocamlbuild topkg cpuid ocb-stubblr ];
propagatedBuildInputs = [ cstruct ppx_deriving ppx_sexp_conv sexplib zarith ] ++ optional withLwt cstruct-lwt;
nativeBuildInputs = [ ocaml findlib ocamlbuild cc-wrapper ];
buildInputs = [ ocamlbuild findlib topkg cpuid ocb-stubblr ];
propagatedBuildInputs = [ cstruct ppx_sexp_conv sexplib zarith ] ++ optional withLwt cstruct-lwt;
buildPhase = "${topkg.buildPhase} --with-lwt ${boolToString withLwt}";
inherit (topkg) installPhase;