diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2020-06-21 11:56:50 +0200 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2020-06-21 16:29:57 +0200 |
commit | f03734efa06c6ca65be597589d68f773aa0d398c (patch) | |
tree | fc683742c5fb9d1f33e6b2d58eae75f85ef8196d /pkgs/development/interpreters/python/cpython | |
parent | ae3d755af4a6d36bab7937d4c1b7511feec16c33 (diff) | |
download | nixlib-f03734efa06c6ca65be597589d68f773aa0d398c.tar nixlib-f03734efa06c6ca65be597589d68f773aa0d398c.tar.gz nixlib-f03734efa06c6ca65be597589d68f773aa0d398c.tar.bz2 nixlib-f03734efa06c6ca65be597589d68f773aa0d398c.tar.lz nixlib-f03734efa06c6ca65be597589d68f773aa0d398c.tar.xz nixlib-f03734efa06c6ca65be597589d68f773aa0d398c.tar.zst nixlib-f03734efa06c6ca65be597589d68f773aa0d398c.zip |
python3: improve cross-compilation of extension modules, fixes #91171
Diffstat (limited to 'pkgs/development/interpreters/python/cpython')
-rw-r--r-- | pkgs/development/interpreters/python/cpython/3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch | 33 | ||||
-rw-r--r-- | pkgs/development/interpreters/python/cpython/default.nix | 3 |
2 files changed, 36 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/python/cpython/3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch b/pkgs/development/interpreters/python/cpython/3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch new file mode 100644 index 000000000000..0c26300d9c06 --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch @@ -0,0 +1,33 @@ +From 1911995b1a1252d80bf2b9651840e185a1a6baf5 Mon Sep 17 00:00:00 2001 +From: Hong Xu <hong@topbug.net> +Date: Thu, 25 Jul 2019 10:25:55 -0700 +Subject: [PATCH] On all posix systems, not just Darwin, set LDSHARED (if not + set) according to CC + +This patch is slightly different from https://bugs.python.org/issue24935 +, except that we now handle LDSHARED according to CC on all posix +systems, not just Darwin or Linux. +--- + Lib/distutils/sysconfig.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index 37feae5df7..9fdce6896d 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -199,10 +199,10 @@ def customize_compiler(compiler): + + if 'CC' in os.environ: + newcc = os.environ['CC'] +- if (sys.platform == 'darwin' ++ if (os.name == 'posix' + and 'LDSHARED' not in os.environ + and ldshared.startswith(cc)): +- # On OS X, if CC is overridden, use that as the default ++ # On POSIX systems, if CC is overridden, use that as the default + # command for LDSHARED as well + ldshared = newcc + ldshared[len(cc):] + cc = newcc +-- +2.25.1 + diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 694f661a9669..e6c8b301c0b0 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -140,6 +140,9 @@ in with passthru; stdenv.mkDerivation { sha256 = "1h18lnpx539h5lfxyk379dxwr8m2raigcjixkf133l4xy3f4bzi2"; } ) + ] ++ [ + # LDSHARED now uses $CC instead of gcc. Fixes cross-compilation of extension modules. + ./3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch ]; postPatch = '' |