Add mingw cross compiling support to the build script
This commit is contained in:
parent
fb316e7873
commit
ba04eccf14
1 changed files with 24 additions and 0 deletions
24
wscript
24
wscript
|
@ -44,6 +44,14 @@ def option_enabled (option):
|
|||
return False
|
||||
return True
|
||||
|
||||
def is_mingw (env):
|
||||
if 'CC' in env:
|
||||
cc = env['CC']
|
||||
if not isinstance (cc, str):
|
||||
cc = ''.join (cc)
|
||||
return cc.find ('mingw') != -1# or cc.find ('wine') != -1
|
||||
return False
|
||||
|
||||
def configure (conf):
|
||||
def option_checkfatal (option, desc):
|
||||
if hasattr (Options.options, 'enable_' + option):
|
||||
|
@ -88,6 +96,22 @@ def configure (conf):
|
|||
nls = 'no '
|
||||
conf.define ('ENABLE_NLS', [0,1][nls == 'yes'])
|
||||
|
||||
# This is specific to cross compiling with mingw
|
||||
if is_mingw (conf.env) and Options.platform != 'win32':
|
||||
Options.platform = 'win32'
|
||||
# Make sure we don't have -fPIC in the CCFLAGS
|
||||
conf.env["shlib_CCFLAGS"] = []
|
||||
# Adjust file naming
|
||||
conf.env["shlib_PATTERN"] = 'lib%s.dll'
|
||||
conf.env['program_PATTERN'] = '%s.exe'
|
||||
# Use Visual C++ compatible alignment
|
||||
conf.env.append_value ('CCFLAGS', '-mms-bitfields')
|
||||
|
||||
conf.env['implib_PATTERN'] = 'lib%s.dll.a'
|
||||
conf.env['IMPLIB_ST'] = '-Wl,--out-implib,%s'
|
||||
|
||||
Utils.pprint ('BLUE', 'Mingw recognized, assuming chross compile.')
|
||||
|
||||
dirname_default ('DOCDIR', os.path.join (conf.env['DATADIR'], 'doc'))
|
||||
dirname_default ('LIBDIR', os.path.join (conf.env['PREFIX'], 'lib'))
|
||||
if conf.env['PREFIX'] == '/usr':
|
||||
|
|
Loading…
Reference in a new issue