pkgsStatic.python3: fix build

This commit is contained in:
Frederik Rietdijk 2020-03-29 11:27:09 +02:00 committed by Frederik Rietdijk
parent fe9ea7a88a
commit c392d70518
2 changed files with 11 additions and 3 deletions

View file

@ -28,6 +28,7 @@
, stripTkinter ? false
, rebuildBytecode ? true
, stripBytecode ? false
, static ? false
}:
assert x11Support -> tcl != null
@ -130,7 +131,7 @@ in with passthru; stdenv.mkDerivation {
CPPFLAGS = concatStringsSep " " (map (p: "-I${getDev p}/include") buildInputs);
LDFLAGS = concatStringsSep " " (map (p: "-L${getLib p}/lib") buildInputs);
LIBS = "${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}";
NIX_LDFLAGS = optionalString stdenv.isLinux "-lgcc_s";
NIX_LDFLAGS = optionalString (stdenv.isLinux && !stdenv.hostPlatform.isMusl) "-lgcc_s" + optionalString stdenv.hostPlatform.isMusl "-lgcc_eh";
# Determinism: We fix the hashes of str, bytes and datetime objects.
PYTHONHASHSEED=0;
@ -169,7 +170,7 @@ in with passthru; stdenv.mkDerivation {
# Never even try to use lchmod on linux,
# don't rely on detecting glibc-isms.
"ac_cv_func_lchmod=no"
];
] ++ optional static "LDFLAGS=-static";
preConfigure = ''
for i in /usr /sw /opt /pkg; do # improve purity
@ -262,7 +263,7 @@ in with passthru; stdenv.mkDerivation {
# Enforce that we don't have references to the OpenSSL -dev package, which we
# explicitly specify in our configure flags above.
disallowedReferences =
stdenv.lib.optionals (openssl != null) [ openssl.dev ]
stdenv.lib.optionals (openssl != null && !static) [ openssl.dev ]
++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
# Ensure we don't have references to build-time packages.
# These typically end up in shebangs.

View file

@ -266,6 +266,13 @@ in {
) super.ocaml-ng;
python27 = super.python27.override { static = true; };
python35 = super.python35.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; };
libev = super.libev.override { static = true; };
}