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. |
(...skipping 16 matching lines...) Expand all Loading... |
27 set -e | 27 set -e |
28 | 28 |
29 OS="$(uname -s)" | 29 OS="$(uname -s)" |
30 | 30 |
31 # Parse command line options. | 31 # Parse command line options. |
32 force_local_build= | 32 force_local_build= |
33 mac_only= | 33 mac_only= |
34 run_tests= | 34 run_tests= |
35 bootstrap= | 35 bootstrap= |
36 with_android=yes | 36 with_android=yes |
37 with_tools_extra= | |
38 chrome_tools="plugins" | 37 chrome_tools="plugins" |
39 | 38 |
40 if [[ "${OS}" = "Darwin" ]]; then | 39 if [[ "${OS}" = "Darwin" ]]; then |
41 with_android= | 40 with_android= |
42 fi | 41 fi |
43 | 42 |
44 while [[ $# > 0 ]]; do | 43 while [[ $# > 0 ]]; do |
45 case $1 in | 44 case $1 in |
46 --bootstrap) | 45 --bootstrap) |
47 bootstrap=yes | 46 bootstrap=yes |
48 ;; | 47 ;; |
49 --force-local-build) | 48 --force-local-build) |
50 force_local_build=yes | 49 force_local_build=yes |
51 ;; | 50 ;; |
52 --mac-only) | 51 --mac-only) |
53 mac_only=yes | 52 mac_only=yes |
54 ;; | 53 ;; |
55 --run-tests) | 54 --run-tests) |
56 run_tests=yes | 55 run_tests=yes |
57 ;; | 56 ;; |
58 --without-android) | 57 --without-android) |
59 with_android= | 58 with_android= |
60 ;; | 59 ;; |
61 --with-tools-extra) | |
62 with_tools_extra=yes | |
63 ;; | |
64 --with-chrome-tools) | 60 --with-chrome-tools) |
65 shift | 61 shift |
66 if [[ $# == 0 ]]; then | 62 if [[ $# == 0 ]]; then |
67 echo "--with-chrome-tools requires an argument." | 63 echo "--with-chrome-tools requires an argument." |
68 exit 1 | 64 exit 1 |
69 fi | 65 fi |
70 chrome_tools=$1 | 66 chrome_tools=$1 |
71 ;; | 67 ;; |
72 --help) | 68 --help) |
73 echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] " | 69 echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] " |
74 echo "--bootstrap: First build clang with CC, then with itself." | 70 echo "--bootstrap: First build clang with CC, then with itself." |
75 echo "--force-local-build: Don't try to download prebuilt binaries." | 71 echo "--force-local-build: Don't try to download prebuilt binaries." |
76 echo "--mac-only: Do initial download only on Mac systems." | 72 echo "--mac-only: Do initial download only on Mac systems." |
77 echo "--run-tests: Run tests after building. Only for local builds." | 73 echo "--run-tests: Run tests after building. Only for local builds." |
78 echo "--without-android: Don't build ASan Android runtime library." | 74 echo "--without-android: Don't build ASan Android runtime library." |
79 echo "--with-tools-extra: Also build the clang-tools-extra repository." | |
80 echo "--with-chrome-tools: Select which chrome tools to build." \ | 75 echo "--with-chrome-tools: Select which chrome tools to build." \ |
81 "Defaults to plugins." | 76 "Defaults to plugins." |
82 echo " Example: --with-chrome-tools 'plugins empty-string'" | 77 echo " Example: --with-chrome-tools 'plugins empty-string'" |
83 echo | 78 echo |
84 exit 1 | 79 exit 1 |
85 ;; | 80 ;; |
86 esac | 81 esac |
87 shift | 82 shift |
88 done | 83 done |
89 | 84 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}" | 236 svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}" |
242 fi | 237 fi |
243 | 238 |
244 echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}" | 239 echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}" |
245 svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}" | 240 svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}" |
246 | 241 |
247 echo Getting compiler-rt r"${CLANG_REVISION}" in "${COMPILER_RT_DIR}" | 242 echo Getting compiler-rt r"${CLANG_REVISION}" in "${COMPILER_RT_DIR}" |
248 svn co --force "${LLVM_REPO_URL}/compiler-rt/trunk@${CLANG_REVISION}" \ | 243 svn co --force "${LLVM_REPO_URL}/compiler-rt/trunk@${CLANG_REVISION}" \ |
249 "${COMPILER_RT_DIR}" | 244 "${COMPILER_RT_DIR}" |
250 | 245 |
251 if [[ -n "${with_tools_extra}" ]]; then | |
252 echo Getting clang-tools-extra r"${CLANG_REVISION}" in \ | |
253 "${CLANG_TOOLS_EXTRA_DIR}" | |
254 svn co --force "${LLVM_REPO_URL}/clang-tools-extra/trunk@${CLANG_REVISION}" \ | |
255 "${CLANG_TOOLS_EXTRA_DIR}" | |
256 else | |
257 rm -rf "${CLANG_TOOLS_EXTRA_DIR}" | |
258 fi | |
259 | |
260 # Echo all commands. | 246 # Echo all commands. |
261 set -x | 247 set -x |
262 | 248 |
263 NUM_JOBS=3 | 249 NUM_JOBS=3 |
264 if [[ "${OS}" = "Linux" ]]; then | 250 if [[ "${OS}" = "Linux" ]]; then |
265 NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)" | 251 NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)" |
266 elif [ "${OS}" = "Darwin" ]; then | 252 elif [ "${OS}" = "Darwin" ]; then |
267 NUM_JOBS="$(sysctl -n hw.ncpu)" | 253 NUM_JOBS="$(sysctl -n hw.ncpu)" |
268 fi | 254 fi |
269 | 255 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 # Run a few tests. | 335 # Run a few tests. |
350 PLUGIN_SRC_DIR="${THIS_DIR}/../plugins" | 336 PLUGIN_SRC_DIR="${THIS_DIR}/../plugins" |
351 "${PLUGIN_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" | 337 "${PLUGIN_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" |
352 cd "${LLVM_BUILD_DIR}" | 338 cd "${LLVM_BUILD_DIR}" |
353 make check-all | 339 make check-all |
354 cd - | 340 cd - |
355 fi | 341 fi |
356 | 342 |
357 # After everything is done, log success for this revision. | 343 # After everything is done, log success for this revision. |
358 echo "${CLANG_REVISION}" > "${STAMP_FILE}" | 344 echo "${CLANG_REVISION}" > "${STAMP_FILE}" |
OLD | NEW |