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 if [[ $(gcc -dumpversion) < "4.7.0" ]]; then | |
| 168 # We need a newer GCC version. | |
| 169 if [[ ! -e "${LLVM_BUILD_TOOLS_DIR}/gcc482" ]]; then | |
| 170 echo "Downloading pre-built GCC 4.8.2" | |
| 171 mkdir -p "${LLVM_BUILD_TOOLS_DIR}" | |
| 172 curl --fail -L "${CDS_URL}/tools/gcc482.tgz" | \ | |
| 173 tar vzxf - -C "${LLVM_BUILD_TOOLS_DIR}" | |
| 174 fi | |
|
Nico
2015/03/04 20:51:19
nit: only do this if gcc_toolchain isn't set (?)
hans
2015/03/04 21:00:13
Oh, good point. Actually, should also check for Li
| |
| 175 gcc_toolchain="${LLVM_BUILD_TOOLS_DIR}/gcc482" | |
| 176 fi | |
| 177 | |
| 178 if [[ $(cmake --version | grep -Eo '[0-9.]+') < "3.0" ]]; then | |
| 179 # We need a newer CMake version. | |
| 180 if [[ ! -e "${LLVM_BUILD_TOOLS_DIR}/cmake310" ]]; then | |
| 181 echo "Downloading pre-built CMake 3.10" | |
| 182 mkdir -p "${LLVM_BUILD_TOOLS_DIR}" | |
| 183 curl --fail -L "${CDS_URL}/tools/cmake310.tgz" | \ | |
| 184 tar vzxf - -C "${LLVM_BUILD_TOOLS_DIR}" | |
| 185 fi | |
| 186 export PATH="${LLVM_BUILD_TOOLS_DIR}/cmake310/bin:${PATH}" | |
| 187 fi | |
| 188 | |
| 164 if [[ "${OS}" == "Linux" ]] && [[ -z ${gcc_toolchain:-''} ]]; then | 189 if [[ "${OS}" == "Linux" ]] && [[ -z ${gcc_toolchain:-''} ]]; then |
| 165 # Set gcc_toolchain on Linux; llvm-symbolizer needs the bundled libstdc++. | 190 # Set gcc_toolchain on Linux; llvm-symbolizer needs the bundled libstdc++. |
| 166 gcc_toolchain="$(dirname $(dirname $(which gcc)))" | 191 gcc_toolchain="$(dirname $(dirname $(which gcc)))" |
| 167 fi | 192 fi |
| 168 | 193 |
| 169 echo "LLVM_FORCE_HEAD_REVISION was set; using r${CLANG_REVISION}" | 194 echo "LLVM_FORCE_HEAD_REVISION was set; using r${CLANG_REVISION}" |
| 170 fi | 195 fi |
| 171 | 196 |
| 172 if [[ -n "$if_needed" ]]; then | 197 if [[ -n "$if_needed" ]]; then |
| 173 if [[ "${OS}" == "Darwin" ]]; then | 198 if [[ "${OS}" == "Darwin" ]]; then |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 203 exit 0 | 228 exit 0 |
| 204 fi | 229 fi |
| 205 fi | 230 fi |
| 206 # To always force a new build if someone interrupts their build half way. | 231 # To always force a new build if someone interrupts their build half way. |
| 207 rm -f "${STAMP_FILE}" | 232 rm -f "${STAMP_FILE}" |
| 208 | 233 |
| 209 | 234 |
| 210 if [[ -z "$force_local_build" ]]; then | 235 if [[ -z "$force_local_build" ]]; then |
| 211 # Check if there's a prebuilt binary and if so just fetch that. That's faster, | 236 # 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. | 237 # 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" | 238 CDS_FILE="clang-${CLANG_REVISION}.tgz" |
| 215 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) | 239 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) |
| 216 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" | 240 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" |
| 217 if [ "${OS}" = "Linux" ]; then | 241 if [ "${OS}" = "Linux" ]; then |
| 218 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}" | 242 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}" |
| 219 elif [ "${OS}" = "Darwin" ]; then | 243 elif [ "${OS}" = "Darwin" ]; then |
| 220 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}" | 244 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}" |
| 221 fi | 245 fi |
| 222 echo Trying to download prebuilt clang | 246 echo Trying to download prebuilt clang |
| 223 if which curl > /dev/null; then | 247 if which curl > /dev/null; then |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 969 | 993 |
| 970 if [[ -n "$run_tests" ]]; then | 994 if [[ -n "$run_tests" ]]; then |
| 971 # Run Chrome tool tests. | 995 # Run Chrome tool tests. |
| 972 ninja -C "${LLVM_BUILD_DIR}" cr-check-all | 996 ninja -C "${LLVM_BUILD_DIR}" cr-check-all |
| 973 # Run the LLVM and Clang tests. | 997 # Run the LLVM and Clang tests. |
| 974 ninja -C "${LLVM_BUILD_DIR}" check-all | 998 ninja -C "${LLVM_BUILD_DIR}" check-all |
| 975 fi | 999 fi |
| 976 | 1000 |
| 977 # After everything is done, log success for this revision. | 1001 # After everything is done, log success for this revision. |
| 978 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" | 1002 echo "${CLANG_AND_PLUGINS_REVISION}" > "${STAMP_FILE}" |
| OLD | NEW |