OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium 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 """A tool to build chrome, executed by buildbot. | 6 """A tool to build chrome, executed by buildbot. |
7 | 7 |
8 When this is run, the current directory (cwd) should be the outer build | 8 When this is run, the current directory (cwd) should be the outer build |
9 directory (e.g., chrome-release/build/). | 9 directory (e.g., chrome-release/build/). |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 (value, keytype) = win32api.RegQueryValueEx(regkey, value) | 30 (value, keytype) = win32api.RegQueryValueEx(regkey, value) |
31 win32api.RegCloseKey(regkey) | 31 win32api.RegCloseKey(regkey) |
32 return value | 32 return value |
33 except win32api.error: | 33 except win32api.error: |
34 return None | 34 return None |
35 | 35 |
36 | 36 |
37 def main_xcode(options, args): | 37 def main_xcode(options, args): |
38 """Interprets options, clobbers object files, and calls xcodebuild. | 38 """Interprets options, clobbers object files, and calls xcodebuild. |
39 """ | 39 """ |
| 40 compiler = options.compiler |
| 41 assert compiler in (None, 'clang') |
| 42 |
40 # Note: this clobbers all targets, not just Debug or Release. | 43 # Note: this clobbers all targets, not just Debug or Release. |
| 44 build_output_dir = os.path.join(os.path.dirname(options.build_dir), |
| 45 'xcodebuild') |
| 46 if compiler == 'clang': |
| 47 build_output_dir = os.path.join(os.path.dirname(options.build_dir), |
| 48 'clang') |
| 49 |
41 if options.clobber: | 50 if options.clobber: |
42 build_output_dir = os.path.join(os.path.dirname(options.build_dir), | |
43 'xcodebuild') | |
44 chromium_utils.RemoveDirectory(build_output_dir) | 51 chromium_utils.RemoveDirectory(build_output_dir) |
45 | 52 |
46 # If the project isn't in args, add all.xcodeproj so simplify configuration. | 53 # If the project isn't in args, add all.xcodeproj to simplify configuration. |
47 command = ['xcodebuild', '-configuration', options.target] | 54 command = ['xcodebuild', '-configuration', options.target] |
48 | 55 |
49 # TODO(mmoss) Support the old 'args' usage until we're confident the master is | 56 # TODO(mmoss) Support the old 'args' usage until we're confident the master is |
50 # switched to passing '--solution' everywhere. | 57 # switched to passing '--solution' everywhere. |
51 if not '-project' in args: | 58 if not '-project' in args: |
52 # TODO(mmoss) Temporary hack to ignore the Windows --solution flag that is | 59 # TODO(mmoss) Temporary hack to ignore the Windows --solution flag that is |
53 # passed to all builders. This can be taken out once the master scripts are | 60 # passed to all builders. This can be taken out once the master scripts are |
54 # updated to only pass platform-appropriate --solution values. | 61 # updated to only pass platform-appropriate --solution values. |
55 if (not options.solution or | 62 if (not options.solution or |
56 os.path.splitext(options.solution)[1] != '.xcodeproj'): | 63 os.path.splitext(options.solution)[1] != '.xcodeproj'): |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 command.extend(['-buildhostsfile', distcc_hosts_file_path]) | 96 command.extend(['-buildhostsfile', distcc_hosts_file_path]) |
90 if os_name == '10_6': | 97 if os_name == '10_6': |
91 # pump --startup will bail if there DISTCC_HOSTS doesn't have valid | 98 # pump --startup will bail if there DISTCC_HOSTS doesn't have valid |
92 # ,cpp entries. Xcode 3.2.x can fall into this trap because it | 99 # ,cpp entries. Xcode 3.2.x can fall into this trap because it |
93 # tries to collect real host status for this step. Work around this | 100 # tries to collect real host status for this step. Work around this |
94 # by manually invoking pump around xcodebuild with enough of | 101 # by manually invoking pump around xcodebuild with enough of |
95 # a DISTCC_HOSTS so it always starts. (radr://8151956) | 102 # a DISTCC_HOSTS so it always starts. (radr://8151956) |
96 env['DISTCC_HOSTS'] = 'dummy,cpp,lzo' | 103 env['DISTCC_HOSTS'] = 'dummy,cpp,lzo' |
97 command.insert(0, "pump") | 104 command.insert(0, "pump") |
98 | 105 |
| 106 if compiler == 'clang': |
| 107 env['CC'] = 'clang++' |
| 108 env['DSTROOT'] = os.path.abspath(build_output_dir) |
| 109 env['OBJROOT'] = os.path.join(env['DSTROOT'], 'obj') |
| 110 env['SYMROOT'] = os.path.join(env['DSTROOT'], 'sym') |
| 111 |
| 112 if options.xcode_target: |
| 113 command.extend(['-target', options.xcode_target]) |
| 114 |
99 # Add on any remaining args | 115 # Add on any remaining args |
100 command.extend(args) | 116 command.extend(args) |
101 | 117 |
102 os.chdir(options.build_dir) | 118 os.chdir(options.build_dir) |
103 result = chromium_utils.RunCommand(command, env=env) | 119 result = chromium_utils.RunCommand(command, env=env) |
104 return result | 120 return result |
105 | 121 |
106 | 122 |
107 def common_linux_settings(command, env, crosstool=None, compiler=None): | 123 def common_linux_settings(command, env, crosstool=None, compiler=None): |
108 """ | 124 """ |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 if chromium_utils.IsWindows(): | 474 if chromium_utils.IsWindows(): |
459 # Windows only. | 475 # Windows only. |
460 option_parser.add_option('', '--no-ib', action='store_true', default=False, | 476 option_parser.add_option('', '--no-ib', action='store_true', default=False, |
461 help='use Visual Studio instead of IncrediBuild') | 477 help='use Visual Studio instead of IncrediBuild') |
462 option_parser.add_option('', '--msvs_version', | 478 option_parser.add_option('', '--msvs_version', |
463 help='VisualStudio version to use') | 479 help='VisualStudio version to use') |
464 if chromium_utils.IsLinux(): | 480 if chromium_utils.IsLinux(): |
465 # For linux to arm cross compile. | 481 # For linux to arm cross compile. |
466 option_parser.add_option('', '--crosstool', default=None, | 482 option_parser.add_option('', '--crosstool', default=None, |
467 help='optional path to crosstool toolset') | 483 help='optional path to crosstool toolset') |
| 484 if chromium_utils.IsMac(): |
| 485 # Mac only. |
| 486 option_parser.add_option('', '--xcode-target', default=None, |
| 487 help='Target from the xcodeproj file') |
468 | 488 |
469 options, args = option_parser.parse_args() | 489 options, args = option_parser.parse_args() |
470 | 490 |
471 if options.build_tool is None: | 491 if options.build_tool is None: |
472 if chromium_utils.IsWindows(): | 492 if chromium_utils.IsWindows(): |
473 main = main_win | 493 main = main_win |
474 elif chromium_utils.IsMac(): | 494 elif chromium_utils.IsMac(): |
475 main = main_xcode | 495 main = main_xcode |
476 elif chromium_utils.IsLinux(): | 496 elif chromium_utils.IsLinux(): |
477 # Check for a Makefile before using the make build, in case we're running | 497 # Check for a Makefile before using the make build, in case we're running |
(...skipping 15 matching lines...) Expand all Loading... |
493 'scons' : main_scons, | 513 'scons' : main_scons, |
494 'xcode' : main_xcode, | 514 'xcode' : main_xcode, |
495 'scons_v8' : main_scons_v8, | 515 'scons_v8' : main_scons_v8, |
496 } | 516 } |
497 main = build_tool_map.get(options.build_tool) | 517 main = build_tool_map.get(options.build_tool) |
498 if not main: | 518 if not main: |
499 sys.stderr.write('Unknown build tool %s.\n' % repr(options.build_tool)) | 519 sys.stderr.write('Unknown build tool %s.\n' % repr(options.build_tool)) |
500 sys.exit(2) | 520 sys.exit(2) |
501 | 521 |
502 sys.exit(main(options, args)) | 522 sys.exit(main(options, args)) |
OLD | NEW |