| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 version_out = re.match(r'clang version ([0-9.]+)', version_out).group(1) | 390 version_out = re.match(r'clang version ([0-9.]+)', version_out).group(1) |
| 391 if version_out != VERSION: | 391 if version_out != VERSION: |
| 392 print ('unexpected clang version %s (not %s), update VERSION in update.py' | 392 print ('unexpected clang version %s (not %s), update VERSION in update.py' |
| 393 % (version_out, VERSION)) | 393 % (version_out, VERSION)) |
| 394 sys.exit(1) | 394 sys.exit(1) |
| 395 | 395 |
| 396 | 396 |
| 397 def UpdateClang(args): | 397 def UpdateClang(args): |
| 398 print 'Updating Clang to %s...' % PACKAGE_VERSION | 398 print 'Updating Clang to %s...' % PACKAGE_VERSION |
| 399 | 399 |
| 400 need_gold_plugin = 'LLVM_DOWNLOAD_GOLD_PLUGIN' in os.environ or ( | 400 # Required for LTO, which is used when is_official_build = true. |
| 401 sys.platform.startswith('linux') and | 401 need_gold_plugin = sys.platform.startswith('linux') |
| 402 'buildtype=Official' in os.environ.get('GYP_DEFINES', '')) | |
| 403 | 402 |
| 404 if ReadStampFile() == PACKAGE_VERSION and not args.force_local_build: | 403 if ReadStampFile() == PACKAGE_VERSION and not args.force_local_build: |
| 405 print 'Clang is already up to date.' | 404 print 'Clang is already up to date.' |
| 406 if not need_gold_plugin or os.path.exists( | 405 if not need_gold_plugin or os.path.exists( |
| 407 os.path.join(LLVM_BUILD_DIR, "lib/LLVMgold.so")): | 406 os.path.join(LLVM_BUILD_DIR, "lib/LLVMgold.so")): |
| 408 return 0 | 407 return 0 |
| 409 | 408 |
| 410 # Reset the stamp file in case the build is unsuccessful. | 409 # Reset the stamp file in case the build is unsuccessful. |
| 411 WriteStampFile('') | 410 WriteStampFile('') |
| 412 | 411 |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 args.force_local_build = True | 892 args.force_local_build = True |
| 894 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): | 893 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): |
| 895 # Only build the Android ASan rt on ToT bots when targetting Android. | 894 # Only build the Android ASan rt on ToT bots when targetting Android. |
| 896 args.with_android = False | 895 args.with_android = False |
| 897 | 896 |
| 898 return UpdateClang(args) | 897 return UpdateClang(args) |
| 899 | 898 |
| 900 | 899 |
| 901 if __name__ == '__main__': | 900 if __name__ == '__main__': |
| 902 sys.exit(main()) | 901 sys.exit(main()) |
| OLD | NEW |