| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 # Unconditionally download a prebuilt gcc to guarantee the included libstdc++ | 305 # Unconditionally download a prebuilt gcc to guarantee the included libstdc++ |
| 306 # works on Ubuntu Precise. | 306 # works on Ubuntu Precise. |
| 307 gcc_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'gcc482precise') | 307 gcc_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'gcc482precise') |
| 308 if not os.path.exists(gcc_dir): | 308 if not os.path.exists(gcc_dir): |
| 309 print 'Downloading pre-built GCC 4.8.2...' | 309 print 'Downloading pre-built GCC 4.8.2...' |
| 310 DownloadAndUnpack( | 310 DownloadAndUnpack( |
| 311 CDS_URL + '/tools/gcc482precise.tgz', LLVM_BUILD_TOOLS_DIR) | 311 CDS_URL + '/tools/gcc482precise.tgz', LLVM_BUILD_TOOLS_DIR) |
| 312 args.gcc_toolchain = gcc_dir | 312 args.gcc_toolchain = gcc_dir |
| 313 | 313 |
| 314 | 314 |
| 315 def AddSvnToPathOnWin(): |
| 316 """Download svn.exe and add it to PATH.""" |
| 317 if sys.platform != 'win32': |
| 318 return |
| 319 svn_ver = 'svn-1.6.6-win' |
| 320 svn_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, svn_ver) |
| 321 if not os.path.exists(svn_dir): |
| 322 DownloadAndUnpack(CDS_URL + '/tools/%s.zip' % svn_ver, LLVM_BUILD_TOOLS_DIR) |
| 323 os.environ['PATH'] = svn_dir + os.pathsep + os.environ.get('PATH', '') |
| 324 |
| 325 |
| 315 def AddCMakeToPath(): | 326 def AddCMakeToPath(): |
| 316 """Download CMake and add it to PATH.""" | 327 """Download CMake and add it to PATH.""" |
| 317 if sys.platform == 'win32': | 328 if sys.platform == 'win32': |
| 318 zip_name = 'cmake-3.4.3-win32-x86.zip' | 329 zip_name = 'cmake-3.4.3-win32-x86.zip' |
| 319 cmake_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, | 330 cmake_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, |
| 320 'cmake-3.4.3-win32-x86', 'bin') | 331 'cmake-3.4.3-win32-x86', 'bin') |
| 321 else: | 332 else: |
| 322 suffix = 'Darwin' if sys.platform == 'darwin' else 'Linux' | 333 suffix = 'Darwin' if sys.platform == 'darwin' else 'Linux' |
| 323 zip_name = 'cmake343_%s.tgz' % suffix | 334 zip_name = 'cmake343_%s.tgz' % suffix |
| 324 cmake_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'cmake343', 'bin') | 335 cmake_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'cmake343', 'bin') |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 452 |
| 442 if args.with_android and not os.path.exists(ANDROID_NDK_DIR): | 453 if args.with_android and not os.path.exists(ANDROID_NDK_DIR): |
| 443 print 'Android NDK not found at ' + ANDROID_NDK_DIR | 454 print 'Android NDK not found at ' + ANDROID_NDK_DIR |
| 444 print 'The Android NDK is needed to build a Clang whose -fsanitize=address' | 455 print 'The Android NDK is needed to build a Clang whose -fsanitize=address' |
| 445 print 'works on Android. See ' | 456 print 'works on Android. See ' |
| 446 print 'https://www.chromium.org/developers/how-tos/android-build-instruction
s' | 457 print 'https://www.chromium.org/developers/how-tos/android-build-instruction
s' |
| 447 print 'for how to install the NDK, or pass --without-android.' | 458 print 'for how to install the NDK, or pass --without-android.' |
| 448 return 1 | 459 return 1 |
| 449 | 460 |
| 450 DownloadHostGcc(args) | 461 DownloadHostGcc(args) |
| 462 AddSvnToPathOnWin() |
| 451 AddCMakeToPath() | 463 AddCMakeToPath() |
| 452 AddGnuWinToPath() | 464 AddGnuWinToPath() |
| 453 | 465 |
| 454 DeleteChromeToolsShim() | 466 DeleteChromeToolsShim() |
| 455 | 467 |
| 456 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR) | 468 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR) |
| 457 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR) | 469 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR) |
| 458 if sys.platform == 'win32' or use_head_revision: | 470 if sys.platform == 'win32' or use_head_revision: |
| 459 Checkout('LLD', LLVM_REPO_URL + '/lld/trunk', LLD_DIR) | 471 Checkout('LLD', LLVM_REPO_URL + '/lld/trunk', LLD_DIR) |
| 460 Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR) | 472 Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR) |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 args.force_local_build = True | 910 args.force_local_build = True |
| 899 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): | 911 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): |
| 900 # Only build the Android ASan rt on ToT bots when targetting Android. | 912 # Only build the Android ASan rt on ToT bots when targetting Android. |
| 901 args.with_android = False | 913 args.with_android = False |
| 902 | 914 |
| 903 return UpdateClang(args) | 915 return UpdateClang(args) |
| 904 | 916 |
| 905 | 917 |
| 906 if __name__ == '__main__': | 918 if __name__ == '__main__': |
| 907 sys.exit(main()) | 919 sys.exit(main()) |
| OLD | NEW |