2013-04-19 08:55:07 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
function usage() {
|
2013-04-19 11:20:31 -04:00
|
|
|
echo "generate a script that builds a debug mysql from github repo's"
|
|
|
|
echo "--git_tag=$git_tag"
|
|
|
|
echo "--mysql=$mysql --mysql_branch=$mysql_branch"
|
|
|
|
echo "--ftengine=$ftengine --ftengine_branch=$ftengine_branch"
|
|
|
|
echo "--ftindex=$ftindex --ftindex_branch=$ftindex_branch"
|
2013-04-30 13:51:09 -04:00
|
|
|
echo "--jemalloc=$jemalloc --jemalloc_branch=$jemalloc_branch"
|
2013-04-19 11:20:31 -04:00
|
|
|
echo "--backup=$backup --backup_branch=$backup_branch"
|
2013-04-30 13:51:09 -04:00
|
|
|
echo "--install_dir=$install_dir"
|
2013-04-19 11:20:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function github_clone() {
|
|
|
|
local repo=$1; local branch=$2
|
|
|
|
echo git clone git@github.com:Tokutek/$repo
|
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
|
|
|
echo pushd $repo
|
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
|
|
|
if [ -z $git_tag ] ; then
|
|
|
|
echo git checkout $branch
|
|
|
|
else
|
|
|
|
echo git checkout $git_tag
|
|
|
|
fi
|
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
|
|
|
echo popd
|
2013-04-19 08:55:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
shopt -s compat31 2>/dev/null
|
|
|
|
|
2013-04-19 11:20:31 -04:00
|
|
|
git_tag=
|
|
|
|
mysql=mysql
|
|
|
|
mysql_branch=5.5.30
|
|
|
|
jemalloc=jemalloc
|
|
|
|
jemalloc_branch=3.3.1
|
|
|
|
ftengine=ft-engine
|
|
|
|
ftengine_branch=master
|
|
|
|
ftindex=ft-index
|
|
|
|
ftindex_branch=master
|
|
|
|
backup=backup-community
|
|
|
|
backup_branch=master
|
2013-04-30 13:51:09 -04:00
|
|
|
install_dir=mysql
|
2013-04-19 11:20:31 -04:00
|
|
|
|
2013-04-19 08:55:07 -04:00
|
|
|
while [ $# -ne 0 ] ; do
|
|
|
|
arg=$1; shift
|
|
|
|
if [[ $arg =~ --(.*)=(.*) ]] ; then
|
|
|
|
eval ${BASH_REMATCH[1]}=${BASH_REMATCH[2]};
|
|
|
|
else
|
|
|
|
usage; exit 1;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo '# setup environment variables'
|
2013-04-30 13:51:09 -04:00
|
|
|
echo install_dir=\$PWD/$install_dir
|
|
|
|
echo mkdir \$install_dir-build \$install_dir
|
2013-04-19 08:55:07 -04:00
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
2013-04-30 13:51:09 -04:00
|
|
|
echo cd \$install_dir-build
|
2013-04-19 08:55:07 -04:00
|
|
|
|
2013-04-30 12:45:48 -04:00
|
|
|
echo '# checkout the fractal tree'
|
|
|
|
github_clone $ftindex $ftindex_branch
|
|
|
|
github_clone $jemalloc $jemalloc_branch
|
|
|
|
echo pushd $ftindex/third_party
|
2013-04-19 08:55:07 -04:00
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
2013-04-30 12:45:48 -04:00
|
|
|
echo ln -s ../../$jemalloc $jemalloc
|
2013-04-19 08:55:07 -04:00
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
2013-04-30 12:45:48 -04:00
|
|
|
echo popd
|
2013-04-19 08:55:07 -04:00
|
|
|
|
|
|
|
echo '# checkout mysql'
|
2013-04-19 11:20:31 -04:00
|
|
|
github_clone $mysql $mysql_branch
|
2013-04-19 08:55:07 -04:00
|
|
|
|
|
|
|
echo '# checkout the community backup'
|
2013-04-19 11:20:31 -04:00
|
|
|
github_clone $backup $backup_branch
|
2013-04-19 08:55:07 -04:00
|
|
|
|
|
|
|
echo '# checkout the tokudb handlerton'
|
2013-04-19 11:20:31 -04:00
|
|
|
github_clone $ftengine $ftengine_branch
|
2013-04-19 08:55:07 -04:00
|
|
|
|
2013-04-30 12:45:48 -04:00
|
|
|
echo '# setup links'
|
|
|
|
echo pushd $ftengine/storage/tokudb
|
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
|
|
|
echo ln -s ../../../$ftindex ft-index
|
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
|
|
|
echo popd
|
2013-04-22 12:14:40 -04:00
|
|
|
echo pushd $mysql/storage
|
2013-04-19 11:20:31 -04:00
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
2013-04-22 12:14:40 -04:00
|
|
|
echo ln -s ../../$ftengine/storage/tokudb tokudb
|
2013-04-19 11:20:31 -04:00
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
|
|
|
echo popd
|
2013-04-22 12:14:40 -04:00
|
|
|
echo pushd $mysql
|
2013-04-19 11:20:31 -04:00
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
2013-04-22 12:14:40 -04:00
|
|
|
echo ln -s ../$backup/backup toku_backup
|
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
|
|
|
echo popd
|
|
|
|
echo pushd $mysql/scripts
|
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
|
|
|
echo ln ../../$ftengine/scripts/tokustat.py
|
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
|
|
|
echo ln ../../$ftengine/scripts/tokufilecheck.py
|
2013-04-19 11:20:31 -04:00
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
|
|
|
echo popd
|
2013-04-19 08:55:07 -04:00
|
|
|
|
|
|
|
echo '# build in the mysql directory'
|
2013-04-30 12:45:48 -04:00
|
|
|
echo cd $mysql
|
2013-04-19 08:55:07 -04:00
|
|
|
echo mkdir build.debug
|
2013-04-30 12:45:48 -04:00
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
2013-04-19 08:55:07 -04:00
|
|
|
echo cd build.debug
|
2013-04-30 13:51:09 -04:00
|
|
|
echo CC=gcc47 CXX=g++47 cmake .. -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=\$install_dir -DBUILD_TESTING=OFF
|
2013-04-19 08:55:07 -04:00
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
|
|
|
|
|
|
|
echo '# install'
|
|
|
|
echo make -j4 install
|
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
|
|
|
|
|
|
|
echo '# create a var directory so mysql does not complain'
|
2013-05-02 12:45:43 -04:00
|
|
|
echo 'cd $install_dir'
|
2013-04-19 08:55:07 -04:00
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|
|
|
|
|
|
|
|
echo '# install the databases in msyql'
|
|
|
|
echo scripts/mysql_install_db --defaults-file=\$HOME/my.cnf
|
|
|
|
echo 'if [ $? != 0 ] ; then exit 1; fi'
|