win: Build with the arch chosen by user

This commit is contained in:
Cheng Zhao 2015-04-11 17:58:19 +08:00
Родитель 1a6832d849
Коммит de016e72a5
5 изменённых файлов: 38 добавлений и 29 удалений

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

@ -8,7 +8,7 @@ import sys
import stat
from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, PLATFORM, \
DIST_ARCH
get_target_arch
from lib.util import scoped_cwd, rm_rf, get_atom_shell_version, make_zip, \
execute, get_chromedriver_version
@ -155,7 +155,7 @@ def create_symbols():
def create_dist_zip():
dist_name = 'atom-shell-{0}-{1}-{2}.zip'.format(ATOM_SHELL_VERSION,
PLATFORM, DIST_ARCH)
PLATFORM, get_target_arch())
zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)
with scoped_cwd(DIST_DIR):
@ -168,7 +168,7 @@ def create_dist_zip():
def create_chromedriver_zip():
dist_name = 'chromedriver-{0}-{1}-{2}.zip'.format(get_chromedriver_version(),
PLATFORM, DIST_ARCH)
PLATFORM, get_target_arch())
zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)
with scoped_cwd(DIST_DIR):
@ -183,7 +183,7 @@ def create_chromedriver_zip():
def create_symbols_zip():
dist_name = 'atom-shell-{0}-{1}-{2}-symbols.zip'.format(ATOM_SHELL_VERSION,
PLATFORM,
DIST_ARCH)
get_target_arch())
zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)
with scoped_cwd(DIST_DIR):

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

@ -1,22 +1,13 @@
#!/usr/bin/env python
import os
import platform
import sys
BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'f1ad1412461ba3345a27cfe935ffc872dba0ac5b'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
}[sys.platform]
DIST_ARCH = {
'32bit': 'ia32',
'64bit': 'x64',
}[ARCH]
PLATFORM = {
'cygwin': 'win32',
'darwin': 'darwin',
@ -26,10 +17,35 @@ PLATFORM = {
verbose_mode = False
def get_target_arch():
# Always build 64bit on OS X.
if PLATFORM == 'darwin':
return 'x64'
# Only build for host's arch on Linux.
elif PLATFORM == 'linux':
if platform.architecture()[0] == '32bit':
return 'ia32'
else:
return 'x64'
# On Windows it depends on user.
elif PLATFORM == 'win32':
target_arch_path = os.path.join(__file__, '..', '..', '..', 'vendor',
'brightray', 'vendor', 'download',
'libchromiumcontent', '.target_arch')
with open(os.path.normpath(target_arch_path)) as f:
target_arch = f.read().strip()
return target_arch
# Maybe we will support other platforms in future.
else:
return 'x64'
def enable_verbose_mode():
print 'Running in verbose mode'
global verbose_mode
verbose_mode = True
def is_verbose_mode():
return verbose_mode

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

@ -4,7 +4,7 @@ import os
import subprocess
import sys
from lib.config import DIST_ARCH
from lib.config import get_target_arch
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
@ -23,14 +23,6 @@ def update_external_binaries():
def update_gyp():
target_arch = DIST_ARCH
if sys.platform == 'darwin':
# Only have 64bit build on OS X.
target_arch = 'x64'
elif sys.platform in ['cygwin', 'win32']:
# Only have 32bit build on Windows.
target_arch = 'ia32'
# 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.
@ -38,6 +30,7 @@ def update_gyp():
# 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))

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

@ -7,7 +7,7 @@ import subprocess
import sys
import tempfile
from lib.config import DIST_ARCH, PLATFORM
from lib.config import PLATFORM, get_target_arch
from lib.util import execute, get_atom_shell_version, parse_version, \
get_chromedriver_version, scoped_cwd
from lib.github import GitHub
@ -22,13 +22,13 @@ OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
DIST_NAME = 'atom-shell-{0}-{1}-{2}.zip'.format(ATOM_SHELL_VERSION,
PLATFORM,
DIST_ARCH)
get_target_arch())
SYMBOLS_NAME = 'atom-shell-{0}-{1}-{2}-symbols.zip'.format(ATOM_SHELL_VERSION,
PLATFORM,
DIST_ARCH)
get_target_arch())
CHROMEDRIVER_NAME = 'chromedriver-{0}-{1}-{2}.zip'.format(CHROMEDRIVER_VERSION,
PLATFORM,
DIST_ARCH)
get_target_arch())
def main():

2
vendor/brightray поставляемый

@ -1 +1 @@
Subproject commit f44a3834690c010a1841cde92ca5e4798b1c9d2f
Subproject commit 33367e86d33f2ba8bf3d9dc796b469e6d5855e20