aboutsummaryrefslogtreecommitdiff
path: root/bootstrap.py
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2012-08-14 20:59:21 -0700
committerEvan Martin <martine@danga.com>2012-08-14 21:01:22 -0700
commitac04abe2f9c87afe4e4d43ac63e5af2dd10376fb (patch)
tree4c76804459e399ad3d61571920622a3e4250e48b /bootstrap.py
parent59e0d69ec2775f1aa46d87ad7d14e6985e5187b6 (diff)
downloadninja-ac04abe2f9c87afe4e4d43ac63e5af2dd10376fb.tar.gz
add a helper binary for wrapping cl.exe
Modify bootstrap etc. to make use of this binary.
Diffstat (limited to 'bootstrap.py')
-rwxr-xr-xbootstrap.py42
1 files changed, 36 insertions, 6 deletions
diff --git a/bootstrap.py b/bootstrap.py
index 8c0687e..abd2528 100755
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -68,6 +68,8 @@ for src in glob.glob('src/*.cc'):
else:
if src.endswith('-win32.cc'):
continue
+ if '_main' in src:
+ continue
sources.append(src)
@@ -110,13 +112,41 @@ verbose = []
if options.verbose:
verbose = ['-v']
-print 'Building ninja using itself...'
-run([sys.executable, 'configure.py'] + conf_args)
-run(['./' + binary] + verbose)
-os.unlink(binary)
-
if sys.platform.startswith('win32'):
+ # Build ninja-msvc-helper using ninja without an msvc-helper.
+ print 'Building ninja-msvc-helper...'
+ run([sys.executable, 'configure.py', '--with-msvc-helper='] + conf_args)
+ run(['./' + binary] + verbose + ['ninja-msvc-helper'])
+
+ # Rename the helper to the same name + .bootstrap.
+ helper_binary = 'ninja-msvc-helper.bootstrap.exe'
+ try:
+ os.unlink(helper_binary)
+ except:
+ pass
+ os.rename('ninja-msvc-helper.exe', helper_binary)
+
+ # Build ninja using the newly-built msvc-helper.
+ print 'Building ninja using itself...'
+ run([sys.executable, 'configure.py',
+ '--with-msvc-helper=%s' % helper_binary] + conf_args)
+ run(['./' + binary] + verbose)
+
+ # Clean up.
for obj in glob.glob('*.obj'):
os.unlink(obj)
-print 'Done!'
+ print """
+Done!
+
+Note: to work around Windows file locking, where you can't rebuild an
+in-use binary, to run ninja after making any changes to build ninja itself
+you should run ninja.bootstrap instead. Your build is also configured to
+use ninja-msvc-helper.bootstrap.exe instead of the ninja-msvc-helper.exe
+that it builds; see the --help output of configure.py."""
+else:
+ print 'Building ninja using itself...'
+ run([sys.executable, 'configure.py'] + conf_args)
+ run(['./' + binary] + verbose)
+ os.unlink(binary)
+ print 'Done!'