Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 return codename | 406 return codename |
| 407 | 407 |
| 408 | 408 |
| 409 def common_make_settings( | 409 def common_make_settings( |
| 410 command, options, env, crosstool=None, compiler=None): | 410 command, options, env, crosstool=None, compiler=None): |
| 411 """ | 411 """ |
| 412 Sets desirable environment variables and command-line options | 412 Sets desirable environment variables and command-line options |
| 413 that are common to the Make and SCons builds. Used on Linux | 413 that are common to the Make and SCons builds. Used on Linux |
| 414 and for the mac make build. | 414 and for the mac make build. |
| 415 """ | 415 """ |
| 416 # TODO(thakis): Add goma-clang support to the make build. | 416 assert compiler in (None, 'clang', 'goma', 'goma-clang', 'asan', 'tsan_gcc') |
| 417 assert compiler in (None, 'clang', 'goma', 'asan', 'tsan_gcc') | |
| 418 if options.mode == 'google_chrome' or options.mode == 'official': | 417 if options.mode == 'google_chrome' or options.mode == 'official': |
| 419 env['CHROMIUM_BUILD'] = '_google_chrome' | 418 env['CHROMIUM_BUILD'] = '_google_chrome' |
| 420 | 419 |
| 421 if options.mode == 'official': | 420 if options.mode == 'official': |
| 422 # Official builds are always Google Chrome. | 421 # Official builds are always Google Chrome. |
| 423 env['OFFICIAL_BUILD'] = '1' | 422 env['OFFICIAL_BUILD'] = '1' |
| 424 env['CHROME_BUILD_TYPE'] = '_official' | 423 env['CHROME_BUILD_TYPE'] = '_official' |
| 425 | 424 |
| 426 # Don't stop at the first error. | 425 # Don't stop at the first error. |
| 427 command.append('-k') | 426 command.append('-k') |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 env['CXX'] = ccache + crosstool + '-g++' | 464 env['CXX'] = ccache + crosstool + '-g++' |
| 466 env['LD'] = crosstool + '-ld' | 465 env['LD'] = crosstool + '-ld' |
| 467 env['RANLIB'] = crosstool + '-ranlib' | 466 env['RANLIB'] = crosstool + '-ranlib' |
| 468 command.append('-j%d' % jobs) | 467 command.append('-j%d' % jobs) |
| 469 # Don't use build-in rules. | 468 # Don't use build-in rules. |
| 470 command.append('-r') | 469 command.append('-r') |
| 471 # For now only build chrome, as other things will break. | 470 # For now only build chrome, as other things will break. |
| 472 command.append('chrome') | 471 command.append('chrome') |
| 473 return | 472 return |
| 474 | 473 |
| 475 if compiler == 'goma': | 474 if compiler in ('goma', 'goma-clang'): |
| 476 print 'using goma' | 475 print 'using', compiler |
| 477 env['CC'] = 'gcc' | 476 if compiler == 'goma': |
| 478 env['CXX'] = 'g++' | 477 env['CC'] = 'gcc' |
| 479 env['PATH'] = options.goma_dir + ':' + env['PATH'] | 478 env['CXX'] = 'g++' |
| 480 goma_jobs = 100 | 479 env['PATH'] = options.goma_dir + ':' + env['PATH'] |
| 480 else: # goma-clang | |
| 481 env['CC'] = 'clang' | |
| 482 env['CXX'] = 'clang++' | |
| 483 clang_dir = os.path.abspath(os.path.join( | |
| 484 slave_utils.SlaveBaseDir(options.build_dir), 'build', 'src', | |
| 485 'third_party', 'llvm-build', 'Release+Asserts', 'bin')) | |
| 486 env['PATH'] = options.goma_dir + ':' + + clang_dir + ':' + env['PATH'] | |
|
szager
2011/10/14 20:11:27
+ +
Syntax error?
Prefer:
env['PATH'] = ':'.join(
Nico
2011/10/14 20:16:48
Done.
| |
| 487 if chromium_utils.IsMac(): | |
| 488 # The default process limit on 10.6 is 266 (`sysctl kern.maxprocperuid`), | |
| 489 # and about 100 processes are used by the system. The webkit bindings | |
| 490 # generation scripts open a preprocessor child process, so building at | |
| 491 # -j100 runs into the process limit. For now, just build with -j50. | |
| 492 goma_jobs = 50 | |
| 493 else: | |
| 494 goma_jobs = 100 | |
| 481 if jobs < goma_jobs: | 495 if jobs < goma_jobs: |
| 482 jobs = goma_jobs | 496 jobs = goma_jobs |
| 483 command.append('-j%d' % jobs) | 497 command.append('-j%d' % jobs) |
| 484 return | 498 return |
| 485 | 499 |
| 486 if compiler == 'clang': | 500 if compiler == 'clang': |
| 487 clang_dir = os.path.abspath(os.path.join( | 501 clang_dir = os.path.abspath(os.path.join( |
| 488 slave_utils.SlaveBaseDir(options.build_dir), 'build', 'src', | 502 slave_utils.SlaveBaseDir(options.build_dir), 'build', 'src', |
| 489 'third_party', 'llvm-build', 'Release+Asserts', 'bin')) | 503 'third_party', 'llvm-build', 'Release+Asserts', 'bin')) |
| 490 env['CC'] = os.path.join(clang_dir, 'clang') | 504 env['CC'] = os.path.join(clang_dir, 'clang') |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 | 629 |
| 616 # V=1 prints the actual executed command | 630 # V=1 prints the actual executed command |
| 617 if options.verbose: | 631 if options.verbose: |
| 618 command.extend(['V=1']) | 632 command.extend(['V=1']) |
| 619 command.extend(options.build_args + args) | 633 command.extend(options.build_args + args) |
| 620 | 634 |
| 621 # If using the Goma compiler, first call goma_ctl with ensure_start | 635 # If using the Goma compiler, first call goma_ctl with ensure_start |
| 622 # (or restart in clobber mode) to ensure the proxy is available. | 636 # (or restart in clobber mode) to ensure the proxy is available. |
| 623 goma_ctl_cmd = [os.path.join(options.goma_dir, 'goma_ctl.sh')] | 637 goma_ctl_cmd = [os.path.join(options.goma_dir, 'goma_ctl.sh')] |
| 624 | 638 |
| 625 if options.compiler == 'goma': | 639 if options.compiler in ('goma', 'goma-clang'): |
| 626 goma_key = os.path.join(options.goma_dir, 'goma.key') | 640 goma_key = os.path.join(options.goma_dir, 'goma.key') |
| 627 env['GOMA_COMPILER_PROXY_DAEMON_MODE'] = 'true' | 641 env['GOMA_COMPILER_PROXY_DAEMON_MODE'] = 'true' |
| 628 if os.path.exists(goma_key): | 642 if os.path.exists(goma_key): |
| 629 env['GOMA_API_KEY_FILE'] = goma_key | 643 env['GOMA_API_KEY_FILE'] = goma_key |
| 630 if options.clobber: | 644 if options.clobber: |
| 631 chromium_utils.RunCommand(goma_ctl_cmd + ['restart'], env=env) | 645 chromium_utils.RunCommand(goma_ctl_cmd + ['restart'], env=env) |
| 632 else: | 646 else: |
| 633 chromium_utils.RunCommand(goma_ctl_cmd + ['ensure_start'], env=env) | 647 chromium_utils.RunCommand(goma_ctl_cmd + ['ensure_start'], env=env) |
| 634 | 648 |
| 635 # Run the build. | 649 # Run the build. |
| 636 result = chromium_utils.RunCommand(command, env=env) | 650 result = chromium_utils.RunCommand(command, env=env) |
| 637 | 651 |
| 638 if options.compiler == 'goma': | 652 if options.compiler in ('goma', 'goma-clang'): |
| 639 # Always stop the proxy for now to allow in-place update. | 653 # Always stop the proxy for now to allow in-place update. |
| 640 chromium_utils.RunCommand(goma_ctl_cmd + ['stop'], env=env) | 654 chromium_utils.RunCommand(goma_ctl_cmd + ['stop'], env=env) |
| 641 | 655 |
| 642 return result | 656 return result |
| 643 | 657 |
| 644 | 658 |
| 645 def main_scons(options, args): | 659 def main_scons(options, args): |
| 646 """Interprets options, clobbers object files, and calls scons. | 660 """Interprets options, clobbers object files, and calls scons. |
| 647 """ | 661 """ |
| 648 options.build_dir = os.path.abspath(options.build_dir) | 662 options.build_dir = os.path.abspath(options.build_dir) |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 952 main = build_tool_map.get(options.build_tool) | 966 main = build_tool_map.get(options.build_tool) |
| 953 if not main: | 967 if not main: |
| 954 sys.stderr.write('Unknown build tool %s.\n' % repr(options.build_tool)) | 968 sys.stderr.write('Unknown build tool %s.\n' % repr(options.build_tool)) |
| 955 return 2 | 969 return 2 |
| 956 | 970 |
| 957 return main(options, args) | 971 return main(options, args) |
| 958 | 972 |
| 959 | 973 |
| 960 if '__main__' == __name__: | 974 if '__main__' == __name__: |
| 961 sys.exit(real_main()) | 975 sys.exit(real_main()) |
| OLD | NEW |