# Template file for 'mysql'
pkgname=mysql
version=5.1.45
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=7dc2fabbdd8ab1d2878ee749be9c56ffc9efe970f7f0f094aa94b18b3cd15a72
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 openssl
Add_dependency run mysql-client

Add_dependency build libstdc++-devel
Add_dependency build zlib-devel
Add_dependency build tcp_wrappers-devel
Add_dependency build ncursesw-devel
Add_dependency build openssl-devel
Add_dependency build readline-devel
Add_dependency full perl

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
}