git.iko.soy/typeable/nixpkgs
on master help sign in
pkgsStatic.python3: fix build
commitc392d705181cf3677d1326351bf361354a65e52f authorFrederik Rietdijk <fridh@fridh.nl> dateSun 29 Mar 2020, 11:27 (7 years ago) parentfe9ea7a
2 files changed+11−3
pkgs/development/interpreters/python/cpython/default.nix+4−3 pkgs/top-level/static.nix+7
pkgs/development/interpreters/python/cpython/default.nix+4−3
@@ -28,6 +28,7 @@
2828, stripTkinter ? false
2929, rebuildBytecode ? true
3030, stripBytecode ? false
31+, static ? false
3132}:
3233
3334assert x11Support -> tcl != null
@@ -130,7 +131,7 @@ in with passthru; stdenv.mkDerivation {
130131 CPPFLAGS = concatStringsSep " " (map (p: "-I${getDev p}/include") buildInputs);
131132 LDFLAGS = concatStringsSep " " (map (p: "-L${getLib p}/lib") buildInputs);
132133 LIBS = "${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}";
133− NIX_LDFLAGS = optionalString stdenv.isLinux "-lgcc_s";
134+ NIX_LDFLAGS = optionalString (stdenv.isLinux && !stdenv.hostPlatform.isMusl) "-lgcc_s" + optionalString stdenv.hostPlatform.isMusl "-lgcc_eh";
134135 # Determinism: We fix the hashes of str, bytes and datetime objects.
135136 PYTHONHASHSEED=0;
136137
@@ -169,7 +170,7 @@ in with passthru; stdenv.mkDerivation {
169170 # Never even try to use lchmod on linux,
170171 # don't rely on detecting glibc-isms.
171172 "ac_cv_func_lchmod=no"
172− ];
173+ ] ++ optional static "LDFLAGS=-static";
173174
174175 preConfigure = ''
175176 for i in /usr /sw /opt /pkg; do # improve purity
@@ -262,7 +263,7 @@ in with passthru; stdenv.mkDerivation {
262263 # Enforce that we don't have references to the OpenSSL -dev package, which we
263264 # explicitly specify in our configure flags above.
264265 disallowedReferences =
265− stdenv.lib.optionals (openssl != null) [ openssl.dev ]
266+ stdenv.lib.optionals (openssl != null && !static) [ openssl.dev ]
266267 ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
267268 # Ensure we don't have references to build-time packages.
268269 # These typically end up in shebangs.
pkgs/top-level/static.nix+7
@@ -266,6 +266,13 @@ in {
266266 ) super.ocaml-ng;
267267
268268 python27 = super.python27.override { static = true; };
269+ python35 = super.python35.override { static = true; };
270+ python36 = super.python36.override { static = true; };
271+ python37 = super.python37.override { static = true; };
272+ python38 = super.python38.override { static = true; };
273+ python39 = super.python39.override { static = true; };
274+ python3Minimal = super.python3Minimal.override { static = true; };
275+
269276
270277 libev = super.libev.override { static = true; };
271278}