about summary refs log tree commit diff
path: root/pkgs/development/interpreters/python/cpython
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2020-03-29 11:27:09 +0200
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2020-03-30 17:06:38 +0200
commitc392d705181cf3677d1326351bf361354a65e52f (patch)
tree864e2a01be9f39fc8d8f0465b2f2fba39a1e85f5 /pkgs/development/interpreters/python/cpython
parentfe9ea7a88a623aaacd1b745aadc3b7038f7c42bb (diff)
downloadnixlib-c392d705181cf3677d1326351bf361354a65e52f.tar
nixlib-c392d705181cf3677d1326351bf361354a65e52f.tar.gz
nixlib-c392d705181cf3677d1326351bf361354a65e52f.tar.bz2
nixlib-c392d705181cf3677d1326351bf361354a65e52f.tar.lz
nixlib-c392d705181cf3677d1326351bf361354a65e52f.tar.xz
nixlib-c392d705181cf3677d1326351bf361354a65e52f.tar.zst
nixlib-c392d705181cf3677d1326351bf361354a65e52f.zip
pkgsStatic.python3: fix build
Diffstat (limited to 'pkgs/development/interpreters/python/cpython')
-rw-r--r--pkgs/development/interpreters/python/cpython/default.nix7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix
index b778b62f908d..23a3d5d84099 100644
--- a/pkgs/development/interpreters/python/cpython/default.nix
+++ b/pkgs/development/interpreters/python/cpython/default.nix
@@ -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.