| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 CHROMIUM_DIR, 'third_party', 'android_tools', 'ndk') | 76 CHROMIUM_DIR, 'third_party', 'android_tools', 'ndk') |
| 77 | 77 |
| 78 # URL for pre-built binaries. | 78 # URL for pre-built binaries. |
| 79 CDS_URL = os.environ.get('CDS_CLANG_BUCKET_OVERRIDE', | 79 CDS_URL = os.environ.get('CDS_CLANG_BUCKET_OVERRIDE', |
| 80 'https://commondatastorage.googleapis.com/chromium-browser-clang') | 80 'https://commondatastorage.googleapis.com/chromium-browser-clang') |
| 81 | 81 |
| 82 LLVM_REPO_URL='https://llvm.org/svn/llvm-project' | 82 LLVM_REPO_URL='https://llvm.org/svn/llvm-project' |
| 83 if 'LLVM_REPO_URL' in os.environ: | 83 if 'LLVM_REPO_URL' in os.environ: |
| 84 LLVM_REPO_URL = os.environ['LLVM_REPO_URL'] | 84 LLVM_REPO_URL = os.environ['LLVM_REPO_URL'] |
| 85 | 85 |
| 86 skip_gold_plugin = 'SKIP_GOLD_PLUGIN' in os.environ |
| 87 |
| 86 # Bump after VC updates. | 88 # Bump after VC updates. |
| 87 DIA_DLL = { | 89 DIA_DLL = { |
| 88 '2013': 'msdia120.dll', | 90 '2013': 'msdia120.dll', |
| 89 '2015': 'msdia140.dll', | 91 '2015': 'msdia140.dll', |
| 90 } | 92 } |
| 91 | 93 |
| 92 | 94 |
| 93 def DownloadUrl(url, output_file): | 95 def DownloadUrl(url, output_file): |
| 94 """Download url into output_file.""" | 96 """Download url into output_file.""" |
| 95 CHUNK_SIZE = 4096 | 97 CHUNK_SIZE = 4096 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 if version_out != VERSION: | 393 if version_out != VERSION: |
| 392 print ('unexpected clang version %s (not %s), update VERSION in update.py' | 394 print ('unexpected clang version %s (not %s), update VERSION in update.py' |
| 393 % (version_out, VERSION)) | 395 % (version_out, VERSION)) |
| 394 sys.exit(1) | 396 sys.exit(1) |
| 395 | 397 |
| 396 | 398 |
| 397 def UpdateClang(args): | 399 def UpdateClang(args): |
| 398 print 'Updating Clang to %s...' % PACKAGE_VERSION | 400 print 'Updating Clang to %s...' % PACKAGE_VERSION |
| 399 | 401 |
| 400 # Required for LTO, which is used when is_official_build = true. | 402 # Required for LTO, which is used when is_official_build = true. |
| 401 need_gold_plugin = sys.platform.startswith('linux') | 403 need_gold_plugin = sys.platform.startswith('linux') and not skip_gold_plugin |
| 402 | 404 |
| 403 if ReadStampFile() == PACKAGE_VERSION and not args.force_local_build: | 405 if ReadStampFile() == PACKAGE_VERSION and not args.force_local_build: |
| 404 print 'Clang is already up to date.' | 406 print 'Clang is already up to date.' |
| 405 if not need_gold_plugin or os.path.exists( | 407 if not need_gold_plugin or os.path.exists( |
| 406 os.path.join(LLVM_BUILD_DIR, "lib/LLVMgold.so")): | 408 os.path.join(LLVM_BUILD_DIR, "lib/LLVMgold.so")): |
| 407 return 0 | 409 return 0 |
| 408 | 410 |
| 409 # Reset the stamp file in case the build is unsuccessful. | 411 # Reset the stamp file in case the build is unsuccessful. |
| 410 WriteStampFile('') | 412 WriteStampFile('') |
| 411 | 413 |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 args.force_local_build = True | 908 args.force_local_build = True |
| 907 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): | 909 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): |
| 908 # Only build the Android ASan rt on ToT bots when targetting Android. | 910 # Only build the Android ASan rt on ToT bots when targetting Android. |
| 909 args.with_android = False | 911 args.with_android = False |
| 910 | 912 |
| 911 return UpdateClang(args) | 913 return UpdateClang(args) |
| 912 | 914 |
| 913 | 915 |
| 914 if __name__ == '__main__': | 916 if __name__ == '__main__': |
| 915 sys.exit(main()) | 917 sys.exit(main()) |
| OLD | NEW |