| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 The Dart project authors. All rights reserved. | 2 # Copyright 2016 The Dart project authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import argparse | 6 import argparse |
| 7 import multiprocessing | 7 import multiprocessing |
| 8 import os | 8 import os |
| 9 import subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 has_clang = (host_os != 'win' | 106 has_clang = (host_os != 'win' |
| 107 and args.os not in ['android'] | 107 and args.os not in ['android'] |
| 108 and not (gn_args['target_os'] == 'linux' and | 108 and not (gn_args['target_os'] == 'linux' and |
| 109 gn_args['host_cpu'] == 'x86') | 109 gn_args['host_cpu'] == 'x86') |
| 110 and not gn_args['target_cpu'].startswith('arm') | 110 and not gn_args['target_cpu'].startswith('arm') |
| 111 and not gn_args['target_cpu'].startswith('mips')) | 111 and not gn_args['target_cpu'].startswith('mips')) |
| 112 gn_args['is_clang'] = args.clang and has_clang | 112 gn_args['is_clang'] = args.clang and has_clang |
| 113 | 113 |
| 114 gn_args['is_asan'] = args.asan and gn_args['is_clang'] | 114 gn_args['is_asan'] = args.asan and gn_args['is_clang'] |
| 115 | 115 |
| 116 if args.target_sysroot: | 116 # Setup the user-defined sysroot. |
| 117 gn_args['target_sysroot'] = args.target_sysroot | 117 if gn_args['target_os'] == 'linux' and args.wheezy: |
| 118 gn_args['dart_use_wheezy_sysroot'] = True |
| 119 else: |
| 120 if args.target_sysroot: |
| 121 gn_args['target_sysroot'] = args.target_sysroot |
| 118 | 122 |
| 119 if args.toolchain_prefix: | 123 if args.toolchain_prefix: |
| 120 gn_args['toolchain_prefix'] = args.toolchain_prefix | 124 gn_args['toolchain_prefix'] = args.toolchain_prefix |
| 121 | 125 |
| 122 goma_dir = os.environ.get('GOMA_DIR') | 126 goma_dir = os.environ.get('GOMA_DIR') |
| 123 goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma') | 127 goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma') |
| 124 if args.goma and goma_dir: | 128 if args.goma and goma_dir: |
| 125 gn_args['use_goma'] = True | 129 gn_args['use_goma'] = True |
| 126 gn_args['goma_dir'] = goma_dir | 130 gn_args['goma_dir'] = goma_dir |
| 127 elif args.goma and os.path.exists(goma_home_dir): | 131 elif args.goma and os.path.exists(goma_home_dir): |
| 128 gn_args['use_goma'] = True | 132 gn_args['use_goma'] = True |
| 129 gn_args['goma_dir'] = goma_home_dir | 133 gn_args['goma_dir'] = goma_home_dir |
| 130 else: | 134 else: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 if host_os.startswith('win'): | 194 if host_os.startswith('win'): |
| 191 return '--ide=vs' | 195 return '--ide=vs' |
| 192 elif host_os.startswith('mac'): | 196 elif host_os.startswith('mac'): |
| 193 return '--ide=xcode' | 197 return '--ide=xcode' |
| 194 else: | 198 else: |
| 195 return '--ide=json' | 199 return '--ide=json' |
| 196 | 200 |
| 197 | 201 |
| 198 # Environment variables for default settings. | 202 # Environment variables for default settings. |
| 199 DART_USE_ASAN = "DART_USE_ASAN" | 203 DART_USE_ASAN = "DART_USE_ASAN" |
| 200 | 204 DART_USE_WHEEZY = "DART_USE_WHEEZY" |
| 201 | 205 |
| 202 def use_asan(): | 206 def use_asan(): |
| 203 return DART_USE_ASAN in os.environ | 207 return DART_USE_ASAN in os.environ |
| 204 | 208 |
| 205 | 209 |
| 210 def use_wheezy(): |
| 211 return DART_USE_WHEEZY in os.environ |
| 212 |
| 213 |
| 206 def parse_args(args): | 214 def parse_args(args): |
| 207 args = args[1:] | 215 args = args[1:] |
| 208 parser = argparse.ArgumentParser(description='A script to run `gn gen`.') | 216 parser = argparse.ArgumentParser(description='A script to run `gn gen`.') |
| 209 | 217 |
| 210 parser.add_argument("-v", "--verbose", | 218 parser.add_argument("-v", "--verbose", |
| 211 help='Verbose output.', | 219 help='Verbose output.', |
| 212 default=False, action="store_true") | 220 default=False, action="store_true") |
| 213 parser.add_argument('--mode', '-m', | 221 parser.add_argument('--mode', '-m', |
| 214 type=str, | 222 type=str, |
| 215 help='Build variants (comma-separated).', | 223 help='Build variants (comma-separated).', |
| (...skipping 11 matching lines...) Expand all Loading... |
| 227 'simmips,mips,simarm64,arm64,simdbc,armsimdbc]', | 235 'simmips,mips,simarm64,arm64,simdbc,armsimdbc]', |
| 228 default='x64') | 236 default='x64') |
| 229 parser.add_argument('--asan', | 237 parser.add_argument('--asan', |
| 230 help='Build with ASAN', | 238 help='Build with ASAN', |
| 231 default=use_asan(), | 239 default=use_asan(), |
| 232 action='store_true') | 240 action='store_true') |
| 233 parser.add_argument('--no-asan', | 241 parser.add_argument('--no-asan', |
| 234 help='Disable ASAN', | 242 help='Disable ASAN', |
| 235 dest='asan', | 243 dest='asan', |
| 236 action='store_false') | 244 action='store_false') |
| 245 parser.add_argument('--wheezy', |
| 246 help='Use the Debian wheezy sysroot on Linux', |
| 247 default=use_wheezy(), |
| 248 action='store_true') |
| 249 parser.add_argument('--no-wheezy', |
| 250 help='Disable the Debian wheezy sysroot on Linux', |
| 251 dest='wheezy', |
| 252 action='store_false') |
| 237 parser.add_argument('--goma', | 253 parser.add_argument('--goma', |
| 238 help='Use goma', | 254 help='Use goma', |
| 239 default=True, | 255 default=True, |
| 240 action='store_true') | 256 action='store_true') |
| 241 parser.add_argument('--no-goma', | 257 parser.add_argument('--no-goma', |
| 242 help='Disable goma', | 258 help='Disable goma', |
| 243 dest='goma', | 259 dest='goma', |
| 244 action='store_false') | 260 action='store_false') |
| 245 parser.add_argument('--clang', | 261 parser.add_argument('--clang', |
| 246 help='Use Clang', | 262 help='Use Clang', |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 return 1 | 340 return 1 |
| 325 | 341 |
| 326 endtime = time.time() | 342 endtime = time.time() |
| 327 if args.verbose: | 343 if args.verbose: |
| 328 print ("GN Time: %.3f seconds" % (endtime - starttime)) | 344 print ("GN Time: %.3f seconds" % (endtime - starttime)) |
| 329 return 0 | 345 return 0 |
| 330 | 346 |
| 331 | 347 |
| 332 if __name__ == '__main__': | 348 if __name__ == '__main__': |
| 333 sys.exit(main(sys.argv)) | 349 sys.exit(main(sys.argv)) |
| OLD | NEW |