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 # Script to build ThreadSanitizer binaries for use with chromium | 7 # Script to build ThreadSanitizer binaries for use with chromium |
8 source common.sh | 8 source common.sh |
9 if system_is_snow_leopard | 9 if system_is_snow_leopard |
10 then | 10 then |
11 echo "ThreadSanitizer is not supported on Mac OS X 10.6 (Snow Leopard) yet." | 11 echo "ThreadSanitizer is not supported on Mac OS X 10.6 yet." >&2 |
| 12 echo "See http://code.google.com/p/data-race-test/issues/detail?id=44" >&2 |
12 exit 1 | 13 exit 1 |
13 fi | 14 fi |
14 | 15 |
15 POST_BUILD_HOOK_DEFINED=yes | 16 POST_BUILD_HOOK_DEFINED=yes |
16 post_build_hook() { | 17 post_build_hook() { |
17 PLATFORM=$1 | 18 PLATFORM=$1 |
18 cd "$THISDIR/tsan/tsan" | 19 cd "$THISDIR/tsan/tsan" |
19 | 20 |
20 SPECIAL_TARGET= | 21 SPECIAL_TARGET= |
21 SPECIAL_FLAGS= | 22 SPECIAL_FLAGS= |
(...skipping 15 matching lines...) Expand all Loading... |
37 VALGRIND_ROOT="$VG_TSAN_DIR" $SPECIAL_TARGET | 38 VALGRIND_ROOT="$VG_TSAN_DIR" $SPECIAL_TARGET |
38 | 39 |
39 OUT_BIN="$ORIG_BINARIES_DIR/$PLATFORM/bin" | 40 OUT_BIN="$ORIG_BINARIES_DIR/$PLATFORM/bin" |
40 mkdir -p $OUT_BIN | 41 mkdir -p $OUT_BIN |
41 # See below for the definition of ORIG_BINARIES_DIR | 42 # See below for the definition of ORIG_BINARIES_DIR |
42 $THISDIR/tsan/tsan/mk-self-contained-valgrind.sh \ | 43 $THISDIR/tsan/tsan/mk-self-contained-valgrind.sh \ |
43 "$VG_TSAN_DIR/out/$PLATFORM" "tsan" \ | 44 "$VG_TSAN_DIR/out/$PLATFORM" "tsan" \ |
44 "$OUT_BIN/valgrind-tsan.sh" | 45 "$OUT_BIN/valgrind-tsan.sh" |
45 } | 46 } |
46 | 47 |
47 TSAN_REV=2200 | 48 TSAN_REV=2386 |
48 TSAN_DIR="$THISDIR/tsan" # Directory to checkout TSan sources | 49 TSAN_DIR="$THISDIR/tsan" # Directory to checkout TSan sources |
49 rm -rf $TSAN_DIR | 50 rm -rf $TSAN_DIR |
50 svn co -r "$TSAN_REV" http://data-race-test.googlecode.com/svn/trunk $TSAN_DIR | 51 svn co -r "$TSAN_REV" http://data-race-test.googlecode.com/svn/trunk $TSAN_DIR |
51 | 52 |
52 # The separate .sh file defines Valgrind/VEX revisions. | 53 VG_TSAN_DIR="$THISDIR/valgrind" # Directory to checkout Valgrind sources |
53 source "tsan/third_party/valgrind_rev.sh" | 54 sh tsan/third_party/update_valgrind.sh # Fetch sources from valgrind-variant |
54 | |
55 VG_TSAN_DIR="$THISDIR/valgrind-tsan" # Directory to checkout Valgrind sources | |
56 checkout_and_patch_valgrind "$VALGRIND_REV" "$VEX_REV" "$VG_TSAN_DIR" | |
57 | 55 |
58 cd "$VG_TSAN_DIR" | 56 cd "$VG_TSAN_DIR" |
59 | 57 |
60 # Apply TSan-specific patches except | |
61 # * limits | |
62 # * guest_amd64_toIR | |
63 # since they are already applied in common.sh. | |
64 rm "$THISDIR"/tsan/valgrind_patches/{limits,guest_amd64_toIR}.patch | |
65 for P in "$THISDIR"/tsan/valgrind_patches/*.patch | |
66 do | |
67 patch -p0 -i $P | |
68 done | |
69 | |
70 if [ `uname -s` == "Darwin" ] | 58 if [ `uname -s` == "Darwin" ] |
71 then | 59 then |
72 if ls /opt/local/bin/ | grep "^gcc-mp-4\.4" >/dev/null | 60 if ls /opt/local/bin/ | grep "^gcc-mp-4\.4" >/dev/null |
73 then | 61 then |
74 export GCC_BINARY_MASK="/opt/local/bin/XXX-mp-4.4" | 62 export GCC_BINARY_MASK="/opt/local/bin/XXX-mp-4.4" |
75 export PATH="$THISDIR/macports-gcc-wrapper:$PATH" | 63 export PATH="$THISDIR/macports-gcc-wrapper:$PATH" |
76 echo "Using gcc-4.4 from MacPorts to build ThreadSanitizer." | 64 echo "Using gcc-4.4 from MacPorts to build ThreadSanitizer." |
77 elif gcc --version | grep " 4\.[0-3]\.[0-9]\| 3\.[0-9]\.[0-9]" >/dev/null | 65 elif gcc --version | grep " 4\.[0-3]\.[0-9]\| 3\.[0-9]\.[0-9]" >/dev/null |
78 then | 66 then |
79 echo "Your gcc version is older than 4.4." | 67 echo "Your gcc version is older than 4.4." |
80 echo "It is recommended to use gcc-4.4 from MacPorts for building" | 68 echo "It is recommended to use gcc-4.4 from MacPorts for building" |
81 echo "ThreadSanitizer, especially if you plan to commit binaries into SVN." | 69 echo "ThreadSanitizer, especially if you plan to commit binaries into SVN." |
82 echo "See http://gcc44.darwinports.com/ for getting gcc-4.4" | 70 echo "See http://gcc44.darwinports.com/ for getting gcc-4.4" |
83 echo "" | 71 echo "" |
84 echo -n "Do you want to continue using old gcc? (y/N)" | 72 echo -n "Do you want to continue using old gcc? (y/N)" |
85 read CONFIRMATION | 73 read CONFIRMATION |
86 if [ "$CONFIRMATION" != "y" ] | 74 if [ "$CONFIRMATION" != "y" ] |
87 then | 75 then |
88 exit 1 | 76 exit 1 |
89 fi | 77 fi |
90 fi | 78 fi |
91 fi | 79 fi |
92 | 80 |
93 # Ugly hack! | 81 # Ugly hack! |
94 # We build Valrgind binaries in the $VG_TSAN_DIR/out and then pack | 82 # We build Valrgind binaries in the $VG_TSAN_DIR/out and then pack |
95 # them into self-contained .sh file into $ORIG_BINARIES_DIR/$PLATFORM | 83 # them into self-contained .sh file into $ORIG_BINARIES_DIR/$PLATFORM |
96 ORIG_BINARIES_DIR=$BINARIES_DIR | 84 ORIG_BINARIES_DIR=$BINARIES_DIR |
97 BINARIES_DIR="$VG_TSAN_DIR/out" | 85 BINARIES_DIR="$VG_TSAN_DIR/out" |
98 build_valgrind_for_available_platforms | 86 build_valgrind_for_available_platforms |
OLD | NEW |