mariadb/scripts/make.mysql.debug.env.bash

157 lines
4.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e -u
2013-05-24 10:59:07 -04:00
function usage() {
2013-05-24 10:59:07 -04:00
echo "build a debug mysql in the current directory"
echo "with default parameters it builds a debug $mysql-$mysql_tree"
echo "--git_tag=$git_tag"
2013-05-24 10:59:07 -04:00
echo "--mysql=$mysql --mysql_tree=$mysql_tree"
echo "--ftengine=$ftengine --ftengine_tree=$ftengine_tree"
echo "--ftindex=$ftindex --ftindex_tree=$ftindex_tree"
echo "--jemalloc=$jemalloc --jemalloc_tree=$jemalloc_tree"
echo "--backup=$backup --backup_tree=$backup_tree"
echo "--cc=$cc --cxx=$cxx"
echo "--local_cache_dir=$local_cache_dir --local_cache_update=$local_cache_update"
echo "--cmake_valgrind=$cmake_valgrind --cmake_debug_paranoid=$cmake_debug_paranoid"
}
function github_clone() {
2013-05-24 10:59:07 -04:00
local repo=$1; local tree=$2
if [[ -z "$local_cache_dir" ]] ; then
git clone git@github.com:Tokutek/$repo
if [ $? != 0 ] ; then exit 1; fi
else
if (( "$local_cache_update" )) ; then
pushd $local_cache_dir/$repo.git
git fetch --all -f -p -v
git fetch --all -f -p -v -t
popd
fi
git clone --reference $local_cache_dir/$repo.git git@github.com:Tokutek/$repo
if [ $? != 0 ] ; then exit 1; fi
fi
2013-05-24 10:59:07 -04:00
pushd $repo
if [ $? != 0 ] ; then exit 1; fi
if [ -z $git_tag ] ; then
if ! git branch | grep "\<$tree\>" > /dev/null && git branch -a | grep "remotes/origin/$tree\>" > /dev/null; then
git checkout --track origin/$tree
else
git checkout $tree
fi
else
2013-05-24 10:59:07 -04:00
git checkout $git_tag
fi
2013-05-24 10:59:07 -04:00
if [ $? != 0 ] ; then exit 1; fi
popd
}
# shopt -s compat31 2>/dev/null
git_tag=
mysql=mysql
2013-12-03 13:22:25 -05:00
mysql_tree=mysql-5.5.34
jemalloc=jemalloc
2013-05-24 10:59:07 -04:00
jemalloc_tree=3.3.1
ftengine=ft-engine
2013-05-24 10:59:07 -04:00
ftengine_tree=master
ftindex=ft-index
2013-05-24 10:59:07 -04:00
ftindex_tree=master
backup=backup-community
2013-05-24 10:59:07 -04:00
backup_tree=master
cc=gcc47
cxx=g++47
local_cache_dir=
local_cache_update=1
cmake_valgrind=
cmake_debug_paranoid=
while [ $# -ne 0 ] ; do
arg=$1; shift
if [[ $arg =~ --(.*)=(.*) ]] ; then
eval ${BASH_REMATCH[1]}=${BASH_REMATCH[2]};
else
usage; exit 1;
fi
done
2013-05-24 10:59:07 -04:00
# setup environment variables
2013-12-03 13:22:25 -05:00
build_dir=$PWD/build
mkdir $build_dir
if [ $? != 0 ] ; then exit 1; fi
install_dir=$PWD/install
2013-05-24 10:59:07 -04:00
mkdir $install_dir
if [ $? != 0 ] ; then exit 1; fi
2013-05-24 10:59:07 -04:00
# checkout the fractal tree
github_clone $ftindex $ftindex_tree
2013-12-03 13:22:25 -05:00
# checkout jemalloc
2013-05-24 10:59:07 -04:00
github_clone $jemalloc $jemalloc_tree
2013-12-03 13:22:25 -05:00
# checkout mysql
2013-05-24 10:59:07 -04:00
github_clone $mysql $mysql_tree
2013-05-24 10:59:07 -04:00
# checkout the community backup
github_clone $backup $backup_tree
2013-05-24 10:59:07 -04:00
# checkout the tokudb handlerton
github_clone $ftengine $ftengine_tree
2013-05-24 10:59:07 -04:00
# setup links'
pushd $ftengine/storage/tokudb
if [ $? != 0 ] ; then exit 1; fi
ln -s ../../../$ftindex ft-index
if [ $? != 0 ] ; then exit 1; fi
popd
pushd $mysql/storage
if [ $? != 0 ] ; then exit 1; fi
ln -s ../../$ftengine/storage/tokudb tokudb
if [ $? != 0 ] ; then exit 1; fi
popd
pushd $mysql
if [ $? != 0 ] ; then exit 1; fi
ln -s ../$backup/backup toku_backup
if [ $? != 0 ] ; then exit 1; fi
popd
pushd $mysql/scripts
if [ $? != 0 ] ; then exit 1; fi
ln ../../$ftengine/scripts/tokustat.py
if [ $? != 0 ] ; then exit 1; fi
ln ../../$ftengine/scripts/tokufilecheck.py
if [ $? != 0 ] ; then exit 1; fi
popd
2013-12-03 13:22:25 -05:00
if [[ $mysql =~ mariadb ]] ; then
pushd $mysql/extra
if [ $? != 0 ] ; then exit 1; fi
ln -s ../../$jemalloc $jemalloc
if [ $? != 0 ] ; then exit 1; fi
popd
else
pushd $ftindex/third_party
if [ $? != 0 ] ; then exit 1; fi
ln -s ../../$jemalloc $jemalloc
if [ $? != 0 ] ; then exit 1; fi
popd
fi
2013-12-03 13:22:25 -05:00
pushd $build_dir
2013-05-24 10:59:07 -04:00
if [ $? != 0 ] ; then exit 1; fi
extra_cmake_options="-DCMAKE_LINK_DEPENDS_NO_SHARED=ON"
if (( $cmake_valgrind )) ; then
extra_cmake_options+=" -DUSE_VALGRIND=ON"
fi
if (( $cmake_debug_paranoid )) ; then
extra_cmake_options+=" -DTOKU_DEBUG_PARANOID=ON"
fi
2013-12-03 13:22:25 -05:00
CC=$cc CXX=$cxx cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$install_dir -DBUILD_TESTING=OFF $extra_cmake_options ../$mysql
2013-05-24 10:59:07 -04:00
if [ $? != 0 ] ; then exit 1; fi
make -j4 install
if [ $? != 0 ] ; then exit 1; fi
popd
2013-05-24 10:59:07 -04:00
pushd $install_dir
scripts/mysql_install_db --defaults-file=$HOME/$(whoami).cnf
popd