Files
MINGW-packages/mingw-w64-python3/0410-MINGW-build-extensions-with-GCC.patch
Алексей edc01d04d6 Update python to 3.7.0 (#4047)
* Initial python-3.7 port

* python3: Add setup.config.in to remove before patching

* python3: Implement setenv for mingw. Fix building with NT threads. Build
with unicode

* Fix typos

* Fix linking core modules

* Mingw build have exec_prefix

* Remove deprecated patch

* Fix building python and modules. Failing to build readline module and
install not working yet

* More getpath changes and more aggressive path separator conversion

* Fix readline module compilation and linking errors

* python3: By default building with posix threads, NT threads are broken.
Some patches optimization. First buildable commit

* Py_DecodeLocale handle char, not wchar

* Fix building multiprocessing module with posix threads
2018-07-06 09:57:52 +03:00

58 lines
2.6 KiB
Diff

diff -Naur Python-3.7.0-orig/Lib/distutils/command/build_ext.py Python-3.7.0/Lib/distutils/command/build_ext.py
--- Python-3.7.0-orig/Lib/distutils/command/build_ext.py 2018-06-27 06:07:35.000000000 +0300
+++ Python-3.7.0/Lib/distutils/command/build_ext.py 2018-06-30 11:16:26.763041000 +0300
@@ -185,7 +185,7 @@
# for extensions under windows use different directories
# for Release and Debug builds.
# also Python's library directory must be appended to library_dirs
- if os.name == 'nt':
+ if os.name == 'nt' and not self.plat_name.startswith(('mingw')):
# the 'libs' directory is for binary installs - we assume that
# must be the *native* platform. But we don't really support
# cross-compiling via a binary install anyway, so we let it go.
@@ -702,6 +702,20 @@
# pyconfig.h that MSVC groks. The other Windows compilers all seem
# to need it mentioned explicitly, though, so that's what we do.
# Append '_d' to the python import library on debug builds.
+
+ # Use self.plat_name as it works even in case of
+ # cross-compilation (at least for mingw build).
+ if self.plat_name.startswith('mingw'):
+ from distutils import sysconfig
+ extra = []
+ for lib in (
+ sysconfig.get_config_var('BLDLIBRARY').split()
+ + sysconfig.get_config_var('SHLIBS').split()
+ ):
+ if lib.startswith('-l'):
+ extra.append(lib[2:])
+ return ext.libraries + extra
+
if sys.platform == "win32":
from distutils._msvccompiler import MSVCCompiler
if not isinstance(self.compiler, MSVCCompiler):
diff -Naur Python-3.7.0-orig/Lib/distutils/util.py Python-3.7.0/Lib/distutils/util.py
--- Python-3.7.0-orig/Lib/distutils/util.py 2018-06-27 06:07:35.000000000 +0300
+++ Python-3.7.0/Lib/distutils/util.py 2018-06-30 11:16:26.763041000 +0300
@@ -36,6 +36,8 @@
"""
if os.name == 'nt':
+ if 'GCC' in sys.version:
+ return 'mingw'
if 'amd64' in sys.version.lower():
return 'win-amd64'
return sys.platform
diff -Naur Python-3.7.0-orig/Lib/sysconfig.py Python-3.7.0/Lib/sysconfig.py
--- Python-3.7.0-orig/Lib/sysconfig.py 2018-06-30 11:15:29.968140700 +0300
+++ Python-3.7.0/Lib/sysconfig.py 2018-06-30 11:16:26.763041000 +0300
@@ -631,6 +631,8 @@
"""
if os.name == 'nt':
+ if 'GCC' in sys.version:
+ return 'mingw'
if 'amd64' in sys.version.lower():
return 'win-amd64'
return sys.platform