summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-10 18:01:12 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-10 18:01:12 +0000
commita77c6a7c2707770b6e8ffec7dc778f1b24b5e153 (patch)
tree79d83dd4555eefde94a97e19e10e5e0dbb176428 /tools
parentc32f8a06555ac80eb0f7445f3085131b37598255 (diff)
downloadchromium_src-a77c6a7c2707770b6e8ffec7dc778f1b24b5e153.zip
chromium_src-a77c6a7c2707770b6e8ffec7dc778f1b24b5e153.tar.gz
chromium_src-a77c6a7c2707770b6e8ffec7dc778f1b24b5e153.tar.bz2
clang: Add a --bootstrap option to update.sh, let package.sh use it.
BUG=113653 TEST=Building a clang package now takes twice as long. Review URL: https://chromiumcodereview.appspot.com/9369063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121473 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-xtools/clang/scripts/package.sh6
-rwxr-xr-xtools/clang/scripts/update.sh53
2 files changed, 48 insertions, 11 deletions
diff --git a/tools/clang/scripts/package.sh b/tools/clang/scripts/package.sh
index 36c5e8f5..7eea12d 100755
--- a/tools/clang/scripts/package.sh
+++ b/tools/clang/scripts/package.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -7,6 +7,7 @@
# to a tgz file.
THIS_DIR="$(dirname "${0}")"
+LLVM_BOOTSTRAP_DIR="${THIS_DIR}/../../../third_party/llvm-bootstrap"
LLVM_BUILD_DIR="${THIS_DIR}/../../../third_party/llvm-build"
LLVM_BIN_DIR="${LLVM_BUILD_DIR}/Release+Asserts/bin"
LLVM_LIB_DIR="${LLVM_BUILD_DIR}/Release+Asserts/lib"
@@ -14,8 +15,9 @@ LLVM_LIB_DIR="${LLVM_BUILD_DIR}/Release+Asserts/lib"
set -ex
# Do a clobber build.
+rm -rf "${LLVM_BOOTSTRAP_DIR}"
rm -rf "${LLVM_BUILD_DIR}"
-"${THIS_DIR}"/update.sh --run-tests
+"${THIS_DIR}"/update.sh --run-tests --bootstrap --force-local-build
R=$("${LLVM_BIN_DIR}/clang" --version | \
sed -ne 's/clang version .*(trunk \([0-9]*\))/\1/p')
diff --git a/tools/clang/scripts/update.sh b/tools/clang/scripts/update.sh
index 9d69d2b..b8839ee 100755
--- a/tools/clang/scripts/update.sh
+++ b/tools/clang/scripts/update.sh
@@ -13,6 +13,7 @@ CLANG_REVISION=148911
THIS_DIR="$(dirname "${0}")"
LLVM_DIR="${THIS_DIR}/../../../third_party/llvm"
LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build"
+LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap"
CLANG_DIR="${LLVM_DIR}/tools/clang"
COMPILER_RT_DIR="${LLVM_DIR}/projects/compiler-rt"
STAMP_FILE="${LLVM_BUILD_DIR}/cr_build_revision"
@@ -29,8 +30,12 @@ OS="$(uname -s)"
force_local_build=
mac_only=
run_tests=
+bootstrap=
while [[ $# > 0 ]]; do
case $1 in
+ --bootstrap)
+ bootstrap=yes
+ ;;
--force-local-build)
force_local_build=yes
;;
@@ -42,6 +47,7 @@ while [[ $# > 0 ]]; do
;;
--help)
echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] "
+ echo "--bootstrap: First build clang with CC, then with itself."
echo "--force-local-build: Don't try to download prebuilt binaries."
echo "--mac-only: Do initial download only on Mac systems."
echo "--run-tests: Run tests after building. Only for local builds."
@@ -87,7 +93,7 @@ fi
# Check if there's anything to be done, exit early if not.
-if [ -f "${STAMP_FILE}" ]; then
+if [[ -f "${STAMP_FILE}" ]]; then
PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}")
if [[ -z "$force_local_build" ]] && \
[[ "${PREVIOUSLY_BUILT_REVISON}" = "${CLANG_REVISION}" ]]; then
@@ -130,7 +136,7 @@ if [[ "${OS}" = "Darwin" ]]; then
done
fi
-if [ -z "$force_local_build" ]; then
+if [[ -z "$force_local_build" ]]; then
# Check if there's a prebuilt binary and if so just fetch that. That's faster,
# and goma relies on having matching binary hashes on client and server too.
CDS_URL=https://commondatastorage.googleapis.com/chromium-browser-clang
@@ -183,12 +189,47 @@ svn co --force "${LLVM_REPO_URL}/compiler-rt/trunk@${CLANG_REVISION}" \
# Echo all commands.
set -x
+NUM_JOBS=3
+if [[ "${OS}" = "Linux" ]]; then
+ NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)"
+elif [ "${OS}" = "Darwin" ]; then
+ NUM_JOBS="$(sysctl -n hw.ncpu)"
+fi
+
+# Build bootstrap clang if requested.
+if [[ -n "${bootstrap}" ]]; then
+ echo "Building bootstrap compiler"
+ mkdir -p "${LLVM_BOOTSTRAP_DIR}"
+ cd "${LLVM_BOOTSTRAP_DIR}"
+ if [[ ! -f ./config.status ]]; then
+ # The bootstrap compiler only needs to be able to build the real compiler,
+ # so it needs no cross-compiler output support. In general, the host
+ # compiler should be as similar to the final compiler as possible, so do
+ # keep --disable-threads & co.
+ ../llvm/configure \
+ --enable-optimized \
+ --enable-targets=host-only \
+ --disable-threads \
+ --disable-pthreads \
+ --without-llvmgcc \
+ --without-llvmgxx
+ MACOSX_DEPLOYMENT_TARGET=10.5 make -j"${NUM_JOBS}"
+ fi
+ if [[ -n "${run_tests}" ]]; then
+ make check-all
+ fi
+ cd -
+ export CC="${PWD}/${LLVM_BOOTSTRAP_DIR}/Release+Asserts/bin/clang"
+ export CXX="${PWD}/${LLVM_BOOTSTRAP_DIR}/Release+Asserts/bin/clang++"
+ echo "Building final compiler"
+fi
+
# Build clang (in a separate directory).
# The clang bots have this path hardcoded in built/scripts/slave/compile.py,
# so if you change it you also need to change these links.
mkdir -p "${LLVM_BUILD_DIR}"
cd "${LLVM_BUILD_DIR}"
-if [ ! -f ./config.status ]; then
+if [[ ! -f ./config.status ]]; then
../llvm/configure \
--enable-optimized \
--disable-threads \
@@ -197,12 +238,6 @@ if [ ! -f ./config.status ]; then
--without-llvmgxx
fi
-NUM_JOBS=3
-if [ "${OS}" = "Linux" ]; then
- NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)"
-elif [ "${OS}" = "Darwin" ]; then
- NUM_JOBS="$(sysctl -n hw.ncpu)"
-fi
MACOSX_DEPLOYMENT_TARGET=10.5 make -j"${NUM_JOBS}"
cd -