Skip to content

Commit

Permalink
Build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislas Polu committed Oct 20, 2014
1 parent 6b58573 commit 5eb53a7
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "vendor/brightray"]
path = vendor/brightray
url = https://github.com/brightray/brightray.git
[submodule "vendor/depot_tools"]
path = vendor/depot_tools
url = https://chromium.googlesource.com/chromium/tools/depot_tools.git
12 changes: 12 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@
['OS=="linux"', {
'target_defaults': {
'cflags': [ '-g' ],
'conditions': [
['target_arch=="ia32"', {
'target_conditions': [
['_toolset=="target"', {
'ldflags': [
# Workaround for linker OOM.
'-Wl,--no-keep-memory',
],
}],
],
}],
],
},
}],
],
Expand Down
5 changes: 5 additions & 0 deletions scripts/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def main():
update_submodules()
bootstrap_brightray(args.url)
create_chrome_version_h()
update_thrust_shell()


def parse_args():
Expand Down Expand Up @@ -65,6 +66,10 @@ def create_chrome_version_h():
if f.read() != content:
f.write(content)

def update_thrust_shell():
update = os.path.join(SOURCE_ROOT, 'scripts', 'update.py')
execute([sys.executable, update])


if __name__ == '__main__':
sys.exit(main())
43 changes: 43 additions & 0 deletions scripts/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python

import argparse
import os
import subprocess
import sys


CONFIGURATIONS = ['Release', 'Debug']
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))


def main():
os.chdir(SOURCE_ROOT)

ninja = os.path.join('vendor', 'depot_tools', 'ninja')
if sys.platform == 'win32':
ninja += '.exe'

args = parse_args()
for config in args.configuration:
build_path = os.path.join('out', config)
ret = subprocess.call([ninja, '-C', build_path, args.target])
if ret != 0:
sys.exit(ret)


def parse_args():
parser = argparse.ArgumentParser(description='Build thrust_shell')
parser.add_argument('-c', '--configuration',
help='Build with Release or Debug configuration',
nargs='+',
default=CONFIGURATIONS,
required=False)
parser.add_argument('-t', '--target',
help='Build specified target',
default='thrust_shell',
required=False)
return parser.parse_args()


if __name__ == '__main__':
sys.exit(main())
42 changes: 42 additions & 0 deletions scripts/update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python

import os
import subprocess
import sys

from config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, DIST_ARCH


SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))


def main():
os.chdir(SOURCE_ROOT)

update_gyp()


def update_gyp():
gyp = os.path.join('vendor', 'brightray', 'vendor', 'gyp', 'gyp_main.py')
python = sys.executable
arch = DIST_ARCH
if sys.platform == 'darwin':
# Only have 64bit build on OS X.
arch = 'x64'
elif sys.platform in ['cygwin', 'win32']:
# Only have 32bit build on Windows.
arch = 'ia32'
if sys.platform == 'cygwin':
# Force using win32 python on cygwin.
python = os.path.join('vendor', 'python_26', 'python.exe')

ret = subprocess.call([python, gyp,
'-f', 'ninja', '--depth', '.', 'thrust_shell.gyp',
'-Icommon.gypi', '-Ivendor/brightray/brightray.gypi',
'-Dtarget_arch={0}'.format(arch)])
if ret != 0:
sys.exit(ret)


if __name__ == '__main__':
sys.exit(main())
1 change: 1 addition & 0 deletions vendor/depot_tools
Submodule depot_tools added at 80c51a

0 comments on commit 5eb53a7

Please sign in to comment.