Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 # Script to build valgrind for use with chromium | 2 # Script to build valgrind for use with chromium |
| 3 # | |
| 4 # Can also be used to just prepare patched source tarball by setting MAKE_TARBAL L=yes | |
|
Lei Zhang
2009/08/12 23:13:27
> 80 chars per line. Is the presubmit check not na
| |
| 5 # or to just build from a patched source tarball by setting USE_TARBALL=yes | |
| 6 # These are useful when configuring jailed buildbots which are not allowed to | |
| 7 # fetch valgrind source via svn | |
| 3 | 8 |
| 4 # Checkout by date doesn't work unless you specify the friggin' timezone | 9 # Checkout by date doesn't work unless you specify the friggin' timezone |
| 5 VALGRIND_SVN_REV=10771 | 10 VALGRIND_SVN_REV=10771 |
| 6 # And svn isn't smart enough to figure out what rev of the linked tree to get | 11 # And svn isn't smart enough to figure out what rev of the linked tree to get |
| 7 VEX_SVN_REV=1913 | 12 VEX_SVN_REV=1913 |
| 8 # and TSAN may be out of sync, so you have to check that out by rev anyway | 13 # and TSAN may be out of sync, so you have to check that out by rev anyway |
| 9 TSAN_SVN_REV=1111 | 14 TSAN_SVN_REV=1111 |
| 10 | 15 |
| 11 THISDIR=`dirname $0` | 16 THISDIR=`dirname $0` |
| 12 THISDIR=`cd $THISDIR && /bin/pwd` | 17 THISDIR=`cd $THISDIR && /bin/pwd` |
| 13 | 18 |
| 14 case x"$1" in | 19 case x"$1" in |
| 15 x|x/*) ;; | 20 x|x/*) ;; |
| 16 *) | 21 *) |
| 17 echo "Usage: sh build-valgrind-for-chromium.sh [prefix]" | 22 echo "Usage: sh build-valgrind-for-chromium.sh [prefix]" |
| 18 echo "Prefix is optional, but if present, must be the absolute path to where" | 23 echo "Prefix is optional, but if present, must be the absolute path to where" |
| 19 echo "you want to install valgrind's bin, include, and lib directories." | 24 echo "you want to install valgrind's bin, include, and lib directories." |
| 20 echo "Prefix defaults to /usr/local/valgrind-$SHORTSVNDATE, where" | 25 echo "Prefix defaults to /usr/local/valgrind-$VALGRIND_SVN_REV, where" |
| 21 echo "$SHORTSVNDATE is the date used when retrieving valgrind from svn." | 26 echo "$VALGRIND_SVN_REV is the revision used when retrieving valgrind from svn ." |
| 22 echo "Will use sudo to do the install if you don't own the parent of prefix." | 27 echo "Will use sudo to do the install if you don't own the parent of prefix." |
| 23 exit 1 | 28 exit 1 |
| 24 ;; | 29 ;; |
| 25 esac | 30 esac |
| 26 | 31 |
| 27 set -x | 32 set -x |
| 28 set -e | 33 set -e |
| 29 | 34 |
| 30 if ld --version | grep gold | 35 if test x"$USE_TARBALL" = xyes && test x"$MAKE_TARBALL" = yes |
| 31 then | 36 then |
| 32 # build/install-build-deps leaves original ld around, try using that | 37 echo Set only one of MAKE_TARBALL or USE_TARBALL to yes |
| 33 if test -x /usr/bin/ld.orig | |
| 34 then | |
| 35 echo "Using /usr/bin/ld.orig instead of gold to link valgrind" | |
| 36 test -d $THISDIR/override_ld && rm -rf $THISDIR/override_ld | |
| 37 mkdir $THISDIR/override_ld | |
| 38 ln -s /usr/bin/ld.orig $THISDIR/override_ld/ld | |
| 39 PATH="$THISDIR/override_ld:$PATH" | |
| 40 else | |
| 41 echo "Cannot build valgrind with gold. Please switch to normal /usr/bin/ld, rerun this script, then switch back to gold." | |
| 42 exit 1 | |
| 43 fi | |
| 44 fi | |
| 45 | |
| 46 # Desired parent directory for valgrind's bin, include, etc. | |
| 47 PREFIX="${1:-/usr/local/valgrind-$VALGRIND_SVN_REV}" | |
| 48 parent_of_prefix="`dirname $PREFIX`" | |
| 49 if test ! -d "$parent_of_prefix" | |
| 50 then | |
| 51 echo "Directory $parent_of_prefix does not exist" | |
| 52 exit 1 | 38 exit 1 |
| 53 fi | 39 fi |
| 54 | 40 |
| 55 # Check out latest version that following patches known to apply against | 41 if test x"$USE_TARBALL" != xyes |
| 56 rm -rf valgrind-$VALGRIND_SVN_REV | 42 then |
| 57 svn co -r $VALGRIND_SVN_REV svn://svn.valgrind.org/valgrind/trunk valgrind-$VALG RIND_SVN_REV | 43 # Check out latest version that following patches known to apply against |
| 44 rm -rf valgrind-$VALGRIND_SVN_REV | |
| 45 svn co -r $VALGRIND_SVN_REV svn://svn.valgrind.org/valgrind/trunk valgrind-$VA LGRIND_SVN_REV | |
| 58 | 46 |
| 59 cd valgrind-$VALGRIND_SVN_REV | 47 cd valgrind-$VALGRIND_SVN_REV |
| 60 | 48 |
| 61 # Make sure svn gets the right version of the external VEX repo, too | 49 # Make sure svn gets the right version of the external VEX repo, too |
| 62 svn update -r $VEX_SVN_REV VEX/ | 50 svn update -r $VEX_SVN_REV VEX/ |
| 63 | 51 |
| 64 # Work around bug https://bugs.kde.org/show_bug.cgi?id=162848 | 52 # Work around bug https://bugs.kde.org/show_bug.cgi?id=162848 |
| 65 # "fork() not handled properly" | 53 # "fork() not handled properly" |
| 66 patch -p0 < "$THISDIR"/fork.patch | 54 patch -p0 < "$THISDIR"/fork.patch |
| 67 | 55 |
| 68 # Add feature bug https://bugs.kde.org/show_bug.cgi?id=201170 | 56 # Add feature bug https://bugs.kde.org/show_bug.cgi?id=201170 |
| 69 # "Want --show-possible option so I can ignore the bazillion possible leaks..." | 57 # "Want --show-possible option so I can ignore the bazillion possible leaks... " |
| 70 patch -p0 < "$THISDIR"/possible.patch | 58 patch -p0 < "$THISDIR"/possible.patch |
| 71 | 59 |
| 72 if [ "$INSTALL_TSAN" = "yes" ] | 60 if [ "$INSTALL_TSAN" = "yes" ] |
| 73 then | 61 then |
| 74 # Add ThreadSanitier to the installation. | 62 # Add ThreadSanitier to the installation. |
| 75 # ThreadSanitizer is an experimental dynamic data race detector. | 63 # ThreadSanitizer is an experimental dynamic data race detector. |
| 76 # See http://code.google.com/p/data-race-test/wiki/ThreadSanitizer | 64 # See http://code.google.com/p/data-race-test/wiki/ThreadSanitizer |
| 77 svn checkout -r $TSAN_SVN_REV http://data-race-test.googlecode.com/svn/trunk/t san tsan | 65 svn checkout -r $TSAN_SVN_REV http://data-race-test.googlecode.com/svn/trunk /tsan tsan |
| 78 mkdir tsan/{docs,tests} | 66 mkdir tsan/{docs,tests} |
| 79 touch tsan/{docs,tests}/Makefile.am | 67 touch tsan/{docs,tests}/Makefile.am |
| 80 patch -p 0 < tsan/valgrind.patch | 68 patch -p 0 < tsan/valgrind.patch |
| 69 fi | |
| 70 | |
| 71 sh autogen.sh | |
| 72 cd .. | |
| 81 fi | 73 fi |
| 82 | 74 |
| 83 sh autogen.sh | 75 if test x"$MAKE_TARBALL" = xyes |
| 84 ./configure --prefix="$PREFIX" | |
| 85 make -j4 | |
| 86 | |
| 87 if ./vg-in-place true | |
| 88 then | 76 then |
| 89 echo built valgrind passes smoke test, good | 77 tar -czvf valgrind-$VALGRIND_SVN_REV.tgz valgrind-$VALGRIND_SVN_REV |
| 90 else | |
| 91 echo built valgrind fails smoke test | |
| 92 exit 1 | |
| 93 fi | 78 fi |
| 94 | 79 |
| 95 test -d $THISDIR/override_ld && rm -rf $THISDIR/override_ld | 80 if test x"$USE_TARBALL" = xyes |
| 81 then | |
| 82 tar -xzvf valgrind-$VALGRIND_SVN_REV.tgz | |
| 83 fi | |
| 96 | 84 |
| 97 # Don't use sudo if we own the destination | 85 if test x"$MAKE_TARBALL" != xyes |
| 98 if test -w "$parent_of_prefix" | |
| 99 then | 86 then |
| 100 make install | 87 cd valgrind-$VALGRIND_SVN_REV |
| 101 else | 88 |
| 102 sudo make install | 89 if ld --version | grep gold |
| 90 then | |
| 91 # build/install-build-deps leaves original ld around, try using that | |
| 92 if test -x /usr/bin/ld.orig | |
| 93 then | |
| 94 echo "Using /usr/bin/ld.orig instead of gold to link valgrind" | |
| 95 test -d $THISDIR/override_ld && rm -rf $THISDIR/override_ld | |
| 96 mkdir $THISDIR/override_ld | |
| 97 ln -s /usr/bin/ld.orig $THISDIR/override_ld/ld | |
| 98 PATH="$THISDIR/override_ld:$PATH" | |
| 99 else | |
| 100 echo "Cannot build valgrind with gold. Please switch to normal /usr/bin/l d, rerun this script, then switch back to gold." | |
| 101 exit 1 | |
| 102 fi | |
| 103 fi | |
| 104 | |
| 105 # Desired parent directory for valgrind's bin, include, etc. | |
| 106 PREFIX="${1:-/usr/local/valgrind-$VALGRIND_SVN_REV}" | |
| 107 parent_of_prefix="`dirname $PREFIX`" | |
| 108 if test ! -d "$parent_of_prefix" | |
| 109 then | |
| 110 echo "Directory $parent_of_prefix does not exist" | |
| 111 exit 1 | |
| 112 fi | |
| 113 | |
| 114 ./configure --prefix="$PREFIX" | |
| 115 make -j4 | |
| 116 | |
| 117 if ./vg-in-place true | |
| 118 then | |
| 119 echo built valgrind passes smoke test, good | |
| 120 else | |
| 121 echo built valgrind fails smoke test | |
| 122 exit 1 | |
| 123 fi | |
| 124 | |
| 125 test -d $THISDIR/override_ld && rm -rf $THISDIR/override_ld | |
| 126 | |
| 127 # Don't use sudo if we own the destination | |
| 128 if test -w "$parent_of_prefix" | |
| 129 then | |
| 130 make install | |
| 131 else | |
| 132 sudo make install | |
| 133 fi | |
| 103 fi | 134 fi |
| OLD | NEW |