#!/bin/sh
# Build script for mysql
# Use this for configure, make and make install for the mysql version 5.0.x.
# Change the version and the CFLAGS for your own system/hardware.

MySQL_VER=5.0.41
MySQL_PREFIX=/usr/local/mysql-$MySQL_VER

echo "Installation tool for MySQL-$MySQL_VER"
echo "Configuring MySQL-$MySQL_VER ..."
echo " "
sleep 2

cd mysql-$MySQL_VER

./configure CFLAGS="-O3 -march=i686 -mtune=i686" \
CXXFLAGS="-O3 -march=i686 -mtune=i686 -felide-constructors -fno-exceptions -fno-rtti" \
	--prefix=$MySQL_PREFIX \
	--enable-assembler \
	--with-mysql-ldflags=-all-static \
	--localstatedir=/var/lib/mysql/data \
	--libexecdir=$MySQL_PREFIX/sbin \
	--mandir=/usr/local/share/man \
	--infodir=/usr/local/share/info \
	--with-unix-socket-path=/var/lib/mysql/mysql.sock \
	--with-mysqld-user=mysql \
	--without-debug \
	--with-innodb \
	--enable-thread-safe-client \
	--with-big-tables \
	--with-federated-storage-engine

sleep 5
echo " "
echo "Building MySQL-$MySQL_VER ..."
echo " "
make -j4


# If you don't run as sudo/root leave the comments.

#sleep 5
#echo " "
#echo "Installing MySQL-$MySQL_VER ..."
#echo " "
#make install
#echo " "
#echo "Linking to the current installed version ($MySQL_VER)!"
#echo " "
#ln -s $MySQL_PREFIX /usr/local/mysql


