-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathcmake.sh
executable file
·110 lines (92 loc) · 3.04 KB
/
cmake.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/sh
usage(){
echo -e "Usage: $0 [OPTIONS]"
echo -e "compile MySQL Server source code"
echo -e ""
echo -e " -H --help display help info ."
echo -e " -t --tar make package to tar.gz file"
echo -e " -d --directory directory to install mysql"
echo -e " -v --version mysql server version"
echo -e " -b --boost-dir boost library directory"
echo -e " -i --install do install"
echo -e " --test do mysql-test-run"
echo -e " --debug compile with debug info"
echo -e "--------------------------------------------------------"
echo -e " version default 3.1"
echo -e " debug default to false"
echo -e " directory default to /usr/local/mysql"
echo -e " boost default to /home/mysql/boost"
echo -e ""
exit 1
}
do_install=0
debug=0
do_tar=0
version=3.2
do_test=0
debug_flag=" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release "
bld_dir="bld"
static_flag=" -DCMAKE_CXX_FLAGS=-static-libstdc++ -DCMAKE_C_FLAGS=-static-libgcc "
boost_dir=/home/mysql/boost/
install_dir=/usr/local/mysql
gccdir=/usr/local/gcc-4.7.3
export LD_LIBRARY_PATH=$gccdir/lib64/:$LD_LIBRARY_PATH
TEMP=`getopt -o b:d:hitv: --long debug,test,help,install,tar,version:,directory:,boost-dir:,verion: \
-n "Try $0 --help for more information" -- "$@"`
if [ $? != 0 ]
then
echo "script abnormal exit"
exit 1
fi
if [ $# -eq 0 ]
then
usage
fi
eval set -- "$TEMP"
while true
do
case $1 in
-d|--directory) install_dir=$2; shift 2;;
-h|--help) usage; shift;;
-i|--install) do_install=1; shift;;
-t|--tar) do_tar=1; shift;;
-v|--version) version=$2; shift 2;;
-b|--boost-dir) boost_dir=$2; shift 2;;
--debug) debug=1; shift;;
--test) do_test=1; shift;;
--) shift ; break;;
*) usage;
esac
done
suffix="-tmysql-$version"
if [ $debug == 1 ]
then
suffix="$suffix-debug"
debug_flag=" -DCMAKE_BUILD_TYPE=Debug -DWITH_DEBUG=ON "
bld_dir="bld_debug"
#static_flag=""
fi
mkdir -p $bld_dir
cd $bld_dir
rm -f CMakeCache.txt
cmd="cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST=$boost_dir -DCMAKE_PREFIX_PATH=/usr/bin/openssl -DWITH_SSL="system" -DWITH_ZLIB=bundled -DWITHOUT_TOKUDB_STORAGE_ENGINE=1 -DMYSQL_SERVER_SUFFIX=$suffix $debug_flag -DFEATURE_SET=community -DWITH_EMBEDDED_SERVER=OFF -DCMAKE_C_COMPILER=$gccdir/bin/gcc -DCMAKE_CXX_COMPILER=$gccdir/bin/g++ -DCMAKE_INSTALL_PREFIX=$install_dir -DWITH_QUERY_RESPONSE_TIME=on $static_flag"
echo "compile args:"
echo "$cmd"
$cmd
make VERBOSE=1 -j `grep -c '^processor' /proc/cpuinfo`
if [ $do_install == 1 ]
then
make install
fi
if [ $do_tar == 1 ]
then
make package
fi
if [ $do_test == 1 ]
then
cd mysql-test
perl mysql-test-run.pl --timer --force --parallel=auto --comment=mtr-no-rpl --vardir=var-mtr-no-rpl --ps-protocol --skip-ndb --skip-rpl --report-unstable-tests --no-warnings --clean-vardir >&test_no_repl.log &
perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl --vardir=var-rpl --ps-protocol --skip-ndb --suite=rpl --clean-vardir --report-unstable-tests --no-warnings >&test_repl.log &
cd ..
fi
cd ..