build: remove gyp build files (#14097)
* build: remove gyp build files * docs: update build instructions * build: temporary restore electron.gyp * build: do not update Electron version in the electron.gyp * chore: remove unused submodules * ci: remove obsolete CI scripts and configs * chore: remove obsolete scripts * chore: remove obsolete functions from lib/util.py * ci: send Slack notification for nightly build results
This commit is contained in:
parent
98eee52fac
commit
72526927d9
56 changed files with 919 additions and 6043 deletions
|
@ -1,300 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import errno
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from lib.config import BASE_URL, PLATFORM, MIPS64EL_SYSROOT_URL, \
|
||||
MIPS64EL_GCC, MIPS64EL_GCC_URL, enable_verbose_mode, \
|
||||
is_verbose_mode, get_target_arch
|
||||
from lib.util import execute, execute_stdout, get_electron_version, \
|
||||
scoped_cwd, download, update_node_modules
|
||||
from tls import check_tls
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
|
||||
DOWNLOAD_DIR = os.path.join(VENDOR_DIR, 'download')
|
||||
PYTHON_26_URL = 'https://chromium.googlesource.com/chromium/deps/python_26'
|
||||
|
||||
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:
|
||||
enable_verbose_mode()
|
||||
if sys.platform == 'cygwin':
|
||||
update_win32_python()
|
||||
|
||||
check_tls(args.verbose)
|
||||
|
||||
update_submodules()
|
||||
|
||||
libcc_source_path = args.libcc_source_path
|
||||
libcc_shared_library_path = args.libcc_shared_library_path
|
||||
libcc_static_library_path = args.libcc_static_library_path
|
||||
|
||||
if args.target_arch == 'mips64el':
|
||||
download_mips64el_toolchain()
|
||||
|
||||
if args.target_arch.startswith('arm'):
|
||||
download_native_mksnapshot(args.target_arch)
|
||||
|
||||
# Redirect to use local libchromiumcontent build.
|
||||
if args.build_release_libcc or args.build_debug_libcc:
|
||||
build_libchromiumcontent(args.verbose, args.target_arch,
|
||||
args.build_debug_libcc, args.update_libcc)
|
||||
dist_dir = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'dist', 'main')
|
||||
libcc_source_path = os.path.join(dist_dir, 'src')
|
||||
libcc_shared_library_path = os.path.join(dist_dir, 'shared_library')
|
||||
libcc_static_library_path = os.path.join(dist_dir, 'static_library')
|
||||
|
||||
if PLATFORM != 'win32':
|
||||
if not args.disable_clang and args.clang_dir == '':
|
||||
# Download prebuilt clang binaries.
|
||||
update_clang()
|
||||
|
||||
setup_python_libs()
|
||||
update_node_modules('.')
|
||||
setup_libchromiumcontent(args.dev, args.target_arch, args.url,
|
||||
libcc_source_path, libcc_shared_library_path,
|
||||
libcc_static_library_path)
|
||||
|
||||
if PLATFORM == 'linux' and args.target_arch != 'mips64el':
|
||||
download_sysroot(args.target_arch)
|
||||
|
||||
create_chrome_version_h()
|
||||
touch_config_gypi()
|
||||
run_update(defines, args.msvs)
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Bootstrap this project')
|
||||
parser.add_argument('-u', '--url',
|
||||
help='The base URL from which to download '
|
||||
'libchromiumcontent (i.e., the URL you passed to '
|
||||
'libchromiumcontent\'s script/upload script',
|
||||
default=BASE_URL,
|
||||
required=False)
|
||||
parser.add_argument('-v', '--verbose',
|
||||
action='store_true',
|
||||
help='Prints the output of the subprocesses')
|
||||
parser.add_argument('-d', '--dev', action='store_true',
|
||||
help='Do not download static_library build')
|
||||
parser.add_argument('-y', '--yes', '--assume-yes',
|
||||
action='store_true',
|
||||
help='Run non-interactively by assuming "yes" to all ' \
|
||||
'prompts.')
|
||||
parser.add_argument('--msvs', action='store_true',
|
||||
help='Generate Visual Studio project')
|
||||
parser.add_argument('--target_arch', default=get_target_arch(),
|
||||
help='Manually 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')
|
||||
build_libcc = parser.add_mutually_exclusive_group()
|
||||
build_libcc.add_argument('--build_release_libcc', action='store_true',
|
||||
help='Build release version of libchromiumcontent')
|
||||
build_libcc.add_argument('--build_debug_libcc', action='store_true',
|
||||
help='Build debug version of libchromiumcontent')
|
||||
parser.add_argument('--update_libcc', default=False,
|
||||
action='store_true', help=('force gclient invocation to '
|
||||
'update libchromiumcontent'))
|
||||
parser.add_argument('--libcc_source_path', required=False,
|
||||
help='The source path of libchromiumcontent. ' \
|
||||
'NOTE: All options of libchromiumcontent are ' \
|
||||
'required OR let electron choose it')
|
||||
parser.add_argument('--libcc_shared_library_path', required=False,
|
||||
help='The shared library path of libchromiumcontent.')
|
||||
parser.add_argument('--libcc_static_library_path', required=False,
|
||||
help='The static library path of libchromiumcontent.')
|
||||
parser.add_argument('--defines', default='',
|
||||
help='The build variables passed to gyp')
|
||||
parser.add_argument('--cc_wrapper',
|
||||
help='Sets cc_wrapper for build. E.g. $(which sccache)')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def args_to_defines(args):
|
||||
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'
|
||||
if args.cc_wrapper is not None:
|
||||
defines += ' cc_wrapper=' + args.cc_wrapper
|
||||
return defines
|
||||
|
||||
|
||||
def check_root():
|
||||
if os.geteuid() == 0:
|
||||
print "We suggest not running this as root, unless you're really sure."
|
||||
choice = raw_input("Do you want to continue? [y/N]: ")
|
||||
if choice not in ('y', 'Y'):
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def update_submodules():
|
||||
execute_stdout(['git', 'submodule', 'sync', '--recursive'])
|
||||
execute_stdout(['git', 'submodule', 'update', '--init', '--recursive'])
|
||||
|
||||
|
||||
def setup_python_libs():
|
||||
for lib in ('requests', 'boto'):
|
||||
with scoped_cwd(os.path.join(VENDOR_DIR, lib)):
|
||||
execute_stdout([sys.executable, 'setup.py', 'build'])
|
||||
|
||||
|
||||
def setup_libchromiumcontent(is_dev, target_arch, url,
|
||||
libcc_source_path,
|
||||
libcc_shared_library_path,
|
||||
libcc_static_library_path):
|
||||
target_dir = os.path.join(DOWNLOAD_DIR, 'libchromiumcontent')
|
||||
script = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script',
|
||||
'download')
|
||||
args = ['-f', '-c', get_libchromiumcontent_commit(), '--target_arch',
|
||||
target_arch, url, target_dir]
|
||||
if (libcc_source_path != None and
|
||||
libcc_shared_library_path != None and
|
||||
libcc_static_library_path != None):
|
||||
args += ['--libcc_source_path', libcc_source_path,
|
||||
'--libcc_shared_library_path', libcc_shared_library_path,
|
||||
'--libcc_static_library_path', libcc_static_library_path]
|
||||
mkdir_p(target_dir)
|
||||
else:
|
||||
mkdir_p(DOWNLOAD_DIR)
|
||||
if is_verbose_mode():
|
||||
args += ['-v']
|
||||
if is_dev:
|
||||
subprocess.check_call([sys.executable, script] + args)
|
||||
else:
|
||||
subprocess.check_call([sys.executable, script, '-s'] + args)
|
||||
|
||||
|
||||
def update_win32_python():
|
||||
with scoped_cwd(VENDOR_DIR):
|
||||
if not os.path.exists('python_26'):
|
||||
execute_stdout(['git', 'clone', PYTHON_26_URL])
|
||||
|
||||
|
||||
def build_libchromiumcontent(verbose, target_arch, debug,
|
||||
force_update):
|
||||
args = [sys.executable,
|
||||
os.path.join(SOURCE_ROOT, 'script', 'build-libchromiumcontent.py')]
|
||||
if debug:
|
||||
args += ['-d']
|
||||
if force_update:
|
||||
args += ['--force-update']
|
||||
if verbose:
|
||||
args += ['-v']
|
||||
execute_stdout(args + ['--target_arch', target_arch])
|
||||
|
||||
|
||||
def update_clang():
|
||||
execute_stdout([os.path.join(SOURCE_ROOT, 'script', 'update-clang.sh')])
|
||||
|
||||
|
||||
def download_sysroot(target_arch):
|
||||
if target_arch == 'ia32':
|
||||
target_arch = 'i386'
|
||||
if target_arch == 'x64':
|
||||
target_arch = 'amd64'
|
||||
execute_stdout([sys.executable,
|
||||
os.path.join(SOURCE_ROOT, 'script', 'install-sysroot.py'),
|
||||
'--arch', target_arch],
|
||||
cwd=VENDOR_DIR)
|
||||
|
||||
|
||||
def download_mips64el_toolchain():
|
||||
# Download sysroot image.
|
||||
if not os.path.exists(os.path.join(VENDOR_DIR,
|
||||
'debian_jessie_mips64-sysroot')):
|
||||
tar_name = 'debian_jessie_mips64-sysroot.tar.bz2'
|
||||
download(tar_name, MIPS64EL_SYSROOT_URL,
|
||||
os.path.join(SOURCE_ROOT, tar_name))
|
||||
subprocess.call(['tar', '-jxf', tar_name, '-C', VENDOR_DIR])
|
||||
os.remove(tar_name)
|
||||
# Download toolchain.
|
||||
if not os.path.exists(os.path.join(VENDOR_DIR, MIPS64EL_GCC)):
|
||||
tar_name = MIPS64EL_GCC + '.tar.gz'
|
||||
download(tar_name, MIPS64EL_GCC_URL, os.path.join(SOURCE_ROOT, tar_name))
|
||||
subprocess.check_call(['tar', '-xf', tar_name, '-C', VENDOR_DIR])
|
||||
os.remove(tar_name)
|
||||
|
||||
def download_native_mksnapshot(arch):
|
||||
if not os.path.exists(os.path.join(VENDOR_DIR,
|
||||
'native_mksnapshot')):
|
||||
tar_name = 'native-mksnapshot.tar.bz2'
|
||||
url = '{0}/linux/{1}/{2}/{3}'.format(BASE_URL, arch,
|
||||
get_libchromiumcontent_commit(), tar_name)
|
||||
download(tar_name, url, os.path.join(SOURCE_ROOT, tar_name))
|
||||
subprocess.call(['tar', '-jxf', tar_name, '-C', VENDOR_DIR])
|
||||
os.remove(tar_name)
|
||||
|
||||
def create_chrome_version_h():
|
||||
version_file = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'VERSION')
|
||||
target_file = os.path.join(SOURCE_ROOT, 'atom', 'common', 'chrome_version.h')
|
||||
template_file = os.path.join(SOURCE_ROOT, 'script', 'chrome_version.h.in')
|
||||
|
||||
with open(version_file, 'r') as f:
|
||||
version = f.read()
|
||||
with open(template_file, 'r') as f:
|
||||
template = f.read()
|
||||
content = template.replace('{PLACEHOLDER}', version.strip())
|
||||
|
||||
# We update the file only if the content has changed (ignoring line ending
|
||||
# differences).
|
||||
should_write = True
|
||||
if os.path.isfile(target_file):
|
||||
with open(target_file, 'r') as f:
|
||||
should_write = f.read().replace('r', '') != content.replace('r', '')
|
||||
if should_write:
|
||||
with open(target_file, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
|
||||
def touch_config_gypi():
|
||||
config_gypi = os.path.join(SOURCE_ROOT, 'vendor', 'node', 'config.gypi')
|
||||
with open(config_gypi, 'w+') as f:
|
||||
content = "\n{'variables':{}}"
|
||||
if f.read() != content:
|
||||
f.write(content)
|
||||
|
||||
|
||||
def run_update(defines, msvs):
|
||||
args = [sys.executable, os.path.join(SOURCE_ROOT, 'script', 'update.py')]
|
||||
if defines:
|
||||
args += ['--defines', defines]
|
||||
if msvs:
|
||||
args += ['--msvs']
|
||||
|
||||
execute_stdout(args)
|
||||
|
||||
|
||||
def get_libchromiumcontent_commit():
|
||||
commit = os.getenv('LIBCHROMIUMCONTENT_COMMIT')
|
||||
if commit:
|
||||
return commit
|
||||
|
||||
# Extract full SHA-1 of libcc submodule commit
|
||||
output = execute(['git', 'submodule', 'status', 'vendor/libchromiumcontent'])
|
||||
commit = re.split('^(?:\s*)([a-f0-9]{40})(?:\s+)', output)[1]
|
||||
return commit
|
||||
|
||||
|
||||
def mkdir_p(path):
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -1,75 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
from lib.config import enable_verbose_mode, get_target_arch
|
||||
from lib.util import execute_stdout
|
||||
from bootstrap import get_libchromiumcontent_commit
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
LIBCC_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'libchromiumcontent')
|
||||
GCLIENT_DONE_MARKER = os.path.join(SOURCE_ROOT, '.gclient_done')
|
||||
LIBCC_COMMIT = get_libchromiumcontent_commit()
|
||||
|
||||
|
||||
def update_gclient_done_marker():
|
||||
with open(GCLIENT_DONE_MARKER, 'wb') as f:
|
||||
f.write(LIBCC_COMMIT)
|
||||
|
||||
|
||||
def libchromiumcontent_outdated():
|
||||
if not os.path.exists(GCLIENT_DONE_MARKER):
|
||||
return True
|
||||
with open(GCLIENT_DONE_MARKER, 'rb') as f:
|
||||
return f.read() != LIBCC_COMMIT
|
||||
|
||||
|
||||
def main():
|
||||
os.chdir(LIBCC_DIR)
|
||||
|
||||
args = parse_args()
|
||||
if args.verbose:
|
||||
enable_verbose_mode()
|
||||
|
||||
# ./script/bootstrap
|
||||
# ./script/update -t x64
|
||||
# ./script/build --no_shared_library -t x64
|
||||
# ./script/create-dist -c static_library -t x64 --no_zip
|
||||
script_dir = os.path.join(LIBCC_DIR, 'script')
|
||||
bootstrap = os.path.join(script_dir, 'bootstrap')
|
||||
update = os.path.join(script_dir, 'update')
|
||||
build = os.path.join(script_dir, 'build')
|
||||
create_dist = os.path.join(script_dir, 'create-dist')
|
||||
if args.force_update or libchromiumcontent_outdated():
|
||||
execute_stdout([sys.executable, bootstrap])
|
||||
execute_stdout([sys.executable, update, '-t', args.target_arch])
|
||||
update_gclient_done_marker()
|
||||
if args.debug:
|
||||
execute_stdout([sys.executable, build, '-D', '-t', args.target_arch])
|
||||
execute_stdout([sys.executable, create_dist, '-c', 'shared_library',
|
||||
'--no_zip', '--keep-debug-symbols',
|
||||
'-t', args.target_arch])
|
||||
else:
|
||||
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])
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Build libchromiumcontent')
|
||||
parser.add_argument('--target_arch',
|
||||
help='Specify the arch to build for')
|
||||
parser.add_argument('-v', '--verbose', action='store_true',
|
||||
help='Prints the output of the subprocesses')
|
||||
parser.add_argument('-d', '--debug', action='store_true',
|
||||
help='Build libchromiumcontent for debugging')
|
||||
parser.add_argument('--force-update', default=False, action='store_true',
|
||||
help='Force gclient to update libchromiumcontent')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
106
script/build.py
106
script/build.py
|
@ -1,106 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from lib.config import MIPS64EL_GCC, get_target_arch, build_env, \
|
||||
enable_verbose_mode, is_verbose_mode
|
||||
from lib.util import electron_gyp, import_vs_env
|
||||
|
||||
|
||||
CONFIGURATIONS = ['Release', 'Debug']
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
|
||||
LIBCC_SOURCE_ROOT = os.path.join(SOURCE_ROOT, 'vendor', 'libchromiumcontent')
|
||||
LIBCC_DIST_MAIN = os.path.join(LIBCC_SOURCE_ROOT, 'dist', 'main')
|
||||
GCLIENT_DONE = os.path.join(SOURCE_ROOT, '.gclient_done')
|
||||
|
||||
|
||||
def main():
|
||||
os.chdir(SOURCE_ROOT)
|
||||
|
||||
args = parse_args()
|
||||
if args.verbose:
|
||||
enable_verbose_mode()
|
||||
|
||||
# Update the VS build env.
|
||||
import_vs_env(get_target_arch())
|
||||
|
||||
# decide which ninja executable to use
|
||||
ninja_path = args.ninja_path
|
||||
if not ninja_path:
|
||||
ninja_path = os.path.join('vendor', 'depot_tools', 'ninja')
|
||||
if sys.platform == 'win32':
|
||||
ninja_path += '.exe'
|
||||
|
||||
# decide how to invoke ninja
|
||||
ninja = [ninja_path]
|
||||
if is_verbose_mode():
|
||||
ninja.append('-v')
|
||||
|
||||
if args.libcc:
|
||||
if ('D' not in args.configuration
|
||||
or not os.path.exists(GCLIENT_DONE)
|
||||
or not os.path.exists(os.path.join(LIBCC_DIST_MAIN, 'build.ninja'))):
|
||||
sys.stderr.write('--libcc should only be used when '
|
||||
'libchromiumcontent was built with bootstrap.py -d '
|
||||
'--debug_libchromiumcontent' + os.linesep)
|
||||
sys.exit(1)
|
||||
script = os.path.join(LIBCC_SOURCE_ROOT, 'script', 'build')
|
||||
subprocess.check_call([sys.executable, script, '-D', '-t',
|
||||
get_target_arch()])
|
||||
subprocess.check_call(ninja + ['-C', LIBCC_DIST_MAIN])
|
||||
|
||||
env = build_env()
|
||||
for config in args.configuration:
|
||||
build_path = os.path.join('out', config[0])
|
||||
build_args = ['-C', build_path, args.target]
|
||||
if args.compdb:
|
||||
build_args += ['-t', 'compdb', 'cxx', 'cc']
|
||||
compdb = open(r'compile_commands.json','w')
|
||||
ret = subprocess.call(ninja + build_args, env=env, stdout=compdb)
|
||||
compdb.close()
|
||||
else:
|
||||
ret = subprocess.call(ninja + build_args, env=env)
|
||||
if ret != 0:
|
||||
sys.exit(ret)
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Build project')
|
||||
parser.add_argument('-c', '--configuration',
|
||||
help='Build with Release or Debug configuration',
|
||||
nargs='+',
|
||||
default=CONFIGURATIONS,
|
||||
required=False)
|
||||
parser.add_argument('-v', '--verbose',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Verbose output')
|
||||
parser.add_argument('-t', '--target',
|
||||
help='Build specified target',
|
||||
default=electron_gyp()['project_name%'],
|
||||
required=False)
|
||||
parser.add_argument('--libcc',
|
||||
help=(
|
||||
'Build libchromiumcontent first. Should be used only '
|
||||
'when libchromiumcontent as built with boostrap.py '
|
||||
'-d --debug_libchromiumcontent.'
|
||||
),
|
||||
action='store_true', default=False)
|
||||
parser.add_argument('--ninja-path',
|
||||
help='Path of ninja command to use.',
|
||||
required=False)
|
||||
parser.add_argument('--compdb',
|
||||
help=(
|
||||
'Generate JSON compilation database. This will not '
|
||||
'trigger actual build. '
|
||||
),
|
||||
action='store_true', default=False)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -116,6 +116,8 @@ def increase_version(versions, index):
|
|||
|
||||
|
||||
def update_electron_gyp(version, suffix):
|
||||
assert(False, "electron.gyp must not be used anymore. We build with GN now.")
|
||||
|
||||
pattern = re.compile(" *'version%' *: *'[0-9.]+(-beta[0-9.]*)?(-dev)?"
|
||||
+ "(-nightly[0-9.]*)?'")
|
||||
with open('electron.gyp', 'r') as f:
|
||||
|
|
116
script/cibuild
116
script/cibuild
|
@ -1,116 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from lib.config import PLATFORM
|
||||
from lib.util import execute, rm_rf, scoped_env
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
|
||||
LINUX_DEPS = [
|
||||
'libdbus-1-dev',
|
||||
'libgconf2-dev',
|
||||
'libgnome-keyring-dev',
|
||||
'libgtk-3-dev',
|
||||
'libnotify-dev',
|
||||
'libnss3-dev',
|
||||
'libxtst-dev',
|
||||
]
|
||||
|
||||
LINUX_DEPS_NO_ARM = [
|
||||
'gcc-multilib',
|
||||
'g++-multilib',
|
||||
]
|
||||
|
||||
LINUX_DEPS_ARM = [
|
||||
'binutils-aarch64-linux-gnu',
|
||||
'libc6-dev-armhf-cross',
|
||||
'linux-libc-dev-armhf-cross',
|
||||
'g++-arm-linux-gnueabihf',
|
||||
'g++-4.8-multilib-arm-linux-gnueabihf',
|
||||
'gcc-4.8-multilib-arm-linux-gnueabihf',
|
||||
]
|
||||
|
||||
LINUX_DEPS_ARM64 = [
|
||||
'binutils-aarch64-linux-gnu',
|
||||
'libc6-dev-arm64-cross',
|
||||
'linux-libc-dev-arm64-cross',
|
||||
'g++-4.8-aarch64-linux-gnu',
|
||||
'gcc-4.8-aarch64-linux-gnu',
|
||||
'gcc-aarch64-linux-gnu',
|
||||
]
|
||||
|
||||
def main():
|
||||
os.environ['CI'] = '1'
|
||||
|
||||
# Ignore the CXX and CC env in CI.
|
||||
try:
|
||||
del os.environ['CC']
|
||||
del os.environ['CXX']
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
target_arch = 'x64'
|
||||
if os.environ.has_key('TARGET_ARCH'):
|
||||
target_arch = os.environ['TARGET_ARCH']
|
||||
|
||||
if PLATFORM == 'linux' and target_arch == 'x64':
|
||||
os.environ['DISPLAY'] = ':99.0'
|
||||
execute(['sh', '-e', '/etc/init.d/xvfb', 'start'])
|
||||
|
||||
# CI's npm is not reliable.
|
||||
npm = 'npm.cmd' if PLATFORM == 'win32' else 'npm'
|
||||
execute([npm, 'install', 'npm@2.12.1'])
|
||||
|
||||
log_versions()
|
||||
# Add "./node_modules/.bin" to the beginning of $PATH, which will ensure
|
||||
# future "npm" invocations use the right version.
|
||||
node_bin_dir = os.path.join(SOURCE_ROOT, 'node_modules', '.bin')
|
||||
os.environ['PATH'] = os.path.pathsep.join([node_bin_dir,
|
||||
os.environ.get('PATH', '')])
|
||||
|
||||
is_release = os.environ.get('ELECTRON_RELEASE', '') == '1'
|
||||
args = ['--target_arch=' + target_arch]
|
||||
if not is_release:
|
||||
args += ['--dev']
|
||||
run_script('bootstrap.py', args)
|
||||
|
||||
if PLATFORM != 'win32':
|
||||
sys.stderr.write('\nRunning `npm run lint`\n')
|
||||
sys.stderr.flush()
|
||||
execute([npm, 'run', 'lint'])
|
||||
|
||||
if is_release:
|
||||
run_script('build.py', ['-c', 'R'])
|
||||
run_script('create-dist.py')
|
||||
run_script('upload.py')
|
||||
else:
|
||||
run_script('build.py', ['-c', 'D'])
|
||||
if PLATFORM == 'win32' or target_arch == 'x64':
|
||||
run_script('test.py', ['--ci', '--rebuild_native_modules'])
|
||||
run_script('verify-ffmpeg.py')
|
||||
|
||||
|
||||
def run_script(script, args=[]):
|
||||
sys.stderr.write('\nRunning ' + script +'\n')
|
||||
sys.stderr.flush()
|
||||
script = os.path.join(SOURCE_ROOT, 'script', script)
|
||||
subprocess.check_call([sys.executable, script] + args)
|
||||
|
||||
|
||||
def log_versions():
|
||||
sys.stderr.write('\nnode --version\n')
|
||||
sys.stderr.flush()
|
||||
subprocess.call(['node', '--version'])
|
||||
|
||||
sys.stderr.write('\nnpm --version\n')
|
||||
sys.stderr.flush()
|
||||
npm = 'npm.cmd' if PLATFORM == 'win32' else 'npm'
|
||||
subprocess.call([npm, '--version'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
export TARGET_ARCH=arm
|
||||
|
||||
script/cibuild-linux
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
export TARGET_ARCH=arm64
|
||||
|
||||
script/cibuild-linux
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
export TARGET_ARCH=ia32
|
||||
|
||||
script/cibuild-linux
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
export TARGET_ARCH=x64
|
||||
|
||||
script/cibuild-linux
|
|
@ -1,37 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
MESSAGE="$(git log --format=%B -n 1 HEAD)"
|
||||
case ${MESSAGE} in
|
||||
Bump* ) export ELECTRON_RELEASE=1 ;;
|
||||
esac
|
||||
|
||||
if [[ -z "${ELECTRON_RELEASE}" ]]; then
|
||||
echo "Generating Linux $TARGET_ARCH debug build"
|
||||
else
|
||||
echo "Generating Linux $TARGET_ARCH release build"
|
||||
fi
|
||||
|
||||
set +x
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
git submodule sync --recursive
|
||||
git submodule update --init --recursive
|
||||
|
||||
docker build \
|
||||
--force-rm \
|
||||
--tag electron-linux \
|
||||
.
|
||||
|
||||
docker run \
|
||||
--rm \
|
||||
--env TARGET_ARCH="$TARGET_ARCH" \
|
||||
--env ELECTRON_RELEASE="$ELECTRON_RELEASE" \
|
||||
--env ELECTRON_GITHUB_TOKEN="$BUILD_ELECTRON_ELECTRON_GITHUB_TOKEN" \
|
||||
--env ELECTRON_S3_BUCKET="$BUILD_ELECTRON_ELECTRON_S3_BUCKET" \
|
||||
--env ELECTRON_S3_ACCESS_KEY="$BUILD_ELECTRON_ELECTRON_S3_ACCESS_KEY" \
|
||||
--env ELECTRON_S3_SECRET_KEY="$BUILD_ELECTRON_ELECTRON_S3_SECRET_KEY" \
|
||||
--user "$UID" \
|
||||
--volume "$PWD":/workspace/electron \
|
||||
--workdir /workspace/electron \
|
||||
electron-linux script/cibuild
|
|
@ -1,2 +0,0 @@
|
|||
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
|
||||
& python "$scriptPath/cibuild"
|
|
@ -1,46 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
from lib.util import rm_rf
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
|
||||
|
||||
def main():
|
||||
os.chdir(SOURCE_ROOT)
|
||||
|
||||
args = parse_args()
|
||||
|
||||
remove_directory('dist')
|
||||
remove_directory('out')
|
||||
|
||||
if not args.build:
|
||||
remove_directory('node_modules')
|
||||
remove_directory('spec/node_modules')
|
||||
|
||||
remove_directory('vendor/download/libchromiumcontent')
|
||||
remove_directory('vendor/libchromiumcontent/src')
|
||||
|
||||
remove_directory(os.path.expanduser('~/.node-gyp'))
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Remove generated and' \
|
||||
'downloaded build files')
|
||||
parser.add_argument('-b', '--build',
|
||||
help='Only remove out and dist directories',
|
||||
action='store_true')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def remove_directory(directory):
|
||||
print 'Removing %s' % directory
|
||||
rm_rf(directory)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -1,372 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import stat
|
||||
if sys.platform == "win32":
|
||||
import _winreg
|
||||
|
||||
from lib.config import BASE_URL, PLATFORM, build_env, \
|
||||
enable_verbose_mode, get_target_arch, get_zip_name
|
||||
|
||||
from lib.util import add_exec_bit, electron_features, electron_gyp, \
|
||||
execute, get_electron_version, make_zip, \
|
||||
parse_version, rm_rf, scoped_cwd
|
||||
|
||||
from lib.env_util import get_vs_location
|
||||
|
||||
|
||||
ELECTRON_VERSION = get_electron_version()
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
|
||||
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
|
||||
CHROMIUM_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'download',
|
||||
'libchromiumcontent', 'static_library')
|
||||
NATIVE_MKSNAPSHOT_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'native_mksnapshot')
|
||||
|
||||
PROJECT_NAME = electron_gyp()['project_name%']
|
||||
PRODUCT_NAME = electron_gyp()['product_name%']
|
||||
PDF_VIEWER_ENABLED = electron_features()['enable_pdf_viewer%']
|
||||
|
||||
TARGET_BINARIES = {
|
||||
'darwin': [
|
||||
],
|
||||
'win32': [
|
||||
'{0}.exe'.format(PROJECT_NAME), # 'electron.exe'
|
||||
'content_shell.pak',
|
||||
'd3dcompiler_47.dll',
|
||||
'icudtl.dat',
|
||||
'libEGL.dll',
|
||||
'libGLESv2.dll',
|
||||
'ffmpeg.dll',
|
||||
'node.dll',
|
||||
'blink_image_resources_200_percent.pak',
|
||||
'content_resources_200_percent.pak',
|
||||
'ui_resources_200_percent.pak',
|
||||
'views_resources_200_percent.pak',
|
||||
'natives_blob.bin',
|
||||
'v8_context_snapshot.bin',
|
||||
],
|
||||
'linux': [
|
||||
PROJECT_NAME, # 'electron'
|
||||
'content_shell.pak',
|
||||
'icudtl.dat',
|
||||
'libffmpeg.so',
|
||||
'libnode.so',
|
||||
'blink_image_resources_200_percent.pak',
|
||||
'content_resources_200_percent.pak',
|
||||
'ui_resources_200_percent.pak',
|
||||
'views_resources_200_percent.pak',
|
||||
'natives_blob.bin',
|
||||
'v8_context_snapshot.bin',
|
||||
],
|
||||
}
|
||||
TARGET_BINARIES_EXT = []
|
||||
TARGET_DIRECTORIES = {
|
||||
'darwin': [
|
||||
'{0}.app'.format(PRODUCT_NAME),
|
||||
],
|
||||
'win32': [
|
||||
'resources',
|
||||
'locales',
|
||||
],
|
||||
'linux': [
|
||||
'resources',
|
||||
'locales',
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
|
||||
if args.chromium_dir:
|
||||
globals().update(CHROMIUM_DIR=args.chromium_dir)
|
||||
|
||||
if args.verbose:
|
||||
enable_verbose_mode()
|
||||
|
||||
rm_rf(DIST_DIR)
|
||||
os.makedirs(DIST_DIR)
|
||||
|
||||
force_build()
|
||||
create_symbols()
|
||||
copy_binaries()
|
||||
copy_chrome_binary('chromedriver')
|
||||
copy_chrome_binary('mksnapshot')
|
||||
copy_license()
|
||||
if PLATFORM == 'win32':
|
||||
copy_vcruntime_binaries()
|
||||
copy_ucrt_binaries()
|
||||
|
||||
if PLATFORM != 'win32' and not args.no_api_docs:
|
||||
create_api_json_schema()
|
||||
create_typescript_definitions()
|
||||
|
||||
if PLATFORM == 'linux':
|
||||
strip_binaries()
|
||||
|
||||
create_version()
|
||||
create_dist_zip()
|
||||
create_chrome_binary_zip('chromedriver', ELECTRON_VERSION)
|
||||
create_chrome_binary_zip('mksnapshot', ELECTRON_VERSION)
|
||||
create_ffmpeg_zip()
|
||||
create_symbols_zip()
|
||||
|
||||
|
||||
def force_build():
|
||||
build = os.path.join(SOURCE_ROOT, 'script', 'build.py')
|
||||
execute([sys.executable, build, '-c', 'Release'])
|
||||
|
||||
|
||||
def copy_binaries():
|
||||
for binary in TARGET_BINARIES[PLATFORM]:
|
||||
shutil.copy2(os.path.join(OUT_DIR, binary), DIST_DIR)
|
||||
|
||||
if PLATFORM != 'darwin' and PDF_VIEWER_ENABLED:
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'pdf_viewer_resources.pak'),
|
||||
DIST_DIR)
|
||||
|
||||
for directory in TARGET_DIRECTORIES[PLATFORM]:
|
||||
shutil.copytree(os.path.join(OUT_DIR, directory),
|
||||
os.path.join(DIST_DIR, directory),
|
||||
symlinks=True)
|
||||
|
||||
|
||||
def copy_chrome_binary(binary):
|
||||
if PLATFORM == 'win32':
|
||||
binary += '.exe'
|
||||
src = os.path.join(CHROMIUM_DIR, binary)
|
||||
dest = os.path.join(DIST_DIR, binary)
|
||||
|
||||
# Copy file and keep the executable bit.
|
||||
shutil.copyfile(src, dest)
|
||||
add_exec_bit(dest)
|
||||
|
||||
def copy_vcruntime_binaries():
|
||||
arch = get_target_arch()
|
||||
if arch == "ia32":
|
||||
arch = "x86"
|
||||
subkey = r"SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\\"
|
||||
with _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, subkey + arch, 0,
|
||||
_winreg.KEY_READ | _winreg.KEY_WOW64_32KEY) as key:
|
||||
runtime_version = _winreg.QueryValueEx(key, "Version")[0][1:]
|
||||
|
||||
version_parts = parse_version(runtime_version)
|
||||
if len(version_parts) > 3:
|
||||
runtime_version = '.'.join(version_parts[0:3])
|
||||
|
||||
vs_location = get_vs_location('[15.0,16.0)')
|
||||
|
||||
crt_dir = os.path.join(vs_location, 'VC', 'Redist', 'MSVC', runtime_version,
|
||||
arch, 'Microsoft.VC141.CRT')
|
||||
|
||||
dlls = ["msvcp140.dll", "vcruntime140.dll"]
|
||||
|
||||
# Note: copyfile is used to remove the read-only flag
|
||||
for dll in dlls:
|
||||
shutil.copyfile(os.path.join(crt_dir, dll), os.path.join(DIST_DIR, dll))
|
||||
TARGET_BINARIES_EXT.append(dll)
|
||||
|
||||
|
||||
def copy_ucrt_binaries():
|
||||
with _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
|
||||
r"SOFTWARE\Microsoft\Windows Kits\Installed Roots"
|
||||
) as key:
|
||||
ucrt_dir = _winreg.QueryValueEx(key, "KitsRoot10")[0]
|
||||
|
||||
arch = get_target_arch()
|
||||
if arch == "ia32":
|
||||
arch = "x86"
|
||||
|
||||
ucrt_dir += r"Redist\ucrt\DLLs\{0}".format(arch)
|
||||
|
||||
dlls = glob.glob(os.path.join(ucrt_dir, '*.dll'))
|
||||
if len(dlls) == 0:
|
||||
raise Exception('UCRT files not found')
|
||||
|
||||
for dll in dlls:
|
||||
shutil.copy2(dll, DIST_DIR)
|
||||
TARGET_BINARIES_EXT.append(os.path.basename(dll))
|
||||
|
||||
|
||||
def copy_license():
|
||||
shutil.copy2(os.path.join(CHROMIUM_DIR, '..', 'LICENSES.chromium.html'),
|
||||
DIST_DIR)
|
||||
shutil.copy2(os.path.join(SOURCE_ROOT, 'LICENSE'), DIST_DIR)
|
||||
|
||||
def create_api_json_schema():
|
||||
node_bin_dir = os.path.join(SOURCE_ROOT, 'node_modules', '.bin')
|
||||
env = os.environ.copy()
|
||||
env['PATH'] = os.path.pathsep.join([node_bin_dir, env['PATH']])
|
||||
outfile = os.path.relpath(os.path.join(DIST_DIR, 'electron-api.json'))
|
||||
execute(['electron-docs-linter', 'docs', '--outfile={0}'.format(outfile),
|
||||
'--version={}'.format(ELECTRON_VERSION.replace('v', ''))],
|
||||
env=env)
|
||||
|
||||
def create_typescript_definitions():
|
||||
node_bin_dir = os.path.join(SOURCE_ROOT, 'node_modules', '.bin')
|
||||
env = os.environ.copy()
|
||||
env['PATH'] = os.path.pathsep.join([node_bin_dir, env['PATH']])
|
||||
infile = os.path.relpath(os.path.join(DIST_DIR, 'electron-api.json'))
|
||||
outfile = os.path.relpath(os.path.join(DIST_DIR, 'electron.d.ts'))
|
||||
execute(['electron-typescript-definitions', '--in={0}'.format(infile),
|
||||
'--out={0}'.format(outfile)], env=env)
|
||||
|
||||
def strip_binaries():
|
||||
for binary in TARGET_BINARIES[PLATFORM]:
|
||||
if binary.endswith('.so') or '.' not in binary:
|
||||
strip_binary(os.path.join(DIST_DIR, binary))
|
||||
|
||||
|
||||
def strip_binary(binary_path):
|
||||
if get_target_arch() == 'arm':
|
||||
strip = 'arm-linux-gnueabihf-strip'
|
||||
elif get_target_arch() == 'arm64':
|
||||
strip = 'aarch64-linux-gnu-strip'
|
||||
elif get_target_arch() == 'mips64el':
|
||||
strip = 'mips64el-redhat-linux-strip'
|
||||
else:
|
||||
strip = 'strip'
|
||||
execute([strip, binary_path], env=build_env())
|
||||
|
||||
|
||||
def create_version():
|
||||
version_path = os.path.join(SOURCE_ROOT, 'dist', 'version')
|
||||
with open(version_path, 'w') as version_file:
|
||||
version_file.write(ELECTRON_VERSION)
|
||||
|
||||
|
||||
def create_symbols():
|
||||
if get_target_arch() == 'mips64el':
|
||||
return
|
||||
|
||||
destination = os.path.join(DIST_DIR, '{0}.breakpad.syms'.format(PROJECT_NAME))
|
||||
dump_symbols = os.path.join(SOURCE_ROOT, 'script', 'dump-symbols.py')
|
||||
execute([sys.executable, dump_symbols, destination])
|
||||
|
||||
if PLATFORM == 'darwin':
|
||||
dsyms = glob.glob(os.path.join(OUT_DIR, '*.dSYM'))
|
||||
for dsym in dsyms:
|
||||
shutil.copytree(dsym, os.path.join(DIST_DIR, os.path.basename(dsym)))
|
||||
elif PLATFORM == 'win32':
|
||||
pdbs = glob.glob(os.path.join(OUT_DIR, '*.pdb'))
|
||||
for pdb in pdbs:
|
||||
shutil.copy2(pdb, DIST_DIR)
|
||||
|
||||
|
||||
def create_dist_zip():
|
||||
dist_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION)
|
||||
zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)
|
||||
|
||||
with scoped_cwd(DIST_DIR):
|
||||
files = TARGET_BINARIES[PLATFORM] + TARGET_BINARIES_EXT + ['LICENSE',
|
||||
'LICENSES.chromium.html', 'version']
|
||||
if PLATFORM != 'darwin' and PDF_VIEWER_ENABLED:
|
||||
files += ['pdf_viewer_resources.pak']
|
||||
dirs = TARGET_DIRECTORIES[PLATFORM]
|
||||
make_zip(zip_file, files, dirs)
|
||||
|
||||
|
||||
def create_chrome_binary_zip(binary, version):
|
||||
file_suffix = ''
|
||||
create_native_mksnapshot = False
|
||||
if binary == 'mksnapshot':
|
||||
arch = get_target_arch()
|
||||
if arch.startswith('arm'):
|
||||
# if the arch is arm/arm64 the mksnapshot executable is an x64 binary,
|
||||
# so name it as such.
|
||||
file_suffix = 'x64'
|
||||
create_native_mksnapshot = True
|
||||
dist_name = get_zip_name(binary, version, file_suffix)
|
||||
zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)
|
||||
|
||||
files = ['LICENSE', 'LICENSES.chromium.html']
|
||||
if PLATFORM == 'win32':
|
||||
files += [binary + '.exe']
|
||||
else:
|
||||
files += [binary]
|
||||
|
||||
with scoped_cwd(DIST_DIR):
|
||||
make_zip(zip_file, files, [])
|
||||
|
||||
if create_native_mksnapshot == True:
|
||||
# Create a zip with the native version of the mksnapshot binary.
|
||||
src = os.path.join(NATIVE_MKSNAPSHOT_DIR, binary)
|
||||
dest = os.path.join(DIST_DIR, binary)
|
||||
# Copy file and keep the executable bit.
|
||||
shutil.copyfile(src, dest)
|
||||
add_exec_bit(dest)
|
||||
|
||||
dist_name = get_zip_name(binary, version)
|
||||
zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)
|
||||
with scoped_cwd(DIST_DIR):
|
||||
make_zip(zip_file, files, [])
|
||||
|
||||
def create_ffmpeg_zip():
|
||||
dist_name = get_zip_name('ffmpeg', ELECTRON_VERSION)
|
||||
zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)
|
||||
|
||||
if PLATFORM == 'darwin':
|
||||
ffmpeg_name = 'libffmpeg.dylib'
|
||||
elif PLATFORM == 'linux':
|
||||
ffmpeg_name = 'libffmpeg.so'
|
||||
elif PLATFORM == 'win32':
|
||||
ffmpeg_name = 'ffmpeg.dll'
|
||||
|
||||
shutil.copy2(os.path.join(CHROMIUM_DIR, '..', 'ffmpeg', ffmpeg_name),
|
||||
DIST_DIR)
|
||||
|
||||
if PLATFORM == 'linux':
|
||||
strip_binary(os.path.join(DIST_DIR, ffmpeg_name))
|
||||
|
||||
with scoped_cwd(DIST_DIR):
|
||||
make_zip(zip_file, [ffmpeg_name, 'LICENSE', 'LICENSES.chromium.html'], [])
|
||||
|
||||
|
||||
def create_symbols_zip():
|
||||
if get_target_arch() == 'mips64el':
|
||||
return
|
||||
|
||||
dist_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'symbols')
|
||||
zip_file = os.path.join(DIST_DIR, dist_name)
|
||||
licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']
|
||||
|
||||
with scoped_cwd(DIST_DIR):
|
||||
dirs = ['{0}.breakpad.syms'.format(PROJECT_NAME)]
|
||||
make_zip(zip_file, licenses, dirs)
|
||||
|
||||
if PLATFORM == 'darwin':
|
||||
dsym_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'dsym')
|
||||
with scoped_cwd(DIST_DIR):
|
||||
dsyms = glob.glob('*.dSYM')
|
||||
make_zip(os.path.join(DIST_DIR, dsym_name), licenses, dsyms)
|
||||
elif PLATFORM == 'win32':
|
||||
pdb_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'pdb')
|
||||
with scoped_cwd(DIST_DIR):
|
||||
pdbs = glob.glob('*.pdb')
|
||||
make_zip(os.path.join(DIST_DIR, pdb_name), pdbs + licenses, [])
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Create Electron Distribution')
|
||||
parser.add_argument('--no_api_docs',
|
||||
action='store_true',
|
||||
help='Skip generating the Electron API Documentation!')
|
||||
parser.add_argument('--chromium_dir',
|
||||
help='Specify a custom libchromiumcontent dist directory '
|
||||
+ 'if manually compiled')
|
||||
parser.add_argument('-v', '--verbose',
|
||||
action='store_true',
|
||||
help='Prints the output of the subprocesses')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -1,113 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tarfile
|
||||
|
||||
from lib.util import safe_mkdir, scoped_cwd
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
|
||||
NODE_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'node')
|
||||
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
|
||||
|
||||
HEADERS_SUFFIX = [
|
||||
'.h',
|
||||
'.gypi',
|
||||
]
|
||||
HEADERS_DIRS = [
|
||||
'src',
|
||||
'deps/http_parser',
|
||||
'deps/zlib',
|
||||
'deps/uv',
|
||||
'deps/npm',
|
||||
'deps/mdb_v8',
|
||||
'deps/v8/include'
|
||||
]
|
||||
HEADERS_FILES = [
|
||||
'common.gypi',
|
||||
'config.gypi',
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
|
||||
safe_mkdir(args.directory)
|
||||
|
||||
node_headers_dir = os.path.join(args.directory,
|
||||
'node-{0}'.format(args.version))
|
||||
iojs_headers_dir = os.path.join(args.directory,
|
||||
'iojs-{0}'.format(args.version))
|
||||
iojs2_headers_dir = os.path.join(args.directory,
|
||||
'iojs-{0}-headers'.format(args.version))
|
||||
|
||||
copy_headers(node_headers_dir)
|
||||
create_header_tarball(args.directory, node_headers_dir)
|
||||
|
||||
copy_headers(iojs_headers_dir)
|
||||
create_header_tarball(args.directory, iojs_headers_dir)
|
||||
|
||||
copy_headers(iojs2_headers_dir)
|
||||
create_header_tarball(args.directory, iojs2_headers_dir)
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='create node header tarballs')
|
||||
parser.add_argument('-v', '--version', help='Specify the version',
|
||||
required=True)
|
||||
parser.add_argument('-d', '--directory', help='Specify the output directory',
|
||||
default=DIST_DIR,
|
||||
required=False)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def copy_headers(dist_headers_dir):
|
||||
safe_mkdir(dist_headers_dir)
|
||||
|
||||
# Copy standard node headers from node. repository.
|
||||
for include_path in HEADERS_DIRS:
|
||||
abs_path = os.path.join(NODE_DIR, include_path)
|
||||
for dirpath, _, filenames in os.walk(abs_path):
|
||||
for filename in filenames:
|
||||
extension = os.path.splitext(filename)[1]
|
||||
if extension not in HEADERS_SUFFIX:
|
||||
continue
|
||||
copy_source_file(os.path.join(dirpath, filename), NODE_DIR,
|
||||
dist_headers_dir)
|
||||
for other_file in HEADERS_FILES:
|
||||
copy_source_file(os.path.join(NODE_DIR, other_file), NODE_DIR,
|
||||
dist_headers_dir)
|
||||
|
||||
# Copy V8 headers from chromium's repository.
|
||||
src = os.path.join(SOURCE_ROOT, 'vendor', 'download', 'libchromiumcontent',
|
||||
'src')
|
||||
for dirpath, _, filenames in os.walk(os.path.join(src, 'v8')):
|
||||
for filename in filenames:
|
||||
extension = os.path.splitext(filename)[1]
|
||||
if extension not in HEADERS_SUFFIX:
|
||||
continue
|
||||
copy_source_file(os.path.join(dirpath, filename), src,
|
||||
os.path.join(dist_headers_dir, 'deps'))
|
||||
|
||||
|
||||
def create_header_tarball(directory, dist_headers_dir):
|
||||
target = dist_headers_dir + '.tar.gz'
|
||||
with scoped_cwd(directory):
|
||||
tarball = tarfile.open(name=target, mode='w:gz')
|
||||
tarball.add(os.path.relpath(dist_headers_dir))
|
||||
tarball.close()
|
||||
|
||||
|
||||
def copy_source_file(source, start, destination):
|
||||
relative = os.path.relpath(source, start=start)
|
||||
final_destination = os.path.join(destination, relative)
|
||||
safe_mkdir(os.path.dirname(final_destination))
|
||||
shutil.copy2(source, final_destination)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -28,28 +28,6 @@ if sys.platform in ['win32', 'cygwin']:
|
|||
NPM += '.cmd'
|
||||
|
||||
|
||||
def get_host_arch():
|
||||
"""Returns the host architecture with a predictable string."""
|
||||
host_arch = platform.machine()
|
||||
|
||||
# Convert machine type to format recognized by gyp.
|
||||
if re.match(r'i.86', host_arch) or host_arch == 'i86pc':
|
||||
host_arch = 'ia32'
|
||||
elif host_arch in ['x86_64', 'amd64']:
|
||||
host_arch = 'x64'
|
||||
elif host_arch.startswith('arm'):
|
||||
host_arch = 'arm'
|
||||
|
||||
# platform.machine is based on running kernel. It's possible to use 64-bit
|
||||
# kernel with 32-bit userland, e.g. to give linker slightly more memory.
|
||||
# Distinguish between different userland bitness by querying
|
||||
# the python binary.
|
||||
if host_arch == 'x64' and platform.architecture()[0] == '32bit':
|
||||
host_arch = 'ia32'
|
||||
|
||||
return host_arch
|
||||
|
||||
|
||||
def tempdir(prefix=''):
|
||||
directory = tempfile.mkdtemp(prefix=prefix)
|
||||
atexit.register(shutil.rmtree, directory)
|
||||
|
@ -188,36 +166,18 @@ def execute_stdout(argv, env=os.environ, cwd=None):
|
|||
else:
|
||||
execute(argv, env, cwd)
|
||||
|
||||
|
||||
def electron_gyp():
|
||||
# FIXME(alexeykuzmin): Use data from //BUILD.gn.
|
||||
# electron.gyp is not used during the build.
|
||||
SOURCE_ROOT = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
|
||||
gyp = os.path.join(SOURCE_ROOT, 'electron.gyp')
|
||||
with open(gyp) as f:
|
||||
obj = eval(f.read());
|
||||
return obj['variables']
|
||||
|
||||
def electron_features():
|
||||
SOURCE_ROOT = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
|
||||
gyp = os.path.join(SOURCE_ROOT, 'features.gypi')
|
||||
with open(gyp) as f:
|
||||
obj = eval(f.read());
|
||||
return obj['variables']['variables']
|
||||
|
||||
def get_electron_version():
|
||||
return 'v' + electron_gyp()['version%']
|
||||
|
||||
|
||||
def parse_version(version):
|
||||
if version[0] == 'v':
|
||||
version = version[1:]
|
||||
|
||||
vs = version.split('.')
|
||||
if len(vs) > 4:
|
||||
return vs[0:4]
|
||||
else:
|
||||
return vs + ['0'] * (4 - len(vs))
|
||||
|
||||
|
||||
def boto_path_dirs():
|
||||
return [
|
||||
os.path.join(BOTO_DIR, 'build', 'lib'),
|
||||
|
@ -247,56 +207,6 @@ def s3put(bucket, access_key, secret_key, prefix, key_prefix, files):
|
|||
run_boto_script(access_key, secret_key, 's3put', *args)
|
||||
|
||||
|
||||
def import_vs_env(target_arch):
|
||||
if sys.platform != 'win32':
|
||||
return
|
||||
|
||||
if target_arch == 'ia32':
|
||||
vs_arch = 'amd64_x86'
|
||||
else:
|
||||
vs_arch = 'x86_amd64'
|
||||
env = get_vs_env('[15.0,16.0)', vs_arch)
|
||||
os.environ.update(env)
|
||||
|
||||
|
||||
def set_clang_env(env):
|
||||
SOURCE_ROOT = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
|
||||
llvm_dir = os.path.join(SOURCE_ROOT, 'vendor', 'llvm-build',
|
||||
'Release+Asserts', 'bin')
|
||||
env['CC'] = os.path.join(llvm_dir, 'clang')
|
||||
env['CXX'] = os.path.join(llvm_dir, 'clang++')
|
||||
|
||||
|
||||
def update_electron_modules(dirname, target_arch, nodedir):
|
||||
env = os.environ.copy()
|
||||
version = get_electron_version()
|
||||
env['npm_config_arch'] = target_arch
|
||||
env['npm_config_target'] = version
|
||||
env['npm_config_nodedir'] = nodedir
|
||||
update_node_modules(dirname, env)
|
||||
execute_stdout([NPM, 'rebuild'], env, dirname)
|
||||
|
||||
|
||||
def update_node_modules(dirname, env=None):
|
||||
if env is None:
|
||||
env = os.environ.copy()
|
||||
if PLATFORM == 'linux':
|
||||
# Use prebuilt clang for building native modules.
|
||||
set_clang_env(env)
|
||||
env['npm_config_clang'] = '1'
|
||||
with scoped_cwd(dirname):
|
||||
args = [NPM, 'install']
|
||||
if is_verbose_mode():
|
||||
args += ['--verbose']
|
||||
# Ignore npm install errors when running in CI.
|
||||
if os.environ.has_key('CI'):
|
||||
try:
|
||||
execute_stdout(args, env)
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
else:
|
||||
execute_stdout(args, env)
|
||||
|
||||
def add_exec_bit(filename):
|
||||
os.chmod(filename, os.stat(filename).st_mode | stat.S_IEXEC)
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
export LIMIT_OUTPUT_IGNORE_SEGFAULTS=1
|
|
@ -1,40 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from lib.util import electron_gyp
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
|
||||
PROJECT_NAME = electron_gyp()['project_name%']
|
||||
PRODUCT_NAME = electron_gyp()['product_name%']
|
||||
|
||||
|
||||
def main():
|
||||
os.chdir(SOURCE_ROOT)
|
||||
|
||||
config = 'D'
|
||||
if '-R' in sys.argv:
|
||||
config = 'R'
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
electron = os.path.join(SOURCE_ROOT, 'out', config,
|
||||
'{0}.app'.format(PRODUCT_NAME), 'Contents',
|
||||
'MacOS', PRODUCT_NAME)
|
||||
elif sys.platform == 'win32':
|
||||
electron = os.path.join(SOURCE_ROOT, 'out', config,
|
||||
'{0}.exe'.format(PROJECT_NAME))
|
||||
else:
|
||||
electron = os.path.join(SOURCE_ROOT, 'out', config, PROJECT_NAME)
|
||||
|
||||
try:
|
||||
subprocess.check_call([electron] + sys.argv[1:])
|
||||
except KeyboardInterrupt:
|
||||
return -1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -1,82 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This script will check out llvm and clang into third_party/llvm and build it.
|
||||
|
||||
# Do NOT CHANGE this if you don't know what you're doing -- see
|
||||
# https://code.google.com/p/chromium/wiki/UpdatingClang
|
||||
# Reverting problematic clang rolls is safe, though.
|
||||
CLANG_REVISION=325667
|
||||
|
||||
# This is incremented when pushing a new build of Clang at the same revision.
|
||||
CLANG_SUB_REVISION=1
|
||||
|
||||
PACKAGE_VERSION="${CLANG_REVISION}-${CLANG_SUB_REVISION}"
|
||||
|
||||
THIS_DIR="$(dirname "${0}")"
|
||||
LLVM_DIR="${THIS_DIR}/../vendor/llvm"
|
||||
LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts"
|
||||
STAMP_FILE="${LLVM_DIR}/../llvm-build/cr_build_revision"
|
||||
|
||||
# ${A:-a} returns $A if it's set, a else.
|
||||
LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project}
|
||||
|
||||
CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang
|
||||
S3_URL=https://s3.amazonaws.com/gh-contractor-zcbenz/clang
|
||||
|
||||
|
||||
# Die if any command dies, error on undefined variable expansions.
|
||||
set -eu
|
||||
|
||||
|
||||
OS="$(uname -s)"
|
||||
|
||||
# Check if there's anything to be done, exit early if not.
|
||||
if [[ -f "${STAMP_FILE}" ]]; then
|
||||
PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}")
|
||||
if [[ "${PREVIOUSLY_BUILT_REVISON}" = "${PACKAGE_VERSION}" ]]; then
|
||||
echo "Clang already at ${PACKAGE_VERSION}"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
# To always force a new build if someone interrupts their build half way.
|
||||
rm -f "${STAMP_FILE}"
|
||||
|
||||
# Check if there's a prebuilt binary and if so just fetch that. That's faster,
|
||||
# and goma relies on having matching binary hashes on client and server too.
|
||||
CDS_FILE="clang-${PACKAGE_VERSION}.tgz"
|
||||
CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX)
|
||||
CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}"
|
||||
if [ "${OS}" = "Linux" ]; then
|
||||
ARCH="$(uname -m)"
|
||||
if [ "${ARCH}" = "aarch64" ]; then
|
||||
CDS_FULL_URL="${S3_URL}/arm64/${CDS_FILE}"
|
||||
else
|
||||
CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}"
|
||||
fi
|
||||
elif [ "${OS}" = "Darwin" ]; then
|
||||
CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}"
|
||||
fi
|
||||
echo Trying to download prebuilt clang
|
||||
if which curl > /dev/null; then
|
||||
curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \
|
||||
rm -rf "${CDS_OUT_DIR}"
|
||||
elif which wget > /dev/null; then
|
||||
wget "${CDS_FULL_URL}" -O "${CDS_OUTPUT}" || rm -rf "${CDS_OUT_DIR}"
|
||||
else
|
||||
echo "Neither curl nor wget found. Please install one of these."
|
||||
exit 1
|
||||
fi
|
||||
if [ -f "${CDS_OUTPUT}" ]; then
|
||||
rm -rf "${LLVM_BUILD_DIR}"
|
||||
mkdir -p "${LLVM_BUILD_DIR}"
|
||||
tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}"
|
||||
echo clang "${PACKAGE_VERSION}" unpacked
|
||||
echo "${PACKAGE_VERSION}" > "${STAMP_FILE}"
|
||||
rm -rf "${CDS_OUT_DIR}"
|
||||
exit 0
|
||||
else
|
||||
echo Did not find prebuilt clang "${PACKAGE_VERSION}", building
|
||||
fi
|
105
script/update.py
105
script/update.py
|
@ -1,105 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from lib.config import get_target_arch, PLATFORM
|
||||
from lib.util import get_host_arch, import_vs_env
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
|
||||
|
||||
def main():
|
||||
os.chdir(SOURCE_ROOT)
|
||||
|
||||
if PLATFORM != 'win32' and platform.architecture()[0] != '64bit':
|
||||
print 'Electron is required to be built on a 64bit machine'
|
||||
return 1
|
||||
|
||||
update_external_binaries()
|
||||
return update_gyp()
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Update build configurations')
|
||||
parser.add_argument('--defines', default='',
|
||||
help='The build variables passed to gyp')
|
||||
group = parser.add_mutually_exclusive_group(required=False)
|
||||
group.add_argument('--msvs', action='store_true',
|
||||
help='Generate Visual Studio project')
|
||||
group.add_argument('--xcode', action='store_true',
|
||||
help='Generate XCode project')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def update_external_binaries():
|
||||
uf = os.path.join('script', 'update-external-binaries.py')
|
||||
subprocess.check_call([sys.executable, uf])
|
||||
|
||||
|
||||
def update_gyp():
|
||||
# Since gyp doesn't support specify link_settings for each configuration,
|
||||
# we are not able to link to different libraries in "Debug" and "Release"
|
||||
# configurations.
|
||||
# In order to work around this, we decided to generate the configuration
|
||||
# for twice, one is to generate "Debug" config, the other one to generate
|
||||
# the "Release" config. And the settings are controlled by the variable
|
||||
# "libchromiumcontent_component" which is defined before running gyp.
|
||||
target_arch = get_target_arch()
|
||||
return (run_gyp(target_arch, 0) or run_gyp(target_arch, 1))
|
||||
|
||||
|
||||
def run_gyp(target_arch, component):
|
||||
# Update the VS build env.
|
||||
import_vs_env(target_arch)
|
||||
|
||||
env = os.environ.copy()
|
||||
if PLATFORM == 'linux' and target_arch != get_host_arch():
|
||||
env['GYP_CROSSCOMPILE'] = '1'
|
||||
elif PLATFORM == 'win32':
|
||||
env['GYP_MSVS_VERSION'] = '2017'
|
||||
python = sys.executable
|
||||
if sys.platform == 'cygwin':
|
||||
# Force using win32 python on cygwin.
|
||||
python = os.path.join('vendor', 'python_26', 'python.exe')
|
||||
gyp = os.path.join('vendor', 'gyp', 'gyp_main.py')
|
||||
gyp_pylib = os.path.join(os.path.dirname(gyp), 'pylib')
|
||||
# Avoid using the old gyp lib in system.
|
||||
env['PYTHONPATH'] = os.path.pathsep.join([gyp_pylib,
|
||||
env.get('PYTHONPATH', '')])
|
||||
# Whether to build for Mac App Store.
|
||||
if os.environ.has_key('MAS_BUILD'):
|
||||
mas_build = 1
|
||||
else:
|
||||
mas_build = 0
|
||||
|
||||
defines = [
|
||||
'-Dlibchromiumcontent_component={0}'.format(component),
|
||||
'-Dtarget_arch={0}'.format(target_arch),
|
||||
'-Dhost_arch={0}'.format(get_host_arch()),
|
||||
'-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]
|
||||
|
||||
generator = 'ninja'
|
||||
if args.msvs:
|
||||
generator = 'msvs-ninja'
|
||||
elif args.xcode:
|
||||
generator = 'xcode-ninja'
|
||||
|
||||
return subprocess.call([python, gyp, '-f', generator, '--depth', '.',
|
||||
'electron.gyp', '-Icommon.gypi'] + defines, env=env)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
Loading…
Add table
Add a link
Reference in a new issue