From: Christian Dywan Date: Sat, 6 Jun 2009 04:30:34 +0000 (+0200) Subject: Add mingw cross compiling support to the build script X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba04eccf14c1ed76ad5586b68575a7d64b6e98bf;p=midori Add mingw cross compiling support to the build script --- diff --git a/wscript b/wscript index 02cd7203..2af80b44 100644 --- a/wscript +++ b/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':