2013-06-24 11:24:30 +04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2013-09-27 06:21:27 +04:00
|
|
|
import os
|
2013-06-24 11:24:30 +04:00
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
2014-08-03 19:13:04 +04:00
|
|
|
from lib.config import DIST_ARCH
|
|
|
|
|
2013-06-24 11:24:30 +04:00
|
|
|
|
2013-07-01 11:49:52 +04:00
|
|
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
2013-06-24 11:24:30 +04:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
os.chdir(SOURCE_ROOT)
|
|
|
|
|
2014-05-18 19:35:07 +04:00
|
|
|
update_external_binaries()
|
2015-04-02 18:03:23 +03:00
|
|
|
return update_gyp()
|
2013-06-24 11:24:30 +04:00
|
|
|
|
|
|
|
|
2014-05-18 19:35:07 +04:00
|
|
|
def update_external_binaries():
|
|
|
|
uf = os.path.join('script', 'update-external-binaries.py')
|
2014-05-18 19:03:46 +04:00
|
|
|
subprocess.check_call([sys.executable, uf])
|
2013-06-28 12:12:40 +04:00
|
|
|
|
2013-06-24 11:24:30 +04:00
|
|
|
|
|
|
|
def update_gyp():
|
2015-04-02 18:03:23 +03:00
|
|
|
target_arch = DIST_ARCH
|
2014-08-03 19:13:04 +04:00
|
|
|
if sys.platform == 'darwin':
|
|
|
|
# Only have 64bit build on OS X.
|
2015-04-02 18:03:23 +03:00
|
|
|
target_arch = 'x64'
|
2014-07-31 22:58:45 +04:00
|
|
|
elif sys.platform in ['cygwin', 'win32']:
|
2014-08-03 19:13:04 +04:00
|
|
|
# Only have 32bit build on Windows.
|
2015-04-02 18:03:23 +03:00
|
|
|
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.
|
|
|
|
# In order to work around this, we decided to generate the configuration
|
|
|
|
# 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.
|
|
|
|
return (run_gyp(target_arch, 0) or run_gyp(target_arch, 1))
|
|
|
|
|
|
|
|
|
|
|
|
def run_gyp(target_arch, component):
|
|
|
|
python = sys.executable
|
|
|
|
if sys.platform == 'cygwin':
|
|
|
|
# Force using win32 python on cygwin.
|
|
|
|
python = os.path.join('vendor', 'python_26', 'python.exe')
|
|
|
|
gyp = os.path.join('vendor', 'brightray', 'vendor', 'gyp', 'gyp_main.py')
|
2015-04-08 14:19:40 +03:00
|
|
|
defines = [
|
|
|
|
'-Dlibchromiumcontent_component={0}'.format(component),
|
|
|
|
'-Dtarget_arch={0}'.format(target_arch),
|
|
|
|
'-Dlibrary=static_library',
|
|
|
|
]
|
|
|
|
return subprocess.call([python, gyp, '-f', 'ninja', '--depth', '.',
|
|
|
|
'atom.gyp', '-Icommon.gypi'] + defines)
|
2013-06-24 11:24:30 +04:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|