| 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 |
| 11 import distutils.spawn | 11 import distutils.spawn |
| 12 import glob | 12 import glob |
| 13 import os | 13 import os |
| 14 import pipes | 14 import pipes |
| 15 import re | 15 import re |
| 16 import shutil | 16 import shutil |
| 17 import subprocess | 17 import subprocess |
| 18 import stat | 18 import stat |
| 19 import sys | 19 import sys |
| 20 import tarfile | 20 import tarfile |
| 21 import tempfile | 21 import tempfile |
| 22 import time | 22 import time |
| 23 import urllib2 | 23 import urllib2 |
| 24 import zipfile | 24 import zipfile |
| 25 | 25 |
| 26 | 26 |
| 27 # Do NOT CHANGE this if you don't know what you're doing -- see | 27 # Do NOT CHANGE this if you don't know what you're doing -- see |
| 28 # https://chromium.googlesource.com/chromium/src/+/master/docs/updating_clang.md | 28 # https://chromium.googlesource.com/chromium/src/+/master/docs/updating_clang.md |
| 29 # Reverting problematic clang rolls is safe, though. | 29 # Reverting problematic clang rolls is safe, though. |
| 30 CLANG_REVISION = '289944' | 30 CLANG_REVISION = '295793' |
| 31 | 31 |
| 32 use_head_revision = 'LLVM_FORCE_HEAD_REVISION' in os.environ | 32 use_head_revision = 'LLVM_FORCE_HEAD_REVISION' in os.environ |
| 33 if use_head_revision: | 33 if use_head_revision: |
| 34 CLANG_REVISION = 'HEAD' | 34 CLANG_REVISION = 'HEAD' |
| 35 | 35 |
| 36 # This is incremented when pushing a new build of Clang at the same revision. | 36 # This is incremented when pushing a new build of Clang at the same revision. |
| 37 CLANG_SUB_REVISION=2 | 37 CLANG_SUB_REVISION=1 |
| 38 | 38 |
| 39 PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION) | 39 PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION) |
| 40 | 40 |
| 41 # Path constants. (All of these should be absolute paths.) | 41 # Path constants. (All of these should be absolute paths.) |
| 42 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 42 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
| 43 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) | 43 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) |
| 44 THIRD_PARTY_DIR = os.path.join(CHROMIUM_DIR, 'third_party') | 44 THIRD_PARTY_DIR = os.path.join(CHROMIUM_DIR, 'third_party') |
| 45 LLVM_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm') | 45 LLVM_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm') |
| 46 LLVM_BOOTSTRAP_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-bootstrap') | 46 LLVM_BOOTSTRAP_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-bootstrap') |
| 47 LLVM_BOOTSTRAP_INSTALL_DIR = os.path.join(THIRD_PARTY_DIR, | 47 LLVM_BOOTSTRAP_INSTALL_DIR = os.path.join(THIRD_PARTY_DIR, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 64 LIBCXXABI_DIR = os.path.join(LLVM_DIR, 'projects', 'libcxxabi') | 64 LIBCXXABI_DIR = os.path.join(LLVM_DIR, 'projects', 'libcxxabi') |
| 65 LLVM_BUILD_TOOLS_DIR = os.path.abspath( | 65 LLVM_BUILD_TOOLS_DIR = os.path.abspath( |
| 66 os.path.join(LLVM_DIR, '..', 'llvm-build-tools')) | 66 os.path.join(LLVM_DIR, '..', 'llvm-build-tools')) |
| 67 STAMP_FILE = os.path.normpath( | 67 STAMP_FILE = os.path.normpath( |
| 68 os.path.join(LLVM_DIR, '..', 'llvm-build', 'cr_build_revision')) | 68 os.path.join(LLVM_DIR, '..', 'llvm-build', 'cr_build_revision')) |
| 69 BINUTILS_DIR = os.path.join(THIRD_PARTY_DIR, 'binutils') | 69 BINUTILS_DIR = os.path.join(THIRD_PARTY_DIR, 'binutils') |
| 70 BINUTILS_BIN_DIR = os.path.join(BINUTILS_DIR, BINUTILS_DIR, | 70 BINUTILS_BIN_DIR = os.path.join(BINUTILS_DIR, BINUTILS_DIR, |
| 71 'Linux_x64', 'Release', 'bin') | 71 'Linux_x64', 'Release', 'bin') |
| 72 BFD_PLUGINS_DIR = os.path.join(BINUTILS_DIR, 'Linux_x64', 'Release', | 72 BFD_PLUGINS_DIR = os.path.join(BINUTILS_DIR, 'Linux_x64', 'Release', |
| 73 'lib', 'bfd-plugins') | 73 'lib', 'bfd-plugins') |
| 74 VERSION = '4.0.0' | 74 VERSION = '5.0.0' |
| 75 ANDROID_NDK_DIR = os.path.join( | 75 ANDROID_NDK_DIR = os.path.join( |
| 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'] |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 # TODO(thakis): Can probably remove this and --if-needed altogether. | 865 # TODO(thakis): Can probably remove this and --if-needed altogether. |
| 866 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', '')): |
| 867 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).' |
| 868 return 0 | 868 return 0 |
| 869 | 869 |
| 870 if use_head_revision: | |
| 871 # TODO(hans): Trunk was updated; remove after the next roll. | |
| 872 global VERSION | |
| 873 VERSION = '5.0.0' | |
| 874 | |
| 875 global CLANG_REVISION, PACKAGE_VERSION | 870 global CLANG_REVISION, PACKAGE_VERSION |
| 876 if args.print_revision: | 871 if args.print_revision: |
| 877 if use_head_revision or args.llvm_force_head_revision: | 872 if use_head_revision or args.llvm_force_head_revision: |
| 878 print GetSvnRevision(LLVM_DIR) | 873 print GetSvnRevision(LLVM_DIR) |
| 879 else: | 874 else: |
| 880 print PACKAGE_VERSION | 875 print PACKAGE_VERSION |
| 881 return 0 | 876 return 0 |
| 882 | 877 |
| 883 if args.print_clang_version: | 878 if args.print_clang_version: |
| 884 sys.stdout.write(VERSION) | 879 sys.stdout.write(VERSION) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 898 args.force_local_build = True | 893 args.force_local_build = True |
| 899 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): | 894 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): |
| 900 # Only build the Android ASan rt on ToT bots when targetting Android. | 895 # Only build the Android ASan rt on ToT bots when targetting Android. |
| 901 args.with_android = False | 896 args.with_android = False |
| 902 | 897 |
| 903 return UpdateClang(args) | 898 return UpdateClang(args) |
| 904 | 899 |
| 905 | 900 |
| 906 if __name__ == '__main__': | 901 if __name__ == '__main__': |
| 907 sys.exit(main()) | 902 sys.exit(main()) |
| OLD | NEW |