| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Script to build valgrind for use with chromium | 7 # Script to build valgrind for use with chromium |
| 8 # | 8 # |
| 9 # Can also be used to just prepare patched source tarball with MAKE_TARBALL=yes | 9 # Can also be used to just prepare patched source tarball with MAKE_TARBALL=yes |
| 10 # or to just build from a patched source tarball with USE_TARBALL=yes. | 10 # or to just build from a patched source tarball with USE_TARBALL=yes. |
| 11 # These are useful when configuring jailed buildbots which are not allowed to | 11 # These are useful when configuring jailed buildbots which are not allowed to |
| 12 # fetch valgrind source via svn. Most users won't need those options. | 12 # fetch valgrind source via svn. Most users won't need those options. |
| 13 | 13 |
| 14 # Checkout by date doesn't work unless you specify the friggin' timezone | 14 # Checkout by date doesn't work unless you specify the friggin' timezone |
| 15 VALGRIND_SVN_REV=10880 | 15 VALGRIND_SVN_REV=10880 |
| 16 # And svn isn't smart enough to figure out what rev of the linked tree to get | 16 # And svn isn't smart enough to figure out what rev of the linked tree to get |
| 17 VEX_SVN_REV=1914 | 17 VEX_SVN_REV=1914 |
| 18 # and TSAN may be out of sync, so you have to check that out by rev anyway | 18 # and TSAN may be out of sync, so you have to check that out by rev anyway |
| 19 TSAN_SVN_REV=1129 | 19 TSAN_SVN_REV=1129 |
| 20 | 20 |
| 21 # suffix for build and install dir to denote our set of patches (may be empty) |
| 22 PATCHLEVEL=-redzone |
| 23 |
| 24 DIRNAME=valgrind-${VALGRIND_SVN_REV}${PATCHLEVEL} |
| 25 |
| 21 THISDIR=$(dirname "${0}") | 26 THISDIR=$(dirname "${0}") |
| 22 THISDIR=$(cd "${THISDIR}" && /bin/pwd) | 27 THISDIR=$(cd "${THISDIR}" && /bin/pwd) |
| 23 | 28 |
| 24 case "x${1}" in | 29 case "x${1}" in |
| 25 x|x/*) ;; | 30 x|x/*) ;; |
| 26 *) | 31 *) |
| 27 echo "Usage: sh build-valgrind-for-chromium.sh [prefix]" | 32 echo "Usage: sh build-valgrind-for-chromium.sh [prefix]" |
| 28 echo "Prefix is optional, but if present, must be the absolute path to where" | 33 echo "Prefix is optional, but if present, must be the absolute path to where" |
| 29 echo "you want to install valgrind's bin, include, and lib directories." | 34 echo "you want to install valgrind's bin, include, and lib directories." |
| 30 echo "Prefix defaults to /usr/local/valgrind-${VALGRIND_SVN_REV}, where" | 35 echo "Prefix defaults to /usr/local/$DIRNAME." |
| 31 echo "${VALGRIND_SVN_REV} is the revision used when retrieving valgrind from s
vn." | |
| 32 echo "Will use sudo to do the install if you don't own the parent of prefix." | 36 echo "Will use sudo to do the install if you don't own the parent of prefix." |
| 33 exit 1 | 37 exit 1 |
| 34 ;; | 38 ;; |
| 35 esac | 39 esac |
| 36 | 40 |
| 37 set -x | 41 set -x |
| 38 set -e | 42 set -e |
| 39 | 43 |
| 40 if test "x${USE_TARBALL}" = "xyes" && test "x${MAKE_TARBALL}" = "xyes" | 44 if test "x${USE_TARBALL}" = "xyes" && test "x${MAKE_TARBALL}" = "xyes" |
| 41 then | 45 then |
| 42 echo Set only one of MAKE_TARBALL or USE_TARBALL to yes | 46 echo Set only one of MAKE_TARBALL or USE_TARBALL to yes |
| 43 exit 1 | 47 exit 1 |
| 44 fi | 48 fi |
| 45 | 49 |
| 46 # Clean checkout our untar | 50 # Clean checkout our untar |
| 47 rm -rf "valgrind-${VALGRIND_SVN_REV}" | 51 test -d "$DIRNAME" && rm -rf ./"$DIRNAME" |
| 48 mkdir -p "valgrind-${VALGRIND_SVN_REV}" | 52 mkdir -p "$DIRNAME" |
| 49 | 53 |
| 50 if test "x${USE_TARBALL}" != "xyes" | 54 if test "x${USE_TARBALL}" != "xyes" |
| 51 then | 55 then |
| 52 # Check out latest version that following patches known to apply against | 56 # Check out latest version that following patches known to apply against |
| 53 svn co -r "${VALGRIND_SVN_REV}" "svn://svn.valgrind.org/valgrind/trunk" "valgr
ind-${VALGRIND_SVN_REV}" | 57 svn co -r "${VALGRIND_SVN_REV}" "svn://svn.valgrind.org/valgrind/trunk" "$DIRN
AME" |
| 54 | 58 |
| 55 cd "valgrind-${VALGRIND_SVN_REV}" | 59 cd "$DIRNAME" |
| 56 | 60 |
| 57 # Make sure svn gets the right version of the external VEX repo, too | 61 # Make sure svn gets the right version of the external VEX repo, too |
| 58 svn update -r "${VEX_SVN_REV}" VEX/ | 62 svn update -r "${VEX_SVN_REV}" VEX/ |
| 59 | 63 |
| 60 # Work around bug https://bugs.kde.org/show_bug.cgi?id=162848 | 64 # Work around bug https://bugs.kde.org/show_bug.cgi?id=162848 |
| 61 # "fork() not handled properly" | 65 # "fork() not handled properly" |
| 62 patch -p0 < "${THISDIR}/fork.patch" | 66 patch -p0 < "${THISDIR}/fork.patch" |
| 63 | 67 |
| 64 # Add feature bug https://bugs.kde.org/show_bug.cgi?id=201170 | 68 # Add feature bug https://bugs.kde.org/show_bug.cgi?id=201170 |
| 65 # "Want --show-possible option so I can ignore the bazillion possible leaks...
" | 69 # "Want --show-possible option so I can ignore the bazillion possible leaks...
" |
| 66 patch -p0 < "${THISDIR}/possible.patch" | 70 patch -p0 < "${THISDIR}/possible.patch" |
| 67 | 71 |
| 68 # Add feature bug https://bugs.kde.org/show_bug.cgi?id=205000 | 72 # Add feature bug https://bugs.kde.org/show_bug.cgi?id=205000 |
| 69 # "Need library load address in log files" | 73 # "Need library load address in log files" |
| 70 patch -p0 < "${THISDIR}/xml-loadadr.patch" | 74 patch -p0 < "${THISDIR}/xml-loadadr.patch" |
| 71 | 75 |
| 76 # Make red zone 64 bytes bigger to catch more buffer overruns |
| 77 patch -p0 < "${THISDIR}/redzone.patch" |
| 78 |
| 72 if [ "${INSTALL_TSAN}" = "yes" ] | 79 if [ "${INSTALL_TSAN}" = "yes" ] |
| 73 then | 80 then |
| 74 # Add ThreadSanitier to the installation. | 81 # Add ThreadSanitier to the installation. |
| 75 # ThreadSanitizer is an experimental dynamic data race detector. | 82 # ThreadSanitizer is an experimental dynamic data race detector. |
| 76 # See http://code.google.com/p/data-race-test/wiki/ThreadSanitizer | 83 # 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/t
runk/tsan tsan | 84 svn checkout -r "${TSAN_SVN_REV}" http://data-race-test.googlecode.com/svn/t
runk/tsan tsan |
| 78 mkdir tsan/tests | 85 mkdir tsan/tests |
| 79 touch tsan/tests/Makefile.am | 86 touch tsan/tests/Makefile.am |
| 80 patch -p 0 < tsan/valgrind.patch | 87 patch -p 0 < tsan/valgrind.patch |
| 81 fi | 88 fi |
| 82 | 89 |
| 83 sh autogen.sh | 90 sh autogen.sh |
| 84 if test -L install-sh | 91 if test -L install-sh |
| 85 then | 92 then |
| 86 # replace symlink with actual contents! | 93 # replace symlink with actual contents! |
| 87 cp install-sh install-sh.new | 94 cp install-sh install-sh.new |
| 88 mv install-sh.new install-sh | 95 mv -f install-sh.new install-sh |
| 89 chmod +x install-sh | 96 chmod +x install-sh |
| 90 fi | 97 fi |
| 91 | 98 |
| 92 # MacOSX before Snow Leopoard needs newer gdb to be able to handle -O1 chrome | 99 # MacOSX before Snow Leopoard needs newer gdb to be able to handle -O1 chrome |
| 93 # Kludgily download and unpack the sources in a subdirectory. | 100 # Kludgily download and unpack the sources in a subdirectory. |
| 94 if test `uname` = Darwin || test "x${MAKE_TARBALL}" = "xyes" | 101 if test `uname` = Darwin || test "x${MAKE_TARBALL}" = "xyes" |
| 95 then | 102 then |
| 96 curl http://www.opensource.apple.com/tarballs/gdb/gdb-1344.tar.gz | tar -xzf
- | 103 curl http://www.opensource.apple.com/tarballs/gdb/gdb-1344.tar.gz | tar -xzf
- |
| 97 fi | 104 fi |
| 98 cd .. | 105 cd .. |
| 99 | 106 |
| 100 fi | 107 fi |
| 101 | 108 |
| 102 if test "x${MAKE_TARBALL}" = "xyes" | 109 if test "x${MAKE_TARBALL}" = "xyes" |
| 103 then | 110 then |
| 104 tar -czvf "valgrind-${VALGRIND_SVN_REV}.tgz" "valgrind-${VALGRIND_SVN_REV}" | 111 tar -czvf "$DIRNAME".tgz "$DIRNAME" |
| 105 fi | 112 fi |
| 106 | 113 |
| 107 if test "x${USE_TARBALL}" = "xyes" | 114 if test "x${USE_TARBALL}" = "xyes" |
| 108 then | 115 then |
| 109 tar -xzvf "valgrind-${VALGRIND_SVN_REV}.tgz" | 116 tar -xzvf "$DIRNAME".tgz |
| 110 fi | 117 fi |
| 111 | 118 |
| 112 if test "x${MAKE_TARBALL}" != "xyes" | 119 if test "x${MAKE_TARBALL}" != "xyes" |
| 113 then | 120 then |
| 114 cd "valgrind-${VALGRIND_SVN_REV}" | 121 cd "$DIRNAME" |
| 115 | 122 |
| 116 OVERRIDE_LD_DIR="${THISDIR}/override_ld" | 123 OVERRIDE_LD_DIR="${THISDIR}/override_ld" |
| 117 if ld --version | grep gold | 124 if ld --version | grep gold |
| 118 then | 125 then |
| 119 # build/install-build-deps leaves original ld around, try using that | 126 # build/install-build-deps leaves original ld around, try using that |
| 120 if test -x /usr/bin/ld.orig | 127 if test -x /usr/bin/ld.orig |
| 121 then | 128 then |
| 122 echo "Using /usr/bin/ld.orig instead of gold to link valgrind" | 129 echo "Using /usr/bin/ld.orig instead of gold to link valgrind" |
| 123 test -d "${OVERRIDE_LD_DIR}" && rm -rf "${OVERRIDE_LD_DIR}" | 130 test -d "${OVERRIDE_LD_DIR}" && rm -rf "${OVERRIDE_LD_DIR}" |
| 124 mkdir "${OVERRIDE_LD_DIR}" | 131 mkdir "${OVERRIDE_LD_DIR}" |
| 125 ln -s /usr/bin/ld.orig "${OVERRIDE_LD_DIR}/ld" | 132 ln -s /usr/bin/ld.orig "${OVERRIDE_LD_DIR}/ld" |
| 126 PATH="${OVERRIDE_LD_DIR}:${PATH}" | 133 PATH="${OVERRIDE_LD_DIR}:${PATH}" |
| 127 # Ubuntu diverts original ld to ld.single when it installs binutils-gold | 134 # Ubuntu diverts original ld to ld.single when it installs binutils-gold |
| 128 elif test -x /usr/bin/ld.single | 135 elif test -x /usr/bin/ld.single |
| 129 then | 136 then |
| 130 echo "Using /usr/bin/ld.single instead of gold to link valgrind" | 137 echo "Using /usr/bin/ld.single instead of gold to link valgrind" |
| 131 test -d "${OVERRIDE_LD_DIR}" && rm -rf "${OVERRIDE_LD_DIR}" | 138 test -d "${OVERRIDE_LD_DIR}" && rm -rf "${OVERRIDE_LD_DIR}" |
| 132 mkdir "${OVERRIDE_LD_DIR}" | 139 mkdir "${OVERRIDE_LD_DIR}" |
| 133 ln -s /usr/bin/ld.single "${OVERRIDE_LD_DIR}/ld" | 140 ln -s /usr/bin/ld.single "${OVERRIDE_LD_DIR}/ld" |
| 134 PATH="${OVERRIDE_LD_DIR}:${PATH}" | 141 PATH="${OVERRIDE_LD_DIR}:${PATH}" |
| 135 else | 142 else |
| 136 echo "Cannot build valgrind with gold. Please switch to normal /usr/bin/l
d, rerun this script, then switch back to gold." | 143 echo "Cannot build valgrind with gold. Please switch to normal /usr/bin/l
d, rerun this script, then switch back to gold." |
| 137 exit 1 | 144 exit 1 |
| 138 fi | 145 fi |
| 139 fi | 146 fi |
| 140 | 147 |
| 141 # Desired parent directory for valgrind's bin, include, etc. | 148 # Desired parent directory for valgrind's bin, include, etc. |
| 142 PREFIX="${1:-/usr/local/valgrind-${VALGRIND_SVN_REV}}" | 149 PREFIX="${1:-/usr/local/$DIRNAME}" |
| 143 parent_of_prefix=$(dirname "${PREFIX}") | 150 parent_of_prefix=$(dirname "${PREFIX}") |
| 144 if test ! -d "${parent_of_prefix}" | 151 if test ! -d "${parent_of_prefix}" |
| 145 then | 152 then |
| 146 echo "Directory ${parent_of_prefix} does not exist" | 153 echo "Directory ${parent_of_prefix} does not exist" |
| 147 exit 1 | 154 exit 1 |
| 148 fi | 155 fi |
| 149 | 156 |
| 150 ./configure --prefix="${PREFIX}" | 157 ./configure --prefix="${PREFIX}" |
| 151 make -j4 | 158 make -j4 |
| 152 | 159 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 176 if test -w "${parent_of_prefix}" | 183 if test -w "${parent_of_prefix}" |
| 177 then | 184 then |
| 178 make install | 185 make install |
| 179 else | 186 else |
| 180 sudo make install | 187 sudo make install |
| 181 fi | 188 fi |
| 182 ;; | 189 ;; |
| 183 esac | 190 esac |
| 184 cd .. | 191 cd .. |
| 185 fi | 192 fi |
| OLD | NEW |