Skip to content

Commit 5eb53a7

Browse files
author
Stanislas Polu
committed
Build scripts
1 parent 6b58573 commit 5eb53a7

File tree

6 files changed

+106
-0
lines changed

6 files changed

+106
-0
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "vendor/brightray"]
22
path = vendor/brightray
33
url = https://github.com/brightray/brightray.git
4+
[submodule "vendor/depot_tools"]
5+
path = vendor/depot_tools
6+
url = https://chromium.googlesource.com/chromium/tools/depot_tools.git

common.gypi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@
122122
['OS=="linux"', {
123123
'target_defaults': {
124124
'cflags': [ '-g' ],
125+
'conditions': [
126+
['target_arch=="ia32"', {
127+
'target_conditions': [
128+
['_toolset=="target"', {
129+
'ldflags': [
130+
# Workaround for linker OOM.
131+
'-Wl,--no-keep-memory',
132+
],
133+
}],
134+
],
135+
}],
136+
],
125137
},
126138
}],
127139
],

scripts/bootstrap.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def main():
2727
update_submodules()
2828
bootstrap_brightray(args.url)
2929
create_chrome_version_h()
30+
update_thrust_shell()
3031

3132

3233
def parse_args():
@@ -65,6 +66,10 @@ def create_chrome_version_h():
6566
if f.read() != content:
6667
f.write(content)
6768

69+
def update_thrust_shell():
70+
update = os.path.join(SOURCE_ROOT, 'scripts', 'update.py')
71+
execute([sys.executable, update])
72+
6873

6974
if __name__ == '__main__':
7075
sys.exit(main())

scripts/build.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env python
2+
3+
import argparse
4+
import os
5+
import subprocess
6+
import sys
7+
8+
9+
CONFIGURATIONS = ['Release', 'Debug']
10+
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
11+
12+
13+
def main():
14+
os.chdir(SOURCE_ROOT)
15+
16+
ninja = os.path.join('vendor', 'depot_tools', 'ninja')
17+
if sys.platform == 'win32':
18+
ninja += '.exe'
19+
20+
args = parse_args()
21+
for config in args.configuration:
22+
build_path = os.path.join('out', config)
23+
ret = subprocess.call([ninja, '-C', build_path, args.target])
24+
if ret != 0:
25+
sys.exit(ret)
26+
27+
28+
def parse_args():
29+
parser = argparse.ArgumentParser(description='Build thrust_shell')
30+
parser.add_argument('-c', '--configuration',
31+
help='Build with Release or Debug configuration',
32+
nargs='+',
33+
default=CONFIGURATIONS,
34+
required=False)
35+
parser.add_argument('-t', '--target',
36+
help='Build specified target',
37+
default='thrust_shell',
38+
required=False)
39+
return parser.parse_args()
40+
41+
42+
if __name__ == '__main__':
43+
sys.exit(main())

scripts/update.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env python
2+
3+
import os
4+
import subprocess
5+
import sys
6+
7+
from config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, DIST_ARCH
8+
9+
10+
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
11+
12+
13+
def main():
14+
os.chdir(SOURCE_ROOT)
15+
16+
update_gyp()
17+
18+
19+
def update_gyp():
20+
gyp = os.path.join('vendor', 'brightray', 'vendor', 'gyp', 'gyp_main.py')
21+
python = sys.executable
22+
arch = DIST_ARCH
23+
if sys.platform == 'darwin':
24+
# Only have 64bit build on OS X.
25+
arch = 'x64'
26+
elif sys.platform in ['cygwin', 'win32']:
27+
# Only have 32bit build on Windows.
28+
arch = 'ia32'
29+
if sys.platform == 'cygwin':
30+
# Force using win32 python on cygwin.
31+
python = os.path.join('vendor', 'python_26', 'python.exe')
32+
33+
ret = subprocess.call([python, gyp,
34+
'-f', 'ninja', '--depth', '.', 'thrust_shell.gyp',
35+
'-Icommon.gypi', '-Ivendor/brightray/brightray.gypi',
36+
'-Dtarget_arch={0}'.format(arch)])
37+
if ret != 0:
38+
sys.exit(ret)
39+
40+
41+
if __name__ == '__main__':
42+
sys.exit(main())

vendor/depot_tools

Submodule depot_tools added at 80c51ae

0 commit comments

Comments
 (0)