Merge pull request #108350 from Ericson2314/no-static-overlay

treewide: Inline more of the static overlay
This commit is contained in:
John Ericson 2021-01-04 22:30:00 -05:00 committed by GitHub
commit 4a6916aba3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 64 additions and 106 deletions

View File

@ -35,7 +35,7 @@
, rebuildBytecode ? true
, stripBytecode ? false
, includeSiteCustomize ? true
, static ? false
, static ? stdenv.hostPlatform.isStatic
# Not using optimizations on Darwin
# configure: error: llvm-profdata is required for a --enable-optimizations build but could not be found.
, enableOptimizations ? (!stdenv.isDarwin)

View File

@ -1,7 +1,10 @@
{ stdenv, fetchurl, curl, hdf5, netcdf
, enable_cdi_lib ? false # build, install and link to a CDI library [default=no]
, enable_all_static ? false # build a completely statically linked CDO binary [default=no]
, enable_cxx ? false # Use CXX as default compiler [default=no]
, # build, install and link to a CDI library [default=no]
enable_cdi_lib ? false
, # build a completely statically linked CDO binary
enable_all_static ? stdenv.hostPlatform.isStatic
, # Use CXX as default compiler [default=no]
enable_cxx ? false
}:
stdenv.mkDerivation rec {

View File

@ -1,5 +1,6 @@
{ stdenv, lib, fetchFromGitHub, cmake, gflags
, staticOnly ? false }:
, staticOnly ? stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec {
pname = "crc32c";

View File

@ -1,5 +1,6 @@
{ stdenv, fetchurl
, staticSupport ? false # Compile statically (support for packages that look for the static object)
, # Compile statically (support for packages that look for the static object)
staticSupport ? stdenv.hostPlatform.isStatic
}:
let

View File

@ -1,4 +1,7 @@
{ stdenv, fetchurl, static ? false }:
{ stdenv, fetchurl
, # Note: -static hasnt work on darwin
static ? with stdenv.hostPlatform; isStatic && !isDarwin
}:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, lib, cmake, cacert, fetchpatch, buildShared ? true }:
{ stdenv, fetchurl, lib, cmake, cacert, fetchpatch
, buildShared ? !stdenv.hostPlatform.isStatic
}:
let

View File

@ -8,7 +8,7 @@
, enableAsioLib ? false, boost ? null
, enableGetAssets ? false, libxml2 ? null
, enableJemalloc ? false, jemalloc ? null
, enableApp ? !stdenv.hostPlatform.isWindows
, enableApp ? with stdenv.hostPlatform; !isWindows && !isStatic
, enablePython ? false, python ? null, cython ? null, ncurses ? null, setuptools ? null
}:

View File

@ -1,4 +1,6 @@
{ stdenv, fetchFromGitHub, cmake, static ? false }:
{ stdenv, fetchFromGitHub, cmake
, static ? stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec {
pname = "snappy";

View File

@ -1,4 +1,6 @@
{ brotli, cmake, pkgconfig, fetchFromGitHub, stdenv, static ? false }:
{ brotli, cmake, pkgconfig, fetchFromGitHub, stdenv
, static ? stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec {
pname = "woff2";

View File

@ -1,6 +1,7 @@
{ stdenv, lib, fetchurl, autoreconfHook, pkgconfig
, libxslt, xz, elf-header
, withStatic ? false }:
, withStatic ? stdenv.hostPlatform.isStatic
}:
let
systems = [ "/run/current-system/kernel-modules" "/run/booted-system/kernel-modules" "" ];

View File

@ -74,7 +74,8 @@ self: super:
mkfontdir = self.mkfontscale;
libxcb = super.libxcb.overrideAttrs (attrs: {
configureFlags = [ "--enable-xkb" "--enable-xinput" ];
configureFlags = [ "--enable-xkb" "--enable-xinput" ]
++ stdenv.lib.optional stdenv.hostPlatform.isStatic "--disable-shared";
outputs = [ "out" "dev" "man" "doc" ];
});
@ -82,15 +83,18 @@ self: super:
outputs = [ "out" "dev" "man" ];
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
depsBuildBuild = [ buildPackages.stdenv.cc ];
depsBuildBuild = [
buildPackages.stdenv.cc
] ++ stdenv.lib.optionals stdenv.hostPlatform.isStatic [
(self.buildPackages.stdenv.cc.libc.static or null)
];
preConfigure = ''
sed 's,^as_dummy.*,as_dummy="\$PATH",' -i configure
'';
postInstall =
''
# Remove useless DocBook XML files.
rm -rf $out/share/doc
'';
postInstall = ''
# Remove useless DocBook XML files.
rm -rf $out/share/doc
'';
CPP = stdenv.lib.optionalString stdenv.isDarwin "clang -E -";
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.xorgproto ];
});
@ -138,6 +142,11 @@ self: super:
xdpyinfo = super.xdpyinfo.overrideAttrs (attrs: {
configureFlags = attrs.configureFlags or []
++ malloc0ReturnsNullCrossFlag;
preConfigure = attrs.preConfigure or ""
# missing transitive dependencies
+ stdenv.lib.optionalString stdenv.hostPlatform.isStatic ''
export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -lXau -lXdmcp"
'';
});
# Propagate some build inputs because of header file dependencies.
@ -223,8 +232,9 @@ self: super:
libXi = super.libXi.overrideAttrs (attrs: {
outputs = [ "out" "dev" "man" "doc" ];
propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ self.libXfixes ];
configureFlags = stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
"xorg_cv_malloc0_returns_null=no";
configureFlags = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"xorg_cv_malloc0_returns_null=no"
] ++ stdenv.lib.optional stdenv.hostPlatform.isStatic "--disable-shared";
});
libXinerama = super.libXinerama.overrideAttrs (attrs: {
@ -745,6 +755,11 @@ self: super:
xauth = super.xauth.overrideAttrs (attrs: {
doCheck = false; # fails
preConfigure = attrs.preConfigure or ""
# missing transitive dependencies
+ stdenv.lib.optionalString stdenv.hostPlatform.isStatic ''
export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -lxcb -lXau -lXdmcp"
'';
});
xcursorthemes = super.xcursorthemes.overrideAttrs (attrs: {

View File

@ -1,4 +1,6 @@
{ stdenv, fetchFromGitHub, cmake, fetchpatch, staticOnly ? false }:
{ stdenv, fetchFromGitHub, cmake, fetchpatch
, staticOnly ? stdenv.hostPlatform.isStatic
}:
# ?TODO: there's also python lib in there

View File

@ -2,7 +2,7 @@
, fixDarwinDylibNames
, file
, legacySupport ? false
, static ? false
, static ? stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec {

View File

@ -1,4 +1,6 @@
{ stdenv, buildPackages, fetchurl, fetchpatch, pkgconfig, libuuid, gettext, texinfo, shared ? true }:
{ stdenv, buildPackages, fetchurl, fetchpatch, pkgconfig, libuuid, gettext, texinfo
, shared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec {
pname = "e2fsprogs";

View File

@ -1,4 +1,7 @@
{ stdenv, fetchurl, xorgproto, libXt, libX11, gifview ? false, static ? false }:
{ stdenv, fetchurl, xorgproto, libXt, libX11
, gifview ? false
, static ? stdenv.hostPlatform.isStatic
}:
with stdenv.lib;

View File

@ -7,7 +7,8 @@
, gnutlsSupport ? false, gnutls ? null
, wolfsslSupport ? false, wolfssl ? null
, scpSupport ? zlibSupport && !stdenv.isSunOS && !stdenv.isCygwin, libssh2 ? null
, gssSupport ? !stdenv.hostPlatform.isWindows, libkrb5 ? null
, # a very sad story re static: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439039
gssSupport ? with stdenv.hostPlatform; !isWindows && !isStatic, libkrb5 ? null
, c-aresSupport ? false, c-ares ? null
, brotliSupport ? false, brotli ? null
}:

View File

@ -108,18 +108,11 @@ in {
haskellStaticAdapter;
};
nghttp2 = super.nghttp2.override {
enableApp = false;
};
zlib = super.zlib.override {
# Dont use new stdenv zlib because
# it doesnt like the --disable-shared flag
stdenv = super.stdenv;
};
gifsicle = super.gifsicle.override {
static = true;
};
openssl = super.openssl_1_1.overrideAttrs (o: {
# OpenSSL doesn't like the `--enable-static` / `--disable-shared` flags.
configureFlags = (removeUnknownConfigureFlags o.configureFlags);
@ -129,86 +122,13 @@ in {
# --disable-shared flag
stdenv = super.stdenv;
};
cdo = super.cdo.override {
enable_all_static = true;
};
gsm = super.gsm.override {
staticSupport = true;
};
crc32c = super.crc32c.override {
staticOnly = true;
};
perl = super.perl.override {
# Dont use new stdenv zlib because
# it doesnt like the --disable-shared flag
stdenv = super.stdenv;
};
woff2 = super.woff2.override {
static = true;
};
snappy = super.snappy.override {
static = true;
};
libressl = super.libressl.override {
buildShared = false;
};
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;
};
zstd = super.zstd.override {
static = true;
};
ocaml-ng = self.lib.mapAttrs (_: set:
if set ? overrideScope' then set.overrideScope' ocamlStaticAdapter else set
) super.ocaml-ng;
python27 = super.python27.override { static = true; };
python36 = super.python36.override { static = true; };
python37 = super.python37.override { static = true; };
python38 = super.python38.override { static = true; };
python39 = super.python39.override { static = true; };
python3Minimal = super.python3Minimal.override { static = true; };
# Note: -static doesnt work on darwin
libev = super.libev.override { static = !super.stdenv.hostPlatform.isDarwin; };
xorg = super.xorg.overrideScope' (xorgself: xorgsuper: {
libX11 = xorgsuper.libX11.overrideAttrs (attrs: {
depsBuildBuild = attrs.depsBuildBuild ++ [ (self.buildPackages.stdenv.cc.libc.static or null) ];
});
xauth = xorgsuper.xauth.overrideAttrs (attrs: {
# missing transitive dependencies
preConfigure = attrs.preConfigure or "" + ''
export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -lxcb -lXau -lXdmcp"
'';
});
xdpyinfo = xorgsuper.xdpyinfo.overrideAttrs (attrs: {
# missing transitive dependencies
preConfigure = attrs.preConfigure or "" + ''
export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -lXau -lXdmcp"
'';
});
libxcb = xorgsuper.libxcb.overrideAttrs (attrs: {
configureFlags = attrs.configureFlags ++ [ "--disable-shared" ];
});
libXi= xorgsuper.libXi.overrideAttrs (attrs: {
configureFlags = attrs.configureFlags ++ [ "--disable-shared" ];
});
});
}