| 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 22 matching lines...) Expand all Loading... |
| 33 # Parse command line options. | 33 # Parse command line options. |
| 34 force_local_build= | 34 force_local_build= |
| 35 mac_only= | 35 mac_only= |
| 36 run_tests= | 36 run_tests= |
| 37 bootstrap= | 37 bootstrap= |
| 38 with_android=yes | 38 with_android=yes |
| 39 # Temporary workaround for http://crbug.com/170629: use older Clang for ASan | 39 # Temporary workaround for http://crbug.com/170629: use older Clang for ASan |
| 40 # Mac builders. | 40 # Mac builders. |
| 41 is_asan_mac_builder_hackfix= | 41 is_asan_mac_builder_hackfix= |
| 42 with_tools_extra= | 42 with_tools_extra= |
| 43 chrome_tools="plugins" |
| 44 |
| 43 if [[ "${OS}" = "Darwin" ]]; then | 45 if [[ "${OS}" = "Darwin" ]]; then |
| 44 with_android= | 46 with_android= |
| 45 fi | 47 fi |
| 46 | 48 |
| 47 while [[ $# > 0 ]]; do | 49 while [[ $# > 0 ]]; do |
| 48 case $1 in | 50 case $1 in |
| 49 --bootstrap) | 51 --bootstrap) |
| 50 bootstrap=yes | 52 bootstrap=yes |
| 51 ;; | 53 ;; |
| 52 --force-local-build) | 54 --force-local-build) |
| 53 force_local_build=yes | 55 force_local_build=yes |
| 54 ;; | 56 ;; |
| 55 --mac-only) | 57 --mac-only) |
| 56 mac_only=yes | 58 mac_only=yes |
| 57 ;; | 59 ;; |
| 58 --run-tests) | 60 --run-tests) |
| 59 run_tests=yes | 61 run_tests=yes |
| 60 ;; | 62 ;; |
| 61 --without-android) | 63 --without-android) |
| 62 with_android= | 64 with_android= |
| 63 ;; | 65 ;; |
| 64 # Temporary workaround for http://crbug.com/170629 - use older Clang for | 66 # Temporary workaround for http://crbug.com/170629 - use older Clang for |
| 65 # ASan Mac builders. | 67 # ASan Mac builders. |
| 66 --is-asan-mac-builder-hackfix) | 68 --is-asan-mac-builder-hackfix) |
| 67 is_asan_mac_builder_hackfix=yes | 69 is_asan_mac_builder_hackfix=yes |
| 68 ;; | 70 ;; |
| 69 --with-tools-extra) | 71 --with-tools-extra) |
| 70 with_tools_extra=yes | 72 with_tools_extra=yes |
| 71 ;; | 73 ;; |
| 74 --with-chrome-tools) |
| 75 shift |
| 76 if [[ $# == 0 ]]; then |
| 77 echo "--with-chrome-tools requires an argument." |
| 78 exit 1 |
| 79 fi |
| 80 chrome_tools=$1 |
| 81 ;; |
| 72 --help) | 82 --help) |
| 73 echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] " | 83 echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] " |
| 74 echo "--bootstrap: First build clang with CC, then with itself." | 84 echo "--bootstrap: First build clang with CC, then with itself." |
| 75 echo "--force-local-build: Don't try to download prebuilt binaries." | 85 echo "--force-local-build: Don't try to download prebuilt binaries." |
| 76 echo "--mac-only: Do initial download only on Mac systems." | 86 echo "--mac-only: Do initial download only on Mac systems." |
| 77 echo "--run-tests: Run tests after building. Only for local builds." | 87 echo "--run-tests: Run tests after building. Only for local builds." |
| 78 echo "--without-android: Don't build ASan Android runtime library." | 88 echo "--without-android: Don't build ASan Android runtime library." |
| 79 echo "--is-asan-mac-builder-hackfix: Use older Clang" \ | 89 echo "--is-asan-mac-builder-hackfix: Use older Clang" \ |
| 80 "to build ASan on Mac." | 90 "to build ASan on Mac." |
| 81 echo "--with-tools-extra: Also build the clang-tools-extra repository." | 91 echo "--with-tools-extra: Also build the clang-tools-extra repository." |
| 92 echo "--with-chrome-tools: Select which chrome tools to build." \ |
| 93 "Defaults to plugins." |
| 94 echo " Example: --with-chrome-tools 'plugins empty-string'" |
| 95 echo |
| 82 exit 1 | 96 exit 1 |
| 83 ;; | 97 ;; |
| 84 esac | 98 esac |
| 85 shift | 99 shift |
| 86 done | 100 done |
| 87 | 101 |
| 88 # Are we on a Chrome buildbot running ASan? | 102 # Are we on a Chrome buildbot running ASan? |
| 89 function on_asan_mac_host { | 103 function on_asan_mac_host { |
| 90 if [[ "${OS}" != "Darwin" ]]; then | 104 if [[ "${OS}" != "Darwin" ]]; then |
| 91 return 1 | 105 return 1 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 fi | 382 fi |
| 369 | 383 |
| 370 # Build ASan runtime for Android. | 384 # Build ASan runtime for Android. |
| 371 cd "${LLVM_BUILD_DIR}" | 385 cd "${LLVM_BUILD_DIR}" |
| 372 make -C tools/clang/runtime/ LLVM_ANDROID_TOOLCHAIN_DIR="../../../../${TC}" | 386 make -C tools/clang/runtime/ LLVM_ANDROID_TOOLCHAIN_DIR="../../../../${TC}" |
| 373 cd - | 387 cd - |
| 374 fi | 388 fi |
| 375 | 389 |
| 376 # Build Chrome-specific clang tools. Paths in this list should be relative to | 390 # Build Chrome-specific clang tools. Paths in this list should be relative to |
| 377 # tools/clang. | 391 # tools/clang. |
| 378 CHROME_TOOL_DIRS="plugins" | |
| 379 # For each tool directory, copy it into the clang tree and use clang's build | 392 # For each tool directory, copy it into the clang tree and use clang's build |
| 380 # system to compile it. | 393 # system to compile it. |
| 381 for CHROME_TOOL_DIR in ${CHROME_TOOL_DIRS}; do | 394 for CHROME_TOOL_DIR in ${chrome_tools}; do |
| 382 TOOL_SRC_DIR="${THIS_DIR}/../${CHROME_TOOL_DIR}" | 395 TOOL_SRC_DIR="${THIS_DIR}/../${CHROME_TOOL_DIR}" |
| 383 TOOL_DST_DIR="${LLVM_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}" | 396 TOOL_DST_DIR="${LLVM_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}" |
| 384 TOOL_BUILD_DIR="${LLVM_BUILD_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}" | 397 TOOL_BUILD_DIR="${LLVM_BUILD_DIR}/tools/clang/tools/chrome-${CHROME_TOOL_DIR}" |
| 385 rm -rf "${TOOL_DST_DIR}" | 398 rm -rf "${TOOL_DST_DIR}" |
| 386 cp -R "${TOOL_SRC_DIR}" "${TOOL_DST_DIR}" | 399 cp -R "${TOOL_SRC_DIR}" "${TOOL_DST_DIR}" |
| 387 rm -rf "${TOOL_BUILD_DIR}" | 400 rm -rf "${TOOL_BUILD_DIR}" |
| 388 mkdir -p "${TOOL_BUILD_DIR}" | 401 mkdir -p "${TOOL_BUILD_DIR}" |
| 389 cp "${TOOL_SRC_DIR}/Makefile" "${TOOL_BUILD_DIR}" | 402 cp "${TOOL_SRC_DIR}/Makefile" "${TOOL_BUILD_DIR}" |
| 390 MACOSX_DEPLOYMENT_TARGET=10.5 make -j"${NUM_JOBS}" -C "${TOOL_BUILD_DIR}" | 403 MACOSX_DEPLOYMENT_TARGET=10.5 make -j"${NUM_JOBS}" -C "${TOOL_BUILD_DIR}" |
| 391 done | 404 done |
| 392 | 405 |
| 393 if [[ -n "$run_tests" ]]; then | 406 if [[ -n "$run_tests" ]]; then |
| 394 # Run a few tests. | 407 # Run a few tests. |
| 395 PLUGIN_SRC_DIR="${THIS_DIR}/../plugins" | 408 PLUGIN_SRC_DIR="${THIS_DIR}/../plugins" |
| 396 "${PLUGIN_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" | 409 "${PLUGIN_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" |
| 397 cd "${LLVM_BUILD_DIR}" | 410 cd "${LLVM_BUILD_DIR}" |
| 398 make check-all | 411 make check-all |
| 399 cd - | 412 cd - |
| 400 fi | 413 fi |
| 401 | 414 |
| 402 # After everything is done, log success for this revision. | 415 # After everything is done, log success for this revision. |
| 403 echo "${CLANG_REVISION}" > "${STAMP_FILE}" | 416 echo "${CLANG_REVISION}" > "${STAMP_FILE}" |
| OLD | NEW |