Commit 9f5e2eee authored by Rich Prohaska's avatar Rich Prohaska

build a debug mysql env

parent e6b903de
#!/usr/bin/env bash #!/usr/bin/env bash
set -e
function usage() { function usage() {
echo "generate a script that builds a debug mysql from github repo's" 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" echo "--git_tag=$git_tag"
echo "--mysql=$mysql --mysql_branch=$mysql_branch" echo "--mysql=$mysql --mysql_tree=$mysql_tree"
echo "--ftengine=$ftengine --ftengine_branch=$ftengine_branch" echo "--ftengine=$ftengine --ftengine_tree=$ftengine_tree"
echo "--ftindex=$ftindex --ftindex_branch=$ftindex_branch" echo "--ftindex=$ftindex --ftindex_tree=$ftindex_tree"
echo "--jemalloc=$jemalloc --jemalloc_branch=$jemalloc_branch" echo "--jemalloc=$jemalloc --jemalloc_tree=$jemalloc_tree"
echo "--backup=$backup --backup_branch=$backup_branch" echo "--backup=$backup --backup_tree=$backup_tree"
echo "--install_dir=$install_dir" echo "--cc=$cc --cxx=$cxx"
} }
function github_clone() { function github_clone() {
local repo=$1; local branch=$2 local repo=$1; local tree=$2
echo git clone git@github.com:Tokutek/$repo git clone git@github.com:Tokutek/$repo
echo 'if [ $? != 0 ] ; then exit 1; fi' if [ $? != 0 ] ; then exit 1; fi
echo pushd $repo pushd $repo
echo 'if [ $? != 0 ] ; then exit 1; fi' if [ $? != 0 ] ; then exit 1; fi
if [ -z $git_tag ] ; then if [ -z $git_tag ] ; then
echo git checkout $branch git checkout $tree
else else
echo git checkout $git_tag git checkout $git_tag
fi fi
echo 'if [ $? != 0 ] ; then exit 1; fi' if [ $? != 0 ] ; then exit 1; fi
echo popd popd
} }
shopt -s compat31 2>/dev/null shopt -s compat31 2>/dev/null
git_tag= git_tag=
mysql=mysql mysql=mysql
mysql_branch=5.5.30 mysql_tree=5.5.30
jemalloc=jemalloc jemalloc=jemalloc
jemalloc_branch=3.3.1 jemalloc_tree=3.3.1
ftengine=ft-engine ftengine=ft-engine
ftengine_branch=master ftengine_tree=master
ftindex=ft-index ftindex=ft-index
ftindex_branch=master ftindex_tree=master
backup=backup-community backup=backup-community
backup_branch=master backup_tree=master
install_dir=mysql cc=gcc47
cxx=g++47
while [ $# -ne 0 ] ; do while [ $# -ne 0 ] ; do
arg=$1; shift arg=$1; shift
...@@ -50,70 +54,64 @@ while [ $# -ne 0 ] ; do ...@@ -50,70 +54,64 @@ while [ $# -ne 0 ] ; do
fi fi
done done
echo '# setup environment variables' # setup environment variables
echo install_dir=\$PWD/$install_dir install_dir=$PWD/$mysql-install
echo mkdir \$install_dir-build \$install_dir mkdir $install_dir
echo 'if [ $? != 0 ] ; then exit 1; fi' if [ $? != 0 ] ; then exit 1; fi
echo cd \$install_dir-build
echo '# checkout the fractal tree'
github_clone $ftindex $ftindex_branch
github_clone $jemalloc $jemalloc_branch
echo pushd $ftindex/third_party
echo 'if [ $? != 0 ] ; then exit 1; fi'
echo ln -s ../../$jemalloc $jemalloc
echo 'if [ $? != 0 ] ; then exit 1; fi'
echo popd
echo '# checkout mysql'
github_clone $mysql $mysql_branch
echo '# checkout the community backup' # checkout the fractal tree
github_clone $backup $backup_branch github_clone $ftindex $ftindex_tree
github_clone $jemalloc $jemalloc_tree
pushd $ftindex/third_party
if [ $? != 0 ] ; then exit 1; fi
ln -s ../../$jemalloc $jemalloc
if [ $? != 0 ] ; then exit 1; fi
popd
echo '# checkout the tokudb handlerton' # checkout mysql'
github_clone $ftengine $ftengine_branch github_clone $mysql $mysql_tree
echo '# setup links' # checkout the community backup
echo pushd $ftengine/storage/tokudb github_clone $backup $backup_tree
echo 'if [ $? != 0 ] ; then exit 1; fi'
echo ln -s ../../../$ftindex ft-index
echo 'if [ $? != 0 ] ; then exit 1; fi'
echo popd
echo pushd $mysql/storage
echo 'if [ $? != 0 ] ; then exit 1; fi'
echo ln -s ../../$ftengine/storage/tokudb tokudb
echo 'if [ $? != 0 ] ; then exit 1; fi'
echo popd
echo pushd $mysql
echo 'if [ $? != 0 ] ; then exit 1; fi'
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
echo 'if [ $? != 0 ] ; then exit 1; fi'
echo popd
echo '# build in the mysql directory' # checkout the tokudb handlerton
echo cd $mysql github_clone $ftengine $ftengine_tree
echo mkdir build.debug
echo 'if [ $? != 0 ] ; then exit 1; fi'
echo cd build.debug
echo CC=gcc47 CXX=g++47 cmake .. -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=\$install_dir -DBUILD_TESTING=OFF
echo 'if [ $? != 0 ] ; then exit 1; fi'
echo '# install' # setup links'
echo make -j4 install pushd $ftengine/storage/tokudb
echo 'if [ $? != 0 ] ; then exit 1; fi' 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
echo '# create a var directory so mysql does not complain' # build in the mysql directory
echo 'cd $install_dir' mkdir $mysql/build.debug
echo 'if [ $? != 0 ] ; then exit 1; fi' if [ $? != 0 ] ; then exit 1; fi
pushd $mysql/build.debug
if [ $? != 0 ] ; then exit 1; fi
CC=$cc CXX=$cxx cmake .. -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$install_dir -DBUILD_TESTING=OFF
if [ $? != 0 ] ; then exit 1; fi
make -j4 install
if [ $? != 0 ] ; then exit 1; fi
popd
echo '# install the databases in msyql' pushd $install_dir
echo scripts/mysql_install_db --defaults-file=\$HOME/my.cnf scripts/mysql_install_db --defaults-file=$HOME/$(whoami).cnf
echo 'if [ $? != 0 ] ; then exit 1; fi' popd
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment