diff options
Diffstat (limited to 'pkgs/top-level/static.nix')
-rw-r--r-- | pkgs/top-level/static.nix | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index d17080960329..687086b6ed3b 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; @@ -82,14 +115,15 @@ in { } // optionalAttrs super.stdenv.hostPlatform.isDarwin { pythonSupport = false; }); - zlib = (super.zlib.override { + zlib = super.zlib.override { static = true; shared = false; + splitStaticOutput = false; # Don’t use new stdenv zlib because # it doesn’t like the --disable-shared flag stdenv = super.stdenv; - }).static; + }; xz = super.xz.override { enableStatic = true; }; @@ -172,11 +206,19 @@ 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; }; + e2fsprogs = super.e2fsprogs.override { + shared = false; + }; + brotli = super.brotli.override { staticOnly = true; }; @@ -196,5 +238,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; }; } |