| 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 """This script is used to download prebuilt clang binaries. | 6 """This script is used to download prebuilt clang binaries. |
| 7 | 7 |
| 8 It is also used by package.py to build the prebuilt clang binaries.""" | 8 It is also used by package.py to build the prebuilt clang binaries.""" |
| 9 | 9 |
| 10 import argparse | 10 import argparse |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 help='first build clang with CC, then with itself.') | 792 help='first build clang with CC, then with itself.') |
| 793 parser.add_argument('--if-needed', action='store_true', | 793 parser.add_argument('--if-needed', action='store_true', |
| 794 help="run only if the script thinks clang is needed") | 794 help="run only if the script thinks clang is needed") |
| 795 parser.add_argument('--force-local-build', action='store_true', | 795 parser.add_argument('--force-local-build', action='store_true', |
| 796 help="don't try to download prebuild binaries") | 796 help="don't try to download prebuild binaries") |
| 797 parser.add_argument('--gcc-toolchain', help='set the version for which gcc ' | 797 parser.add_argument('--gcc-toolchain', help='set the version for which gcc ' |
| 798 'version be used for building; --gcc-toolchain=/opt/foo ' | 798 'version be used for building; --gcc-toolchain=/opt/foo ' |
| 799 'picks /opt/foo/bin/gcc') | 799 'picks /opt/foo/bin/gcc') |
| 800 parser.add_argument('--lto-gold-plugin', action='store_true', | 800 parser.add_argument('--lto-gold-plugin', action='store_true', |
| 801 help='build LLVM Gold plugin with LTO') | 801 help='build LLVM Gold plugin with LTO') |
| 802 parser.add_argument('--llvm-force-head-revision', action='store_true', |
| 803 help=('use the revision in the repo when printing ' |
| 804 'the revision')) |
| 802 parser.add_argument('--print-revision', action='store_true', | 805 parser.add_argument('--print-revision', action='store_true', |
| 803 help='print current clang revision and exit.') | 806 help='print current clang revision and exit.') |
| 804 parser.add_argument('--print-clang-version', action='store_true', | 807 parser.add_argument('--print-clang-version', action='store_true', |
| 805 help='print current clang version (e.g. x.y.z) and exit.') | 808 help='print current clang version (e.g. x.y.z) and exit.') |
| 806 parser.add_argument('--run-tests', action='store_true', | 809 parser.add_argument('--run-tests', action='store_true', |
| 807 help='run tests after building; only for local builds') | 810 help='run tests after building; only for local builds') |
| 808 parser.add_argument('--tools', nargs='*', | 811 parser.add_argument('--tools', nargs='*', |
| 809 help='select which chrome tools to build', | 812 help='select which chrome tools to build', |
| 810 default=['plugins', 'blink_gc_plugin']) | 813 default=['plugins', 'blink_gc_plugin']) |
| 811 parser.add_argument('--without-android', action='store_false', | 814 parser.add_argument('--without-android', action='store_false', |
| (...skipping 23 matching lines...) Expand all Loading... |
| 835 if os.path.isdir(LLVM_BUILD_DIR): | 838 if os.path.isdir(LLVM_BUILD_DIR): |
| 836 is_clang_required = True | 839 is_clang_required = True |
| 837 if not is_clang_required: | 840 if not is_clang_required: |
| 838 return 0 | 841 return 0 |
| 839 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): | 842 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): |
| 840 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' | 843 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' |
| 841 return 0 | 844 return 0 |
| 842 | 845 |
| 843 global CLANG_REVISION, PACKAGE_VERSION | 846 global CLANG_REVISION, PACKAGE_VERSION |
| 844 if args.print_revision: | 847 if args.print_revision: |
| 845 if use_head_revision: | 848 if use_head_revision or args.llvm_force_head_revision: |
| 846 print GetSvnRevision(LLVM_DIR) | 849 print GetSvnRevision(LLVM_DIR) |
| 847 else: | 850 else: |
| 848 print PACKAGE_VERSION | 851 print PACKAGE_VERSION |
| 849 return 0 | 852 return 0 |
| 850 | 853 |
| 851 if args.print_clang_version: | 854 if args.print_clang_version: |
| 852 sys.stdout.write(VERSION) | 855 sys.stdout.write(VERSION) |
| 853 return 0 | 856 return 0 |
| 854 | 857 |
| 855 # Don't buffer stdout, so that print statements are immediately flushed. | 858 # Don't buffer stdout, so that print statements are immediately flushed. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 866 args.force_local_build = True | 869 args.force_local_build = True |
| 867 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): | 870 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): |
| 868 # Only build the Android ASan rt on ToT bots when targetting Android. | 871 # Only build the Android ASan rt on ToT bots when targetting Android. |
| 869 args.with_android = False | 872 args.with_android = False |
| 870 | 873 |
| 871 return UpdateClang(args) | 874 return UpdateClang(args) |
| 872 | 875 |
| 873 | 876 |
| 874 if __name__ == '__main__': | 877 if __name__ == '__main__': |
| 875 sys.exit(main()) | 878 sys.exit(main()) |
| OLD | NEW |