Skip to content

Commit

Permalink
pkgsStatic.python3: Fix build
Browse files Browse the repository at this point in the history
TODO: Nuke openssl references in:
- lib/python3.7/_sysconfigdata_m_linux_aarch64-linux-gnu.py
- lib/python3.7/config-3.7m-aarch64-linux-gnu/Makefile

(Why doesn't it nuke them already?)
  • Loading branch information
knedlsepp committed Mar 8, 2020
1 parent 5e8c897 commit b1298d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkgs/development/interpreters/python/cpython/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
, stripTkinter ? false
, rebuildBytecode ? true
, stripBytecode ? false
, static ? false
}:

assert x11Support -> tcl != null
Expand Down Expand Up @@ -130,12 +131,13 @@ 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 && !static) "-lgcc_s";
# Determinism: We fix the hashes of str, bytes and datetime objects.
PYTHONHASHSEED=0;

configureFlags = [
configureFlags = optionals (!static) [
"--enable-shared"
] ++ [
"--with-threads"
"--without-ensurepip"
"--with-system-expat"
Expand Down Expand Up @@ -169,6 +171,9 @@ 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"
] ++ optionals static [
"--disable-shared"
"LDFLAGS=-static"
];

preConfigure = ''
Expand Down Expand Up @@ -262,7 +267,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.
Expand Down
4 changes: 4 additions & 0 deletions pkgs/top-level/static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,9 @@ in {

python27 = super.python27.override { static = true; };

python = super.python.override { static = true; };
python3 = super.python3.override { static = true; };
python37 = super.python37.override { static = true; };

libev = super.libev.override { static = true; };
}

0 comments on commit b1298d9

Please sign in to comment.