Add logic to bundle native mksnapshot for arm/arm64

This commit is contained in:
John Kleinschmidt 2018-04-02 16:54:39 -04:00
Родитель 23bb3bd963
Коммит 7acbbf2ef3
4 изменённых файлов: 53 добавлений и 13 удалений

2
.gitignore поставляемый
Просмотреть файл

@ -40,6 +40,8 @@
/vendor/llvm/
/vendor/npm/
/vendor/python_26/
/vendor/native_mksnapshot
/vendor/LICENSES.chromium.html
node_modules/
SHASUMS256.txt
**/package-lock.json

Просмотреть файл

@ -40,6 +40,9 @@ def main():
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,
@ -216,6 +219,15 @@ def download_mips64el_toolchain():
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')

Просмотреть файл

@ -24,6 +24,7 @@ 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%']
@ -141,7 +142,6 @@ def copy_chrome_binary(binary):
shutil.copyfile(src, dest)
os.chmod(dest, os.stat(dest).st_mode | stat.S_IEXEC)
def copy_vcruntime_binaries():
with _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
r"SOFTWARE\Microsoft\VisualStudio\14.0\Setup\VC", 0,
@ -260,17 +260,39 @@ def create_dist_zip():
def create_chrome_binary_zip(binary, version):
dist_name = get_zip_name(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):
files = ['LICENSE', 'LICENSES.chromium.html']
if PLATFORM == 'win32':
files += [binary + '.exe']
else:
files += [binary]
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)
os.chmod(dest, os.stat(dest).st_mode | stat.S_IEXEC)
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)

Просмотреть файл

@ -85,12 +85,16 @@ def main():
upload_electron(github, release, os.path.join(DIST_DIR, ffmpeg),
args.upload_to_s3)
# Upload chromedriver and mksnapshot for minor version update.
if parse_version(args.version)[2] == '0':
chromedriver = get_zip_name('chromedriver', ELECTRON_VERSION)
upload_electron(github, release, os.path.join(DIST_DIR, chromedriver),
args.upload_to_s3)
mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION)
chromedriver = get_zip_name('chromedriver', ELECTRON_VERSION)
upload_electron(github, release, os.path.join(DIST_DIR, chromedriver),
args.upload_to_s3)
mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION)
upload_electron(github, release, os.path.join(DIST_DIR, mksnapshot),
args.upload_to_s3)
if get_target_arch().startswith('arm'):
# Upload the x64 binary for arm/arm64 mksnapshot
mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION, 'x64')
upload_electron(github, release, os.path.join(DIST_DIR, mksnapshot),
args.upload_to_s3)