OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # Copyright (c) 2009-2010 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2009-2010 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 # This script contains some functions useful to build | 7 # This script contains some functions useful to build |
8 # Valgrind and ThreadSanitizer for use with chromium | 8 # Valgrind and ThreadSanitizer for use with chromium |
9 | 9 |
10 THISDIR=$(dirname "${0}") | 10 THISDIR=$(dirname "${0}") |
11 THISDIR=$(cd "${THISDIR}" && /bin/pwd) | 11 THISDIR=$(cd "${THISDIR}" && /bin/pwd) |
12 | 12 |
13 system_is_snow_leopard() { | 13 system_is_snow_leopard() { |
14 uname -r | grep 10\.[0-9]\.[0-9] >/dev/null | 14 uname -r | grep 10\.[0-9]\.[0-9] >/dev/null |
15 } | 15 } |
16 | 16 |
17 checkout_and_patch_valgrind() { | 17 checkout_and_patch_valgrind() { |
18 # $1 = Valgrind revision | 18 # $1 = Valgrind revision |
19 # $2 = VEX revision | 19 # $2 = VEX revision |
20 # $3 = source dir | 20 # $3 = source dir |
21 # Checkout Valgrind, apply our patches to Valgrind. | 21 # Checkout Valgrind, apply our patches to Valgrind. |
22 # The source will be put in $THISDIR/valgrind-source | 22 # The source will be put in $THISDIR/valgrind-source |
23 cd $THISDIR | 23 cd "$THISDIR" |
24 VG_REV="$1" | 24 VG_REV="$1" |
25 VEX_REV="$2" | 25 VEX_REV="$2" |
26 SOURCE_DIR="$3" | 26 SOURCE_DIR="$3" |
27 SVN_URI="svn://svn.valgrind.org/valgrind/trunk" | 27 SVN_URI="svn://svn.valgrind.org/valgrind/trunk" |
28 | 28 |
29 test -d "$SOURCE_DIR" && rm -rf "$SOURCE_DIR" | 29 test -d "$SOURCE_DIR" && rm -rf "$SOURCE_DIR" |
30 mkdir "$SOURCE_DIR" | 30 mkdir "$SOURCE_DIR" |
31 | 31 |
32 # Check out latest version that following patches known to apply against | 32 # Check out latest version that following patches known to apply against |
33 svn co -r "$VG_REV" "$SVN_URI" "$SOURCE_DIR" | 33 svn co -r "$VG_REV" "$SVN_URI" "$SOURCE_DIR" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 if [ "$CONFIGURE_FLAGS" == "" ] ; then | 146 if [ "$CONFIGURE_FLAGS" == "" ] ; then |
147 rm -rf "$BINARIES_DIR/local" | 147 rm -rf "$BINARIES_DIR/local" |
148 ln -s "$OUTPUT_DIR" "$BINARIES_DIR/local" | 148 ln -s "$OUTPUT_DIR" "$BINARIES_DIR/local" |
149 fi | 149 fi |
150 | 150 |
151 maybe_build_gdb_for_mac "$OUTPUT_DIR" | 151 maybe_build_gdb_for_mac "$OUTPUT_DIR" |
152 | 152 |
153 # Delete un-needed stuff from the $OUTPUT_DIR | 153 # Delete un-needed stuff from the $OUTPUT_DIR |
154 # TODO(timurrrr): probably, we should just don't build the unused tools | 154 # TODO(timurrrr): probably, we should just don't build the unused tools |
155 cd $OUTPUT_DIR | 155 cd "$OUTPUT_DIR" |
156 rm -rf include | 156 rm -rf include |
157 rm -rf lib/pkgconfig lib/*.a | 157 rm -rf lib/pkgconfig lib/*.a |
158 rm bin/*cg_* bin/callgrind* | 158 rm bin/*cg_* bin/callgrind* |
159 cd lib/valgrind | 159 cd lib/valgrind |
160 rm -rf *.a \ | 160 rm -rf *.a \ |
161 *drd* \ | 161 *drd* \ |
162 *exp-* \ | 162 *exp-* \ |
163 *none* \ | 163 *none* \ |
164 *lackey* \ | 164 *lackey* \ |
165 *massif* \ | 165 *massif* \ |
166 *helgrind* \ | 166 *helgrind* \ |
167 *callgrind* \ | 167 *callgrind* \ |
168 *cachegrind* | 168 *cachegrind* |
169 | 169 |
170 # Strip all binaries except "vgpreload" (we do need their symbols). | 170 # Strip all binaries except "vgpreload" (we do need their symbols). |
171 strip `ls -1 | grep "memcheck" | grep -v "dSYM" | grep -v "vgpreload"` | 171 strip `ls -1 | grep "memcheck" | grep -v "dSYM" | grep -v "vgpreload"` |
172 | 172 |
173 # Some tools may define some post-build steps, e.g. ThreadSanitzer. | 173 # Some tools may define some post-build steps, e.g. ThreadSanitzer. |
174 if [ "$POST_BUILD_HOOK_DEFINED" != "" ] | 174 if [ "$POST_BUILD_HOOK_DEFINED" != "" ] |
175 then | 175 then |
176 post_build_hook $1 $2 | 176 post_build_hook $1 $2 |
177 fi | 177 fi |
178 | 178 |
179 # We're done | 179 # We're done |
180 cd $PREV_DIR | 180 cd "$PREV_DIR" |
181 # }}} | 181 # }}} |
182 } | 182 } |
183 | 183 |
184 maybe_build_gdb_for_mac() { | 184 maybe_build_gdb_for_mac() { |
185 # {{{1 | 185 # {{{1 |
186 # MacOSX before Snow Leopoard needs newer gdb to be able to handle -O1 chrome | 186 # MacOSX before Snow Leopoard needs newer gdb to be able to handle -O1 chrome |
187 # Kludgily download and unpack the sources in a subdirectory, | 187 # Kludgily download and unpack the sources in a subdirectory, |
188 # then install into $1. | 188 # then install into $1. |
189 # This is SLOW and we want it to run only once, so we execute it only | 189 # This is SLOW and we want it to run only once, so we execute it only |
190 # if explicitly asked to do so. | 190 # if explicitly asked to do so. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 fi | 222 fi |
223 ;; | 223 ;; |
224 *) | 224 *) |
225 build_valgrind "local" | 225 build_valgrind "local" |
226 ;; | 226 ;; |
227 esac | 227 esac |
228 } | 228 } |
229 | 229 |
230 # Check that the binaries directory exists. | 230 # Check that the binaries directory exists. |
231 BINARIES_DIR="$THISDIR/../binaries" | 231 BINARIES_DIR="$THISDIR/../binaries" |
232 if ! [ -a $BINARIES_DIR ] | 232 if ! [ -a "$BINARIES_DIR" ] |
233 then | 233 then |
234 echo "Error: $BINARIES_DIR doesn't exist!" >&2 | 234 echo "Error: $BINARIES_DIR doesn't exist!" >&2 |
235 exit 1 | 235 exit 1 |
236 fi | 236 fi |
237 | 237 |
238 set -e | 238 set -e |
239 set -x | 239 set -x |
OLD | NEW |