parser.add_option('--with-python', metavar='EXE', help='use EXE as the Python interpreter', default=os.path.basename(sys.executable)) parser.add_option( '--force-pselect', action='store_true', help='ppoll() is used by default where available, ' 'but some platforms may need to use pselect instead', ) (options, args) = parser.parse_args() if args: print('ERROR: extra unparsed command-line arguments:', args) sys.exit(1) platform = platform_helper.Platform(options.platform) if options.host: host = platform_helper.Platform(options.host) else: host = platform BUILD_FILENAME = 'build.ninja' buildfile = open(BUILD_FILENAME, 'w') n = ninja_syntax.Writer(buildfile) n.comment('This file is used to build ninja itself.') n.comment('It is generated by ' + os.path.basename(__file__) + '.') n.newline() n.variable('ninja_required_version', '1.3') n.newline()
'--verbose', action='store_true', help='enable verbose build', ) parser.add_option( '--x64', action='store_true', help='force 64-bit build (Windows)', ) parser.add_option('--platform', help='target platform (' + '/'.join(platform_helper.platforms()) + ')', choices=platform_helper.platforms()) (options, conf_args) = parser.parse_args() platform = platform_helper.Platform(options.platform) conf_args.append("--platform=" + platform.platform()) def run(*args, **kwargs): returncode = subprocess.call(*args, **kwargs) if returncode != 0: sys.exit(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 platform.is_freebsd() or platform.is_openbsd(): cflags.append('-I/usr/local/include')