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}") |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 sh autogen.sh || autoreconf -fvi | 102 sh autogen.sh || autoreconf -fvi |
103 if test -L install-sh | 103 if test -L install-sh |
104 then | 104 then |
105 # replace symlink with actual contents! | 105 # replace symlink with actual contents! |
106 cp install-sh install-sh.new | 106 cp install-sh install-sh.new |
107 mv -f install-sh.new install-sh | 107 mv -f install-sh.new install-sh |
108 chmod +x install-sh | 108 chmod +x install-sh |
109 fi | 109 fi |
110 | 110 |
111 # If gold is installed as a linker, use the old one | |
112 OVERRIDE_LD_DIR="${THISDIR}/override_ld" | |
113 if ld --version | grep gold | |
114 then | |
115 # build/install-build-deps leaves original ld around, try using that | |
116 if test -x /usr/bin/ld.orig | |
117 then | |
118 echo "Using /usr/bin/ld.orig instead of gold to link valgrind" | |
119 test -d "${OVERRIDE_LD_DIR}" && rm -rf "${OVERRIDE_LD_DIR}" | |
120 mkdir "${OVERRIDE_LD_DIR}" | |
121 ln -s /usr/bin/ld.orig "${OVERRIDE_LD_DIR}/ld" | |
122 PATH="${OVERRIDE_LD_DIR}:${PATH}" | |
123 # Ubuntu diverts original ld to ld.single when it installs binutils-gold | |
124 elif test -x /usr/bin/ld.single | |
125 then | |
126 echo "Using /usr/bin/ld.single instead of gold to link valgrind" | |
127 test -d "${OVERRIDE_LD_DIR}" && rm -rf "${OVERRIDE_LD_DIR}" | |
128 mkdir "${OVERRIDE_LD_DIR}" | |
129 ln -s /usr/bin/ld.single "${OVERRIDE_LD_DIR}/ld" | |
130 PATH="${OVERRIDE_LD_DIR}:${PATH}" | |
131 else | |
132 echo "Cannot build valgrind with gold. Please switch to normal /usr/bin/l
d, rerun this script, then switch back to gold." | |
133 exit 1 | |
134 fi | |
135 fi | |
136 | |
137 ./configure $CONFIGURE_FLAGS --prefix="${OUTPUT_DIR}" | 111 ./configure $CONFIGURE_FLAGS --prefix="${OUTPUT_DIR}" |
138 make -j4 | 112 make -j4 |
139 | 113 |
140 # Test if Valgrind binary works on a simple program {{{2 | 114 # Test if Valgrind binary works on a simple program {{{2 |
141 cat > simpletest.c <<EOF | 115 cat > simpletest.c <<EOF |
142 #include <stdio.h> | 116 #include <stdio.h> |
143 int main(void) { | 117 int main(void) { |
144 printf("OK\n"); | 118 printf("OK\n"); |
145 return 0; | 119 return 0; |
146 } | 120 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 # Check that the binaries directory exists. | 225 # Check that the binaries directory exists. |
252 BINARIES_DIR="$THISDIR/../binaries" | 226 BINARIES_DIR="$THISDIR/../binaries" |
253 if ! [ -a "$BINARIES_DIR" ] | 227 if ! [ -a "$BINARIES_DIR" ] |
254 then | 228 then |
255 echo "Error: $BINARIES_DIR doesn't exist!" >&2 | 229 echo "Error: $BINARIES_DIR doesn't exist!" >&2 |
256 exit 1 | 230 exit 1 |
257 fi | 231 fi |
258 | 232 |
259 set -e | 233 set -e |
260 set -x | 234 set -x |
OLD | NEW |