OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2012 the V8 project authors. All rights reserved. | 3 # Copyright 2012 the V8 project authors. All rights reserved. |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 16 matching lines...) Expand all Loading... |
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | 29 |
30 # This script is wrapper for V8 that adds some support for how GYP | 30 # This script is wrapper for V8 that adds some support for how GYP |
31 # is invoked by V8 beyond what can be done in the gclient hooks. | 31 # is invoked by V8 beyond what can be done in the gclient hooks. |
32 | 32 |
33 import glob | 33 import glob |
34 import os | 34 import os |
35 import platform | 35 import platform |
36 import shlex | 36 import shlex |
| 37 import subprocess |
37 import sys | 38 import sys |
38 | 39 |
39 script_dir = os.path.dirname(os.path.realpath(__file__)) | 40 script_dir = os.path.dirname(os.path.realpath(__file__)) |
40 v8_root = os.path.abspath(os.path.join(script_dir, os.pardir)) | 41 v8_root = os.path.abspath(os.path.join(script_dir, os.pardir)) |
41 | 42 |
42 sys.path.insert(0, os.path.join(v8_root, 'build', 'gyp', 'pylib')) | 43 sys.path.insert(0, os.path.join(v8_root, 'build', 'gyp', 'pylib')) |
43 import gyp | 44 import gyp |
44 | 45 |
45 # Add paths so that pymod_do_main(...) can import files. | 46 # Add paths so that pymod_do_main(...) can import files. |
46 sys.path.insert( | 47 sys.path.insert( |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 # Optionally add supplemental .gypi files if present. | 101 # Optionally add supplemental .gypi files if present. |
101 supplements = glob.glob(os.path.join(v8_root, '*', 'supplement.gypi')) | 102 supplements = glob.glob(os.path.join(v8_root, '*', 'supplement.gypi')) |
102 for supplement in supplements: | 103 for supplement in supplements: |
103 AddInclude(supplement) | 104 AddInclude(supplement) |
104 | 105 |
105 return result | 106 return result |
106 | 107 |
107 | 108 |
108 def run_gyp(args): | 109 def run_gyp(args): |
109 rc = gyp.main(args) | 110 rc = gyp.main(args) |
| 111 |
| 112 # Check for landmines (reasons to clobber the build). This must be run here, |
| 113 # rather than a separate runhooks step so that any environment modifications |
| 114 # from above are picked up. |
| 115 print 'Running build/landmines.py...' |
| 116 subprocess.check_call( |
| 117 [sys.executable, os.path.join(script_dir, 'landmines.py')]) |
| 118 |
110 if rc != 0: | 119 if rc != 0: |
111 print 'Error running GYP' | 120 print 'Error running GYP' |
112 sys.exit(rc) | 121 sys.exit(rc) |
113 | 122 |
114 | 123 |
115 if __name__ == '__main__': | 124 if __name__ == '__main__': |
116 args = sys.argv[1:] | 125 args = sys.argv[1:] |
117 | 126 |
118 if 'SKIP_V8_GYP_ENV' not in os.environ: | 127 if 'SKIP_V8_GYP_ENV' not in os.environ: |
119 # Update the environment based on v8.gyp_env | 128 # Update the environment based on v8.gyp_env |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 if platform.system() == 'Linux' and gyp_generators != 'ninja': | 171 if platform.system() == 'Linux' and gyp_generators != 'ninja': |
163 # Work around for crbug.com/331475. | 172 # Work around for crbug.com/331475. |
164 for f in glob.glob(os.path.join(v8_root, 'out', 'Makefile.*')): | 173 for f in glob.glob(os.path.join(v8_root, 'out', 'Makefile.*')): |
165 os.unlink(f) | 174 os.unlink(f) |
166 # --generator-output defines where the Makefile goes. | 175 # --generator-output defines where the Makefile goes. |
167 gyp_args.append('--generator-output=out') | 176 gyp_args.append('--generator-output=out') |
168 # -Goutput_dir defines where the build output goes, relative to the | 177 # -Goutput_dir defines where the build output goes, relative to the |
169 # Makefile. Set it to . so that the build output doesn't end up in out/out. | 178 # Makefile. Set it to . so that the build output doesn't end up in out/out. |
170 gyp_args.append('-Goutput_dir=.') | 179 gyp_args.append('-Goutput_dir=.') |
171 run_gyp(gyp_args) | 180 run_gyp(gyp_args) |
OLD | NEW |