OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 dist_text = dist_file.read().strip() | 498 dist_text = dist_file.read().strip() |
499 dist_file.close() | 499 dist_file.close() |
500 codename = None | 500 codename = None |
501 for line in dist_text.splitlines(): | 501 for line in dist_text.splitlines(): |
502 match_data = re.match(r'^DISTRIB_CODENAME=(\w+)$', line) | 502 match_data = re.match(r'^DISTRIB_CODENAME=(\w+)$', line) |
503 if match_data: | 503 if match_data: |
504 codename = match_data.group(1) | 504 codename = match_data.group(1) |
505 return codename | 505 return codename |
506 | 506 |
507 | 507 |
| 508 def maybe_set_official_build_envvars(options, env): |
| 509 if options.mode == 'google_chrome' or options.mode == 'official': |
| 510 env['CHROMIUM_BUILD'] = '_google_chrome' |
| 511 |
| 512 if options.mode == 'official': |
| 513 # Official builds are always Google Chrome. |
| 514 env['OFFICIAL_BUILD'] = '1' |
| 515 env['CHROME_BUILD_TYPE'] = '_official' |
| 516 |
| 517 |
508 def common_make_settings( | 518 def common_make_settings( |
509 command, options, env, crosstool=None, compiler=None): | 519 command, options, env, crosstool=None, compiler=None): |
510 """ | 520 """ |
511 Sets desirable environment variables and command-line options | 521 Sets desirable environment variables and command-line options |
512 that are common to the Make and SCons builds. Used on Linux | 522 that are common to the Make and SCons builds. Used on Linux |
513 and for the mac make build. | 523 and for the mac make build. |
514 """ | 524 """ |
515 assert compiler in (None, 'clang', 'goma', 'goma-clang', 'jsonclang') | 525 assert compiler in (None, 'clang', 'goma', 'goma-clang', 'jsonclang') |
516 if options.mode == 'google_chrome' or options.mode == 'official': | 526 maybe_set_official_build_envvars(options, env) |
517 env['CHROMIUM_BUILD'] = '_google_chrome' | |
518 | |
519 if options.mode == 'official': | |
520 # Official builds are always Google Chrome. | |
521 env['OFFICIAL_BUILD'] = '1' | |
522 env['CHROME_BUILD_TYPE'] = '_official' | |
523 | 527 |
524 # Don't stop at the first error. | 528 # Don't stop at the first error. |
525 command.append('-k') | 529 command.append('-k') |
526 | 530 |
527 # Set jobs parallelization based on number of cores. | 531 # Set jobs parallelization based on number of cores. |
528 jobs = os.sysconf('SC_NPROCESSORS_ONLN') | 532 jobs = os.sysconf('SC_NPROCESSORS_ONLN') |
529 | 533 |
530 # Test if we can use ccache. | 534 # Test if we can use ccache. |
531 ccache = '' | 535 ccache = '' |
532 if chromium_utils.IsLinux(): | 536 if chromium_utils.IsLinux(): |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 # For now, only delete all non-.ninja files. TODO(thakis): Make "clobber" a | 730 # For now, only delete all non-.ninja files. TODO(thakis): Make "clobber" a |
727 # step that runs before "runhooks". Once the master has been restarted, | 731 # step that runs before "runhooks". Once the master has been restarted, |
728 # remove all clobber handling from compile.py. | 732 # remove all clobber handling from compile.py. |
729 ninja_clobber(options.target_output_dir) | 733 ninja_clobber(options.target_output_dir) |
730 | 734 |
731 if options.verbose: | 735 if options.verbose: |
732 command.append('-v') | 736 command.append('-v') |
733 command.extend(options.build_args) | 737 command.extend(options.build_args) |
734 command.extend(args) | 738 command.extend(args) |
735 | 739 |
| 740 maybe_set_official_build_envvars(options, env) |
| 741 |
736 if options.llvm_tsan: | 742 if options.llvm_tsan: |
737 # Do not report thread leaks when running executables compiled with TSan. | 743 # Do not report thread leaks when running executables compiled with TSan. |
738 # http://dev.chromium.org/developers/testing/threadsanitizer-tsan-v2 | 744 # http://dev.chromium.org/developers/testing/threadsanitizer-tsan-v2 |
739 # contains other options that might be worth adding. | 745 # contains other options that might be worth adding. |
740 env['TSAN_OPTIONS'] = 'report_thread_leaks=0' | 746 env['TSAN_OPTIONS'] = 'report_thread_leaks=0' |
741 | 747 |
742 if chromium_utils.IsMac() and options.disable_aslr: | 748 if chromium_utils.IsMac() and options.disable_aslr: |
743 # Disallow dyld to randomize the load addresses of executables. | 749 # Disallow dyld to randomize the load addresses of executables. |
744 # If any of them is compiled with ASan it will hang otherwise. | 750 # If any of them is compiled with ASan it will hang otherwise. |
745 env['DYLD_NO_PIE'] = '1' | 751 env['DYLD_NO_PIE'] = '1' |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 # Bug 1064677 for more details. | 934 # Bug 1064677 for more details. |
929 if not options.keep_version_file: | 935 if not options.keep_version_file: |
930 chromium_utils.RemoveFile(options.target_output_dir, 'obj', 'chrome_dll', | 936 chromium_utils.RemoveFile(options.target_output_dir, 'obj', 'chrome_dll', |
931 'chrome_dll_version.rc') | 937 'chrome_dll_version.rc') |
932 | 938 |
933 env = EchoDict(os.environ) | 939 env = EchoDict(os.environ) |
934 | 940 |
935 # no goma support yet for this build tool. | 941 # no goma support yet for this build tool. |
936 assert options.compiler != 'goma' | 942 assert options.compiler != 'goma' |
937 | 943 |
938 if options.mode == 'google_chrome' or options.mode == 'official': | 944 maybe_set_official_build_envvars(options, env) |
939 env['CHROMIUM_BUILD'] = '_google_chrome' | |
940 | |
941 if options.mode == 'official': | |
942 # Official builds are always Google Chrome. | |
943 env['OFFICIAL_BUILD'] = '1' | |
944 env['CHROME_BUILD_TYPE'] = '_official' | |
945 | 945 |
946 if not options.solution: | 946 if not options.solution: |
947 options.solution = 'all.sln' | 947 options.solution = 'all.sln' |
948 | 948 |
949 result = -1 | 949 result = -1 |
950 solution = os.path.join(options.build_dir, options.solution) | 950 solution = os.path.join(options.build_dir, options.solution) |
951 command = [tool, solution] + tool_options + args | 951 command = [tool, solution] + tool_options + args |
952 errors = [] | 952 errors = [] |
953 # Examples: | 953 # Examples: |
954 # midl : command line error MIDL1003 : error returned by the C | 954 # midl : command line error MIDL1003 : error returned by the C |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 options.target_output_dir = get_target_build_dir(options.build_tool, | 1194 options.target_output_dir = get_target_build_dir(options.build_tool, |
1195 options.src_dir, options.target, 'iphoneos' in args) | 1195 options.src_dir, options.target, 'iphoneos' in args) |
1196 options.clobber = (options.clobber or | 1196 options.clobber = (options.clobber or |
1197 landmines_triggered(options.target_output_dir)) | 1197 landmines_triggered(options.target_output_dir)) |
1198 | 1198 |
1199 return main(options, args) | 1199 return main(options, args) |
1200 | 1200 |
1201 | 1201 |
1202 if '__main__' == __name__: | 1202 if '__main__' == __name__: |
1203 sys.exit(real_main()) | 1203 sys.exit(real_main()) |
OLD | NEW |