# Template file for 'mysql'
pkgname=mysql
version=5.1.54
distfiles="http://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-5.1/mysql-${version}.tar.gz"
build_style=gnu_configure
configure_args="--localstatedir=/var --sysconfdir=/etc/mysql
--with-libwrap --with-charset=utf8 --with-collation=utf8_general_ci
--with-extra-charsets=complex --with-embedded-server --enable-local-infile
--with-unix-socket-path=/var/run/mysqld/mysqld.sock --enable-assembler
--with-pthread --with-named-curses-libs=\"-lncursesw\" --with-ssl=/usr
--with-zlib-dir=/usr --with-fast-mutexes --with-big-tables
--with-plugins=all --with-embedded-privilege-control --with-mysqlmanager
--with-mysqld-user=mysqld --enable-thread-safe-client
--libexecdir=/usr/sbin --without-readline"
short_desc="The world's most popular open source database"
maintainer="Juan RP <xtraeme@gmail.com>"
checksum=84370fffc4fe277645fb3a5040d153ff567576b664f0663452be077826b7ab1f
long_desc="
 MySQL is the world's most popular open source database software, with over
 100 million copies of its software downloaded or distributed throughout
 it's history. With its superior speed, reliability, and ease of use, MySQL
 has become the preferred choice for Web, Web 2.0, SaaS, ISV, Telecom
 companies and forward-thinking corporate IT Managers because it eliminates
 the major problems associated with downtime, maintenance and administration
 for modern, online applications."

# Fix build with gcc-4.4.
CFLAGS="-fPIC -fno-strict-aliasing"
CXXFLAGS="-fPIC -fno-strict-aliasing"

subpackages="libmysqlclient libmysqlclient-devel libndbclient"
subpackages="${subpackages} libndbclient-devel libmysqld-devel"
subpackages="${subpackages} mysql-client mysql-ndb"

conf_files="/etc/mysql/my.cnf /etc/conf.d/mysqld"
openrc_services="mysqld default false"

# Create mysqld user/group.
system_accounts="mysqld"
mysqld_homedir="/var/lib/mysql"

Add_dependency run glibc
Add_dependency run libgcc
Add_dependency run libstdc++
Add_dependency run zlib
Add_dependency run tcp_wrappers-libs
Add_dependency run libssl
Add_dependency run mysql-client

Add_dependency build libstdc++-devel
Add_dependency build zlib-devel
Add_dependency build tcp_wrappers-devel
Add_dependency build ncurses-devel
Add_dependency build openssl-devel
Add_dependency build readline-devel
Add_dependency full perl		">=0"

post_install()
{
	# Remove tests
	rm -rf ${DESTDIR}/usr/sql-bench ${DESTDIR}/usr/mysql-test

	# Install config files and OpenRC service.
	install -D -m640 ${FILESDIR}/my.cnf ${DESTDIR}/etc/mysql/my.cnf
	install -D -m644 ${FILESDIR}/mysqld.confd ${DESTDIR}/etc/conf.d/mysqld
	install -D -m755 ${FILESDIR}/mysqld.rc ${DESTDIR}/etc/init.d/mysqld
}
