summary refs log tree commit diff
path: root/pkgs/development/interpreters/python/cpython/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/interpreters/python/cpython/default.nix')
-rw-r--r--pkgs/development/interpreters/python/cpython/default.nix14
1 files changed, 5 insertions, 9 deletions
diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix
index 4463dc8e9ba..1218f2eb24e 100644
--- a/pkgs/development/interpreters/python/cpython/default.nix
+++ b/pkgs/development/interpreters/python/cpython/default.nix
@@ -63,9 +63,6 @@ assert x11Support -> tcl != null
 
 assert bluezSupport -> bluez != null;
 
-assert lib.assertMsg (enableOptimizations -> (!stdenv.cc.isClang))
-  "Optimizations with clang are not supported. configure: error: llvm-profdata is required for a --enable-optimizations build but could not be found.";
-
 assert lib.assertMsg (reproducibleBuild -> stripBytecode)
   "Deterministic builds require stripping bytecode.";
 
@@ -104,8 +101,6 @@ let
 
   version = with sourceVersion; "${major}.${minor}.${patch}${suffix}";
 
-  strictDeps = true;
-
   nativeBuildInputs = optionals (!stdenv.isDarwin) [
     autoreconfHook
     pkg-config
@@ -115,7 +110,7 @@ let
   ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     buildPackages.stdenv.cc
     pythonForBuild
-  ] ++ optionals (stdenv.cc.isClang && enableLTO) [
+  ] ++ optionals (stdenv.cc.isClang && (enableLTO || enableOptimizations)) [
     stdenv.cc.cc.libllvm.out
   ];
 
@@ -186,7 +181,8 @@ in with passthru; stdenv.mkDerivation {
   pname = "python3";
   inherit version;
 
-  inherit buildInputs nativeBuildInputs;
+  inherit nativeBuildInputs;
+  buildInputs = [ bash ] ++ buildInputs; # bash is only for patchShebangs
 
   src = fetchurl {
     url = with sourceVersion; "https://www.python.org/ftp/python/${major}.${minor}.${patch}/Python-${version}.tar.xz";
@@ -289,7 +285,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"}";
-  NIX_LDFLAGS = lib.optionalString stdenv.cc.isGNU ({
+  NIX_LDFLAGS = lib.optionalString (stdenv.cc.isGNU && !stdenv.hostPlatform.isStatic) ({
     "glibc" = "-lgcc_s";
     "musl" = "-lgcc_eh";
   }."${stdenv.hostPlatform.libc}" or "");
@@ -465,7 +461,7 @@ in with passthru; stdenv.mkDerivation {
 
   preFixup = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
     # Ensure patch-shebangs uses shebangs of host interpreter.
-    export PATH=${lib.makeBinPath [ "$out" bash ]}:$PATH
+    export PATH=${lib.makeBinPath [ "$out" ]}:$PATH
   '';
 
   # Add CPython specific setup-hook that configures distutils.sysconfig to