| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 case $1 in | 71 case $1 in |
| 72 --bootstrap) | 72 --bootstrap) |
| 73 bootstrap=yes | 73 bootstrap=yes |
| 74 ;; | 74 ;; |
| 75 --if-needed) | 75 --if-needed) |
| 76 if_needed=yes | 76 if_needed=yes |
| 77 ;; | 77 ;; |
| 78 --force-local-build) | 78 --force-local-build) |
| 79 force_local_build=yes | 79 force_local_build=yes |
| 80 ;; | 80 ;; |
| 81 --print-revision) |
| 82 echo $CLANG_REVISION |
| 83 exit 0 |
| 84 ;; |
| 81 --run-tests) | 85 --run-tests) |
| 82 run_tests=yes | 86 run_tests=yes |
| 83 ;; | 87 ;; |
| 84 --without-android) | 88 --without-android) |
| 85 with_android= | 89 with_android= |
| 86 ;; | 90 ;; |
| 87 --with-chrome-tools) | 91 --with-chrome-tools) |
| 88 shift | 92 shift |
| 89 if [[ $# == 0 ]]; then | 93 if [[ $# == 0 ]]; then |
| 90 echo "--with-chrome-tools requires an argument." | 94 echo "--with-chrome-tools requires an argument." |
| (...skipping 15 matching lines...) Expand all Loading... |
| 106 exit 1 | 110 exit 1 |
| 107 fi | 111 fi |
| 108 ;; | 112 ;; |
| 109 | 113 |
| 110 --help) | 114 --help) |
| 111 echo "usage: $0 [--force-local-build] [--if-needed] [--run-tests] " | 115 echo "usage: $0 [--force-local-build] [--if-needed] [--run-tests] " |
| 112 echo "--bootstrap: First build clang with CC, then with itself." | 116 echo "--bootstrap: First build clang with CC, then with itself." |
| 113 echo "--force-local-build: Don't try to download prebuilt binaries." | 117 echo "--force-local-build: Don't try to download prebuilt binaries." |
| 114 echo "--if-needed: Download clang only if the script thinks it is needed." | 118 echo "--if-needed: Download clang only if the script thinks it is needed." |
| 115 echo "--run-tests: Run tests after building. Only for local builds." | 119 echo "--run-tests: Run tests after building. Only for local builds." |
| 120 echo "--print-revision: Print current clang revision and exit." |
| 116 echo "--without-android: Don't build ASan Android runtime library." | 121 echo "--without-android: Don't build ASan Android runtime library." |
| 117 echo "--with-chrome-tools: Select which chrome tools to build." \ | 122 echo "--with-chrome-tools: Select which chrome tools to build." \ |
| 118 "Defaults to plugins." | 123 "Defaults to plugins." |
| 119 echo " Example: --with-chrome-tools 'plugins empty-string'" | 124 echo " Example: --with-chrome-tools 'plugins empty-string'" |
| 120 echo "--gcc-toolchain: Set the prefix for which GCC version should" | 125 echo "--gcc-toolchain: Set the prefix for which GCC version should" |
| 121 echo " be used for building. For example, to use gcc in" | 126 echo " be used for building. For example, to use gcc in" |
| 122 echo " /opt/foo/bin/gcc, use '--gcc-toolchain '/opt/foo" | 127 echo " /opt/foo/bin/gcc, use '--gcc-toolchain '/opt/foo" |
| 123 echo | 128 echo |
| 124 exit 1 | 129 exit 1 |
| 125 ;; | 130 ;; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 [[ "${PREVIOUSLY_BUILT_REVISON}" = \ | 169 [[ "${PREVIOUSLY_BUILT_REVISON}" = \ |
| 165 "${CLANG_AND_PLUGINS_REVISION}" ]]; then | 170 "${CLANG_AND_PLUGINS_REVISION}" ]]; then |
| 166 echo "Clang already at ${CLANG_AND_PLUGINS_REVISION}" | 171 echo "Clang already at ${CLANG_AND_PLUGINS_REVISION}" |
| 167 exit 0 | 172 exit 0 |
| 168 fi | 173 fi |
| 169 fi | 174 fi |
| 170 # To always force a new build if someone interrupts their build half way. | 175 # To always force a new build if someone interrupts their build half way. |
| 171 rm -f "${STAMP_FILE}" | 176 rm -f "${STAMP_FILE}" |
| 172 | 177 |
| 173 | 178 |
| 174 # Clobber all output files. PCH files only work with the compiler that created | |
| 175 # them, so we need clobber the output files to make sure they are rebuilt | |
| 176 # using the new compiler. | |
| 177 echo "Clobbering build files" | |
| 178 MAKE_DIR="${THIS_DIR}/../../../out" | |
| 179 XCODEBUILD_DIR="${THIS_DIR}/../../../xcodebuild" | |
| 180 for DIR in "${XCODEBUILD_DIR}" "${MAKE_DIR}"; do | |
| 181 if [[ -d "${DIR}" ]]; then | |
| 182 rm -rf "${DIR}" | |
| 183 fi | |
| 184 done | |
| 185 | |
| 186 if [[ -z "$force_local_build" ]]; then | 179 if [[ -z "$force_local_build" ]]; then |
| 187 # Check if there's a prebuilt binary and if so just fetch that. That's faster, | 180 # Check if there's a prebuilt binary and if so just fetch that. That's faster, |
| 188 # and goma relies on having matching binary hashes on client and server too. | 181 # and goma relies on having matching binary hashes on client and server too. |
| 189 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang | 182 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang |
| 190 CDS_FILE="clang-${CLANG_REVISION}.tgz" | 183 CDS_FILE="clang-${CLANG_REVISION}.tgz" |
| 191 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) | 184 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) |
| 192 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" | 185 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" |
| 193 if [ "${OS}" = "Linux" ]; then | 186 if [ "${OS}" = "Linux" ]; then |
| 194 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}" | 187 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}" |
| 195 elif [ "${OS}" = "Darwin" ]; then | 188 elif [ "${OS}" = "Darwin" ]; then |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 "${TOOL_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" | 477 "${TOOL_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" |
| 485 fi | 478 fi |
| 486 done | 479 done |
| 487 pushd "${LLVM_BUILD_DIR}" | 480 pushd "${LLVM_BUILD_DIR}" |
| 488 ${MAKE} check-all | 481 ${MAKE} check-all |
| 489 popd | 482 popd |
| 490 fi | 483 fi |
| 491 | 484 |
| 492 # After everything is done, log success for this revision. | 485 # After everything is done, log success for this revision. |
| 493 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" | 486 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" |
| OLD | NEW |