Support cross-compiling

This commit is contained in:
Cheng Zhao 2015-07-01 07:47:21 +00:00
parent fdf7452ba9
commit 3d88d56965
6 changed files with 214 additions and 74 deletions

View file

@ -20,29 +20,18 @@ 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':
try:
target_arch_path = os.path.join(__file__, '..', '..', '..', 'vendor',
'brightray', 'vendor', 'download',
'libchromiumcontent', '.target_arch')
with open(os.path.normpath(target_arch_path)) as f:
return f.read().strip()
except IOError as e:
if e.errno != errno.ENOENT:
raise
# Build 32bit by default.
try:
target_arch_path = os.path.join(__file__, '..', '..', '..', 'vendor',
'brightray', 'vendor', 'download',
'libchromiumcontent', '.target_arch')
with open(os.path.normpath(target_arch_path)) as f:
return f.read().strip()
except IOError as e:
if e.errno != errno.ENOENT:
raise
if PLATFORM == 'win32':
return 'ia32'
# Maybe we will support other platforms in future.
else:
return 'x64'