From 8ecbf8400a9e5336d027640463068331a435db32 Mon Sep 17 00:00:00 2001 From: Evan Martin Date: Tue, 20 Dec 2011 11:01:04 -0800 Subject: fix mingw cross-compile --- HACKING | 6 +++--- configure.py | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/HACKING b/HACKING index dcd5888..b49b857 100644 --- a/HACKING +++ b/HACKING @@ -45,14 +45,14 @@ Generating the manual: Windows development on Linux (this is kind of hacky right now): - sudo apt-get install gcc-mingw32 wine - export CC=i586-mingw32msvc-cc CXX=i586-mingw32msvc-c++ AR=i586-mingw32msvc-ar -- ./configure.py --platform=mingw +- ./configure.py --platform=mingw --host=linux - Build gtest: - unpack it into your source dir - ./configure - to work around missing _TlsAlloc I had to hack the libtool script to append -lmingw32 -lkernel32 at the *end* of the link line -- Build ninja: /path/to/linux/ninja ninja -- Run: ./ninja (implicitly runs through wine(!)) +- Build ninja: /path/to/linux/ninja +- Run: ./ninja.exe (implicitly runs through wine(!)) Windows development on Windows: - install mingw, msys, and python diff --git a/configure.py b/configure.py index c342677..6b4c0d3 100755 --- a/configure.py +++ b/configure.py @@ -32,6 +32,9 @@ profilers = ['gmon', 'pprof'] parser.add_option('--platform', help='target platform (' + '/'.join(platforms) + ')', choices=platforms) +parser.add_option('--host', + help='host platform (' + '/'.join(platforms) + ')', + choices=platforms) parser.add_option('--debug', action='store_true', help='enable debugging flags',) parser.add_option('--profile', metavar='TYPE', @@ -50,6 +53,7 @@ if platform is None: platform = 'freebsd' elif platform.startswith('mingw') or platform.startswith('win'): platform = 'mingw' +host = options.host or platform BUILD_FILENAME = 'build.ninja' buildfile = open(BUILD_FILENAME, 'w') @@ -89,7 +93,7 @@ if platform == 'mingw': cflags.remove('-fvisibility=hidden'); cflags.append('-Igtest-1.6.0/include') ldflags.append('-Lgtest-1.6.0/lib/.libs') - ldflags.extend(['-static']) + ldflags.append('-static') else: if options.profile == 'gmon': cflags.append('-pg') @@ -111,7 +115,7 @@ n.rule('cxx', description='CXX $out') n.newline() -if platform != 'mingw': +if host != 'mingw': n.rule('ar', command='rm -f $out && $ar crs $out $in', description='AR $out') -- cgit v0.12