Files
MINGW-packages/mingw-w64-wxPython4.0/0003-Optionally-use-MinGW-toolchain.patch
2022-07-15 16:01:54 +02:00

114 lines
4.5 KiB
Diff

diff -urN wxPython-4.0.7.post2/buildtools/config.py.orig wxPython-4.0.7.post2/buildtools/config.py
--- wxPython-4.0.7.post2/buildtools/config.py.orig 2022-07-11 17:17:28.646158400 +0200
+++ wxPython-4.0.7.post2/buildtools/config.py 2022-07-11 17:18:43.541135100 +0200
@@ -137,13 +137,16 @@
self.finishSetup()
- def finishSetup(self, wx_config=None, debug=None):
+ def finishSetup(self, wx_config=None, debug=None, compiler=None):
if wx_config is not None:
self.WX_CONFIG = wx_config
if debug is not None:
self.debug = debug
+ if compiler is not None:
+ self.COMPILER = compiler
+
#---------------------------------------
# MSW specific settings
if os.name == 'nt' and self.COMPILER == 'msvc':
diff -urN wxPython-4.0.7.post2/wscript.orig wxPython-4.0.7.post2/wscript
--- wxPython-4.0.7.post2/wscript.orig 2019-11-12 03:54:31.000000000 +0100
+++ wxPython-4.0.7.post2/wscript 2022-07-11 17:22:56.272316400 +0200
@@ -34,8 +35,7 @@
def options(opt):
if isWindows:
opt.load('msvc')
- else:
- opt.load('compiler_c compiler_cxx')
+ opt.load('compiler_c compiler_cxx')
opt.load('python')
opt.add_option('--debug', dest='debug', action='store_true', default=False,
@@ -55,6 +55,8 @@
help='On Linux build for gtk2 (default gtk3)')
opt.add_option('--gtk3', dest='gtk3', action='store_true', default=True,
help='On Linux build for gtk3')
+ opt.add_option('--no_msvc', dest='use_msvc', action='store_false', default=isWindows,
+ help='Set to use a MinGW toolchain')
opt.add_option('--msvc_arch', dest='msvc_arch', default='x86', action='store',
help='The architecture to target for MSVC builds. Supported values '
'are: "x86" or "x64"')
@@ -64,7 +66,7 @@
def configure(conf):
- if isWindows:
+ if conf.options.use_msvc:
# For now simply choose the compiler version based on the Python
# version. We have a chicken-egg problem here. The compiler needs to
# be selected before the Python stuff can be configured, but we need
@@ -97,6 +99,8 @@
conf.load('msvc')
else:
conf.load('compiler_c compiler_cxx')
+ if isWindows:
+ conf.load('winres')
if conf.options.python:
conf.env.PYTHON = conf.options.python
@@ -114,10 +118,12 @@
conf.env.debug = conf.options.debug
conf.env.msvc_relwithdebug = conf.options.msvc_relwithdebug
+ conf.env.use_msvc = conf.options.use_msvc
+
# Ensure that the headers in siplib and Phoenix's src dir can be found
conf.env.INCLUDES_WXPY = ['sip/siplib', 'wx/include', 'src']
- if isWindows:
+ if conf.options.use_msvc:
# Windows/MSVC specific stuff
cfg.finishSetup(debug=conf.env.debug)
@@ -203,7 +209,8 @@
# finish configuring the Config object
conf.env.wx_config = conf.options.wx_config
- cfg.finishSetup(conf.env.wx_config, conf.env.debug)
+ cfg.finishSetup(conf.env.wx_config, conf.env.debug,
+ 'mingw32' if isWindows and not conf.env.use_msvc else None)
# Check wx-config exists and fetch some values from it
rpath = ' --no-rpath' if not conf.options.no_magic else ''
@@ -542,7 +555,8 @@
from distutils.file_util import copy_file
from buildtools.config import opj, updateLicenseFiles
- cfg.finishSetup(bld.env.wx_config)
+ cfg.finishSetup(wx_config=bld.env.wx_config,
+ compiler='mingw32' if isWindows and not bld.env.use_msvc else None)
if not isWindows:
cmd = ' '.join(bld.env.CC) + ' --version'
@@ -668,7 +688,7 @@
open(tgt, "wb").close() # essentially just a unix 'touch' command
tgt = opj(cfg.PKGDIR, os.path.basename(src))
copy_file(src, tgt, verbose=1)
- if isWindows and task.env.msvc_relwithdebug:
+ if task.env.use_msvc and task.env.msvc_relwithdebug:
# also copy the .pdb file
src = src.replace('.pyd', '.pdb')
tgt = opj(cfg.PKGDIR, os.path.basename(src))
@@ -722,7 +742,7 @@
# Add flags to create .pdb files for debugging with MSVC
def addRelwithdebugFlags(bld, moduleName):
- if isWindows and bld.env.msvc_relwithdebug:
+ if bld.env.use_msvc and bld.env.msvc_relwithdebug:
compile_flags = ['/Zi', '/Fd_tmp_{}.pdb'.format(moduleName)]
if sys.version_info > (3,5):
# It looks like the /FS flag doesn't exist in the compilers used