forked from Percona-QA/percona-qa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_mysql_debug.sh
executable file
·56 lines (48 loc) · 2.35 KB
/
build_mysql_debug.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
#!/bin/bash
# Created by Roel Van de Paar, Percona LLC
# The first option is the bzr tree name on lp. If it is not passed, check if the local tree = a source tree ready for building
if [ -z $1 ]; then
if [ ! -r CMakeLists.txt ]; then
echo "No bzr tree name (for example "lp:mysql-server/5.6" was specified (as first option to this script to enable pull and build mode),"
echo "and the current directory is not a source tree (to enable build mode only). Exiting"
exit 1
fi
else
bzr branch $1
DIR=$(echo "$1" | sed 's|.*/||')
cd $DIR
if [ ! -r CMakeLists.txt ]; then
echo "Something went wrong. Branch was pulled but there is no "CMakeLists.txt" in the current directory $PWD. Exiting"
exit 1
fi
fi
CURDIR=$PWD # The source code directory containing at least CMakeLists.txt file
cd ${CURDIR}/..
rm -Rf ${CURDIR}_dbg
mkdir ${CURDIR}_dbg
#GENERAL_BLD_OPT="-DENABLE_DOWNLOADS=1 -DBUILD_CONFIG=mysql_release -DWITH_EMBEDDED_SERVER=OFF -DFEATURE_SET=community -DENABLE_DTRACE=OFF"
GENERAL_BLD_OPT="-DENABLE_DOWNLOADS=1 -DBUILD_CONFIG=mysql_release -DWITH_EMBEDDED_SERVER=OFF -DFEATURE_SET=community -DWITH_ASAN=ON"
#In time, we need to add -DWITH_DEBUG=ON here + in build script in PS source. See mail "Debuggy" 18 Oct 2013.
#However, memcached is holding us back: https://bugs.launchpad.net/percona-server/+bug/1241455
echo $(cd ${CURDIR}_dbg; \
cmake ${GENERAL_BLD_OPT} -DCMAKE_BUILD_TYPE=Debug -DDEBUG_EXTNAME=OFF ${CURDIR} > /tmp/mysql_dbg 2>&1; \
make >> /tmp/mysql_dbg 2>&1 ; \
./scripts/make_binary_distribution) >> /tmp/mysql_dbg 2>&1 &
PID_dbg=$!
wait $PID_dbg
# Make sure builds are done / disks are in sync
sync
sleep 1
cd ${CURDIR}_dbg
TAR_dbg=`ls -1 *.tar.gz | head -n1`
TAR_dbg_new=$(echo $TAR_dbg | sed 's|.tar.gz|-debug.tar.gz|')
mv ${TAR_dbg} ${CURDIR}/../${TAR_dbg_new}
cd ${CURDIR}/..
rm -Rf ${CURDIR}_dbg # Remark this line for debugging
tar -xf $TAR_dbg_new > /dev/null
DIR_dbg=$(echo $TAR_dbg | sed 's|.tar.gz||')
cp ${DIR_dbg}/bin/mysqld-debug ${DIR_dbg}/bin/mysqld 2>/dev/null # Workaround for http://bugs.mysql.com/bug.php?id=69856 (MS only, or PS build in MS-way)
mv ${DIR_dbg} ${DIR_dbg}-debug
echo "Done! There is not a debug build ready as follows:"
echo -e "${DIR_dbg}-debug\n | Extracted from ${TAR_dbg_new}\n | Compile log in /tmp/mysql_dbg"
echo -e "Copy commands for your convenience:\ncd ..\nmv ${DIR_dbg}-debug\t\t\t /ssd"