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
No known key found for this signature in database
GPG key ID: E081FF12ADCB4AD5
22 changed files with 65 additions and 31 deletions

View file

@ -6,14 +6,15 @@ let param =
if stdenv.lib.versionAtLeast ocaml.version "4.02" then {
version = "0.8.5";
sha256 = "1mhckvdcxkikbzgvy24kjz4265l15b86a6swz7m3ynbgvqdcfzqn";
buildInputs = [ dune ];
nativeBuildInputs = [ dune ];
propagatedBuildInputs = [ uuidm ];
buildPhase = "dune build -p alcotest";
inherit (dune) installPhase;
} else {
version = "0.7.2";
sha256 = "1qgsz2zz5ky6s5pf3j3shc4fjc36rqnjflk8x0wl1fcpvvkr52md";
buildInputs = [ ocamlbuild topkg ];
buildInputs = [ topkg ];
nativeBuildInputs = [ ocamlbuild ];
inherit (topkg) buildPhase installPhase;
};
in
@ -27,7 +28,8 @@ stdenv.mkDerivation rec {
inherit (param) sha256;
};
buildInputs = [ ocaml findlib ] ++ param.buildInputs;
nativeBuildInputs = [ ocaml findlib ] ++ (param.nativeBuildInputs or []);
buildInputs = [ findlib ] ++ (param.buildInputs or []);
propagatedBuildInputs = [ cmdliner astring fmt result ]
++ (param.propagatedBuildInputs or []);

View file

@ -25,7 +25,8 @@ stdenv.mkDerivation rec {
inherit (param) sha256;
};
buildInputs = [ ocaml findlib ocamlbuild ounit topkg ];
buildInputs = [ findlib ounit topkg ];
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
propagatedBuildInputs = [ result cstruct zarith ] ++ param.propagatedBuildInputs;
buildPhase = "${topkg.run} build --tests true";

View file

@ -10,7 +10,8 @@ stdenv.mkDerivation rec {
sha256 = "1s10iqx8rgnxr5n93lf4blwirjf8nlm272yg5sipr7lsr35v49wc";
};
buildInputs = [ ocaml findlib ocamlbuild topkg ];
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
buildInputs = [ findlib topkg ];
propagatedBuildInputs = [ astring fmt fpath logs rresult ];
inherit (topkg) buildPhase installPhase;

View file

@ -25,8 +25,8 @@ stdenv.mkDerivation rec {
inherit (param) sha256;
};
nativeBuildInputs = [ ocamlbuild topkg ];
buildInputs = [ ocaml findlib ];
nativeBuildInputs = [ ocaml ocamlbuild findlib ];
buildInputs = [ topkg ];
propagatedBuildInputs = [ result ];
inherit (topkg) buildPhase installPhase;

View file

@ -8,7 +8,8 @@ stdenv.mkDerivation {
sha256 = "1zj9azcxcn6skmb69ykgmi9z8c50yskwg03wqgh87lypgjdcz060";
};
buildInputs = [ ocaml findlib ocamlbuild topkg cmdliner ];
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
buildInputs = [ findlib topkg cmdliner ];
propagatedBuildInputs = [ result uchar ];
inherit (topkg) buildPhase installPhase;

View file

@ -10,7 +10,8 @@ stdenv.mkDerivation {
sha256 = "1176dcmxb11fnw49b7yysvkjh0kpzx4s48lmdn5psq9vshp5c29w";
};
buildInputs = [ ocaml findlib ocamlbuild topkg ];
buildInputs = [ findlib topkg ];
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
propagatedBuildInputs = [ uutf ];
inherit (topkg) buildPhase installPhase;

View file

@ -18,7 +18,8 @@ stdenv.mkDerivation rec {
sha256 = "1lkhr7i44xw4kpfbhgj3rbqy3dv5bfm4kyrbl8a9rfafddcxlwss";
};
buildInputs = [ ocaml findlib ocamlbuild topkg fmt cmdliner lwt ];
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
buildInputs = [ findlib topkg fmt cmdliner lwt ];
propagatedBuildInputs = [ result ];
buildPhase = "${topkg.run} build --with-js_of_ocaml false";

View file

@ -11,7 +11,9 @@ stdenv.mkDerivation {
sha256 = "058d83hmxd5mjccxdm3ydchmhk2lca5jdg82jg0klsigmf4ida6v";
};
buildInputs = [ ocaml findlib ocamlbuild ];
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
buildInputs = [ findlib ];
configurePlatforms = [];
createFindlibDestdir = true;

View file

@ -23,7 +23,8 @@ stdenv.mkDerivation {
inherit (param) sha256;
};
buildInputs = [ ocaml findlib ocamlbuild topkg ]
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
buildInputs = [ findlib topkg ]
++ stdenv.lib.optional jsooSupport js_of_ocaml;
buildPhase = "${topkg.buildPhase} --with-js_of_ocaml ${boolToString jsooSupport}";

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;

View file

@ -16,7 +16,8 @@ stdenv.mkDerivation rec {
})
];
buildInputs = [ ocaml findlib ];
nativeBuildInputs = [ ocaml findlib ];
buildInputs = [ findlib ];
createFindlibDestdir = true;

View file

@ -14,7 +14,9 @@ stdenv.mkDerivation {
sha256 = "0hbd2sqdz75lv5ax82yhsfdk1dlcvq12xpys6n85ysmrl0c3d3lk";
});
buildInputs = [ ocaml findlib ocamlbuild ];
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
buildInputs = [ findlib ];
configurePlatforms = [];
dontAddPrefix = true;

View file

@ -37,7 +37,8 @@ in
inherit (param) sha256;
};
buildInputs = [ ocaml findlib ];
nativeBuildInputs = [ ocaml findlib ];
buildInputs = [ findlib ];
createFindlibDestdir = true;

View file

@ -9,7 +9,8 @@ stdenv.mkDerivation rec {
sha256 = "1fxq57xy1ajzfdnvv5zfm7ap2nf49znw5f9gbi4kb9vds942ij27";
};
buildInputs = [ ocaml findlib ocamlbuild topkg js_of_ocaml ];
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
buildInputs = [ findlib topkg js_of_ocaml ];
propagatedBuildInputs = [ result ];

View file

@ -21,7 +21,8 @@ stdenv.mkDerivation rec {
sha256 = "02wv4lia583imn3sfci4nqv6ac5nzig5j3yfdnlqa0q8bp9rfc6g";
};
buildInputs = [ ocaml ocamlbuild findlib topkg ppx_sexp_conv ppx_cstruct ]
nativeBuildInputs = [ ocaml ocamlbuild findlib ];
buildInputs = [ findlib topkg ppx_sexp_conv ppx_cstruct ]
++ optionals doCheck [ ounit cstruct-unix ];
propagatedBuildInputs = [ cstruct-sexp nocrypto result x509 ] ++
optional withLwt lwt;

View file

@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
sha256 = "1df61vw6v5bg2mys045682ggv058yqkqb67w7r2gz85crs04d5fw";
};
buildInputs = [ ocaml findlib ocamlbuild ];
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
propagatedBuildInputs = [ result ];
buildPhase = "${run} build";

View file

@ -8,9 +8,11 @@ stdenv.mkDerivation {
sha256 = "1w2saw7zanf9m9ffvz2lvcxvlm118pws2x1wym526xmydhqpyfa7";
};
buildInputs = [ ocaml ocamlbuild findlib opaline ];
nativeBuildInputs = [ ocaml ocamlbuild findlib opaline ];
buildInputs = [ findlib ];
buildPhase = "ocaml pkg/build.ml native=true native-dynlink=true";
installPhase = "opaline -libdir $OCAMLFIND_DESTDIR";
configurePlatforms = [];
meta = {
description = "Compatibility library for OCamls Uchar module";

View file

@ -8,7 +8,9 @@ stdenv.mkDerivation rec {
sha256 = "1ivxb3hxn9bk62rmixx6px4fvn52s4yr1bpla7rgkcn8981v45r8";
};
buildInputs = [ ocaml findlib ocamlbuild topkg cmdliner ];
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
configurePlatforms = [];
buildInputs = [ topkg cmdliner ];
inherit (topkg) buildPhase installPhase;

View file

@ -13,7 +13,8 @@ stdenv.mkDerivation rec {
sha256 = "1nx1rly3qj23jzn9yk3x6fwqimcxjd84kv5859vvhdg56psq26p6";
};
buildInputs = [ ocaml findlib ocamlbuild topkg cmdliner ];
nativeBuildInputs = [ ocaml ocamlbuild findlib ];
buildInputs = [ findlib topkg cmdliner ];
propagatedBuildInputs = [ uchar ];
inherit (topkg) buildPhase installPhase;

View file

@ -6,7 +6,7 @@ let
version = "1.7.0";
url = "https://github.com/ocaml-community/yojson/releases/download/${version}/yojson-${version}.tbz";
sha256 = "08llz96if8bcgnaishf18si76cv11zbkni0aldb54k3cn7ipiqvd";
buildInputs = [ dune ];
nativeBuildInputs = [ dune ];
extra = { inherit (dune) installPhase; };
} else rec {
version = "1.2.3";
@ -29,9 +29,10 @@ stdenv.mkDerivation ({
inherit (param) url sha256;
};
buildInputs = [ ocaml findlib ] ++ (param.buildInputs or []);
propagatedBuildInputs = [ cppo easy-format biniou ];
nativeBuildInputs = [ ocaml findlib ] ++ (param.nativeBuildInputs or []);
propagatedNativeBuildInputs = [ cppo ];
propagatedBuildInputs = [ easy-format biniou ];
configurePlatforms = [];
meta = with stdenv.lib; {
description = "An optimized parsing and printing library for the JSON format";

View file

@ -7,7 +7,8 @@ stdenv.mkDerivation {
inherit (js_of_ocaml-compiler) version src installPhase meta;
buildInputs = [ ocaml findlib dune ocaml-migrate-parsetree ppx_tools_versioned ];
buildInputs = [ findlib ocaml-migrate-parsetree ppx_tools_versioned ];
nativeBuildInputs = [ ocaml findlib dune ];
postPatch = "patchShebangs lib/generate_stubs.sh";

View file

@ -13,8 +13,10 @@ buildDunePackage rec {
sha256 = "0c537say0f3197zn8d83nrihabrxyn28xc6d7c9c3l0vvrv6qvfj";
};
buildInputs = [ cmdliner cppo ];
nativeBuildInputs = [ ocaml findlib dune cppo ];
buildInputs = [ cmdliner ];
configurePlatforms = [];
propagatedBuildInputs = [ yojson ];
meta = {