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 # ASan Mac builders are pinned to this revision, see http://crbug.com/170629. | |
| 13 CLANG_ASAN_MAC_REVISION=170392 | |
| 12 | 14 |
| 13 THIS_DIR="$(dirname "${0}")" | 15 THIS_DIR="$(dirname "${0}")" |
| 14 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" | 16 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" |
| 15 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build" | 17 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build" |
| 16 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" | 18 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" |
| 17 CLANG_DIR="${LLVM_DIR}/tools/clang" | 19 CLANG_DIR="${LLVM_DIR}/tools/clang" |
| 18 COMPILER_RT_DIR="${LLVM_DIR}/projects/compiler-rt" | 20 COMPILER_RT_DIR="${LLVM_DIR}/projects/compiler-rt" |
| 19 ANDROID_NDK_DIR="${LLVM_DIR}/../android_tools/ndk" | 21 ANDROID_NDK_DIR="${LLVM_DIR}/../android_tools/ndk" |
| 20 STAMP_FILE="${LLVM_BUILD_DIR}/cr_build_revision" | 22 STAMP_FILE="${LLVM_BUILD_DIR}/cr_build_revision" |
| 21 | 23 |
| 22 # ${A:-a} returns $A if it's set, a else. | 24 # ${A:-a} returns $A if it's set, a else. |
| 23 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} | 25 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} |
| 24 | 26 |
| 25 # Die if any command dies. | 27 # Die if any command dies. |
| 26 set -e | 28 set -e |
| 27 | 29 |
| 28 OS="$(uname -s)" | 30 OS="$(uname -s)" |
| 29 | 31 |
| 30 # Parse command line options. | 32 # Parse command line options. |
| 31 force_local_build= | 33 force_local_build= |
| 32 mac_only= | 34 mac_only= |
| 33 run_tests= | 35 run_tests= |
| 34 bootstrap= | 36 bootstrap= |
| 35 with_android=yes | 37 with_android=yes |
| 38 is_asan_mac_builder= | |
| 36 if [[ "${OS}" = "Darwin" ]]; then | 39 if [[ "${OS}" = "Darwin" ]]; then |
| 37 with_android= | 40 with_android= |
| 38 fi | 41 fi |
| 39 | 42 |
| 40 while [[ $# > 0 ]]; do | 43 while [[ $# > 0 ]]; do |
| 41 case $1 in | 44 case $1 in |
| 42 --bootstrap) | 45 --bootstrap) |
| 43 bootstrap=yes | 46 bootstrap=yes |
| 44 ;; | 47 ;; |
| 45 --force-local-build) | 48 --force-local-build) |
| 46 force_local_build=yes | 49 force_local_build=yes |
| 47 ;; | 50 ;; |
| 48 --mac-only) | 51 --mac-only) |
| 49 mac_only=yes | 52 mac_only=yes |
| 50 ;; | 53 ;; |
| 51 --run-tests) | 54 --run-tests) |
| 52 run_tests=yes | 55 run_tests=yes |
| 53 ;; | 56 ;; |
| 54 --without-android) | 57 --without-android) |
| 55 with_android= | 58 with_android= |
| 56 ;; | 59 ;; |
| 60 --is-asan-mac-builder) | |
| 61 is_asan_mac_builder=yes | |
|
Nico
2013/02/12 16:51:25
This is in already, but in the future when doing s
| |
| 62 ;; | |
| 57 --help) | 63 --help) |
| 58 echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] " | 64 echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] " |
| 59 echo "--bootstrap: First build clang with CC, then with itself." | 65 echo "--bootstrap: First build clang with CC, then with itself." |
| 60 echo "--force-local-build: Don't try to download prebuilt binaries." | 66 echo "--force-local-build: Don't try to download prebuilt binaries." |
| 61 echo "--mac-only: Do initial download only on Mac systems." | 67 echo "--mac-only: Do initial download only on Mac systems." |
| 62 echo "--run-tests: Run tests after building. Only for local builds." | 68 echo "--run-tests: Run tests after building. Only for local builds." |
| 63 echo "--without-android: Don't build ASan Android runtime library." | 69 echo "--without-android: Don't build ASan Android runtime library." |
| 70 echo "--is-asan-mac-builder: Use older Clang to build ASan on Mac." | |
| 64 exit 1 | 71 exit 1 |
| 65 ;; | 72 ;; |
| 66 esac | 73 esac |
| 67 shift | 74 shift |
| 68 done | 75 done |
| 69 | 76 |
| 77 # Are we on a Chrome buildbot running ASan? | |
| 78 function on_asan_mac_host { | |
| 79 HOST="$(uname -n)" | |
| 80 if [[ "${HOST}" == "vm633-m1.golo.chromium.org" ]]; then | |
| 81 return 0 | |
| 82 fi | |
| 83 for num in $(seq 600 655) | |
| 84 do | |
| 85 if [[ "${HOST}" == "vm${num}-m4.golo.chromium.org" ]]; then | |
| 86 return 0 | |
| 87 fi | |
| 88 done | |
| 89 return 1 | |
| 90 } | |
| 91 | |
| 92 # Use older Clang for ASan Mac builds. See http://crbug.com/170629. | |
| 93 if [[ -n is_asan_mac_builder ]] || on_asan_mac_host; then | |
| 94 CLANG_REVISION=${CLANG_ASAN_MAC_REVISION} | |
| 95 fi | |
| 96 | |
| 70 # --mac-only prevents the initial download on non-mac systems, but if clang has | 97 # --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 | 98 # 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 | 99 # --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. | 100 # can just delete their third_party/llvm-build directory. |
| 74 if [[ -n "$mac_only" ]] && [[ "${OS}" != "Darwin" ]] && | 101 if [[ -n "$mac_only" ]] && [[ "${OS}" != "Darwin" ]] && |
| 75 [[ ! ( "$GYP_DEFINES" =~ .*(clang|tsan|asan)=1.* ) ]] && | 102 [[ ! ( "$GYP_DEFINES" =~ .*(clang|tsan|asan)=1.* ) ]] && |
| 76 ! [[ -d "${LLVM_BUILD_DIR}" ]]; then | 103 ! [[ -d "${LLVM_BUILD_DIR}" ]]; then |
| 77 exit 0 | 104 exit 0 |
| 78 fi | 105 fi |
| 79 | 106 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 if [[ -n "$run_tests" ]]; then | 356 if [[ -n "$run_tests" ]]; then |
| 330 # Run a few tests. | 357 # Run a few tests. |
| 331 "${PLUGIN_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" | 358 "${PLUGIN_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" |
| 332 cd "${LLVM_BUILD_DIR}" | 359 cd "${LLVM_BUILD_DIR}" |
| 333 make check-all | 360 make check-all |
| 334 cd - | 361 cd - |
| 335 fi | 362 fi |
| 336 | 363 |
| 337 # After everything is done, log success for this revision. | 364 # After everything is done, log success for this revision. |
| 338 echo "${CLANG_REVISION}" > "${STAMP_FILE}" | 365 echo "${CLANG_REVISION}" > "${STAMP_FILE}" |
| OLD | NEW |