OLD | NEW |
1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
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 will check out llvm and clang into third_party/llvm and build it. | 6 # This script will check out llvm and clang into third_party/llvm and build it. |
7 | 7 |
8 # Do NOT CHANGE this if you don't know what you're doing -- see | 8 # Do NOT CHANGE this if you don't know what you're doing -- see |
9 # https://code.google.com/p/chromium/wiki/UpdatingClang | 9 # https://code.google.com/p/chromium/wiki/UpdatingClang |
10 # Reverting problematic clang rolls is safe, though. | 10 # Reverting problematic clang rolls is safe, though. |
11 CLANG_REVISION=170392 | 11 CLANG_REVISION=170392 |
12 # ASan Mac builders are pinned to this revision, see http://crbug.com/170629. | 12 # ASan Mac builders are pinned to this revision, see http://crbug.com/170629. |
13 CLANG_ASAN_MAC_REVISION=170392 | 13 CLANG_ASAN_MAC_REVISION=170392 |
14 | 14 |
15 THIS_DIR="$(dirname "${0}")" | 15 THIS_DIR="$(dirname "${0}")" |
16 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" | 16 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" |
17 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build" | 17 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build" |
18 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" | 18 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" |
19 CLANG_DIR="${LLVM_DIR}/tools/clang" | 19 CLANG_DIR="${LLVM_DIR}/tools/clang" |
| 20 CLANG_TOOLS_EXTRA_DIR="${CLANG_DIR}/tools/extra" |
20 COMPILER_RT_DIR="${LLVM_DIR}/projects/compiler-rt" | 21 COMPILER_RT_DIR="${LLVM_DIR}/projects/compiler-rt" |
21 ANDROID_NDK_DIR="${LLVM_DIR}/../android_tools/ndk" | 22 ANDROID_NDK_DIR="${LLVM_DIR}/../android_tools/ndk" |
22 STAMP_FILE="${LLVM_BUILD_DIR}/cr_build_revision" | 23 STAMP_FILE="${LLVM_BUILD_DIR}/cr_build_revision" |
23 | 24 |
24 # ${A:-a} returns $A if it's set, a else. | 25 # ${A:-a} returns $A if it's set, a else. |
25 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} | 26 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} |
26 | 27 |
27 # Die if any command dies. | 28 # Die if any command dies. |
28 set -e | 29 set -e |
29 | 30 |
30 OS="$(uname -s)" | 31 OS="$(uname -s)" |
31 | 32 |
32 # Parse command line options. | 33 # Parse command line options. |
33 force_local_build= | 34 force_local_build= |
34 mac_only= | 35 mac_only= |
35 run_tests= | 36 run_tests= |
36 bootstrap= | 37 bootstrap= |
37 with_android=yes | 38 with_android=yes |
38 is_asan_mac_builder= | 39 is_asan_mac_builder= |
| 40 with_tools_extra= |
39 if [[ "${OS}" = "Darwin" ]]; then | 41 if [[ "${OS}" = "Darwin" ]]; then |
40 with_android= | 42 with_android= |
41 fi | 43 fi |
42 | 44 |
43 while [[ $# > 0 ]]; do | 45 while [[ $# > 0 ]]; do |
44 case $1 in | 46 case $1 in |
45 --bootstrap) | 47 --bootstrap) |
46 bootstrap=yes | 48 bootstrap=yes |
47 ;; | 49 ;; |
48 --force-local-build) | 50 --force-local-build) |
49 force_local_build=yes | 51 force_local_build=yes |
50 ;; | 52 ;; |
51 --mac-only) | 53 --mac-only) |
52 mac_only=yes | 54 mac_only=yes |
53 ;; | 55 ;; |
54 --run-tests) | 56 --run-tests) |
55 run_tests=yes | 57 run_tests=yes |
56 ;; | 58 ;; |
57 --without-android) | 59 --without-android) |
58 with_android= | 60 with_android= |
59 ;; | 61 ;; |
60 --is-asan-mac-builder) | 62 --is-asan-mac-builder) |
61 is_asan_mac_builder=yes | 63 is_asan_mac_builder=yes |
62 ;; | 64 ;; |
| 65 --with-tools-extra) |
| 66 with_tools_extra=yes |
| 67 ;; |
63 --help) | 68 --help) |
64 echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] " | 69 echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] " |
65 echo "--bootstrap: First build clang with CC, then with itself." | 70 echo "--bootstrap: First build clang with CC, then with itself." |
66 echo "--force-local-build: Don't try to download prebuilt binaries." | 71 echo "--force-local-build: Don't try to download prebuilt binaries." |
67 echo "--mac-only: Do initial download only on Mac systems." | 72 echo "--mac-only: Do initial download only on Mac systems." |
68 echo "--run-tests: Run tests after building. Only for local builds." | 73 echo "--run-tests: Run tests after building. Only for local builds." |
69 echo "--without-android: Don't build ASan Android runtime library." | 74 echo "--without-android: Don't build ASan Android runtime library." |
70 echo "--is-asan-mac-builder: Use older Clang to build ASan on Mac." | 75 echo "--is-asan-mac-builder: Use older Clang to build ASan on Mac." |
| 76 echo "--with-tools-extra: Also build the clang-tools-extra repository." |
71 exit 1 | 77 exit 1 |
72 ;; | 78 ;; |
73 esac | 79 esac |
74 shift | 80 shift |
75 done | 81 done |
76 | 82 |
77 # Are we on a Chrome buildbot running ASan? | 83 # Are we on a Chrome buildbot running ASan? |
78 function on_asan_mac_host { | 84 function on_asan_mac_host { |
79 HOST="$(uname -n)" | 85 HOST="$(uname -n)" |
80 # Chrome Mac ASan Builder. | 86 # Chrome Mac ASan Builder. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}" | 268 svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}" |
263 fi | 269 fi |
264 | 270 |
265 echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}" | 271 echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}" |
266 svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}" | 272 svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}" |
267 | 273 |
268 echo Getting compiler-rt r"${CLANG_REVISION}" in "${COMPILER_RT_DIR}" | 274 echo Getting compiler-rt r"${CLANG_REVISION}" in "${COMPILER_RT_DIR}" |
269 svn co --force "${LLVM_REPO_URL}/compiler-rt/trunk@${CLANG_REVISION}" \ | 275 svn co --force "${LLVM_REPO_URL}/compiler-rt/trunk@${CLANG_REVISION}" \ |
270 "${COMPILER_RT_DIR}" | 276 "${COMPILER_RT_DIR}" |
271 | 277 |
| 278 if [[ -n "${with_tools_extra}" ]]; then |
| 279 echo Getting clang-tools-extra r"${CLANG_REVISION}" in \ |
| 280 "${CLANG_TOOLS_EXTRA_DIR}" |
| 281 svn co --force "${LLVM_REPO_URL}/clang-tools-extra/trunk@${CLANG_REVISION}" \ |
| 282 "${CLANG_TOOLS_EXTRA_DIR}" |
| 283 else |
| 284 rm -rf "${CLANG_TOOLS_EXTRA_DIR}" |
| 285 fi |
| 286 |
272 # Echo all commands. | 287 # Echo all commands. |
273 set -x | 288 set -x |
274 | 289 |
275 NUM_JOBS=3 | 290 NUM_JOBS=3 |
276 if [[ "${OS}" = "Linux" ]]; then | 291 if [[ "${OS}" = "Linux" ]]; then |
277 NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)" | 292 NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)" |
278 elif [ "${OS}" = "Darwin" ]; then | 293 elif [ "${OS}" = "Darwin" ]; then |
279 NUM_JOBS="$(sysctl -n hw.ncpu)" | 294 NUM_JOBS="$(sysctl -n hw.ncpu)" |
280 fi | 295 fi |
281 | 296 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 # Run a few tests. | 382 # Run a few tests. |
368 PLUGIN_SRC_DIR="${THIS_DIR}/../plugins" | 383 PLUGIN_SRC_DIR="${THIS_DIR}/../plugins" |
369 "${PLUGIN_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" | 384 "${PLUGIN_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" |
370 cd "${LLVM_BUILD_DIR}" | 385 cd "${LLVM_BUILD_DIR}" |
371 make check-all | 386 make check-all |
372 cd - | 387 cd - |
373 fi | 388 fi |
374 | 389 |
375 # After everything is done, log success for this revision. | 390 # After everything is done, log success for this revision. |
376 echo "${CLANG_REVISION}" > "${STAMP_FILE}" | 391 echo "${CLANG_REVISION}" > "${STAMP_FILE}" |
OLD | NEW |