X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bootstrap.py;h=56eab64d18dc11c9bf67fe17d44010c563cf215f;hb=961107222e58b91913487378ff9a920c80237690;hp=1df423db934abc716a0684f88d5baf635e56dcfa;hpb=5d6249fa8c3d6241f46701f43fd48db576714ae4;p=platform%2Fupstream%2Fninja.git diff --git a/bootstrap.py b/bootstrap.py index 1df423d..56eab64 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -13,93 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -from optparse import OptionParser -import sys -import os -import glob -import errno -import shlex -import subprocess - -parser = OptionParser() -parser.add_option('--verbose', action='store_true', - help='enable verbose build',) -(options, conf_args) = parser.parse_args() - -def run(*args, **kwargs): - try: - subprocess.check_call(*args, **kwargs) - except subprocess.CalledProcessError, e: - sys.exit(e.returncode) - -# Compute system-specific CFLAGS/LDFLAGS as used in both in the below -# g++ call as well as in the later configure.py. -cflags = os.environ.get('CFLAGS', '').split() -ldflags = os.environ.get('LDFLAGS', '').split() -if sys.platform.startswith('freebsd'): - cflags.append('-I/usr/local/include') - ldflags.append('-L/usr/local/lib') - -print 'Building ninja manually...' - -try: - os.mkdir('build') -except OSError, e: - if e.errno != errno.EEXIST: - raise - -sources = [] -for src in glob.glob('src/*.cc'): - if src.endswith('test.cc') or src.endswith('.in.cc'): - continue - - filename = os.path.basename(src) - if filename == 'browse.cc': # Depends on generated header. - continue +from __future__ import print_function - if sys.platform.startswith('win32'): - if filename == 'subprocess.cc': - continue - else: - if src.endswith('-win32.cc'): - continue - - sources.append(src) - -if sys.platform.startswith('win32'): - sources.append('src/getopt.c') - -vcdir = os.environ.get('VCINSTALLDIR') -if vcdir: - args = [os.path.join(vcdir, 'bin', 'cl.exe'), '/nologo', '/EHsc', '/DNOMINMAX'] -else: - args = shlex.split(os.environ.get('CXX', 'g++')) - args.extend(['-Wno-deprecated', - '-DNINJA_PYTHON="' + sys.executable + '"', - '-DNINJA_BOOTSTRAP']) -args.extend(cflags) -args.extend(ldflags) -binary = 'ninja.bootstrap' -if sys.platform.startswith('win32'): - binary = 'ninja.bootstrap.exe' -args.extend(sources) -if vcdir: - args.extend(['/link', '/out:' + binary]) -else: - args.extend(['-o', binary]) - -if options.verbose: - print ' '.join(args) - -run(args) - -verbose = [] -if options.verbose: - verbose = ['-v'] - -print 'Building ninja using itself...' -run([sys.executable, 'configure.py'] + conf_args) -run(['./' + binary] + verbose) -os.unlink(binary) +import subprocess +import sys -print 'Done!' +print('DEPRECATED: this script will be deleted.') +print('use "configure.py --bootstrap" instead.') +subprocess.check_call([sys.executable, 'configure.py', '--bootstrap'])