Skip to content

Instantly share code, notes, and snippets.

@arisawa
Forked from masaki/mqh_install.sh
Created September 11, 2012 23:48
Show Gist options
  • Save arisawa/3703085 to your computer and use it in GitHub Desktop.
Save arisawa/3703085 to your computer and use it in GitHub Desktop.
Installing MySQL5.1 / Q4M / HandlerSocket
#!/bin/zsh
MYSQL_VERSION=5.1.63
if [ `which perl` = "/usr/bin/perl" ]; then
echo -n -e "\e[1;31mUSING SYSTEM PERL OK? [y/n]\e[m: "
read ANSWER
if [ "$ANSWER" != "y" ]; then
exit 255
fi
PERL_CPANM_OPT="$PERL_CPANM_OPT --sudo"
fi
### MySQL
echo -e "\e[1;32mStarting MySQL5.1 installation.\e[m"
brew install https://raw.github.com/Homebrew/homebrew-versions/master/mysql51.rb --with-utf8-default --use-llvm
mysql_install_db --basedir=/usr/local/Cellar/mysql51/$MYSQL_VERSION
mysql.server start
### reinstall DBD::mysql
curl -fsSL http://xrl.us/cpanm | perl - --reinstall -n DBD::mysql
### Build MySQL source
### Please FIXME!!
echo -e "\e[1;32mStarting build MySQL.\e[m"
mkdir ~/tmp
cp `brew --cache`/mysql51-$MYSQL_VERSION.tar.gz ~/tmp
cd ~/tmp
tar xfz mysql51-$MYSQL_VERSION.tar.gz
cd mysql-$MYSQL_VERSION/
./configure --without-docs --without-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/mysql51/$MYSQL_VERSION \
--localstatedir=/usr/local/var/mysql --sysconfdir=/usr/local/etc --with-plugins=innobase,myisam \
--with-extra-charsets=complex --with-ssl --with-readline --enable-assembler --enable-thread-safe-client \
--enable-local-infile --enable-shared --with-partition --with-charset=utf8
env CXXPLAGS="-O3 -march=core2 -msse4.1 -w -pipe -fno-omit-frame-pointer -felide-constructors" make
### Q4M
echo -e "\e[1;32mStarting Q4M installation.\e[m"
cd ~/tmp
curl -O http://q4m.kazuhooku.com/dist/q4m-0.9.5.tar.gz
tar zxfv q4m-0.9.5.tar.gz
cd q4m-0.9.5
./configure --prefix=/usr/local/Cellar/mysql51/$MYSQL_VERSION --with-mysql=$HOME/tmp/mysql-$MYSQL_VERSION CFLAGS="-I/usr/local/Cellar/mysql51/$MYSQL_VERSION/include/mysql" CPPFLAGS="-I/usr/local/Cellar/mysql51/$MYSQL_VERSION/include/mysql"
make && make install
mysql -u root < support-files/install.sql
mysql -u root -e 'show plugins'
# perl run_tests.pl
### HS
echo -e "\e[1;32mStarting HandlerSocket installation.\e[m"
cd ~/tmp
git clone git://github.com/ahiguti/HandlerSocket-Plugin-for-MySQL.git
cd HandlerSocket-Plugin-for-MySQL
./autogen.sh
./configure --with-mysql-source=$HOME/tmp/mysql-$MYSQL_VERSION --with-mysql-bindir=/usr/local/Cellar/mysql51/$MYSQL_VERSION/bin --use-llvm
make && make install
mysql -u root -e "install plugin handlersocket soname 'handlersocket.so'"
cd perl-Net-HandlerSocket
curl -fsSL http://xrl.us/cpanm | perl - .
### finish
mysql -uroot -e 'show plugins'
echo -e "\e[1;32mdone.\e[m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment