Convert --clang_dir and --disable_clang to --defines

This commit is contained in:
Cheng Zhao 2016-05-02 21:19:16 +09:00
parent 26e4ce30bb
commit 098d72b741
4 changed files with 39 additions and 21 deletions

View file

@ -26,6 +26,7 @@ def main():
os.chdir(SOURCE_ROOT)
args = parse_args()
defines = args_to_defines(args)
if not args.yes and PLATFORM != 'win32':
check_root()
if args.verbose:
@ -63,7 +64,7 @@ def main():
create_chrome_version_h()
touch_config_gypi()
run_update()
run_update(defines)
update_electron_modules('spec', args.target_arch)
@ -102,6 +103,16 @@ def parse_args():
return parser.parse_args()
def args_to_defines(args):
defines = ''
if args.disable_clang:
defines += ' clang=0'
if args.clang_dir:
defines += ' make_clang_dir=' + args.clang_dir
defines += ' clang_use_chrome_plugins=0'
return defines
def check_root():
if os.geteuid() == 0:
print "We suggest not running this as root, unless you're really sure."
@ -179,14 +190,12 @@ def update_win32_python():
execute_stdout(['git', 'clone', PYTHON_26_URL])
def build_libchromiumcontent(verbose, target_arch, disable_clang, clang_dir):
def build_libchromiumcontent(verbose, target_arch, defines):
args = [os.path.join(SOURCE_ROOT, 'script', 'build-libchromiumcontent.py')]
if verbose:
args += ['-v']
if disable_clang:
args += ['--disable_clang']
if clang_dir:
args += ['--clang_dir', clang_dir]
if defines:
args += ['--defines', defines]
execute_stdout(args + ['--target_arch', target_arch])
@ -234,9 +243,9 @@ def touch_config_gypi():
f.write(content)
def run_update():
def run_update(defines):
update = os.path.join(SOURCE_ROOT, 'script', 'update.py')
execute_stdout([sys.executable, update])
execute_stdout([sys.executable, update, '--defines', defines])
if __name__ == '__main__':

View file

@ -18,14 +18,8 @@ def main():
if args.verbose:
enable_verbose_mode()
extra_update_args = []
if args.disable_clang:
extra_update_args += ['--disable_clang']
if args.clang_dir:
extra_update_args += ['--clang_dir', args.clang_dir]
# ./script/bootstrap
# ./script/update -t x64
# ./script/update -t x64 --defines=''
# ./script/build --no_shared_library -t x64
# ./script/create-dist -c static_library -t x64 --no_zip
script_dir = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor',
@ -35,8 +29,8 @@ def main():
build = os.path.join(script_dir, 'build')
create_dist = os.path.join(script_dir, 'create-dist')
execute_stdout([sys.executable, bootstrap])
execute_stdout([sys.executable, update, '-t', args.target_arch] +
extra_update_args)
execute_stdout([sys.executable, update, '-t', args.target_arch,
'--defines', args.defines])
execute_stdout([sys.executable, build, '-R', '-t', args.target_arch])
execute_stdout([sys.executable, create_dist, '-c', 'static_library',
'--no_zip', '-t', args.target_arch])
@ -46,9 +40,8 @@ def parse_args():
parser = argparse.ArgumentParser(description='Build libchromiumcontent')
parser.add_argument('--target_arch',
help='Specify the arch to build for')
parser.add_argument('--clang_dir', default='', help='Path to clang binaries')
parser.add_argument('--disable_clang', action='store_true',
help='Use compilers other than clang for building')
parser.add_argument('--defines', default='',
help='The definetions passed to gyp')
parser.add_argument('-v', '--verbose', action='store_true',
help='Prints the output of the subprocesses')
return parser.parse_args()

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
import argparse
import os
import platform
import subprocess
@ -23,6 +24,13 @@ def main():
return update_gyp()
def parse_args():
parser = argparse.ArgumentParser(description='Update build configurations')
parser.add_argument('--defines', default='',
help='The definetions passed to gyp')
return parser.parse_args()
def update_external_binaries():
uf = os.path.join('script', 'update-external-binaries.py')
subprocess.check_call([sys.executable, uf])
@ -60,6 +68,7 @@ def run_gyp(target_arch, component):
mas_build = 1
else:
mas_build = 0
defines = [
'-Dlibchromiumcontent_component={0}'.format(component),
'-Dtarget_arch={0}'.format(target_arch),
@ -67,6 +76,13 @@ def run_gyp(target_arch, component):
'-Dlibrary=static_library',
'-Dmas_build={0}'.format(mas_build),
]
# Add the defines passed from command line.
args = parse_args()
for define in [d.strip() for d in args.defines.split(' ')]:
if define:
defines += ['-D' + define]
return subprocess.call([python, gyp, '-f', 'ninja', '--depth', '.',
'electron.gyp', '-Icommon.gypi'] + defines, env=env)

2
vendor/brightray vendored

@ -1 +1 @@
Subproject commit 3d168efd1d27d4ac3869beac6290c5066c392721
Subproject commit 9a5b443e4953fa51ddd0a8d4739e60edf0a666a3