summaryrefslogtreecommitdiffstats
path: root/tools/clang
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-14 21:54:59 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-14 21:54:59 +0000
commit79434009537cc57fcb16692be93801a3984eea95 (patch)
tree636d54d72bbbb0472699279c0a808150297fc5af /tools/clang
parentffa8af6283117b9265f10f58432823d60b98b181 (diff)
downloadchromium_src-79434009537cc57fcb16692be93801a3984eea95.zip
chromium_src-79434009537cc57fcb16692be93801a3984eea95.tar.gz
chromium_src-79434009537cc57fcb16692be93801a3984eea95.tar.bz2
mac: Let `gclient runhooks` warn about predictive compilation in xcode3
clang doesn't support predictive compilation, and upstream doesn't want to add support for it, so tell people to disable predictive compilation in xcode instead. Do this every time `gclient runhooks` runs, no matter if clang is up-to-date or not. Running `xcodebuild -version` sometimes takes a second or time, but most of the time it's quick, and it's very fast compared to gyp anyway. BUG=96315 TEST=`gclient runhooks`, note warning message. Do what message says, `gclient runhooks` again, note that no warning message shows up. TBR=mark Review URL: http://codereview.chromium.org/7889022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101168 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/clang')
-rwxr-xr-xtools/clang/scripts/update.sh33
1 files changed, 26 insertions, 7 deletions
diff --git a/tools/clang/scripts/update.sh b/tools/clang/scripts/update.sh
index f3a261b..20f1ffa 100755
--- a/tools/clang/scripts/update.sh
+++ b/tools/clang/scripts/update.sh
@@ -18,6 +18,8 @@ LLVM_REPO_URL=${LLVM_URL:-http://llvm.org/svn/llvm-project}
# Die if any command dies.
set -e
+OS="$(uname -s)"
+
# Parse command line options.
force_local_build=
mac_only=
@@ -39,10 +41,27 @@ while [[ $# > 0 ]]; do
shift
done
-if [ "$mac_only" -a "$(uname -s)" != "Darwin" ]; then
+if [[ -n "$mac_only" ]] && [[ "${OS}" != "Darwin" ]]; then
exit 0
fi
+# Xcode and clang don't get along when predictive compilation is enabled.
+# http://crbug.com/96315
+if [[ "${OS}" = "Darwin" ]] && xcodebuild -version | grep -q 'Xcode 3.2' ; then
+ XCONF=com.apple.Xcode
+ if [ "$(defaults read "${XCONF}" EnablePredictiveCompilation)" != "0" ]; then
+ echo
+ echo " HEARKEN!"
+ echo "You're using Xcode3 and you have 'Predictive Compilation' enabled."
+ echo "This does not work well with clang (http://crbug.com/96315)."
+ echo "Disable it in Preferences->Building (lower right), or run"
+ echo " defaults write ${XCONF} EnablePredictiveCompilation -boolean NO"
+ echo "while Xcode is not running."
+ echo
+ fi
+fi
+
+
# Since people need to run this script anyway to compile clang, let it check out
# clang as well if it's not in DEPS, so that people don't have to change their
# DEPS if they just want to give clang a try.
@@ -51,8 +70,8 @@ CLANG_REVISION=$(grep 'clang_revision":' "${DEPS_FILE}" | egrep -o [[:digit:]]+)
# Check if there's anything to be done, exit early if not.
if [ -f "${STAMP_FILE}" ]; then
PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}")
- if [ -z "$force_local_build" -a \
- "${PREVIOUSLY_BUILT_REVISON}" = "${CLANG_REVISION}" ]; then
+ if [[ -z "$force_local_build" ]] && \
+ [[ "${PREVIOUSLY_BUILT_REVISON}" = "${CLANG_REVISION}" ]]; then
echo "Clang already at ${CLANG_REVISION}"
exit 0
fi
@@ -66,9 +85,9 @@ if [ -z "$force_local_build" ]; then
CDS_URL=http://commondatastorage.googleapis.com/chromium-browser-clang
CDS_FILE="clang-${CLANG_REVISION}.tgz"
echo Trying to download prebuilt clang
- if [ "$(uname -s)" = "Linux" ]; then
+ if [ "${OS}" = "Linux" ]; then
wget "${CDS_URL}/Linux_x64/${CDS_FILE}" || rm -f "${CDS_FILE}"
- elif [ "$(uname -s)" = "Darwin" ]; then
+ elif [ "${OS}" = "Darwin" ]; then
curl -L --fail -O "${CDS_URL}/Mac/${CDS_FILE}" || rm -f "${CDS_FILE}"
fi
if [ -f "${CDS_FILE}" ]; then
@@ -120,9 +139,9 @@ if [ ! -f ./config.status ]; then
fi
NUM_JOBS=3
-if [ "$(uname -s)" = "Linux" ]; then
+if [ "${OS}" = "Linux" ]; then
NUM_JOBS="$(grep -c "^processor" /proc/cpuinfo)"
-elif [ "$(uname -s)" = "Darwin" ]; then
+elif [ "${OS}" = "Darwin" ]; then
NUM_JOBS="$(sysctl -n hw.ncpu)"
fi
make -j"${NUM_JOBS}"