| 1 |
#! /bin/sh |
| 2 |
|
| 3 |
mode="" |
| 4 |
cxxfilt="" |
| 5 |
|
| 6 |
# For g++ 3.X, the PurifyPlus tools needs a program named "cxxfilt", |
| 7 |
# "c++file" or similar. It is part of libtool. If not found, you can |
| 8 |
# specify the path to it. |
| 9 |
|
| 10 |
while test $# -gt 0 |
| 11 |
do |
| 12 |
case "$1" in |
| 13 |
--debug) EXTRA_CONFIG_FLAGS=--with-debug ;; |
| 14 |
--purify) mode=purify ;; |
| 15 |
--purecov*) mode=purecov ;; |
| 16 |
--quantify) mode=quantify ;; |
| 17 |
--cxxfilt) shift ; cxxfilt=$1 ;; |
| 18 |
-h | --help ) |
| 19 |
echo "Usage: $0 [ options ]" |
| 20 |
echo "Where the 'options' are" |
| 21 |
echo " --help | -h Display this help" |
| 22 |
echo " --debug Compile with DBUG enabled" |
| 23 |
echo " --purify Only prepare for Purify" |
| 24 |
echo " --purecov Only prepare for PureCover" |
| 25 |
echo " --quantify Only prepare for Quantify" |
| 26 |
echo " --cxxfilt <cxxfilt> Path to cxxfilt/c++filt program" |
| 27 |
echo " This program is needed for gcc 3.X" |
| 28 |
exit 0 ;; |
| 29 |
*) echo "No such option '$1'" ; exit 1 ;; |
| 30 |
esac |
| 31 |
shift |
| 32 |
done |
| 33 |
|
| 34 |
make -k maintainer-clean || true |
| 35 |
/bin/rm -f */.deps/*.P config.cache |
| 36 |
|
| 37 |
path=`dirname $0` |
| 38 |
. "$path/autorun.sh" |
| 39 |
|
| 40 |
CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -DHAVE_valgrind -DEXTRA_DEBUG -O2" CXX=g++ CXXLD=g++ CXXFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -DHAVE_valgrind -DEXTRA_DEBUG -O2" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-embedded-server --with-innodb $EXTRA_CONFIG_FLAGS |
| 41 |
|
| 42 |
make -j 4 |
| 43 |
|
| 44 |
# ---------------------------------------------------------------------- |
| 45 |
|
| 46 |
#set -x |
| 47 |
|
| 48 |
purifying_binaries () |
| 49 |
{ |
| 50 |
while test $1 |
| 51 |
do |
| 52 |
dir=$1 |
| 53 |
shift |
| 54 |
target=$1 |
| 55 |
shift |
| 56 |
binary=$1 |
| 57 |
shift |
| 58 |
|
| 59 |
opts="" |
| 60 |
if [ -n "$cxxfilt" ] ; then |
| 61 |
opts="$opts -demangle-program=$cxxfilt" |
| 62 |
fi |
| 63 |
opts="$opts -best-effort" |
| 64 |
|
| 65 |
back=`pwd` |
| 66 |
cd $dir |
| 67 |
|
| 68 |
# Because of libtool magic, the target and binary |
| 69 |
# created might not be the same. To trigger rebuild, |
| 70 |
# we need to move them both. |
| 71 |
|
| 72 |
mv $binary $binary-old |
| 73 |
if [ -f $target ] ; then |
| 74 |
mv $target $target-old |
| 75 |
fi |
| 76 |
|
| 77 |
if [ -n "$mode" -a $mode = purify ] ; then |
| 78 |
make CCLD="purify $opts gcc" CXXLD="purify $opts g++" $target |
| 79 |
mv $binary $binary-purify |
| 80 |
fi |
| 81 |
|
| 82 |
if [ -n "$mode" -a $mode = quantify ] ; then |
| 83 |
make CCLD="quantify $opts gcc" CXXLD="quantify $opts g++" $target |
| 84 |
mv $binary $binary-quantify |
| 85 |
fi |
| 86 |
|
| 87 |
if [ -n "$mode" -a $mode = purecov ] ; then |
| 88 |
make CCLD="purecov $opts gcc" CXXLD="purecov $opts g++" $target |
| 89 |
mv $binary $binary-purecov |
| 90 |
fi |
| 91 |
|
| 92 |
mv $binary-old $binary |
| 93 |
if [ -f $target-old ] ; then |
| 94 |
mv $target-old $target |
| 95 |
fi |
| 96 |
|
| 97 |
cd $back |
| 98 |
done |
| 99 |
} |
| 100 |
|
| 101 |
|
| 102 |
purifying_binaries \ |
| 103 |
sql mysqld mysqld \ |
| 104 |
client mysqltest .libs/mysqltest \ |
| 105 |
tests mysql_client_test mysql_client_test \ |
| 106 |
libmysqld/examples mysqltest_embedded mysqltest_embedded \ |
| 107 |
libmysqld/examples mysql_client_test_embedded mysql_client_test_embedded |
| 108 |
|
| 109 |
# ---------------------------------------------------------------------- |
| 110 |
|