OLD | NEW |
| (Empty) |
1 #!/usr/bin/python | |
2 # Copyright 2009 The Native Client Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 """This script is wrapper for NaCl that adds some support for how GYP | |
7 is invoked by NaCl beyond what can be done it the gclient hooks.""" | |
8 | |
9 import glob | |
10 import os | |
11 import shlex | |
12 import sys | |
13 | |
14 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | |
15 GCLIENT_ROOT = os.path.dirname(os.path.dirname(SCRIPT_DIR)) | |
16 GYP_DIR = os.path.join(GCLIENT_ROOT, 'tools', 'gyp') | |
17 sys.path.insert(0, os.path.join(GYP_DIR, 'pylib')) | |
18 | |
19 import gyp | |
20 | |
21 def main(): | |
22 print 'Updating projects from gyp files...' | |
23 os.chdir(GCLIENT_ROOT) | |
24 | |
25 if not os.environ.get('GYP_GENERATORS'): | |
26 os.environ['GYP_GENERATORS'] = 'ninja' | |
27 | |
28 args = sys.argv[1:] | |
29 | |
30 # If we didn't get a file, check an env var, and then fall back to | |
31 # assuming 'native_client/build/all.gyp' | |
32 if len(args) == 0: | |
33 args += shlex.split(os.environ.get('NACL_GYP_FILE', | |
34 'native_client/build/all.gyp')) | |
35 | |
36 # Add settings that are only included in the standalone NaCl Gyp | |
37 # build and won't get included when NaCl is built as part of another | |
38 # project, such as Chrome. configs.gypi includes compiler | |
39 # configuration that arguably should be built into Gyp; Chrome | |
40 # provides its own conflicting version in its common.gypi. | |
41 args += ['-I', 'native_client/build/configs.gypi'] | |
42 # Enable warnings that we don't necessarily want to enable for | |
43 # Chrome source that is built as NaCl untrusted code. | |
44 args += ['-I', 'native_client/build/standalone_flags.gypi'] | |
45 | |
46 # Pick depth explicitly. | |
47 args += ['--depth', '.'] | |
48 | |
49 # Building NaCl as standalone (not as part of Chrome) | |
50 args += ['-D', 'nacl_standalone=1'] | |
51 | |
52 # Off we go... | |
53 return gyp.main(args) | |
54 | |
55 if __name__ == '__main__': | |
56 sys.exit(main()) | |
OLD | NEW |