void-packages/srcpkgs/mysql/template
Jürgen Buchmüller 3d03607120 mysql: fix cross build
Closes: #20741
2020-04-08 13:23:02 +02:00

131 lines
4.4 KiB
Bash

# Template file for 'mysql'
pkgname=mysql
version=5.6.43
revision=3
build_style=cmake
configure_args="-DSYSCONFDIR=/etc/mysql -DMYSQL_DATADIR=/var/lib/mysql
-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock -DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON
-DINSTALL_INFODIR=share/mysql/docs -DINSTALL_MANDIR=share/man
-DINSTALL_PLUGINDIR=lib/mysql/plugin -DINSTALL_SCRIPTDIR=bin
-DINSTALL_INCLUDEDIR=include/mysql -DINSTALL_DOCREADMEDIR=share/mysql
-DINSTALL_SUPPORTFILESDIR=share/mysql -DINSTALL_MYSQLSHAREDIR=share/mysql
-DINSTALL_DOCDIR=share/mysql/docs -DINSTALL_SHAREDIR=share/mysql
-DWITH_ZLIB=system -DWITH_SSL=system -DWITH_LIBWRAP=OFF
-DWITH_EXTRA_CHARSETS=complex -DWITH_EMBEDDED_SERVER=ON
-DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
-DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
-DSTACK_DIRECTION=1 -DHAVE_LLVM_LIBCPP_EXITCODE=0"
hostmakedepends="perl bison ncurses-devel"
makedepends="zlib-devel libressl-devel readline-devel"
depends="mysql-client"
conf_files="/etc/mysql/my.cnf"
short_desc="World's most popular open source database"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-only"
homepage="https://www.mysql.com/products/community/"
distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
checksum=1c95800bf0e1b7a19a37d37fbc5023af85c6bc0b41532433b3a886263a1673ef
system_accounts="mysql"
mysql_homedir="/var/lib/mysql"
lib32disabled=yes
CFLAGS="-D__STDC_ISO_10646__"
if [ "$CROSS_BUILD" ]; then
configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE=1"
configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE__TRYRUN_OUTPUT=0"
fi
pre_configure() {
# libressl major detection.
sed -i '/OPENSSL_MAJOR_VERSION/s/1/2/' cmake/ssl.cmake
sed -i 's/sys\/poll\.h/poll.h/' include/my_net.h
# We need some host binaries before starting cross compilation.
if [ "$CROSS_BUILD" ]; then
CC= CXX= CPP= LD= AR= AS= RANLIB= CFLAGS= CXXFLAGS= LDFLAGS= cmake .
make comp_err comp_sql gen_lex_hash gen_lex_token
mkdir -p bin.host/{extra,scripts,sql}
cp extra/comp_err bin.host/extra
cp scripts/comp_sql bin.host/scripts
cp sql/gen_lex_hash bin.host/sql
cp sql/gen_lex_token bin.host/sql
make clean
# Remove the rules for the host binaries to not
# have them overwritten with target binaries
rm CMakeCache.txt
vsed -i ${wrksrc}/scripts/CMakeLists.txt \
-e "/ADD_EXECUTABLE(comp_sql/d"
vsed -i ${wrksrc}/sql/CMakeLists.txt \
-e "/ADD_EXECUTABLE(gen_lex_hash/d" \
-e "/ADD_EXECUTABLE(gen_lex_token/d" \
-e "/ADD_DEPENDENCIES(gen_lex_token/d"
fi
}
pre_build() {
if [ "$CROSS_BUILD" ]; then
mkdir -p ${wrksrc}/build
cp -a ${wrksrc}/bin.host/* ${wrksrc}/build
mkdir -p ${wrksrc}/build/libmysqld
cp ${wrksrc}/bin.host/sql/gen_lex_token ${wrksrc}/build/libmysqld
export PATH=${PATH}:${wrksrc}/build/extra:${wrksrc}/build/scripts:${wrksrc}/build/sql
fi
}
post_install() {
# Remove unneeded stuff.
rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
# Configuration file.
vinstall ${FILESDIR}/my.cnf 640 etc/mysql
# runit service
vsv mysqld
}
libmysqlclient_package() {
short_desc+=" - client library"
pkg_install() {
vmove "usr/lib/libmysqlclient*.so.*"
}
}
libmysqlclient-devel_package() {
depends="libmysqlclient>=${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove usr/bin/mysql_config
vmove usr/share/man/man1/mysql_config.1
vmove usr/include
vmove "usr/lib/*.a"
vmove "usr/lib/*.so"
}
}
mysql-client_package() {
depends="perl"
short_desc+=" - database client binaries"
pkg_install() {
for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
mysql_client_test_embedded mysqldumpslow mysqlbinlog \
mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
mysqlslap mysqltest_embedded mysqlmanager mysqltest \
mysqlhotcopy mysql_upgrade mysql_zap; do
if [ -f ${DESTDIR}/usr/bin/${f} ]; then
vmove usr/bin/${f}
elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
vmove usr/sbin/${f}
fi
if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
vmove usr/share/man/man1/${f}.1
elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
vmove usr/share/man/man8/${f}.8
fi
done
}
}