diff options
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters/python/cpython/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/interpreters/python/cpython/default.nix | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix index 3ad4021d6dfe..694f661a9669 100644 --- a/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix @@ -12,6 +12,7 @@ , zlib , self , configd +, autoreconfHook , python-setup-hook , nukeReferences # For the Python package set @@ -30,6 +31,9 @@ , stripBytecode ? false , includeSiteCustomize ? true , static ? false +# Not using optimizations on Darwin +# configure: error: llvm-profdata is required for a --enable-optimizations build but could not be found. +, enableOptimizations ? (!stdenv.isDarwin) }: assert x11Support -> tcl != null @@ -52,7 +56,9 @@ let version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; - nativeBuildInputs = [ + nativeBuildInputs = optionals (!stdenv.isDarwin) [ + autoreconfHook + ] ++ [ nukeReferences ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ buildPackages.stdenv.cc @@ -107,9 +113,17 @@ in with passthru; stdenv.mkDerivation { # Backport a fix for discovering `rpmbuild` command when doing `python setup.py bdist_rpm` to 3.5, 3.6, 3.7. # See: https://bugs.python.org/issue11122 ./3.7/fix-hardcoded-path-checking-for-rpmbuild.patch - ] ++ optionals (isPy37 || isPy38) [ + ] ++ optionals (isPy37 || isPy38 || isPy39) [ # Fix darwin build https://bugs.python.org/issue34027 ./3.7/darwin-libutil.patch + ] ++ optionals (pythonOlder "3.8") [ + # Backport from CPython 3.8 of a good list of tests to run for PGO. + ( + if isPy36 || isPy37 then + ./3.6/profile-task.patch + else + ./3.5/profile-task.patch + ) ] ++ optionals (isPy3k && hasDistutilsCxxPatch) [ # Fix for http://bugs.python.org/issue1222585 # Upstream distutils is calling C compiler to compile C++ code, which @@ -118,7 +132,7 @@ in with passthru; stdenv.mkDerivation { ( if isPy35 then ./3.5/python-3.x-distutils-C++.patch - else if isPy37 || isPy38 then + else if isPy37 || isPy38 || isPy39 then ./3.7/python-3.x-distutils-C++.patch else fetchpatch { @@ -142,10 +156,14 @@ in with passthru; stdenv.mkDerivation { configureFlags = [ "--enable-shared" - "--with-threads" "--without-ensurepip" "--with-system-expat" "--with-system-ffi" + ] ++ optionals enableOptimizations [ + "--enable-optimizations" + ] ++ optionals (pythonOlder "3.7") [ + # This is unconditionally true starting in CPython 3.7. + "--with-threads" ] ++ optionals (sqlite != null && isPy3k) [ "--enable-loadable-sqlite-extensions" ] ++ optionals (openssl != null) [ |