Chromium Code Reviews| 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 | 12 |
| 13 THIS_DIR="$(dirname "${0}")" | 13 THIS_DIR="$(dirname "${0}")" |
| 14 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" | 14 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" |
| 15 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build" | 15 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build" |
| 16 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" | 16 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" |
| 17 CLANG_DIR="${LLVM_DIR}/tools/clang" | 17 CLANG_DIR="${LLVM_DIR}/tools/clang" |
| 18 CLANG_TOOLS_EXTRA_DIR="${CLANG_DIR}/tools/extra" | |
| 18 COMPILER_RT_DIR="${LLVM_DIR}/projects/compiler-rt" | 19 COMPILER_RT_DIR="${LLVM_DIR}/projects/compiler-rt" |
| 19 ANDROID_NDK_DIR="${LLVM_DIR}/../android_tools/ndk" | 20 ANDROID_NDK_DIR="${LLVM_DIR}/../android_tools/ndk" |
| 20 STAMP_FILE="${LLVM_BUILD_DIR}/cr_build_revision" | 21 STAMP_FILE="${LLVM_BUILD_DIR}/cr_build_revision" |
| 21 | 22 |
| 22 # ${A:-a} returns $A if it's set, a else. | 23 # ${A:-a} returns $A if it's set, a else. |
| 23 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} | 24 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} |
| 24 | 25 |
| 25 # Die if any command dies. | 26 # Die if any command dies. |
| 26 set -e | 27 set -e |
| 27 | 28 |
| 28 OS="$(uname -s)" | 29 OS="$(uname -s)" |
| 29 | 30 |
| 30 # Parse command line options. | 31 # Parse command line options. |
| 31 force_local_build= | 32 force_local_build= |
| 32 mac_only= | 33 mac_only= |
| 33 run_tests= | 34 run_tests= |
| 34 bootstrap= | 35 bootstrap= |
| 35 with_android=yes | 36 with_android=yes |
| 37 with_tools_extra= | |
| 36 if [[ "${OS}" = "Darwin" ]]; then | 38 if [[ "${OS}" = "Darwin" ]]; then |
| 37 with_android= | 39 with_android= |
| 38 fi | 40 fi |
| 39 | 41 |
| 40 while [[ $# > 0 ]]; do | 42 while [[ $# > 0 ]]; do |
| 41 case $1 in | 43 case $1 in |
| 42 --bootstrap) | 44 --bootstrap) |
| 43 bootstrap=yes | 45 bootstrap=yes |
| 44 ;; | 46 ;; |
| 45 --force-local-build) | 47 --force-local-build) |
| 46 force_local_build=yes | 48 force_local_build=yes |
| 47 ;; | 49 ;; |
| 48 --mac-only) | 50 --mac-only) |
| 49 mac_only=yes | 51 mac_only=yes |
| 50 ;; | 52 ;; |
| 51 --run-tests) | 53 --run-tests) |
| 52 run_tests=yes | 54 run_tests=yes |
| 53 ;; | 55 ;; |
| 54 --without-android) | 56 --without-android) |
| 55 with_android= | 57 with_android= |
| 56 ;; | 58 ;; |
| 59 --with-tools-extra) | |
| 60 with_tools_extra=yes | |
| 61 ;; | |
| 57 --help) | 62 --help) |
| 58 echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] " | 63 echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] " |
| 59 echo "--bootstrap: First build clang with CC, then with itself." | 64 echo "--bootstrap: First build clang with CC, then with itself." |
| 60 echo "--force-local-build: Don't try to download prebuilt binaries." | 65 echo "--force-local-build: Don't try to download prebuilt binaries." |
| 61 echo "--mac-only: Do initial download only on Mac systems." | 66 echo "--mac-only: Do initial download only on Mac systems." |
| 62 echo "--run-tests: Run tests after building. Only for local builds." | 67 echo "--run-tests: Run tests after building. Only for local builds." |
| 63 echo "--without-android: Don't build ASan Android runtime library." | 68 echo "--without-android: Don't build ASan Android runtime library." |
| 69 echo "--with-extras: Also checkout the clang-tools-extra repository." | |
| 64 exit 1 | 70 exit 1 |
| 65 ;; | 71 ;; |
| 66 esac | 72 esac |
| 67 shift | 73 shift |
| 68 done | 74 done |
| 69 | 75 |
| 70 # --mac-only prevents the initial download on non-mac systems, but if clang has | 76 # --mac-only prevents the initial download on non-mac systems, but if clang has |
| 71 # already been downloaded in the past, this script keeps it up to date even if | 77 # already been downloaded in the past, this script keeps it up to date even if |
| 72 # --mac-only is passed in and the system isn't a mac. People who don't like this | 78 # --mac-only is passed in and the system isn't a mac. People who don't like this |
| 73 # can just delete their third_party/llvm-build directory. | 79 # can just delete their third_party/llvm-build directory. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}" | 235 svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}" |
| 230 fi | 236 fi |
| 231 | 237 |
| 232 echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}" | 238 echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}" |
| 233 svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}" | 239 svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}" |
| 234 | 240 |
| 235 echo Getting compiler-rt r"${CLANG_REVISION}" in "${COMPILER_RT_DIR}" | 241 echo Getting compiler-rt r"${CLANG_REVISION}" in "${COMPILER_RT_DIR}" |
| 236 svn co --force "${LLVM_REPO_URL}/compiler-rt/trunk@${CLANG_REVISION}" \ | 242 svn co --force "${LLVM_REPO_URL}/compiler-rt/trunk@${CLANG_REVISION}" \ |
| 237 "${COMPILER_RT_DIR}" | 243 "${COMPILER_RT_DIR}" |
| 238 | 244 |
| 245 if [[ -n "${with_tools_extra}" ]]; then | |
| 246 echo Getting clang-tools-extra r"${CLANG_REVISION}" in \ | |
| 247 "${CLANG_TOOLS_EXTRA_DIR}" | |
| 248 svn co --force "${LLVM_REPO_URL}/clang-tools-extra/trunk@${CLANG_REVISION}" \ | |
| 249 "${CLANG_TOOLS_EXTRA_DIR}" | |
| 250 fi | |
|
Nico
2013/02/12 00:28:08
What should happen if you build with --with-tools-
dcheng
2013/02/12 02:00:41
Good point. I've updated this to rm -rf if --with-
| |
| 251 | |
| 239 # Echo all commands. | 252 # Echo all commands. |
| 240 set -x | 253 set -x |
| 241 | 254 |
| 242 NUM_JOBS=3 | 255 NUM_JOBS=3 |
| 243 if [[ "${OS}" = "Linux" ]]; then | 256 if [[ "${OS}" = "Linux" ]]; then |
| 244 NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)" | 257 NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)" |
| 245 elif [ "${OS}" = "Darwin" ]; then | 258 elif [ "${OS}" = "Darwin" ]; then |
| 246 NUM_JOBS="$(sysctl -n hw.ncpu)" | 259 NUM_JOBS="$(sysctl -n hw.ncpu)" |
| 247 fi | 260 fi |
| 248 | 261 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 if [[ -n "$run_tests" ]]; then | 342 if [[ -n "$run_tests" ]]; then |
| 330 # Run a few tests. | 343 # Run a few tests. |
| 331 "${PLUGIN_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" | 344 "${PLUGIN_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" |
| 332 cd "${LLVM_BUILD_DIR}" | 345 cd "${LLVM_BUILD_DIR}" |
| 333 make check-all | 346 make check-all |
| 334 cd - | 347 cd - |
| 335 fi | 348 fi |
| 336 | 349 |
| 337 # After everything is done, log success for this revision. | 350 # After everything is done, log success for this revision. |
| 338 echo "${CLANG_REVISION}" > "${STAMP_FILE}" | 351 echo "${CLANG_REVISION}" > "${STAMP_FILE}" |
| OLD | NEW |