diff --git a/pkgs/development/libraries/libgcrypt/default.nix b/pkgs/development/libraries/libgcrypt/default.nix index 75d8e6710e0..e7a9ec60a6d 100644 --- a/pkgs/development/libraries/libgcrypt/default.nix +++ b/pkgs/development/libraries/libgcrypt/default.nix @@ -27,7 +27,8 @@ stdenv.mkDerivation rec { ++ stdenv.lib.optional stdenv.isDarwin gettext ++ stdenv.lib.optional enableCapabilities libcap; - configureFlags = [ "--with-libgpg-error-prefix=${libgpgerror.dev}" ]; + configureFlags = [ "--with-libgpg-error-prefix=${libgpgerror.dev}" ] + ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-asm"; # Make sure libraries are correct for .pc and .la files # Also make sure includes are fixed for callers who don't use libgpgcrypt-config diff --git a/pkgs/development/libraries/libusb1/default.nix b/pkgs/development/libraries/libusb1/default.nix index 9a08a7756c8..9d90304042c 100644 --- a/pkgs/development/libraries/libusb1/default.nix +++ b/pkgs/development/libraries/libusb1/default.nix @@ -28,13 +28,8 @@ stdenv.mkDerivation (rec { NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s"; - configureFlags = - # We use `isLinux` here only to avoid mass rebuilds for Darwin, where - # disabling udev happens automatically. Remove `isLinux` at next big change! - stdenv.lib.optional (stdenv.isLinux && !enableSystemd) "--disable-udev"; - - preFixup = stdenv.lib.optionalString enableSystemd '' - sed 's,-ludev,-L${systemd.lib}/lib -ludev,' -i $out/lib/libusb-1.0.la + preFixup = stdenv.lib.optionalString stdenv.isLinux '' + sed 's,-ludev,-L${stdenv.lib.getLib systemd}/lib -ludev,' -i $out/lib/libusb-1.0.la ''; meta = with stdenv.lib; { diff --git a/pkgs/development/ocaml-modules/alcotest/default.nix b/pkgs/development/ocaml-modules/alcotest/default.nix index c43ad10d7d8..8415dc751d5 100644 --- a/pkgs/development/ocaml-modules/alcotest/default.nix +++ b/pkgs/development/ocaml-modules/alcotest/default.nix @@ -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 []); diff --git a/pkgs/development/ocaml-modules/asn1-combinators/default.nix b/pkgs/development/ocaml-modules/asn1-combinators/default.nix index c6d99fa33e7..49fcdbd261a 100644 --- a/pkgs/development/ocaml-modules/asn1-combinators/default.nix +++ b/pkgs/development/ocaml-modules/asn1-combinators/default.nix @@ -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"; diff --git a/pkgs/development/ocaml-modules/bos/default.nix b/pkgs/development/ocaml-modules/bos/default.nix index 0f168daac8c..6b37cf1aed3 100644 --- a/pkgs/development/ocaml-modules/bos/default.nix +++ b/pkgs/development/ocaml-modules/bos/default.nix @@ -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; diff --git a/pkgs/development/ocaml-modules/cmdliner/default.nix b/pkgs/development/ocaml-modules/cmdliner/default.nix index 271ec1f2af9..34d57b403b0 100644 --- a/pkgs/development/ocaml-modules/cmdliner/default.nix +++ b/pkgs/development/ocaml-modules/cmdliner/default.nix @@ -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; diff --git a/pkgs/development/ocaml-modules/fmt/default.nix b/pkgs/development/ocaml-modules/fmt/default.nix index c7fff722399..d136ec092c2 100644 --- a/pkgs/development/ocaml-modules/fmt/default.nix +++ b/pkgs/development/ocaml-modules/fmt/default.nix @@ -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; diff --git a/pkgs/development/ocaml-modules/jsonm/default.nix b/pkgs/development/ocaml-modules/jsonm/default.nix index c4a7fa0f7a7..d1f5cabb32d 100644 --- a/pkgs/development/ocaml-modules/jsonm/default.nix +++ b/pkgs/development/ocaml-modules/jsonm/default.nix @@ -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; diff --git a/pkgs/development/ocaml-modules/logs/default.nix b/pkgs/development/ocaml-modules/logs/default.nix index 15d2bde0ec6..a89f66477fa 100644 --- a/pkgs/development/ocaml-modules/logs/default.nix +++ b/pkgs/development/ocaml-modules/logs/default.nix @@ -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"; diff --git a/pkgs/development/ocaml-modules/magic-mime/default.nix b/pkgs/development/ocaml-modules/magic-mime/default.nix index 65acbd6cc42..16e37addd45 100644 --- a/pkgs/development/ocaml-modules/magic-mime/default.nix +++ b/pkgs/development/ocaml-modules/magic-mime/default.nix @@ -11,7 +11,9 @@ stdenv.mkDerivation { sha256 = "058d83hmxd5mjccxdm3ydchmhk2lca5jdg82jg0klsigmf4ida6v"; }; - buildInputs = [ ocaml findlib ocamlbuild ]; + nativeBuildInputs = [ ocaml findlib ocamlbuild ]; + buildInputs = [ findlib ]; + configurePlatforms = []; createFindlibDestdir = true; diff --git a/pkgs/development/ocaml-modules/mtime/default.nix b/pkgs/development/ocaml-modules/mtime/default.nix index f86909cc10b..02d6380715b 100644 --- a/pkgs/development/ocaml-modules/mtime/default.nix +++ b/pkgs/development/ocaml-modules/mtime/default.nix @@ -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}"; diff --git a/pkgs/development/ocaml-modules/nocrypto/default.nix b/pkgs/development/ocaml-modules/nocrypto/default.nix index 06a87c072b4..bed872ed08d 100644 --- a/pkgs/development/ocaml-modules/nocrypto/default.nix +++ b/pkgs/development/ocaml-modules/nocrypto/default.nix @@ -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, ppx_deriving, 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 ppx_deriving ]; + propagatedBuildInputs = [ cstruct ppx_sexp_conv sexplib zarith ] ++ optional withLwt cstruct-lwt; buildPhase = "${topkg.buildPhase} --with-lwt ${boolToString withLwt}"; inherit (topkg) installPhase; diff --git a/pkgs/development/ocaml-modules/num/default.nix b/pkgs/development/ocaml-modules/num/default.nix index d46bff5b3d5..022b7af9629 100644 --- a/pkgs/development/ocaml-modules/num/default.nix +++ b/pkgs/development/ocaml-modules/num/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, fetchpatch, ocaml, findlib }: +{ stdenv, lib, fetchFromGitHub, fetchpatch, ocaml, findlib, withStatic ? false }: stdenv.mkDerivation rec { version = "1.1"; @@ -14,12 +14,14 @@ stdenv.mkDerivation rec { url = "https://github.com/ocaml/num/commit/6d4c6d476c061298e6385e8a0864f083194b9307.patch"; sha256 = "18zlvb5n327q8y3c52js5dvyy29ssld1l53jqng8m9w1k24ypi0b"; }) - ]; + ] ++ lib.optional withStatic ./enable-static.patch; - buildInputs = [ ocaml findlib ]; + nativeBuildInputs = [ ocaml findlib ]; + buildInputs = [ ocaml findlib ]; createFindlibDestdir = true; + meta = { description = "Legacy Num library for arbitrary-precision integer and rational arithmetic"; license = stdenv.lib.licenses.lgpl21; diff --git a/pkgs/development/ocaml-modules/num/enable-static.patch b/pkgs/development/ocaml-modules/num/enable-static.patch new file mode 100644 index 00000000000..be3ca197f4e --- /dev/null +++ b/pkgs/development/ocaml-modules/num/enable-static.patch @@ -0,0 +1,12 @@ +diff -u a/src/Makefile b/src/Makefile +--- a/src/Makefile ++++ b/src/Makefile +@@ -45,7 +45,7 @@ + endif + + libnums.$(A): $(COBJS) +- $(OCAMLMKLIB) -oc nums $(COBJS) ++ $(OCAMLMKLIB) -custom -oc nums $(COBJS) + + nums.cma: $(CMOS) + $(OCAMLMKLIB) -o nums -oc nums -linkall $(CMOS) diff --git a/pkgs/development/ocaml-modules/ocamlgraph/default.nix b/pkgs/development/ocaml-modules/ocamlgraph/default.nix index 887dce58689..a39e72d3880 100644 --- a/pkgs/development/ocaml-modules/ocamlgraph/default.nix +++ b/pkgs/development/ocaml-modules/ocamlgraph/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, ocaml, findlib, lablgtk}: +{stdenv, fetchurl, ocaml, findlib, lablgtk ? null}: stdenv.mkDerivation rec { pname = "ocamlgraph"; @@ -16,7 +16,8 @@ stdenv.mkDerivation rec { postPatch = '' sed -i 's@$(DESTDIR)$(OCAMLLIB)/ocamlgraph@$(DESTDIR)/lib/ocaml/${ocaml.version}/site-lib/ocamlgraph@' Makefile.in sed -i 's@OCAMLFINDDEST := -destdir $(DESTDIR)@@' Makefile.in - sed -i 's@+lablgtk2@${lablgtk}/lib/ocaml/${ocaml.version}/site-lib/lablgtk2 -I ${lablgtk}/lib/ocaml/${ocaml.version}/site-lib/stublibs@' configure Makefile.in editor/Makefile + ${stdenv.lib.optionalString (lablgtk != null) + "sed -i 's@+lablgtk2@${lablgtk}/lib/ocaml/${ocaml.version}/site-lib/lablgtk2 -I ${lablgtk}/lib/ocaml/${ocaml.version}/site-lib/stublibs@' configure Makefile.in editor/Makefile"} ''; createFindlibDestdir = true; diff --git a/pkgs/development/ocaml-modules/opam-file-format/default.nix b/pkgs/development/ocaml-modules/opam-file-format/default.nix index 4d308dc78b5..0ca332a2a06 100644 --- a/pkgs/development/ocaml-modules/opam-file-format/default.nix +++ b/pkgs/development/ocaml-modules/opam-file-format/default.nix @@ -15,6 +15,8 @@ stdenv.mkDerivation rec { installFlags = [ "LIBDIR=$(OCAMLFIND_DESTDIR)" ]; + patches = [ ./optional-static.patch ]; + meta = { description = "Parser and printer for the opam file syntax"; license = stdenv.lib.licenses.lgpl21; diff --git a/pkgs/development/ocaml-modules/opam-file-format/optional-static.patch b/pkgs/development/ocaml-modules/opam-file-format/optional-static.patch new file mode 100644 index 00000000000..5501fdd0c6c --- /dev/null +++ b/pkgs/development/ocaml-modules/opam-file-format/optional-static.patch @@ -0,0 +1,13 @@ +diff -u a/Makefile b/Makefile +--- a/Makefile ++++ b/Makefile +@@ -1,1 +1,5 @@ +-TARGETS = opam-file-format.cma opam-file-format.cmxa opam-file-format.cmxs ++TARGETS = opam-file-format.cma opam-file-format.cmxa ++ ++ifeq "$(NATDYNLINK)" "true" ++TARGETS = $(TARGETS) opam-file-format.cmxs ++endif + +all: $(TARGETS) + diff --git a/pkgs/development/ocaml-modules/ounit/default.nix b/pkgs/development/ocaml-modules/ounit/default.nix index 758bb072090..6f4536f2e8b 100644 --- a/pkgs/development/ocaml-modules/ounit/default.nix +++ b/pkgs/development/ocaml-modules/ounit/default.nix @@ -14,7 +14,9 @@ stdenv.mkDerivation { sha256 = "0hbd2sqdz75lv5ax82yhsfdk1dlcvq12xpys6n85ysmrl0c3d3lk"; }); - buildInputs = [ ocaml findlib ocamlbuild ]; + nativeBuildInputs = [ ocaml findlib ocamlbuild ]; + buildInputs = [ findlib ]; + configurePlatforms = []; dontAddPrefix = true; diff --git a/pkgs/development/ocaml-modules/ppx_tools/default.nix b/pkgs/development/ocaml-modules/ppx_tools/default.nix index fd2b67225e6..984906342bc 100644 --- a/pkgs/development/ocaml-modules/ppx_tools/default.nix +++ b/pkgs/development/ocaml-modules/ppx_tools/default.nix @@ -37,6 +37,7 @@ in inherit (param) sha256; }; + nativeBuildInputs = [ ocaml findlib ]; buildInputs = [ ocaml findlib ]; createFindlibDestdir = true; diff --git a/pkgs/development/ocaml-modules/ptime/default.nix b/pkgs/development/ocaml-modules/ptime/default.nix index f21f05eeae5..de3d940b3bb 100644 --- a/pkgs/development/ocaml-modules/ptime/default.nix +++ b/pkgs/development/ocaml-modules/ptime/default.nix @@ -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 ]; diff --git a/pkgs/development/ocaml-modules/tls/default.nix b/pkgs/development/ocaml-modules/tls/default.nix index b1a178128ad..80d9933f8b6 100644 --- a/pkgs/development/ocaml-modules/tls/default.nix +++ b/pkgs/development/ocaml-modules/tls/default.nix @@ -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; diff --git a/pkgs/development/ocaml-modules/topkg/default.nix b/pkgs/development/ocaml-modules/topkg/default.nix index a3e718d5329..edbbec3dcb3 100644 --- a/pkgs/development/ocaml-modules/topkg/default.nix +++ b/pkgs/development/ocaml-modules/topkg/default.nix @@ -29,7 +29,7 @@ stdenv.mkDerivation rec { sha256 = "1df61vw6v5bg2mys045682ggv058yqkqb67w7r2gz85crs04d5fw"; }; - buildInputs = [ ocaml findlib ocamlbuild ]; + nativeBuildInputs = [ ocaml findlib ocamlbuild ]; propagatedBuildInputs = [ result ]; buildPhase = "${run} build"; diff --git a/pkgs/development/ocaml-modules/uchar/default.nix b/pkgs/development/ocaml-modules/uchar/default.nix index c943d3ce35a..2140871021d 100644 --- a/pkgs/development/ocaml-modules/uchar/default.nix +++ b/pkgs/development/ocaml-modules/uchar/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opaline }: +{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opaline, withShared ? true }: stdenv.mkDerivation { name = "ocaml${ocaml.version}-uchar-0.0.2"; @@ -8,9 +8,11 @@ stdenv.mkDerivation { sha256 = "1w2saw7zanf9m9ffvz2lvcxvlm118pws2x1wym526xmydhqpyfa7"; }; - buildInputs = [ ocaml ocamlbuild findlib opaline ]; - buildPhase = "ocaml pkg/build.ml native=true native-dynlink=true"; + nativeBuildInputs = [ ocaml ocamlbuild findlib opaline ]; + buildInputs = [ findlib ocaml ocamlbuild opaline ]; + buildPhase = "ocaml pkg/build.ml native=true native-dynlink=${if withShared then "true" else "false"}"; installPhase = "opaline -libdir $OCAMLFIND_DESTDIR"; + configurePlatforms = []; meta = { description = "Compatibility library for OCaml’s Uchar module"; diff --git a/pkgs/development/ocaml-modules/uuidm/default.nix b/pkgs/development/ocaml-modules/uuidm/default.nix index 079e810bfdc..497b2df88b1 100644 --- a/pkgs/development/ocaml-modules/uuidm/default.nix +++ b/pkgs/development/ocaml-modules/uuidm/default.nix @@ -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; diff --git a/pkgs/development/ocaml-modules/uutf/default.nix b/pkgs/development/ocaml-modules/uutf/default.nix index 863a4cbb840..f289781b422 100644 --- a/pkgs/development/ocaml-modules/uutf/default.nix +++ b/pkgs/development/ocaml-modules/uutf/default.nix @@ -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; diff --git a/pkgs/development/ocaml-modules/yojson/default.nix b/pkgs/development/ocaml-modules/yojson/default.nix index 84d5e488b25..24942da0072 100644 --- a/pkgs/development/ocaml-modules/yojson/default.nix +++ b/pkgs/development/ocaml-modules/yojson/default.nix @@ -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"; diff --git a/pkgs/development/ocaml-modules/zarith/default.nix b/pkgs/development/ocaml-modules/zarith/default.nix index c97078c62ed..f0cb5a59485 100644 --- a/pkgs/development/ocaml-modules/zarith/default.nix +++ b/pkgs/development/ocaml-modules/zarith/default.nix @@ -6,9 +6,9 @@ let source = if stdenv.lib.versionAtLeast ocaml.version "4.02" then { - version = "1.9.1"; - url = https://github.com/ocaml/Zarith/archive/release-1.9.1.tar.gz; - sha256 = "0pfa271476dic5pvn6kxz3dfswxs6kqm2cxmhdx5xq2ayca05gj9"; + version = "1.9"; + url = https://github.com/ocaml/Zarith/archive/release-1.9.tar.gz; + sha256 = "1xrqcaj5gp52xp4ybpnblw8ciwlgrr0zi7rg7hnk8x83isjkpmwx"; } else { version = "1.3"; url = http://forge.ocamlcore.org/frs/download.php/1471/zarith-1.3.tgz; @@ -26,9 +26,8 @@ stdenv.mkDerivation rec { propagatedBuildInputs = [ gmp ]; patchPhase = "patchShebangs ./z_pp.pl"; - configurePhase = '' - ./configure -installdir $out/lib/ocaml/${ocaml.version}/site-lib - ''; + dontAddPrefix = true; + configureFlags = [ "-installdir ${placeholder "out"}/lib/ocaml/${ocaml.version}/site-lib" ]; preInstall = "mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs"; diff --git a/pkgs/development/tools/ocaml/js_of_ocaml/3.0.nix b/pkgs/development/tools/ocaml/js_of_ocaml/3.0.nix index d1ff9eee817..9ca6ca67421 100644 --- a/pkgs/development/tools/ocaml/js_of_ocaml/3.0.nix +++ b/pkgs/development/tools/ocaml/js_of_ocaml/3.0.nix @@ -3,11 +3,12 @@ }: stdenv.mkDerivation { - pname = "js_of_ocaml"; + pname = "js_of_ocaml"; - inherit (js_of_ocaml-compiler) version src installPhase meta; + 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"; diff --git a/pkgs/development/tools/ocaml/js_of_ocaml/compiler.nix b/pkgs/development/tools/ocaml/js_of_ocaml/compiler.nix index c449c0f9002..801e4142780 100644 --- a/pkgs/development/tools/ocaml/js_of_ocaml/compiler.nix +++ b/pkgs/development/tools/ocaml/js_of_ocaml/compiler.nix @@ -1,5 +1,5 @@ { lib, fetchFromGitHub, buildDunePackage -, cmdliner, cppo, yojson +, ocaml, findlib, cmdliner, dune, cppo, yojson }: buildDunePackage rec { @@ -13,8 +13,10 @@ buildDunePackage rec { sha256 = "0c537say0f3197zn8d83nrihabrxyn28xc6d7c9c3l0vvrv6qvfj"; }; - buildInputs = [ cmdliner cppo ]; + nativeBuildInputs = [ ocaml findlib dune cppo ]; + buildInputs = [ cmdliner ]; + configurePlatforms = []; propagatedBuildInputs = [ yojson ]; meta = { diff --git a/pkgs/os-specific/linux/kmod/default.nix b/pkgs/os-specific/linux/kmod/default.nix index 433506e5c39..052ab3061c1 100644 --- a/pkgs/os-specific/linux/kmod/default.nix +++ b/pkgs/os-specific/linux/kmod/default.nix @@ -1,5 +1,6 @@ { stdenv, lib, fetchurl, autoreconfHook, pkgconfig -, libxslt, xz, elf-header }: +, libxslt, xz, elf-header +, withStatic ? false }: let systems = [ "/run/current-system/kernel-modules" "/run/booted-system/kernel-modules" "" ]; @@ -21,10 +22,11 @@ in stdenv.mkDerivation rec { "--sysconfdir=/etc" "--with-xz" "--with-modulesdirs=${modulesDirs}" - ]; + ] ++ lib.optional withStatic "--enable-static"; patches = [ ./module-dir.patch ] - ++ lib.optional stdenv.isDarwin ./darwin.patch; + ++ lib.optional stdenv.isDarwin ./darwin.patch + ++ lib.optional withStatic ./enable-static.patch; postInstall = '' for prog in rmmod insmod lsmod modinfo modprobe depmod; do diff --git a/pkgs/os-specific/linux/kmod/enable-static.patch b/pkgs/os-specific/linux/kmod/enable-static.patch new file mode 100644 index 00000000000..8308c655792 --- /dev/null +++ b/pkgs/os-specific/linux/kmod/enable-static.patch @@ -0,0 +1,12 @@ +diff --git a/configure.ac b/configure.ac +index ee72283..b42c42a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -19,7 +19,6 @@ AM_SILENT_RULES([yes]) + LT_INIT([disable-static pic-only]) + DOLT + +-AS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static is not supported by kmod])]) + AS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is not supported by kmod])]) + + ##################################################################### diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index d1708096032..98a75e2df87 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -52,6 +52,39 @@ self: super: let }); }; + removeUnknownConfigureFlags = f: with self.lib; + remove "--disable-shared" + (remove "--enable-static" f); + + ocamlFixPackage = b: + b.overrideAttrs (o: { + configurePlatforms = [ ]; + configureFlags = removeUnknownConfigureFlags (o.configureFlags or [ ]); + buildInputs = o.buildInputs ++ o.nativeBuildInputs or [ ]; + propagatedNativeBuildInputs = o.propagatedBuildInputs or [ ]; + }); + + ocamlStaticAdapter = _: super: + self.lib.mapAttrs + (_: p: if p ? overrideAttrs then ocamlFixPackage p else p) + super + // { + lablgtk = null; # Currently xlibs cause infinite recursion + ocaml = ((super.ocaml.override { useX11 = false; }).overrideAttrs (o: { + configurePlatforms = [ ]; + dontUpdateAutotoolsGnuConfigScripts = true; + })).overrideDerivation (o: { + preConfigure = '' + configureFlagsArray+=("-cc" "$CC" "-as" "$AS" "-partialld" "$LD -r") + ''; + configureFlags = (removeUnknownConfigureFlags o.configureFlags) ++ [ + "--no-shared-libs" + "-host ${o.stdenv.hostPlatform.config}" + "-target ${o.stdenv.targetPlatform.config}" + ]; + }); + }; + in { stdenv = foldl (flip id) super.stdenv staticAdapters; gcc49Stdenv = foldl (flip id) super.gcc49Stdenv staticAdapters; @@ -172,6 +205,10 @@ in { }; }; + kmod = super.kmod.override { + withStatic = true; + }; + curl = super.curl.override { # a very sad story: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439039 gssSupport = false; @@ -196,5 +233,9 @@ in { }; }; + ocaml-ng = self.lib.mapAttrs (_: set: + if set ? overrideScope' then set.overrideScope' ocamlStaticAdapter else set + ) super.ocaml-ng; + python27 = super.python27.override { static = true; }; }