Chromium Code Reviews| 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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 855 args = parser.parse_args() | 855 args = parser.parse_args() |
| 856 | 856 |
| 857 if args.lto_gold_plugin and not args.bootstrap: | 857 if args.lto_gold_plugin and not args.bootstrap: |
| 858 print '--lto-gold-plugin requires --bootstrap' | 858 print '--lto-gold-plugin requires --bootstrap' |
| 859 return 1 | 859 return 1 |
| 860 if args.lto_gold_plugin and not sys.platform.startswith('linux'): | 860 if args.lto_gold_plugin and not sys.platform.startswith('linux'): |
| 861 print '--lto-gold-plugin is only effective on Linux. Ignoring the option.' | 861 print '--lto-gold-plugin is only effective on Linux. Ignoring the option.' |
| 862 args.lto_gold_plugin = False | 862 args.lto_gold_plugin = False |
| 863 | 863 |
| 864 if args.if_needed: | 864 if args.if_needed: |
| 865 is_clang_required = False | 865 # TODO(thakis): Can probably remove this and --if-needed altogether. |
| 866 # clang is always used on Mac and Linux. | |
| 867 if sys.platform == 'darwin' or sys.platform.startswith('linux'): | |
| 868 is_clang_required = True | |
| 869 # clang requested via $GYP_DEFINES. | |
| 870 if re.search(r'\b(clang|asan|lsan|msan|tsan)=1', | |
| 871 os.environ.get('GYP_DEFINES', '')): | |
| 872 is_clang_required = True | |
| 873 # clang previously downloaded, keep it up to date. | |
| 874 # If you don't want this, delete third_party/llvm-build on your machine. | |
| 875 if os.path.isdir(LLVM_BUILD_DIR): | |
| 876 is_clang_required = True | |
| 877 if not is_clang_required: | |
| 878 return 0 | |
|
hans
2017/02/21 17:47:06
Nice!
| |
| 879 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): | 866 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): |
| 880 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' | 867 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' |
| 881 return 0 | 868 return 0 |
| 882 | 869 |
| 883 if use_head_revision: | 870 if use_head_revision: |
| 884 # TODO(hans): Trunk was updated; remove after the next roll. | 871 # TODO(hans): Trunk was updated; remove after the next roll. |
| 885 global VERSION | 872 global VERSION |
| 886 VERSION = '5.0.0' | 873 VERSION = '5.0.0' |
| 887 | 874 |
| 888 global CLANG_REVISION, PACKAGE_VERSION | 875 global CLANG_REVISION, PACKAGE_VERSION |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 911 args.force_local_build = True | 898 args.force_local_build = True |
| 912 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): | 899 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): |
| 913 # Only build the Android ASan rt on ToT bots when targetting Android. | 900 # Only build the Android ASan rt on ToT bots when targetting Android. |
| 914 args.with_android = False | 901 args.with_android = False |
| 915 | 902 |
| 916 return UpdateClang(args) | 903 return UpdateClang(args) |
| 917 | 904 |
| 918 | 905 |
| 919 if __name__ == '__main__': | 906 if __name__ == '__main__': |
| 920 sys.exit(main()) | 907 sys.exit(main()) |
| OLD | NEW |