PKGBUILDs/community/percona-server/PKGBUILD
2018-12-31 17:27:54 +00:00

186 lines
6.5 KiB
Bash

# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - drop numactl makedepend, don't build with NUMA
# - disable epoll on aarch64
# - patch to fix padding calculation
pkgbase=percona-server
pkgname=('libperconaserverclient' 'percona-server-clients' 'percona-server')
pkgver=8.0.13_3
_boost_ver=1.67.0
_pkgver=${pkgver/_/-}
_myver=${pkgver/_rel*}
pkgrel=1
arch=('x86_64')
makedepends=('cmake' 'zlib' 'lz4' 'zstd' 'libaio' 'systemd-tools' 'pam' 'jemalloc' 'openssl' 'rpcsvc-proto')
license=('GPL')
url="https://www.percona.com/software/mysql-database/percona-server"
source=("https://www.percona.com/downloads/Percona-Server-${pkgver%.*_*}/Percona-Server-$_pkgver/source/tarball/percona-server-$_pkgver.tar.gz"
"http://jenkins.percona.com/downloads/boost/boost_${_boost_ver//./_}.tar.gz"
'my.cnf'
'mysql-user.conf'
'build-hostname.patch'
'no-werror.patch'
'rocksdb-systemlibs.patch'
'0001-fix-LF_PINS-padding-calculation.patch')
sha256sums=('ab00626775b85ea506c1d992d66acee50f0bfbde54b830731f61652e87ff93da'
'8aa4e330c870ef50a896634c931adf468b21f8a69b77007e45c444151229f665'
'b467b04d6d06152b2abc33f2a6de63fef0fc922dd5119d2ee1d07d3c1a489731'
'e638a2657085f15b6728f43c1fd6aa551b27608fbf6b435e33afd3606a0cfb0e'
'1537fdbb92dd1c135c1eb9f4d10c44fd02e652db66c933d731990a1196f1397c'
'fe1cb2b079c56ff0f827c7dfb25d004b2190410406820c490dc6152cfe392b70'
'38f1acce8d8eff8167f1defcd4ce7063e67beeb7ab67bbf15ba5630290d00b71'
'aa5e960625843b061f47c32b4a267fab1115667b8b7d1ce7ec952efe42eb77af')
prepare() {
cd $pkgbase-$_pkgver
rm -v sql/sql_yacc.{cc,h}
patch -p1 -i "$srcdir"/build-hostname.patch
patch -p1 -i "$srcdir"/no-werror.patch
# patch -p1 -i "$srcdir"/rocksdb-systemlibs.patch
patch -p1 -i "$srcdir"/0001-fix-LF_PINS-padding-calculation.patch
}
build() {
# rm -rf build
mkdir -p build
cd build
[[ $CARCH == "aarch64" ]] && CONFIG="-DHAVE_SYS_EPOLL_H=0"
cmake ../$pkgbase-$_pkgver \
-DBUILD_CONFIG=mysql_release \
-DREPRODUCIBLE_BUILD=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
-DSYSCONFDIR=/etc/mysql \
-DMYSQL_DATADIR=/var/lib/mysql \
-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DENABLED_LOCAL_INFILE=ON \
-DINSTALL_INFODIR=share/doc/percona-server \
-DINSTALL_DOCREADMEDIR=share/doc/percona-server \
-DINSTALL_DOCDIR=share/doc/percona-server \
-DINSTALL_MANDIR=share/man \
-DINSTALL_PLUGINDIR=lib/mysql/plugin \
-DINSTALL_SCRIPTDIR=bin \
-DINSTALL_INCLUDEDIR=include/perconaserver \
-DINSTALL_SUPPORTFILESDIR=share/mysql \
-DINSTALL_MYSQLSHAREDIR=share/mysql \
-DWITH_ZLIB=system \
-DWITH_LZ4=system \
-DWITH_SSL=system \
-DWITH_LIBWRAP=OFF \
-DWITH_MECAB=OFF \
-DWITH_PAM=ON \
-DWITH_EXTRA_CHARSETS=complex \
-DWITH_EMBEDDED_SERVER=ON \
-DWITH_EMBEDDED_SHARED_LIBRARY=ON \
-DWITH_INNODB_MEMCACHED=ON \
-DWITH_ARCHIVE_STORAGE_ENGINE=ON \
-DWITH_BLACKHOLE_STORAGE_ENGINE=ON \
-DWITH_FEDERATED_STORAGE_ENGINE=ON \
-DWITH_ROCKSDB=ON \
-DTOKU_DEBUG_PARANOID=OFF \
-DWITH_VALGRIND=OFF \
-DUSE_VALGRIND=OFF \
-DDEBUG_EXTNAME=OFF \
-DBUILD_TESTING=OFF \
-DWITH_UNIT_TESTS=OFF \
-DUSE_GTAGS=OFF \
-DUSE_CTAGS=OFF \
-DUSE_ETAGS=OFF \
-DUSE_CSCOPE=OFF \
-DTOKUDB_BACKUP_PLUGIN_VERSION=$_pkgver \
-DWITH_SYSTEMD=1 \
-DWITH_SCALABILITY_METRICS=ON \
-DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' \
-DCMAKE_C_FLAGS="-fPIC $CFLAGS -fno-strict-aliasing -DBIG_JOINS=1 -fomit-frame-pointer -fno-delete-null-pointer-checks -Wno-dev" \
-DCMAKE_CXX_FLAGS="-fPIC $CXXFLAGS -fno-strict-aliasing -DBIG_JOINS=1 -felide-constructors -fno-delete-null-pointer-checks -Wno-dev -Wno-error=nonnull-compare -Wno-deprecated-declarations -Wno-misleading-indentation -Wno-maybe-uninitialized" \
-DWITH_MYSQLD_LDFLAGS="-pie ${LDFLAGS},-z,now" \
-DWITH_BOOST="../boost_${_boost_ver//./_}" \
-DWITH_NUMA=OFF \
$CONFIG
make
}
package_libperconaserverclient() {
pkgdesc='Percona Server client libraries'
depends=('zlib' 'openssl')
cd build
for dir in include libmysql libservices; do
make -C $dir DESTDIR="$pkgdir" install
done
# Conflicting files with libmariadbclient
rm -rf "$pkgdir"/usr/lib/{libmysql*,mysql}
install -Dm755 scripts/mysql_config "$pkgdir"/usr/bin/perconaserver_config
install -Dm644 "$srcdir"/$pkgbase-$_pkgver/man/mysql_config.1 "$pkgdir"/usr/share/man/man1/perconaserver_config.1
install -D -m0644 scripts/perconaserverclient.pc "$pkgdir"/usr/lib/pkgconfig/perconaserverclient.pc
install -D -m0644 "$srcdir"/$pkgbase-$_pkgver/support-files/mysql.m4 "$pkgdir"/usr/share/aclocal/perconaserverclient.m4
}
package_percona-server-clients() {
pkgdesc='Percona Server client tools'
depends=('libperconaserverclient' 'zlib' 'lz4' 'jemalloc' 'readline')
conflicts=('mysql-clients')
provides=("mysql-clients=$_myver" "mariadb-clients=$_myver")
cd build
make -C client DESTDIR="$pkgdir" install
# install man pages
install -d "$pkgdir"/usr/share/man/man1
for man in mysql{,admin,check,dump,import,show,slap,pump,binlog,_upgrade}; do
install -m644 "$srcdir"/$pkgbase-$_pkgver/man/$man.1 "$pkgdir"/usr/share/man/man1/$man.1
done
# provided by percona-server
rm "$pkgdir"/usr/bin/mysql{_config_editor,_secure_installation,_ssl_rsa_setup}
}
package_percona-server() {
pkgdesc='Drop-in replacement for MySQL that provides improved performance, diagnostics, instrumentation and MyRocks storage engine'
backup=('etc/mysql/my.cnf')
depends=('libaio' 'systemd-tools' 'pam' 'jemalloc' 'lz4' 'zstd' 'openssl' 'libtirpc')
optdepends=('perl-dbd-mysql')
conflicts=('mysql')
provides=("mysql=$_myver" "mariadb=$_myver")
options=('emptydirs')
cd build
make DESTDIR="$pkgdir" install
install -Dm644 ../my.cnf "$pkgdir"/etc/mysql/my.cnf
install -Dm644 ../mysql-user.conf "$pkgdir"/usr/lib/sysusers.d/mysql.conf
cd "$pkgdir"
mv usr/usr/lib/* usr/lib
rm -rf usr/usr
# Move documentation
if [ -f usr/PATENTS ]; then
mv usr/{PATENTS,README.md} usr/share/doc/$pkgname/
rm usr/COPYING.*
fi
# provided by libperconaserverclient
rm usr/bin/mysql_config
rm usr/lib/lib{mysql,perconaserver}*
rm -r usr/include/
rm usr/share/man/man1/mysql_config.1
rm -r usr/share/aclocal usr/lib/pkgconfig
# provided by percona-server-clients
rm usr/bin/mysql{,admin,check,dump,import,show,slap,pump,binlog,test,_upgrade}
rm usr/share/man/man1/mysql{,admin,check,dump,import,show,slap,pump,binlog,_upgrade}.1
# not needed
rm -r usr/mysql-test
}