win: Build with the arch chosen by user

This commit is contained in:
Cheng Zhao 2015-04-11 17:58:19 +08:00
parent 1a6832d849
commit de016e72a5
5 changed files with 38 additions and 29 deletions

View file

@ -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