OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium 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 # This script is wrapper for Chromium that adds some support for how GYP | 7 # This script is wrapper for Chromium that adds some support for how GYP |
8 # is invoked by Chromium beyond what can be done in the gclient hooks. | 8 # is invoked by Chromium beyond what can be done in the gclient hooks. |
9 | 9 |
10 import glob | 10 import glob |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 def RunGN(supplemental_includes): | 125 def RunGN(supplemental_includes): |
126 """Runs GN, returning True if it succeeded, printing an error and returning | 126 """Runs GN, returning True if it succeeded, printing an error and returning |
127 false if not.""" | 127 false if not.""" |
128 | 128 |
129 # The binaries in platform-specific subdirectories in src/tools/gn/bin. | 129 # The binaries in platform-specific subdirectories in src/tools/gn/bin. |
130 gnpath = SRC_DIR + '/tools/gn/bin/' | 130 gnpath = SRC_DIR + '/tools/gn/bin/' |
131 if sys.platform == 'win32': | 131 if sys.platform == 'win32': |
132 gnpath += 'win/gn.exe' | 132 gnpath += 'win/gn.exe' |
133 elif sys.platform.startswith('linux'): | 133 elif sys.platform.startswith('linux'): |
134 # On Linux we have 32-bit and 64-bit versions. Checking /sbin/init avoids | 134 # On Linux we have 32-bit and 64-bit versions. |
135 # uname's confusion when running a 32-bit userland on a 64-bit kernel. | 135 if subprocess.check_output(["getconf", "LONG_BIT"]).find("64") >= 0: |
136 if subprocess.check_output(["file", "/sbin/init"]).find("ELF 64-bit") >= 0: | |
137 gnpath += 'linux/gn' | 136 gnpath += 'linux/gn' |
138 else: | 137 else: |
139 gnpath += 'linux/gn32' | 138 gnpath += 'linux/gn32' |
140 elif sys.platform == 'darwin': | 139 elif sys.platform == 'darwin': |
141 gnpath += 'mac/gn' | 140 gnpath += 'mac/gn' |
142 else: | 141 else: |
143 print 'Unknown platform for GN: ', sys.platform | 142 print 'Unknown platform for GN: ', sys.platform |
144 return False | 143 return False |
145 | 144 |
146 print 'Generating gyp files from GN...' | 145 print 'Generating gyp files from GN...' |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 # to enfore syntax checking. | 264 # to enfore syntax checking. |
266 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') | 265 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') |
267 if syntax_check and int(syntax_check): | 266 if syntax_check and int(syntax_check): |
268 args.append('--check') | 267 args.append('--check') |
269 | 268 |
270 print 'Updating projects from gyp files...' | 269 print 'Updating projects from gyp files...' |
271 sys.stdout.flush() | 270 sys.stdout.flush() |
272 | 271 |
273 # Off we go... | 272 # Off we go... |
274 sys.exit(gyp.main(args)) | 273 sys.exit(gyp.main(args)) |
OLD | NEW |