Merge pull request #295 from electron/arm64
Setup CI machine for ARM64 build
This commit is contained in:
Коммит
a3cff05227
|
@ -5,5 +5,6 @@
|
|||
/src/
|
||||
/libchromiumcontent.zip
|
||||
/libchromiumcontent-static.zip
|
||||
/vendor/binutils-aarch64
|
||||
.gclient
|
||||
.gclient_entries
|
||||
|
|
|
@ -27,6 +27,10 @@ def main():
|
|||
env['PATH']])
|
||||
if sys.platform in ['win32', 'cygwin']:
|
||||
env['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
|
||||
if target_arch == 'arm64':
|
||||
binutils_dir = os.path.join(VENDOR_DIR, 'binutils-aarch64')
|
||||
env['LD_LIBRARY_PATH'] = binutils_dir + '/usr/x86_64-linux-gnu/aarch64-linux-gnu/lib'
|
||||
env['PATH'] = os.pathsep.join([binutils_dir + '/usr/bin', env['PATH']])
|
||||
|
||||
os.chdir(SOURCE_ROOT)
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@ def main():
|
|||
elif sys.platform == 'linux2':
|
||||
return (run_ci(['-t', 'x64']) or
|
||||
run_ci(['-t', 'ia32']) or
|
||||
run_ci(['-t', 'arm']))
|
||||
run_ci(['-t', 'arm']) or
|
||||
run_ci(['-t', 'arm64']))
|
||||
else:
|
||||
return run_ci([])
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
export TARGET_ARCH=arm64
|
||||
|
||||
script/cibuild-libchromiumcontent-linux
|
|
@ -16,6 +16,7 @@ from lib.config import get_output_dir
|
|||
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
|
||||
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
|
||||
SRC_DIR = os.path.join(SOURCE_ROOT, 'src')
|
||||
|
||||
|
@ -515,28 +516,28 @@ def copy_dir(relative_path, relative_to, destination):
|
|||
copy_source_file(os.path.join(dirpath, filename), relative_to=relative_to, destination=destination)
|
||||
|
||||
|
||||
def add_gdb_index_section(gdb, objcopy, symfile, dirname):
|
||||
def add_gdb_index_section(gdb, objcopy, symfile, dirname, env):
|
||||
subprocess.check_call([gdb, '-batch',
|
||||
'-ex', 'file {0}'.format(symfile),
|
||||
'-ex', 'save gdb-index .'], cwd=dirname)
|
||||
'-ex', 'save gdb-index .'], cwd=dirname, env=env)
|
||||
index_file = symfile + '.gdb-index'
|
||||
subprocess.check_call([objcopy, '--add-section',
|
||||
'.gdb_index={0}'.format(index_file),
|
||||
'--set-section-flags', '.gdb_index=readonly',
|
||||
symfile, symfile], cwd=dirname)
|
||||
symfile, symfile], cwd=dirname, env=env)
|
||||
os.unlink(os.path.join(dirname, index_file))
|
||||
|
||||
|
||||
def create_debug_file(gdb, objcopy, binfile, symfile, dirname):
|
||||
def create_debug_file(gdb, objcopy, binfile, symfile, dirname, env):
|
||||
subprocess.check_call([objcopy, '--only-keep-debug', binfile, symfile],
|
||||
cwd=dirname)
|
||||
cwd=dirname, env=env)
|
||||
# add gdb_index section to the debug file, which will improve load speed.
|
||||
add_gdb_index_section(gdb, objcopy, symfile, dirname)
|
||||
add_gdb_index_section(gdb, objcopy, symfile, dirname, env)
|
||||
|
||||
|
||||
def link_binary_to_debug_file(objcopy, binfile, symfile, dirname):
|
||||
def link_binary_to_debug_file(objcopy, binfile, symfile, dirname, env):
|
||||
subprocess.check_call([objcopy, '--add-gnu-debuglink={0}'.format(symfile),
|
||||
binfile], cwd=dirname)
|
||||
binfile], cwd=dirname, env=env)
|
||||
|
||||
|
||||
def run_strip(target_arch, filename, create_debug_archive):
|
||||
|
@ -550,6 +551,12 @@ def run_strip(target_arch, filename, create_debug_archive):
|
|||
else:
|
||||
strip_flags = ['-x', '-S']
|
||||
|
||||
env = os.environ.copy()
|
||||
if target_arch == 'arm64':
|
||||
binutils_dir = os.path.join(VENDOR_DIR, 'binutils-aarch64')
|
||||
env['LD_LIBRARY_PATH'] = binutils_dir + '/usr/x86_64-linux-gnu/aarch64-linux-gnu/lib'
|
||||
env['PATH'] = os.pathsep.join([binutils_dir + '/usr/bin', env['PATH']])
|
||||
|
||||
if target_arch == 'arm' and filename.endswith(('.so', 'chromedriver')):
|
||||
strip = 'arm-linux-gnueabihf-strip'
|
||||
objcopy = 'arm-linux-gnueabihf-objcopy'
|
||||
|
@ -569,10 +576,10 @@ def run_strip(target_arch, filename, create_debug_archive):
|
|||
# different version will be bundled.
|
||||
and not symfile.startswith('libffmpeg'))
|
||||
if create_debug_archive:
|
||||
create_debug_file(gdb, objcopy, filename, symfile, dirname)
|
||||
subprocess.check_call([strip] + strip_flags + [filename])
|
||||
create_debug_file(gdb, objcopy, filename, symfile, dirname, env)
|
||||
subprocess.check_call([strip] + strip_flags + [filename], env=env)
|
||||
if create_debug_archive:
|
||||
link_binary_to_debug_file(objcopy, filename, symfile, dirname)
|
||||
link_binary_to_debug_file(objcopy, filename, symfile, dirname, env)
|
||||
|
||||
|
||||
def run_ar_combine(filename, target_dir):
|
||||
|
|
|
@ -28,6 +28,8 @@ if sys.platform == 'win32':
|
|||
|
||||
TARBALL_REPO = 'zcbenz/chromium-source-tarball'
|
||||
TARBALL_URL = 'https://github.com/{0}/releases/download/{1}/chromium-{1}.tar.xz'
|
||||
DEBIAN_MIRROR = 'http://ftp.jp.debian.org/debian/pool/main/'
|
||||
BINTOOLS_NAME = 'c/cross-binutils/binutils-aarch64-linux-gnu_2.25-5_amd64.deb'
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
|
@ -45,6 +47,9 @@ def main():
|
|||
update_toolchain_json()
|
||||
|
||||
target_arch = args.target_arch
|
||||
if target_arch == 'arm64':
|
||||
install_aarch64_bintools()
|
||||
|
||||
return (apply_patches() or
|
||||
copy_chromiumcontent_files() or
|
||||
update_clang() or
|
||||
|
@ -122,6 +127,27 @@ def install_sysroot():
|
|||
subprocess.check_call([sys.executable, install, '--arch', arch])
|
||||
|
||||
|
||||
def install_aarch64_bintools():
|
||||
destination = os.path.join(VENDOR_DIR, 'binutils-aarch64')
|
||||
if os.path.exists(destination):
|
||||
return
|
||||
|
||||
url = DEBIAN_MIRROR + BINTOOLS_NAME
|
||||
deb_name = 'binutils-aarch64.deb'
|
||||
with open(deb_name, 'wb+') as f:
|
||||
with contextlib.closing(urllib2.urlopen(url)) as u:
|
||||
while True:
|
||||
chunk = u.read(1024*1024)
|
||||
if not len(chunk):
|
||||
break
|
||||
f.write(chunk)
|
||||
|
||||
env = os.environ.copy()
|
||||
env['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
|
||||
subprocess.call(['dpkg', '-x', deb_name, destination])
|
||||
rm_f(deb_name)
|
||||
|
||||
|
||||
def update_toolchain_json():
|
||||
env = os.environ.copy()
|
||||
env['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
|
||||
|
|
Загрузка…
Ссылка в новой задаче