From 7263951cc87a9cd0bd377cef83c9241d0dffb665 Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Wed, 20 Nov 2019 18:46:18 +0300 Subject: ocaml: partially fix pkgsStatic.ocaml-ng This commit adds a static adapter for ocaml packages and applies it to pkgsStatic.ocaml-ng. The adapter fixes build of ocaml itself with version <= 4.7 and also attempts to fix builds of some packages. --- pkgs/top-level/static.nix | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'pkgs') diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index bf75f700f77..98a75e2df87 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -51,7 +51,40 @@ self: super: let enableStaticLibraries = true; }); }; + + 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; @@ -199,6 +232,10 @@ 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; }; } -- cgit 1.4.1