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 = '280106' | 30 CLANG_REVISION = '280836' |
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=1 | 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 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR) | 326 DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR) |
327 os.environ['PATH'] = cmake_dir + os.pathsep + os.environ.get('PATH', '') | 327 os.environ['PATH'] = cmake_dir + os.pathsep + os.environ.get('PATH', '') |
328 | 328 |
329 | 329 |
330 def AddGnuWinToPath(): | 330 def AddGnuWinToPath(): |
331 """Download some GNU win tools and add them to PATH.""" | 331 """Download some GNU win tools and add them to PATH.""" |
332 if sys.platform != 'win32': | 332 if sys.platform != 'win32': |
333 return | 333 return |
334 | 334 |
335 gnuwin_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'gnuwin') | 335 gnuwin_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'gnuwin') |
336 GNUWIN_VERSION = '4' | 336 GNUWIN_VERSION = '5' |
337 GNUWIN_STAMP = os.path.join(gnuwin_dir, 'stamp') | 337 GNUWIN_STAMP = os.path.join(gnuwin_dir, 'stamp') |
338 if ReadStampFile(GNUWIN_STAMP) == GNUWIN_VERSION: | 338 if ReadStampFile(GNUWIN_STAMP) == GNUWIN_VERSION: |
339 print 'GNU Win tools already up to date.' | 339 print 'GNU Win tools already up to date.' |
340 else: | 340 else: |
341 zip_name = 'gnuwin-%s.zip' % GNUWIN_VERSION | 341 zip_name = 'gnuwin-%s.zip' % GNUWIN_VERSION |
342 DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR) | 342 DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR) |
343 WriteStampFile(GNUWIN_VERSION, GNUWIN_STAMP) | 343 WriteStampFile(GNUWIN_VERSION, GNUWIN_STAMP) |
344 | 344 |
345 os.environ['PATH'] = gnuwin_dir + os.pathsep + os.environ.get('PATH', '') | 345 os.environ['PATH'] = gnuwin_dir + os.pathsep + os.environ.get('PATH', '') |
346 | 346 |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 VERSION, 'include_sanitizer', | 747 VERSION, 'include_sanitizer', |
748 'sanitizer') | 748 'sanitizer') |
749 EnsureDirExists(aux_sanitizer_include_dir) | 749 EnsureDirExists(aux_sanitizer_include_dir) |
750 for _, _, files in os.walk(sanitizer_include_dir): | 750 for _, _, files in os.walk(sanitizer_include_dir): |
751 for f in files: | 751 for f in files: |
752 CopyFile(os.path.join(sanitizer_include_dir, f), | 752 CopyFile(os.path.join(sanitizer_include_dir, f), |
753 aux_sanitizer_include_dir) | 753 aux_sanitizer_include_dir) |
754 | 754 |
755 if args.with_android: | 755 if args.with_android: |
756 make_toolchain = os.path.join( | 756 make_toolchain = os.path.join( |
757 ANDROID_NDK_DIR, 'build', 'tools', 'make-standalone-toolchain.sh') | 757 ANDROID_NDK_DIR, 'build', 'tools', 'make_standalone_toolchain.py') |
758 for target_arch in ['aarch64', 'arm', 'i686']: | 758 for target_arch in ['aarch64', 'arm', 'i686']: |
759 # Make standalone Android toolchain for target_arch. | 759 # Make standalone Android toolchain for target_arch. |
760 toolchain_dir = os.path.join( | 760 toolchain_dir = os.path.join( |
761 LLVM_BUILD_DIR, 'android-toolchain-' + target_arch) | 761 LLVM_BUILD_DIR, 'android-toolchain-' + target_arch) |
762 RunCommand([ | 762 RunCommand([ |
763 make_toolchain, | 763 make_toolchain, |
764 '--platform=android-' + ('21' if target_arch == 'aarch64' else '19'), | 764 '--api=' + ('21' if target_arch == 'aarch64' else '19'), |
765 '--install-dir="%s"' % toolchain_dir, | 765 '--install-dir=%s' % toolchain_dir, |
Nico
2016/09/08 19:57:08
python script has better quoting, "" no longer nee
| |
766 '--system=linux-x86_64', | |
767 '--stl=stlport', | 766 '--stl=stlport', |
768 '--toolchain=' + { | 767 '--arch=' + { |
769 'aarch64': 'aarch64-linux-android-4.9', | 768 'aarch64': 'arm64', |
770 'arm': 'arm-linux-androideabi-4.9', | 769 'arm': 'arm', |
771 'i686': 'x86-4.9', | 770 'i686': 'x86', |
772 }[target_arch]]) | 771 }[target_arch]]) |
773 # Android NDK r9d copies a broken unwind.h into the toolchain, see | 772 # Android NDK r9d copies a broken unwind.h into the toolchain, see |
774 # http://crbug.com/357890 | 773 # http://crbug.com/357890 |
775 for f in glob.glob(os.path.join(toolchain_dir, 'include/c++/*/unwind.h')): | 774 for f in glob.glob(os.path.join(toolchain_dir, 'include/c++/*/unwind.h')): |
776 os.remove(f) | 775 os.remove(f) |
777 | 776 |
778 # Build ASan runtime for Android in a separate build tree. | 777 # Build ASan runtime for Android in a separate build tree. |
779 build_dir = os.path.join(LLVM_BUILD_DIR, 'android-' + target_arch) | 778 build_dir = os.path.join(LLVM_BUILD_DIR, 'android-' + target_arch) |
780 if not os.path.exists(build_dir): | 779 if not os.path.exists(build_dir): |
781 os.mkdir(os.path.join(build_dir)) | 780 os.mkdir(os.path.join(build_dir)) |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
898 args.force_local_build = True | 897 args.force_local_build = True |
899 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): | 898 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): |
900 # Only build the Android ASan rt on ToT bots when targetting Android. | 899 # Only build the Android ASan rt on ToT bots when targetting Android. |
901 args.with_android = False | 900 args.with_android = False |
902 | 901 |
903 return UpdateClang(args) | 902 return UpdateClang(args) |
904 | 903 |
905 | 904 |
906 if __name__ == '__main__': | 905 if __name__ == '__main__': |
907 sys.exit(main()) | 906 sys.exit(main()) |
OLD | NEW |