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. |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 ABS_CHROMIUM_TOOLS_DIR="${PWD}/${CHROMIUM_TOOLS_DIR}" | 27 ABS_CHROMIUM_TOOLS_DIR="${PWD}/${CHROMIUM_TOOLS_DIR}" |
| 28 ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}" | 28 ABS_LIBCXX_DIR="${PWD}/${LIBCXX_DIR}" |
| 29 ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}" | 29 ABS_LIBCXXABI_DIR="${PWD}/${LIBCXXABI_DIR}" |
| 30 ABS_LLVM_DIR="${PWD}/${LLVM_DIR}" | 30 ABS_LLVM_DIR="${PWD}/${LLVM_DIR}" |
| 31 ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}" | 31 ABS_LLVM_BUILD_DIR="${PWD}/${LLVM_BUILD_DIR}" |
| 32 ABS_COMPILER_RT_DIR="${PWD}/${COMPILER_RT_DIR}" | 32 ABS_COMPILER_RT_DIR="${PWD}/${COMPILER_RT_DIR}" |
| 33 | 33 |
| 34 # ${A:-a} returns $A if it's set, a else. | 34 # ${A:-a} returns $A if it's set, a else. |
| 35 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} | 35 LLVM_REPO_URL=${LLVM_URL:-https://llvm.org/svn/llvm-project} |
| 36 | 36 |
| 37 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang | |
| 38 | |
| 37 if [[ -z "$GYP_DEFINES" ]]; then | 39 if [[ -z "$GYP_DEFINES" ]]; then |
| 38 GYP_DEFINES= | 40 GYP_DEFINES= |
| 39 fi | 41 fi |
| 40 if [[ -z "$GYP_GENERATORS" ]]; then | 42 if [[ -z "$GYP_GENERATORS" ]]; then |
| 41 GYP_GENERATORS= | 43 GYP_GENERATORS= |
| 42 fi | 44 fi |
| 43 | 45 |
| 44 | 46 |
| 45 # Die if any command dies, error on undefined variable expansions. | 47 # Die if any command dies, error on undefined variable expansions. |
| 46 set -eu | 48 set -eu |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 force_local_build=yes | 156 force_local_build=yes |
| 155 | 157 |
| 156 # Skip local patches when using HEAD: they probably don't apply anymore. | 158 # Skip local patches when using HEAD: they probably don't apply anymore. |
| 157 with_patches= | 159 with_patches= |
| 158 | 160 |
| 159 if ! [[ "$GYP_DEFINES" =~ .*OS=android.* ]]; then | 161 if ! [[ "$GYP_DEFINES" =~ .*OS=android.* ]]; then |
| 160 # Only build the Android ASan rt when targetting Android. | 162 # Only build the Android ASan rt when targetting Android. |
| 161 with_android= | 163 with_android= |
| 162 fi | 164 fi |
| 163 | 165 |
| 166 LLVM_BUILD_TOOLS_DIR="${ABS_LLVM_DIR}/../llvm-build-tools" | |
| 167 | |
| 164 if [[ "${OS}" == "Linux" ]] && [[ -z ${gcc_toolchain:-''} ]]; then | 168 if [[ "${OS}" == "Linux" ]] && [[ -z ${gcc_toolchain:-''} ]]; then |
|
Nico
2015/03/04 21:03:01
Isn't it usually [[ --n "$gcc_toolchain"]]?
Also,
| |
| 165 # Set gcc_toolchain on Linux; llvm-symbolizer needs the bundled libstdc++. | 169 if [[ $(gcc -dumpversion) < "4.7.0" ]]; then |
| 166 gcc_toolchain="$(dirname $(dirname $(which gcc)))" | 170 # We need a newer GCC version. |
| 171 if [[ ! -e "${LLVM_BUILD_TOOLS_DIR}/gcc482" ]]; then | |
| 172 echo "Downloading pre-built GCC 4.8.2" | |
| 173 mkdir -p "${LLVM_BUILD_TOOLS_DIR}" | |
| 174 curl --fail -L "${CDS_URL}/tools/gcc482.tgz" | \ | |
| 175 tar vzxf - -C "${LLVM_BUILD_TOOLS_DIR}" | |
| 176 fi | |
| 177 gcc_toolchain="${LLVM_BUILD_TOOLS_DIR}/gcc482" | |
| 178 else | |
| 179 # Always set gcc_toolchain; llvm-symbolizer needs the bundled libstdc++. | |
| 180 gcc_toolchain="$(dirname $(dirname $(which gcc)))" | |
| 181 fi | |
| 182 fi | |
| 183 | |
| 184 if [[ "${OS}" == "Linux" ]]; then | |
| 185 # TODO(hans): Might need to make this work on Mac eventually. | |
| 186 if [[ $(cmake --version | grep -Eo '[0-9.]+') < "3.0" ]]; then | |
| 187 # We need a newer CMake version. | |
| 188 if [[ ! -e "${LLVM_BUILD_TOOLS_DIR}/cmake310" ]]; then | |
| 189 echo "Downloading pre-built CMake 3.10" | |
| 190 mkdir -p "${LLVM_BUILD_TOOLS_DIR}" | |
| 191 curl --fail -L "${CDS_URL}/tools/cmake310.tgz" | \ | |
| 192 tar vzxf - -C "${LLVM_BUILD_TOOLS_DIR}" | |
| 193 fi | |
| 194 export PATH="${LLVM_BUILD_TOOLS_DIR}/cmake310/bin:${PATH}" | |
| 195 fi | |
| 167 fi | 196 fi |
| 168 | 197 |
| 169 echo "LLVM_FORCE_HEAD_REVISION was set; using r${CLANG_REVISION}" | 198 echo "LLVM_FORCE_HEAD_REVISION was set; using r${CLANG_REVISION}" |
| 170 fi | 199 fi |
| 171 | 200 |
| 172 if [[ -n "$if_needed" ]]; then | 201 if [[ -n "$if_needed" ]]; then |
| 173 if [[ "${OS}" == "Darwin" ]]; then | 202 if [[ "${OS}" == "Darwin" ]]; then |
| 174 # clang is used on Mac. | 203 # clang is used on Mac. |
| 175 true | 204 true |
| 176 elif [[ "$GYP_DEFINES" =~ .*(clang|tsan|asan|lsan|msan)=1.* ]]; then | 205 elif [[ "$GYP_DEFINES" =~ .*(clang|tsan|asan|lsan|msan)=1.* ]]; then |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 203 exit 0 | 232 exit 0 |
| 204 fi | 233 fi |
| 205 fi | 234 fi |
| 206 # To always force a new build if someone interrupts their build half way. | 235 # To always force a new build if someone interrupts their build half way. |
| 207 rm -f "${STAMP_FILE}" | 236 rm -f "${STAMP_FILE}" |
| 208 | 237 |
| 209 | 238 |
| 210 if [[ -z "$force_local_build" ]]; then | 239 if [[ -z "$force_local_build" ]]; then |
| 211 # Check if there's a prebuilt binary and if so just fetch that. That's faster, | 240 # Check if there's a prebuilt binary and if so just fetch that. That's faster, |
| 212 # and goma relies on having matching binary hashes on client and server too. | 241 # and goma relies on having matching binary hashes on client and server too. |
| 213 CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang | |
| 214 CDS_FILE="clang-${CLANG_REVISION}.tgz" | 242 CDS_FILE="clang-${CLANG_REVISION}.tgz" |
| 215 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) | 243 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) |
| 216 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" | 244 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" |
| 217 if [ "${OS}" = "Linux" ]; then | 245 if [ "${OS}" = "Linux" ]; then |
| 218 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}" | 246 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}" |
| 219 elif [ "${OS}" = "Darwin" ]; then | 247 elif [ "${OS}" = "Darwin" ]; then |
| 220 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}" | 248 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}" |
| 221 fi | 249 fi |
| 222 echo Trying to download prebuilt clang | 250 echo Trying to download prebuilt clang |
| 223 if which curl > /dev/null; then | 251 if which curl > /dev/null; then |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 969 | 997 |
| 970 if [[ -n "$run_tests" ]]; then | 998 if [[ -n "$run_tests" ]]; then |
| 971 # Run Chrome tool tests. | 999 # Run Chrome tool tests. |
| 972 ninja -C "${LLVM_BUILD_DIR}" cr-check-all | 1000 ninja -C "${LLVM_BUILD_DIR}" cr-check-all |
| 973 # Run the LLVM and Clang tests. | 1001 # Run the LLVM and Clang tests. |
| 974 ninja -C "${LLVM_BUILD_DIR}" check-all | 1002 ninja -C "${LLVM_BUILD_DIR}" check-all |
| 975 fi | 1003 fi |
| 976 | 1004 |
| 977 # After everything is done, log success for this revision. | 1005 # After everything is done, log success for this revision. |
| 978 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" | 1006 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" |
| OLD | NEW |