SUMMARY="SQL database server"
DESCRIPTION="A fast, multi-threaded, multi-user SQL database server."
HOMEPAGE="https://www.mysql.com"
COPYRIGHT="2000, 2012, Oracle and/or its affiliates. All rights reserved."
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://downloads.mysql.com/archives/get/p/23/file/mysql-$portVersion.tar.gz"
CHECKSUM_SHA256="f7d3ac87693de8d0f4ddf457c268107b0d538a0b577f1c2596a8a28eb0bdd1c4"
PATCHES="mysql-$portVersion.patchset"

ARCHITECTURES="!x86_gcc2 !x86"
SECONDARY_ARCHITECTURES="!x86"

PROVIDES="
	mysql$secondaryArchSuffix = $portVersion
	cmd:comp_err$secondaryArchSuffix
	cmd:innochecksum$secondaryArchSuffix
	cmd:msql2mysql$secondaryArchSuffix
	cmd:my_print_defaults$secondaryArchSuffix
	cmd:myisam_ftdump$secondaryArchSuffix
	cmd:myisamchk$secondaryArchSuffix
	cmd:myisamlog$secondaryArchSuffix
	cmd:myisampack$secondaryArchSuffix
	cmd:mysql$secondaryArchSuffix
	cmd:mysql_client_test$secondaryArchSuffix
	cmd:mysql_config$secondaryArchSuffix
	cmd:mysql_convert_table_format$secondaryArchSuffix
	cmd:mysql_explain_log$secondaryArchSuffix
	cmd:mysql_find_rows$secondaryArchSuffix
	cmd:mysql_fix_extensions$secondaryArchSuffix
	cmd:mysql_fix_privilege_tables$secondaryArchSuffix
	cmd:mysql_install_db$secondaryArchSuffix
	cmd:mysql_secure_installation$secondaryArchSuffix
	cmd:mysql_setpermission$secondaryArchSuffix
	cmd:mysql_tableinfo$secondaryArchSuffix
	cmd:mysql_tzinfo_to_sql$secondaryArchSuffix
	cmd:mysql_upgrade$secondaryArchSuffix
	cmd:mysql_upgrade_shell$secondaryArchSuffix
	cmd:mysql_waitpid$secondaryArchSuffix
	cmd:mysql_zap$secondaryArchSuffix
	cmd:mysqlaccess$secondaryArchSuffix
	cmd:mysqladmin$secondaryArchSuffix
	cmd:mysqlbinlog$secondaryArchSuffix
	cmd:mysqlbug$secondaryArchSuffix
	cmd:mysqlcheck$secondaryArchSuffix
	cmd:mysqld_multi$secondaryArchSuffix
	cmd:mysqld_safe$secondaryArchSuffix
	cmd:mysqldump$secondaryArchSuffix
	cmd:mysqldumpslow$secondaryArchSuffix
	cmd:mysqlhotcopy$secondaryArchSuffix
	cmd:mysqlimport$secondaryArchSuffix
	cmd:mysqlshow$secondaryArchSuffix
	cmd:mysqltest$secondaryArchSuffix
	cmd:mysqltestmanager_pwgen$secondaryArchSuffix
	cmd:mysqltestmanagerc$secondaryArchSuffix
	cmd:perror$secondaryArchSuffix
	cmd:replace$secondaryArchSuffix
	cmd:resolve_stack_dump$secondaryArchSuffix
	cmd:resolveip$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libedit$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	lib:libreadline$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcrypto$secondaryArchSuffix
	devel:libedit$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
	devel:libreadline$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:awk
	cmd:bison
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	autoreconf -vfi
	runConfigure ./configure \
		--without-readline \
		--without-libedit \
		CFLAGS=-O2 \
		CPPFLAGS=-Wno-narrowing
	make $jobArgs
}

INSTALL()
{
	make install
	# strict build fails on these paths, should be looked into
	rm -r $prefix/mysql-test $prefix/sql-bench
}
