 Chromium Code Reviews
 Chromium Code Reviews Issue 1375213007:
  Clang toolchain on Linux: compress with XZ, include LLVM Gold plugin.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1375213007:
  Clang toolchain on Linux: compress with XZ, include LLVM Gold plugin.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 exit 0 | 238 exit 0 | 
| 239 fi | 239 fi | 
| 240 fi | 240 fi | 
| 241 # To always force a new build if someone interrupts their build half way. | 241 # To always force a new build if someone interrupts their build half way. | 
| 242 rm -f "${STAMP_FILE}" | 242 rm -f "${STAMP_FILE}" | 
| 243 | 243 | 
| 244 | 244 | 
| 245 if [[ -z "$force_local_build" ]]; then | 245 if [[ -z "$force_local_build" ]]; then | 
| 246 # Check if there's a prebuilt binary and if so just fetch that. That's faster, | 246 # Check if there's a prebuilt binary and if so just fetch that. That's faster, | 
| 247 # and goma relies on having matching binary hashes on client and server too. | 247 # and goma relies on having matching binary hashes on client and server too. | 
| 248 CDS_FILE="clang-${PACKAGE_VERSION}.tgz" | 248 CDS_FILE="clang-${PACKAGE_VERSION}" | 
| 249 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) | 249 CDS_OUT_DIR=$(mktemp -d -t clang_download.XXXXXX) | 
| 250 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}" | 250 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}.tgz" | 
| 251 if [ "${OS}" = "Linux" ]; then | 251 if [ "${OS}" = "Linux" ]; then | 
| 252 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}" | 252 CDS_OUTPUT="${CDS_OUT_DIR}/${CDS_FILE}.tar.xz" | 
| 253 CDS_FULL_URL="${CDS_URL}/Linux_x64/${CDS_FILE}.tar.xz" | |
| 253 elif [ "${OS}" = "Darwin" ]; then | 254 elif [ "${OS}" = "Darwin" ]; then | 
| 254 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}" | 255 CDS_FULL_URL="${CDS_URL}/Mac/${CDS_FILE}.tgz" | 
| 255 fi | 256 fi | 
| 256 echo Trying to download prebuilt clang | 257 echo Trying to download prebuilt clang | 
| 257 if which curl > /dev/null; then | 258 if which curl > /dev/null; then | 
| 258 curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \ | 259 curl -L --fail "${CDS_FULL_URL}" -o "${CDS_OUTPUT}" || \ | 
| 259 rm -rf "${CDS_OUT_DIR}" | 260 rm -rf "${CDS_OUT_DIR}" | 
| 260 elif which wget > /dev/null; then | 261 elif which wget > /dev/null; then | 
| 261 wget "${CDS_FULL_URL}" -O "${CDS_OUTPUT}" || rm -rf "${CDS_OUT_DIR}" | 262 wget "${CDS_FULL_URL}" -O "${CDS_OUTPUT}" || rm -rf "${CDS_OUT_DIR}" | 
| 262 else | 263 else | 
| 263 echo "Neither curl nor wget found. Please install one of these." | 264 echo "Neither curl nor wget found. Please install one of these." | 
| 264 exit 1 | 265 exit 1 | 
| 265 fi | 266 fi | 
| 266 if [ -f "${CDS_OUTPUT}" ]; then | 267 if [ -f "${CDS_OUTPUT}" ]; then | 
| 267 rm -rf "${LLVM_BUILD_DIR}" | 268 rm -rf "${LLVM_BUILD_DIR}" | 
| 268 mkdir -p "${LLVM_BUILD_DIR}" | 269 mkdir -p "${LLVM_BUILD_DIR}" | 
| 269 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}" | 270 if [ "${OS}" = "Linux"]; then | 
| 271 unxz < "${CDS_OUTPUT}" | tar -x -C "${LLVM_BUILD_DIR}" | |
| 
hans
2015/10/05 20:53:57
Maybe just use tar's -J option?
 | |
| 272 else | |
| 273 tar -xzf "${CDS_OUTPUT}" -C "${LLVM_BUILD_DIR}" | |
| 274 fi | |
| 270 echo clang "${PACKAGE_VERSION}" unpacked | 275 echo clang "${PACKAGE_VERSION}" unpacked | 
| 271 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 276 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 
| 272 rm -rf "${CDS_OUT_DIR}" | 277 rm -rf "${CDS_OUT_DIR}" | 
| 273 # Download the gold plugin if requested to by an environment variable. | 278 # Download the gold plugin if requested to by an environment variable. | 
| 274 # This is used by the CFI ClusterFuzz bot. | 279 # This is used by the CFI ClusterFuzz bot. | 
| 275 if [[ -n "${LLVM_DOWNLOAD_GOLD_PLUGIN}" ]]; then | 280 if [[ -n "${LLVM_DOWNLOAD_GOLD_PLUGIN}" ]]; then | 
| 276 ${THIS_DIR}/../../../build/download_gold_plugin.py | 281 ${THIS_DIR}/../../../build/download_gold_plugin.py | 
| 277 fi | 282 fi | 
| 278 exit 0 | 283 exit 0 | 
| 279 else | 284 else | 
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 660 # Run Chrome tool tests. | 665 # Run Chrome tool tests. | 
| 661 ninja -C "${LLVM_BUILD_DIR}" cr-check-all | 666 ninja -C "${LLVM_BUILD_DIR}" cr-check-all | 
| 662 fi | 667 fi | 
| 663 if [[ -n "$run_tests" ]]; then | 668 if [[ -n "$run_tests" ]]; then | 
| 664 # Run the LLVM and Clang tests. | 669 # Run the LLVM and Clang tests. | 
| 665 ninja -C "${LLVM_BUILD_DIR}" check-all | 670 ninja -C "${LLVM_BUILD_DIR}" check-all | 
| 666 fi | 671 fi | 
| 667 | 672 | 
| 668 # After everything is done, log success for this revision. | 673 # After everything is done, log success for this revision. | 
| 669 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 674 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 
| OLD | NEW |