| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/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 CLANG_DIR="${LLVM_DIR}"/tools/clang | 10 CLANG_DIR="${LLVM_DIR}"/tools/clang |
| 11 DEPS_FILE="${THIS_DIR}"/../../../DEPS | 11 DEPS_FILE="${THIS_DIR}"/../../../DEPS |
| 12 | 12 |
| 13 # ${A:-a} returns $A if it's set, a else. |
| 14 LLVM_REPO_URL=${LLVM_URL:-http://llvm.org/svn/llvm-project} |
| 15 |
| 13 # Die if any command dies. | 16 # Die if any command dies. |
| 14 set -e | 17 set -e |
| 15 | 18 |
| 16 # Since people need to run this script anyway to compile clang, let it check out | 19 # Since people need to run this script anyway to compile clang, let it check out |
| 17 # clang as well if it's not in DEPS, so that people don't have to change their | 20 # clang as well if it's not in DEPS, so that people don't have to change their |
| 18 # DEPS if they just want to give clang a try. | 21 # DEPS if they just want to give clang a try. |
| 19 CLANG_REVISION=$(grep 'clang_revision":' "${DEPS_FILE}" | egrep -o [[:digit:]]+) | 22 CLANG_REVISION=$(grep 'clang_revision":' "${DEPS_FILE}" | egrep -o [[:digit:]]+) |
| 20 | 23 |
| 21 if grep -q 'src/third_party/llvm":' "${DEPS_FILE}"; then | 24 if grep -q 'src/third_party/llvm":' "${DEPS_FILE}"; then |
| 22 echo LLVM pulled in through DEPS, skipping LLVM update step | 25 echo LLVM pulled in through DEPS, skipping LLVM update step |
| 23 else | 26 else |
| 24 echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}" | 27 echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}" |
| 25 svn co --force \ | 28 svn co --force "${LLVM_REPO_URL}"/llvm/trunk@"${CLANG_REVISION}" "${LLVM_DIR}" |
| 26 http://llvm.org/svn/llvm-project/llvm/trunk@"${CLANG_REVISION}" \ | |
| 27 "${LLVM_DIR}" | |
| 28 fi | 29 fi |
| 29 | 30 |
| 30 if grep -q 'src/third_party/llvm/tools/clang":' "${DEPS_FILE}"; then | 31 if grep -q 'src/third_party/llvm/tools/clang":' "${DEPS_FILE}"; then |
| 31 echo clang pulled in through DEPS, skipping clang update step | 32 echo clang pulled in through DEPS, skipping clang update step |
| 32 else | 33 else |
| 33 echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}" | 34 echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}" |
| 34 svn co --force \ | 35 svn co --force "${LLVM_REPO_URL}"/cfe/trunk@"${CLANG_REVISION}" "${CLANG_DIR}" |
| 35 http://llvm.org/svn/llvm-project/cfe/trunk@"${CLANG_REVISION}" \ | |
| 36 "${CLANG_DIR}" | |
| 37 fi | 36 fi |
| 38 | 37 |
| 39 # Echo all commands. | 38 # Echo all commands. |
| 40 set -x | 39 set -x |
| 41 | 40 |
| 42 # Build clang (in a separate directory). | 41 # Build clang (in a separate directory). |
| 43 # The clang bots have this path hardcoded in built/scripts/slave/compile.py, | 42 # The clang bots have this path hardcoded in built/scripts/slave/compile.py, |
| 44 # so if you change it you also need to change these links. | 43 # so if you change it you also need to change these links. |
| 45 mkdir -p "${LLVM_DIR}"/../llvm-build | 44 mkdir -p "${LLVM_DIR}"/../llvm-build |
| 46 cd "${LLVM_DIR}"/../llvm-build | 45 cd "${LLVM_DIR}"/../llvm-build |
| (...skipping 15 matching lines...) Expand all Loading... |
| 62 # plugin. | 61 # plugin. |
| 63 PLUGIN_SRC_DIR="${THIS_DIR}"/../plugins | 62 PLUGIN_SRC_DIR="${THIS_DIR}"/../plugins |
| 64 PLUGIN_DST_DIR="${LLVM_DIR}"/../llvm/tools/clang/tools/chrome-plugin | 63 PLUGIN_DST_DIR="${LLVM_DIR}"/../llvm/tools/clang/tools/chrome-plugin |
| 65 PLUGIN_BUILD_DIR="${LLVM_DIR}"/../llvm-build/tools/clang/tools/chrome-plugin | 64 PLUGIN_BUILD_DIR="${LLVM_DIR}"/../llvm-build/tools/clang/tools/chrome-plugin |
| 66 rm -rf "${PLUGIN_DST_DIR}" | 65 rm -rf "${PLUGIN_DST_DIR}" |
| 67 cp -R "${PLUGIN_SRC_DIR}" "${PLUGIN_DST_DIR}" | 66 cp -R "${PLUGIN_SRC_DIR}" "${PLUGIN_DST_DIR}" |
| 68 rm -rf "${PLUGIN_BUILD_DIR}" | 67 rm -rf "${PLUGIN_BUILD_DIR}" |
| 69 mkdir -p "${PLUGIN_BUILD_DIR}" | 68 mkdir -p "${PLUGIN_BUILD_DIR}" |
| 70 cp "${PLUGIN_SRC_DIR}"/Makefile "${PLUGIN_BUILD_DIR}" | 69 cp "${PLUGIN_SRC_DIR}"/Makefile "${PLUGIN_BUILD_DIR}" |
| 71 make -j"${NUM_JOBS}" -C "${PLUGIN_BUILD_DIR}" | 70 make -j"${NUM_JOBS}" -C "${PLUGIN_BUILD_DIR}" |
| OLD | NEW |