From f5e6c62418deef6539393019a0eb207d5e986ecd Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 8 Apr 2015 20:08:27 +0800 Subject: [PATCH] linux: Fix create distribution for chromedriver --- script/create-dist.py | 29 +++++++++++++++++++++-------- script/lib/util.py | 2 +- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/script/create-dist.py b/script/create-dist.py index 64da6b045ef6..e3ff67ed463a 100755 --- a/script/create-dist.py +++ b/script/create-dist.py @@ -5,6 +5,7 @@ import re import shutil import subprocess import sys +import stat from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, TARGET_PLATFORM, \ DIST_ARCH @@ -17,6 +18,8 @@ ATOM_SHELL_VERSION = get_atom_shell_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', 'brightray', 'vendor', + 'download', 'libchromiumcontent', 'static_library') SYMBOL_NAME = { 'darwin': 'libchromiumcontent.dylib.dSYM', @@ -107,12 +110,20 @@ def copy_binaries(): def copy_chromedriver(): - build = os.path.join(SOURCE_ROOT, 'script', 'build.py') - execute([sys.executable, build, '-c', 'Release', '-t', 'copy_chromedriver']) - binary = 'chromedriver' if TARGET_PLATFORM == 'win32': - binary += '.exe' - shutil.copy2(os.path.join(OUT_DIR, binary), DIST_DIR) + chromedriver = 'chromedriver.exe' + else: + chromedriver = 'chromedriver' + src = os.path.join(CHROMIUM_DIR, chromedriver) + dest = os.path.join(DIST_DIR, chromedriver) + + # Copy file and keep the executable bit. + shutil.copyfile(src, dest) + os.chmod(dest, os.stat(dest).st_mode | stat.S_IEXEC) + + # Fix the linking with boringssl. + if TARGET_PLATFORM == 'linux': + execute(['chrpath', '-r', '$ORIGIN', dest]) def copy_license(): @@ -173,9 +184,11 @@ def create_chromedriver_zip(): with scoped_cwd(DIST_DIR): files = ['LICENSE'] if TARGET_PLATFORM == 'win32': - files += ['chromedriver.exe'] - else: - files += ['chromedriver'] + files += ['chromedriver.exe', 'boringssl.dll'] + elif TARGET_PLATFORM == 'darwin': + files += ['chromedriver', 'libboringssl.dylib'] + elif TARGET_PLATFORM == 'linux': + files += ['chromedriver', 'libboringssl.so'] make_zip(zip_file, files, []) diff --git a/script/lib/util.py b/script/lib/util.py index 174c65a83d95..04ee9817e28d 100644 --- a/script/lib/util.py +++ b/script/lib/util.py @@ -162,7 +162,7 @@ def get_chromedriver_version(): SOURCE_ROOT = os.path.abspath(os.path.join(__file__, '..', '..', '..')) chromedriver = os.path.join(SOURCE_ROOT, 'out', 'R', 'chromedriver') output = subprocess.check_output([chromedriver, '-v']).strip() - return 'v' + output[13:] + return 'v' + output[13:output.rfind(' ')] def parse_version(version):