summaryrefslogtreecommitdiffstats
path: root/tools/valgrind/build-valgrind-for-chromium.sh
diff options
context:
space:
mode:
authordkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 21:27:52 +0000
committerdkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 21:27:52 +0000
commitfd8ca1c4c4bb82944e25fa50418a4c498e157ac3 (patch)
tree1cfaf9ccf5738d2125c2305d9764d224ae4b9cd1 /tools/valgrind/build-valgrind-for-chromium.sh
parent9c4946b2bb89623299bbcff5f632841258957e08 (diff)
downloadchromium_src-fd8ca1c4c4bb82944e25fa50418a4c498e157ac3.zip
chromium_src-fd8ca1c4c4bb82944e25fa50418a4c498e157ac3.tar.gz
chromium_src-fd8ca1c4c4bb82944e25fa50418a4c498e157ac3.tar.bz2
build-valgrind-for-chrome.sh: Don't install valgrind to /usr/bin anymore
(wasn't useful on Goobuntu anyway, where some other valgrind came first in the PATH) Don't hardcode versions/dates. Add usage message. Remove URLs to some patches (they go stale fast) chrome_tests.sh: use the valgrind built by build-valgrind-for-chrome.sh by default, but provide way to override Review URL: http://codereview.chromium.org/165317 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23076 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/valgrind/build-valgrind-for-chromium.sh')
-rwxr-xr-xtools/valgrind/build-valgrind-for-chromium.sh59
1 files changed, 41 insertions, 18 deletions
diff --git a/tools/valgrind/build-valgrind-for-chromium.sh b/tools/valgrind/build-valgrind-for-chromium.sh
index a1fef40..823e0f7 100755
--- a/tools/valgrind/build-valgrind-for-chromium.sh
+++ b/tools/valgrind/build-valgrind-for-chromium.sh
@@ -1,8 +1,26 @@
#!/bin/sh
# Script to build valgrind for use with chromium
+SVNDATE='{2009-07-15}'
+SHORTSVNDATE=20090715
+TSAN_SVN_REV='1096'
+
THISDIR=`dirname $0`
THISDIR=`cd $THISDIR && /bin/pwd`
+
+case x"$1" in
+x|x/*) ;;
+*)
+ echo "Usage: sh build-valgrind-for-chromium.sh [prefix]"
+ echo "Prefix is optional, but if present, must be the absolute path to where"
+ echo "you want to install valgrind's bin, include, and lib directories."
+ echo "Prefix defaults to /usr/local/valgrind-$SHORTSVNDATE, where"
+ echo "$SHORTSVNDATE is the date used when retrieving valgrind from svn."
+ echo "Will use sudo to do the install if you don't own the parent of prefix."
+ exit 1
+ ;;
+esac
+
set -x
set -e
@@ -22,25 +40,30 @@ then
fi
fi
+# Desired parent directory for valgrind's bin, include, etc.
+PREFIX="${1:-/usr/local/valgrind-$SHORTSVNDATE}"
+parent_of_prefix="`dirname $PREFIX`"
+if test ! -d "$parent_of_prefix"
+then
+ echo "Directory $parent_of_prefix does not exist"
+ exit 1
+fi
+
# Check out latest version that following patches known to apply against
-rm -rf valgrind-20090715
-svn co -r '{2009-07-15}' svn://svn.valgrind.org/valgrind/trunk valgrind-20090715
+rm -rf valgrind-$SHORTSVNDATE
+svn co -r $SVNDATE svn://svn.valgrind.org/valgrind/trunk valgrind-$SHORTSVNDATE
-cd valgrind-20090715
+cd valgrind-$SHORTSVNDATE
-# Just in case, make sure svn gets the right version of the external VEX repo, too
-cd VEX
-svn update -r '{2009-07-15}'
-cd ..
+# Make sure svn gets the right version of the external VEX repo, too
+svn update -r $SVNDATE VEX/
# Work around bug https://bugs.kde.org/show_bug.cgi?id=162848
# "fork() not handled properly"
-#wget -O fork.patch "https://bugs.kde.org/attachment.cgi?id=35510"
patch -p0 < "$THISDIR"/fork.patch
# Work around bug https://bugs.kde.org/show_bug.cgi?id=186796
# "long suppressions truncated"
-#wget -O longlines.patch "https://bugs.kde.org/attachment.cgi?id=35174"
patch -p0 < "$THISDIR"/longlines.patch
# Work around bug http://bugs.kde.org/186790
@@ -49,7 +72,6 @@ patch -p0 < "$THISDIR"/leak.patch
# Add feature bug https://bugs.kde.org/show_bug.cgi?id=201170
# "Want --show-possible option so I can ignore the bazillion possible leaks..."
-#wget -O possible.patch https://bugs.kde.org/attachment.cgi?id=35559
patch -p0 < "$THISDIR"/possible.patch
if [ "$INSTALL_TSAN" = "yes" ]
@@ -57,7 +79,7 @@ then
# Add ThreadSanitier to the installation.
# ThreadSanitizer is an experimental dynamic data race detector.
# See http://code.google.com/p/data-race-test/wiki/ThreadSanitizer
- svn checkout -r 1096 http://data-race-test.googlecode.com/svn/trunk/tsan tsan
+ svn checkout -r $TSAN_SVN_REV http://data-race-test.googlecode.com/svn/trunk/tsan tsan
mkdir tsan/{docs,tests}
touch tsan/{docs,tests}/Makefile.am
patch -p 0 < tsan/valgrind.patch
@@ -65,7 +87,7 @@ then
fi
sh autogen.sh
-./configure --prefix=/usr/local/valgrind-20090715
+./configure --prefix="$PREFIX"
make -j4
if ./vg-in-place true
@@ -78,9 +100,10 @@ fi
test -d $THISDIR/override_ld && rm -rf $THISDIR/override_ld
-sudo make install
-cd /usr
-test -f bin/valgrind && sudo mv bin/valgrind bin/valgrind.orig
-sudo ln -sf /usr/local/valgrind-20090715/bin/valgrind bin
-test -d include/valgrind && sudo mv include/valgrind include/valgrind.orig
-sudo ln -sf /usr/local/valgrind-20090715/include/valgrind include
+# Don't use sudo if we own the destination
+if test -w "$parent_of_prefix"
+then
+ make install
+else
+ sudo make install
+fi