From ac04abe2f9c87afe4e4d43ac63e5af2dd10376fb Mon Sep 17 00:00:00 2001 From: Evan Martin Date: Tue, 14 Aug 2012 20:59:21 -0700 Subject: add a helper binary for wrapping cl.exe Modify bootstrap etc. to make use of this binary. --- bootstrap.py | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'bootstrap.py') 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!' -- cgit v1.2.3