From 489cc06d0fa49e55137109d1b94f7b116fa59f38 Mon Sep 17 00:00:00 2001 From: Hannu Koivisto Date: Wed, 10 Oct 2012 14:17:42 +0300 Subject: Add --windows option to bootstrap.py Makes it possible to make a native Windows build when using Cygwin Python. --- bootstrap.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bootstrap.py b/bootstrap.py index 12848ac..7463d34 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -31,6 +31,9 @@ parser.add_option('--verbose', action='store_true', help='enable verbose build',) parser.add_option('--x64', action='store_true', help='force 64-bit build (Windows)',) +parser.add_option('--windows', action='store_true', + help='force native Windows build (when using Cygwin Python)', + default=sys.platform.startswith('win32')) (options, conf_args) = parser.parse_args() def run(*args, **kwargs): @@ -66,7 +69,7 @@ for src in glob.glob('src/*.cc'): if filename == 'browse.cc': # Depends on generated header. continue - if sys.platform.startswith('win32'): + if options.windows: if src.endswith('-posix.cc'): continue else: @@ -75,7 +78,7 @@ for src in glob.glob('src/*.cc'): sources.append(src) -if sys.platform.startswith('win32'): +if options.windows: sources.append('src/getopt.c') vcdir = os.environ.get('VCINSTALLDIR') @@ -90,14 +93,14 @@ else: cflags.extend(['-Wno-deprecated', '-DNINJA_PYTHON="' + sys.executable + '"', '-DNINJA_BOOTSTRAP']) - if sys.platform.startswith('win32'): + if options.windows: cflags.append('-D_WIN32_WINNT=0x0501') if options.x64: cflags.append('-m64') args.extend(cflags) args.extend(ldflags) binary = 'ninja.bootstrap' -if sys.platform.startswith('win32'): +if options.windows: binary = 'ninja.bootstrap.exe' args.extend(sources) if vcdir: @@ -118,7 +121,7 @@ verbose = [] if options.verbose: verbose = ['-v'] -if sys.platform.startswith('win32'): +if options.windows: print('Building ninja using itself...') run([sys.executable, 'configure.py', '--with-ninja=%s' % binary] + conf_args) -- cgit v0.12