OLD | NEW |
1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 THIS_DIR="$(dirname "${0}")" | 8 THIS_DIR="$(dirname "${0}")" |
9 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" | 9 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" |
10 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build" | 10 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build" |
11 CLANG_DIR="${LLVM_DIR}/tools/clang" | 11 CLANG_DIR="${LLVM_DIR}/tools/clang" |
12 DEPS_FILE="${THIS_DIR}/../../../DEPS" | 12 DEPS_FILE="${THIS_DIR}/../../../DEPS" |
13 if [ -e "${THIS_DIR}/../../../chromium_deps/DEPS" ]; then | 13 if [ -e "${THIS_DIR}/../../../chromium_deps/DEPS" ]; then |
14 # For bare WebKit/chromium checkouts. | 14 # For bare WebKit/chromium checkouts. |
15 DEPS_FILE="${THIS_DIR}/../../../chromium_deps/DEPS" | 15 DEPS_FILE="${THIS_DIR}/../../../chromium_deps/DEPS" |
16 fi | 16 fi |
17 STAMP_FILE="${LLVM_BUILD_DIR}/cr_build_revision" | 17 STAMP_FILE="${LLVM_BUILD_DIR}/cr_build_revision" |
18 | 18 |
19 # ${A:-a} returns $A if it's set, a else. | 19 # ${A:-a} returns $A if it's set, a else. |
20 LLVM_REPO_URL=${LLVM_URL:-http://llvm.org/svn/llvm-project} | 20 LLVM_REPO_URL=${LLVM_URL:-http://llvm.org/svn/llvm-project} |
21 | 21 |
22 # Die if any command dies. | 22 # Die if any command dies. |
23 set -e | 23 set -e |
24 | 24 |
25 OS="$(uname -s)" | 25 OS="$(uname -s)" |
26 | 26 |
27 # Parse command line options. | 27 # Parse command line options. |
28 force_local_build= | 28 force_local_build= |
29 mac_only= | 29 mac_only= |
| 30 run_tests= |
30 while [[ $# > 0 ]]; do | 31 while [[ $# > 0 ]]; do |
31 case $1 in | 32 case $1 in |
32 --force-local-build) | 33 --force-local-build) |
33 force_local_build=yes | 34 force_local_build=yes |
34 ;; | 35 ;; |
35 --mac-only) | 36 --mac-only) |
36 mac_only=yes | 37 mac_only=yes |
37 ;; | 38 ;; |
| 39 --run-tests) |
| 40 run_tests=yes |
| 41 ;; |
38 --help) | 42 --help) |
39 echo "usage: $0 [--force-local-build] [--mac-only] " | 43 echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] " |
40 echo "--force-local-build: Don't try to download prebuilt binaries." | 44 echo "--force-local-build: Don't try to download prebuilt binaries." |
41 echo "--mac-only: Do nothing on non-Mac systems." | 45 echo "--mac-only: Do nothing on non-Mac systems." |
| 46 echo "--run-tests: Run tests after building. Only for local builds." |
42 exit 1 | 47 exit 1 |
43 ;; | 48 ;; |
44 esac | 49 esac |
45 shift | 50 shift |
46 done | 51 done |
47 | 52 |
48 if [[ -n "$mac_only" ]] && [[ "${OS}" != "Darwin" ]]; then | 53 if [[ -n "$mac_only" ]] && [[ "${OS}" != "Darwin" ]]; then |
49 exit 0 | 54 exit 0 |
50 fi | 55 fi |
51 | 56 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 PLUGIN_SRC_DIR="${THIS_DIR}/../plugins" | 206 PLUGIN_SRC_DIR="${THIS_DIR}/../plugins" |
202 PLUGIN_DST_DIR="${LLVM_DIR}/tools/clang/tools/chrome-plugin" | 207 PLUGIN_DST_DIR="${LLVM_DIR}/tools/clang/tools/chrome-plugin" |
203 PLUGIN_BUILD_DIR="${LLVM_BUILD_DIR}/tools/clang/tools/chrome-plugin" | 208 PLUGIN_BUILD_DIR="${LLVM_BUILD_DIR}/tools/clang/tools/chrome-plugin" |
204 rm -rf "${PLUGIN_DST_DIR}" | 209 rm -rf "${PLUGIN_DST_DIR}" |
205 cp -R "${PLUGIN_SRC_DIR}" "${PLUGIN_DST_DIR}" | 210 cp -R "${PLUGIN_SRC_DIR}" "${PLUGIN_DST_DIR}" |
206 rm -rf "${PLUGIN_BUILD_DIR}" | 211 rm -rf "${PLUGIN_BUILD_DIR}" |
207 mkdir -p "${PLUGIN_BUILD_DIR}" | 212 mkdir -p "${PLUGIN_BUILD_DIR}" |
208 cp "${PLUGIN_SRC_DIR}/Makefile" "${PLUGIN_BUILD_DIR}" | 213 cp "${PLUGIN_SRC_DIR}/Makefile" "${PLUGIN_BUILD_DIR}" |
209 make -j"${NUM_JOBS}" -C "${PLUGIN_BUILD_DIR}" | 214 make -j"${NUM_JOBS}" -C "${PLUGIN_BUILD_DIR}" |
210 | 215 |
| 216 if [[ -n "$run_tests" ]]; then |
| 217 # Run a few tests. |
| 218 "${PLUGIN_SRC_DIR}/tests/test.sh" "${LLVM_BUILD_DIR}/Release+Asserts" |
| 219 fi |
| 220 |
211 # After everything is done, log success for this revision. | 221 # After everything is done, log success for this revision. |
212 echo "${CLANG_REVISION}" > "${STAMP_FILE}" | 222 echo "${CLANG_REVISION}" > "${STAMP_FILE}" |
OLD | NEW |