summaryrefslogtreecommitdiffstats
path: root/bootstrap.py
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2012-09-13 18:07:45 (GMT)
committerEvan Martin <martine@danga.com>2012-09-13 18:11:47 (GMT)
commitc57f8a4258998a185f961ce12fd7c905a3e86180 (patch)
tree8651047b7ac8387f50348b6c37d8c5d6dd8addd4 /bootstrap.py
parentce825d2f6e2bb8a0fa0bb97fe961d5f194f8f6f8 (diff)
downloadNinja-c57f8a4258998a185f961ce12fd7c905a3e86180.zip
Ninja-c57f8a4258998a185f961ce12fd7c905a3e86180.tar.gz
Ninja-c57f8a4258998a185f961ce12fd7c905a3e86180.tar.bz2
windows: merge msvc-helper into ninja.exe itself
Now "ninja -t msvc ..." passes the "..." to the msvc helper main. This drastically simplifies bootstrap and makes ninja a single binary again.
Diffstat (limited to 'bootstrap.py')
-rwxr-xr-xbootstrap.py28
1 files changed, 8 insertions, 20 deletions
diff --git a/bootstrap.py b/bootstrap.py
index abd2528..3032a9b 100755
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -19,6 +19,7 @@ import os
import glob
import errno
import shlex
+import shutil
import subprocess
os.chdir(os.path.dirname(os.path.abspath(__file__)))
@@ -68,8 +69,6 @@ for src in glob.glob('src/*.cc'):
else:
if src.endswith('-win32.cc'):
continue
- if '_main' in src:
- continue
sources.append(src)
@@ -113,25 +112,14 @@ if options.verbose:
verbose = ['-v']
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([sys.executable, 'configure.py', '--with-ninja=%s' % binary] +
+ conf_args)
run(['./' + binary] + verbose)
+ # Copy the new executable over the bootstrap one.
+ shutil.copyfile('ninja.exe', binary)
+
# Clean up.
for obj in glob.glob('*.obj'):
os.unlink(obj)
@@ -142,8 +130,8 @@ 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."""
+use ninja.bootstrap.exe as the MSVC helper; see the --with-ninja flag of
+the --help output of configure.py."""
else:
print 'Building ninja using itself...'
run([sys.executable, 'configure.py'] + conf_args)