2014-01-31 04:18:30 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2015-04-11 10:26:15 +00:00
|
|
|
import errno
|
2015-04-11 09:58:19 +00:00
|
|
|
import os
|
2014-06-04 15:24:38 +00:00
|
|
|
import platform
|
|
|
|
import sys
|
|
|
|
|
2015-04-11 09:58:19 +00:00
|
|
|
|
2014-12-18 00:25:25 +00:00
|
|
|
BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
|
2015-04-10 11:00:06 +00:00
|
|
|
LIBCHROMIUMCONTENT_COMMIT = 'f1ad1412461ba3345a27cfe935ffc872dba0ac5b'
|
2014-06-04 15:24:38 +00:00
|
|
|
|
2015-04-11 09:30:52 +00:00
|
|
|
PLATFORM = {
|
2014-06-04 15:24:38 +00:00
|
|
|
'cygwin': 'win32',
|
|
|
|
'darwin': 'darwin',
|
|
|
|
'linux2': 'linux',
|
|
|
|
'win32': 'win32',
|
|
|
|
}[sys.platform]
|
2014-12-08 17:00:35 +00:00
|
|
|
|
|
|
|
verbose_mode = False
|
|
|
|
|
2015-04-11 09:58:19 +00:00
|
|
|
|
|
|
|
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':
|
2015-04-11 10:26:15 +00:00
|
|
|
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.
|
|
|
|
return 'ia32'
|
2015-04-11 09:58:19 +00:00
|
|
|
# Maybe we will support other platforms in future.
|
|
|
|
else:
|
|
|
|
return 'x64'
|
|
|
|
|
|
|
|
|
2014-12-08 17:00:35 +00:00
|
|
|
def enable_verbose_mode():
|
|
|
|
print 'Running in verbose mode'
|
|
|
|
global verbose_mode
|
|
|
|
verbose_mode = True
|
|
|
|
|
2015-04-11 09:58:19 +00:00
|
|
|
|
2014-12-08 17:00:35 +00:00
|
|
|
def is_verbose_mode():
|
|
|
|
return verbose_mode
|