def download_node(): node_path = os.path.join(SOURCE_VENDOR, 'node') update_module(node_path, 'node', 'git', 'https://github.com/silkedit/node.git') old_path = os.getcwd() os.chdir(node_path) util.execute_stdout(['git', 'checkout', 'origin/silkedit']) os.chdir(old_path)
def generate_lastchange(): lastchange_file = os.path.join("build", "util", "LASTCHANGE") if os.path.isfile(lastchange_file): return lastchange_script = os.path.join("build", "util", "lastchange.py") util.execute_stdout(["python", lastchange_script, lastchange_file])
def build_vendor(args): os.chdir(VENDOR_DIR) ninja = get_ninja() for config in args.configuration: build_dir = os.path.join("out", config) if args.target_arch == "x64" and sys.platform == "win32": build_dir += "_x64" util.execute_stdout([ninja, "-C", build_dir] + args.target)
def generate_ninja_files(args): gyp_file = os.path.join("build", "gyp_chromium") node_common_gypi = os.path.join("node", "common.gypi") node_config_gypi = os.path.join("node", "config.gypi") exec_args = ["python", gyp_file, "--depth=.", "--toplevel-dir=.", "vendor.gyp"] exec_args += ["-I", "custom.gypi"] if os.path.isfile(node_common_gypi) and args.group != "basic": exec_args += ["-I", node_common_gypi] if os.path.isfile(node_config_gypi) and args.group != "basic": exec_args += ["-I", node_config_gypi] exec_args += ["-D", "component=" + args.component] exec_args += ["-D", "library=" + args.library] util.execute_stdout(exec_args)
def build_node(args): old_path = os.getcwd() os.chdir(os.path.join(SOURCE_VENDOR, 'node')) if sys.platform == 'darwin': params = ['chmod', 'u+x', 'configure'] util.execute_stdout(params) params = ['./configure'] if args.enable_static: params.append('--enable-static') else: params.append('--enable-shared') if args.enable_debug: params.append('--debug') util.execute_stdout(params) util.execute_stdout(['make']) elif sys.platform == 'win32': params = ['vcbuild.bat'] if not args.enable_static: params.append('shared') if args.enable_debug: params.append('debug') if args.enable_release: params.append('release') util.execute_stdout(params) os.chdir(old_path)
def platform_specific(): print 'apply platform dependent operation...' if sys.platform == 'win32': winsdk_dir = os.environ['WindowsSdkDir'] if not winsdk_dir or winsdk_dir.isspace(): print 'windows sdk not installed' sys.exit(-1) setenv_cmd_path = os.path.join(winsdk_dir, 'bin') setenv_cmd_path += '/SetEnv.Cmd' setenv_cmd_path = os.path.normpath(setenv_cmd_path) if not os.path.isfile(setenv_cmd_path): import ctypes is_admin = ctypes.windll.shell32.IsUserAnAdmin() if not is_admin: sys.exit('need admin privilege on Windows') open(setenv_cmd_path, 'a').close() elif sys.platform == 'darwin': util.execute_stdout([os.path.join(SOURCE_ROOT, 'update-clang.sh')])
def build_chromium(args): old_path = os.getcwd() # generate ninja project files os.chdir(os.path.join(SOURCE_VENDOR, 'chromium')) params = ['python', 'src/build/gyp_chromium', 'src/base/base.gyp'] util.execute_stdout(params) # build with ninja os.chdir(os.path.join(SOURCE_VENDOR, 'chromium', 'src')) config_list = [] if args.enable_debug: config_list.append('Debug') if args.enable_release: config_list.append('Release') for config in config_list: build_ninja = os.path.normpath(os.path.join(os.getcwd(), 'out', config)) params = ['ninja', '-C', build_ninja, 'base'] util.execute_stdout(params) os.chdir(old_path)
def update_submodules(args): modules = get_submodules(args) for module in modules: print "update module " + module util.execute_stdout(["git", "submodule", "sync", "--", module]) util.execute_stdout(["git", "submodule", "update", "--init", "--recursive", "--", module])
def update_clang(): util.execute_stdout([os.path.join("script", "update-clang.sh")])
def configura_node(args): configure_file = os.path.join("node", "configure") if not os.path.isfile(configure_file): return util.execute_stdout(["python", configure_file, "--enable-shared", "--dest-cpu", args.target_arch])