Files
MINGW-packages/mingw-w64-python3/0410-MINGW-build-extensions-with-GCC.patch
2016-07-12 14:49:26 +03:00

58 lines
2.8 KiB
Diff

diff -Naur Python-3.5.2-orig/Lib/distutils/command/build_ext.py Python-3.5.2/Lib/distutils/command/build_ext.py
--- Python-3.5.2-orig/Lib/distutils/command/build_ext.py 2016-06-26 00:38:35.000000000 +0300
+++ Python-3.5.2/Lib/distutils/command/build_ext.py 2016-07-12 14:21:28.374300700 +0300
@@ -184,7 +184,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.
@@ -701,6 +701,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.5.2-orig/Lib/distutils/util.py Python-3.5.2/Lib/distutils/util.py
--- Python-3.5.2-orig/Lib/distutils/util.py 2016-06-26 00:38:35.000000000 +0300
+++ Python-3.5.2/Lib/distutils/util.py 2016-07-12 14:21:28.380800700 +0300
@@ -40,6 +40,8 @@
For other non-POSIX platforms, currently just returns 'sys.platform'.
"""
if os.name == 'nt':
+ if 'GCC' in sys.version:
+ return 'mingw'
# sniff sys.version for architecture.
prefix = " bit ("
i = sys.version.find(prefix)
diff -Naur Python-3.5.2-orig/Lib/sysconfig.py Python-3.5.2/Lib/sysconfig.py
--- Python-3.5.2-orig/Lib/sysconfig.py 2016-07-12 14:20:30.962800700 +0300
+++ Python-3.5.2/Lib/sysconfig.py 2016-07-12 14:21:28.412800700 +0300
@@ -627,6 +627,8 @@
For other non-POSIX platforms, currently just returns 'sys.platform'.
"""
if os.name == 'nt':
+ if 'GCC' in sys.version:
+ return 'mingw'
# sniff sys.version for architecture.
prefix = " bit ("
i = sys.version.find(prefix)