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 # Do NOT CHANGE this if you don't know what you're doing -- see | 26 # Do NOT CHANGE this if you don't know what you're doing -- see |
27 # https://code.google.com/p/chromium/wiki/UpdatingClang | 27 # https://chromium.googlesource.com/chromium/src/+/master/docs/updating_clang.md |
28 # Reverting problematic clang rolls is safe, though. | 28 # Reverting problematic clang rolls is safe, though. |
29 CLANG_REVISION = '255169' | 29 CLANG_REVISION = '255169' |
30 | 30 |
31 use_head_revision = 'LLVM_FORCE_HEAD_REVISION' in os.environ | 31 use_head_revision = 'LLVM_FORCE_HEAD_REVISION' in os.environ |
32 if use_head_revision: | 32 if use_head_revision: |
33 CLANG_REVISION = 'HEAD' | 33 CLANG_REVISION = 'HEAD' |
34 | 34 |
35 # This is incremented when pushing a new build of Clang at the same revision. | 35 # This is incremented when pushing a new build of Clang at the same revision. |
36 CLANG_SUB_REVISION=1 | 36 CLANG_SUB_REVISION=1 |
37 | 37 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 except urllib2.URLError: | 371 except urllib2.URLError: |
372 print 'Failed to download prebuilt clang %s' % cds_file | 372 print 'Failed to download prebuilt clang %s' % cds_file |
373 print 'Use --force-local-build if you want to build locally.' | 373 print 'Use --force-local-build if you want to build locally.' |
374 print 'Exiting.' | 374 print 'Exiting.' |
375 return 1 | 375 return 1 |
376 | 376 |
377 if args.with_android and not os.path.exists(ANDROID_NDK_DIR): | 377 if args.with_android and not os.path.exists(ANDROID_NDK_DIR): |
378 print 'Android NDK not found at ' + ANDROID_NDK_DIR | 378 print 'Android NDK not found at ' + ANDROID_NDK_DIR |
379 print 'The Android NDK is needed to build a Clang whose -fsanitize=address' | 379 print 'The Android NDK is needed to build a Clang whose -fsanitize=address' |
380 print 'works on Android. See ' | 380 print 'works on Android. See ' |
381 print 'http://code.google.com/p/chromium/wiki/AndroidBuildInstructions' | 381 print 'https://www.chromium.org/developers/how-tos/android-build-instruction
s' |
382 print 'for how to install the NDK, or pass --without-android.' | 382 print 'for how to install the NDK, or pass --without-android.' |
383 return 1 | 383 return 1 |
384 | 384 |
385 MaybeDownloadHostGcc(args) | 385 MaybeDownloadHostGcc(args) |
386 AddCMakeToPath() | 386 AddCMakeToPath() |
387 | 387 |
388 DeleteChromeToolsShim() | 388 DeleteChromeToolsShim() |
389 | 389 |
390 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR) | 390 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR) |
391 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR) | 391 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR) |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 args.force_local_build = True | 818 args.force_local_build = True |
819 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): | 819 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): |
820 # Only build the Android ASan rt on ToT bots when targetting Android. | 820 # Only build the Android ASan rt on ToT bots when targetting Android. |
821 args.with_android = False | 821 args.with_android = False |
822 | 822 |
823 return UpdateClang(args) | 823 return UpdateClang(args) |
824 | 824 |
825 | 825 |
826 if __name__ == '__main__': | 826 if __name__ == '__main__': |
827 sys.exit(main()) | 827 sys.exit(main()) |
OLD | NEW |