OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 The Dart Authors. All rights reserved. | 3 # Copyright (c) 2012 The Dart Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """ | 7 """ |
8 Invoke gyp to generate build files for building the Dart VM. | 8 Invoke gyp to generate build files for building the Dart VM. |
9 """ | 9 """ |
10 | 10 |
11 import os | 11 import os |
12 import subprocess | 12 import subprocess |
13 import sys | 13 import sys |
14 | 14 |
| 15 SCRIPT_DIR = os.path.dirname(sys.argv[0]) |
| 16 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) |
| 17 |
15 def execute(args): | 18 def execute(args): |
16 process = subprocess.Popen(args) | 19 process = subprocess.Popen(args, cwd=DART_ROOT) |
17 process.wait() | 20 process.wait() |
18 return process.returncode | 21 return process.returncode |
19 | 22 |
20 def main(): | 23 def main(): |
21 component = 'all' | 24 component = 'all' |
22 if len(sys.argv) == 2: | 25 if len(sys.argv) == 2: |
23 component = sys.argv[1] | 26 component = sys.argv[1] |
24 | 27 |
25 component_gyp_files = { | 28 component_gyp_files = { |
26 'all' : 'dart/dart.gyp', | 29 'all' : 'dart.gyp', |
27 'runtime' : 'dart/runtime/dart-runtime.gyp', | 30 'runtime' : 'runtime/dart-runtime.gyp', |
28 } | 31 } |
29 args = ['python', '-S', 'dart/third_party/gyp/gyp_main.py', | 32 args = ['python', '-S', 'third_party/gyp/gyp_main.py', |
30 '--depth=dart', '-Idart/tools/gyp/all.gypi', | 33 '--depth=.', '-Itools/gyp/all.gypi', |
31 component_gyp_files[component]] | 34 component_gyp_files[component]] |
32 | 35 |
33 if sys.platform == 'win32': | 36 if sys.platform == 'win32': |
34 # Generate Visual Studio 2010 compatible files by default. | 37 # Generate Visual Studio 2010 compatible files by default. |
35 if not os.environ.get('GYP_MSVS_VERSION'): | 38 if not os.environ.get('GYP_MSVS_VERSION'): |
36 args.extend(['-G', 'msvs_version=2010']) | 39 args.extend(['-G', 'msvs_version=2010']) |
37 | 40 |
38 sys.exit(execute(args)) | 41 sys.exit(execute(args)) |
39 | 42 |
40 if __name__ == '__main__': | 43 if __name__ == '__main__': |
41 main() | 44 main() |
OLD | NEW |