archrelease: copy trunk to community-any
[ArchLinux/community.git] / percona-server / trunk / PKGBUILD
blob0c4a30b3cdff2d84d4aed4dc1a229edbefd647a2
1 # Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
3 pkgbase=percona-server
4 pkgname=('libperconaserverclient' 'percona-server-clients' 'percona-server')
5 pkgver=8.0.32_24
6 _boost_ver=1.77.0
7 _pkgver=${pkgver/_/-}
8 _myver=${pkgver/_rel*}
9 pkgrel=1
10 arch=('x86_64')
11 makedepends=('cmake' 'zlib' 'lz4' 'zstd' 'libaio' 'systemd-tools' 'pam' 'numactl' 'jemalloc' 'openssl'
12              'rpcsvc-proto' 'doxygen' 'graphviz' 'libevent' 'protobuf' 'libfido2') # 'boost'
13 license=('GPL')
14 url="https://www.percona.com/software/mysql-database/percona-server"
15 source=("https://www.percona.com/downloads/Percona-Server-${pkgver%.*_*}/Percona-Server-$_pkgver/source/tarball/percona-server-$_pkgver.tar.gz"
16         "https://boostorg.jfrog.io/artifactory/main/release/$_boost_ver/source/boost_${_boost_ver//./_}.tar.gz"
17         'my.cnf'
18         'mysql-user.conf'
19         'mysqlrouter-user.conf')
20 sha256sums=('2867706e914597cb3a5161751573c5463caf8343684ed7eeafcad1eb8f2d081e'
21             '5347464af5b14ac54bb945dc68f1dd7c56f0dad7262816b956138fc53bcc0131'
22             'b467b04d6d06152b2abc33f2a6de63fef0fc922dd5119d2ee1d07d3c1a489731'
23             '5d7710fe88ec6d298175a309c0b776142397b119c468830b2865980292ed5da6'
24             '4ca7ffdcb2d1716d4f31e4c7dd314e5d76e64f13fdc67c5d81c53650b793f5e0')
26 prepare() {
27         cd $pkgbase-$_pkgver
28         rm -v sql/sql_yacc.{cc,h}
30         sed -r -e s@/var/run/mysqlrouter@/run/mysqlrouter@ \
31                -e s@lib64/mysql@lib/mysql@ \
32                -i cmake/install_layout.cmake
34         for svcfile in mysqld{,@}.service.in; do
35                 sed '/^PrivateTmp=/ a StateDirectory=mysql mysql-files\nRuntimeDirectory=mysqld' \
36                         -i scripts/systemd/$svcfile
37         done
39         sed '/^PrivateTmp=/ a StateDirectory=mysqlrouter\nRuntimeDirectory=mysqlrouter' \
40                 -i scripts/systemd/mysqlrouter.service.in
43 build() {
44         # rm -rf build
45         mkdir -p build
46         cd build
48         cmake "../$pkgbase-$_pkgver" \
49                 -DCMAKE_C_FLAGS_RELWITHDEBINFO="${CFLAGS} -DNDEBUG -ffat-lto-objects -msse4.2 -mpclmul" \
50                 -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="${CXXFLAGS} -DNDEBUG -ffat-lto-objects -msse4.2 -mpclmul" \
51                 -Wno-dev \
52                 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
53                 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
54                 -DBUILD_CONFIG=mysql_release \
55                 -DREPRODUCIBLE_BUILD=ON \
56                 -DCMAKE_INSTALL_PREFIX=/usr \
57                 -DSYSCONFDIR=/etc/mysql \
58                 -DMYSQL_DATADIR=/var/lib/mysql \
59                 -DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock \
60                 -DDEFAULT_CHARSET=utf8mb4 \
61                 -DDEFAULT_COLLATION=utf8mb4_0900_ai_ci \
62                 -DWITH_EXTRA_CHARSETS=all \
63                 -DENABLED_LOCAL_INFILE=ON \
64                 -DINSTALL_LAYOUT=RPM \
65                 -DINSTALL_SBINDIR=bin \
66                 -DINSTALL_LIBDIR=lib \
67                 -DINSTALL_PLUGINDIR=lib/perconaserver/plugin \
68                 -DINSTALL_INCLUDEDIR=include/perconaserver \
69                 -DINSTALL_INFODIR=share/doc/percona-server \
70                 -DINSTALL_DOCREADMEDIR=share/doc/percona-server \
71                 -DINSTALL_DOCDIR=share/doc/percona-server \
72                 -DINSTALL_MANDIR=share/man \
73                 -DINSTALL_SUPPORTFILESDIR=share/mysql \
74                 -DINSTALL_MYSQLSHAREDIR=share/mysql \
75                 -DINSTALL_STATIC_LIBRARIES=OFF \
76                 -DWITH_ZLIB=system \
77                 -DWITH_LZ4=system \
78                 -DWITH_ZSTD=system \
79                 -DWITH_SSL=system \
80                 -DWITH_ICU=system \
81                 -DWITH_LIBEVENT=system \
82                 -DWITH_PROTOBUF=system \
83                 -DWITH_FIDO=system \
84                 -DWITH_ENCRYPTION_UDF=ON \
85                 -DWITH_KEYRING_VAULT=ON \
86                 -DWITH_LIBWRAP=OFF \
87                 -DWITH_MECAB=OFF \
88                 -DWITH_PAM=ON \
89                 -DWITH_INNODB_MEMCACHED=ON \
90                 -DWITH_ARCHIVE_STORAGE_ENGINE=ON \
91                 -DWITH_BLACKHOLE_STORAGE_ENGINE=ON \
92                 -DWITH_FEDERATED_STORAGE_ENGINE=ON \
93                 -DWITH_ROCKSDB=ON \
94                 -DROCKSDB_DISABLE_AVX2=1 \
95                 -DROCKSDB_DISABLE_MARCH_NATIVE=1 \
96                 -DWITH_VALGRIND=OFF \
97                 -DDEBUG_EXTNAME=OFF \
98                 -DBUILD_TESTING=OFF \
99                 -DWITH_UNIT_TESTS=OFF \
100                 -DWITH_SYSTEMD=1 \
101                 -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' \
102                 -DWITH_NUMA=ON \
103                 -DWITH_BOOST="../boost_${_boost_ver//./_}"
104                 # -DWITH_BOOST=system
106         make
109 package_libperconaserverclient() {
110         pkgdesc='Percona Server client libraries'
111         depends=('zlib' 'zstd' 'openssl' 'libfido2')
112         optdepends=('libsasl: authentication_ldap_sasl_client plugin')
114         cd build
115         for dir in include libmysql libservices; do
116                 make -C $dir DESTDIR="$pkgdir" install
117         done
119         rm -vrf "$pkgdir"/usr/lib/perconaserver/plugin/debug
121         install -Dm755 scripts/mysql_config "$pkgdir"/usr/bin/perconaserver_config
122         install -Dm644 "$srcdir/$pkgbase-$_pkgver/man/mysql_config.1" "$pkgdir"/usr/share/man/man1/perconaserver_config.1
123         sed s@/lib64@/lib@ -i "$pkgdir"/usr/bin/perconaserver_config
125         install -D -m0644 scripts/perconaserverclient.pc "$pkgdir"/usr/lib/pkgconfig/perconaserverclient.pc
126         install -D -m0644 "$srcdir/$pkgbase-$_pkgver/support-files/mysql.m4" "$pkgdir"/usr/share/aclocal/perconaserverclient.m4
129 package_percona-server-clients() {
130         pkgdesc='Percona Server client tools'
131         depends=('libperconaserverclient' 'zlib' 'zstd' 'lz4' 'openssl' 'jemalloc' 'readline')
132         conflicts=('mysql-clients')
133         provides=("mysql-clients=$_myver" "mariadb-clients=$_myver")
135         cd build
136         make -C client DESTDIR="$pkgdir" install
138         # install man pages
139         install -d "$pkgdir"/usr/share/man/man1
140         for man in mysql{,admin,check,dump,import,show,slap,pump,binlog,_upgrade}; do
141                 install -m644 "$srcdir/$pkgbase-$_pkgver/man/$man.1" "$pkgdir"/usr/share/man/man1/$man.1
142         done
144         # provided by percona-server
145         rm "$pkgdir"/usr/bin/mysql{_config_editor,_secure_installation,_ssl_rsa_setup}
148 package_percona-server() {
149         pkgdesc='Drop-in replacement for MySQL that provides improved performance, diagnostics, instrumentation and MyRocks storage engine'
150         backup=('etc/mysql/my.cnf' 'etc/mysqlrouter/mysqlrouter.conf')
151         depends=('libaio' 'systemd-tools' 'pam' 'jemalloc' 'numactl' 'lz4' 'zstd' 'openssl' 'libtirpc' 'curl'
152                  'libevent' 'protobuf' 'icu') # 'boost-libs'
153         optdepends=('perl-dbd-mysql')
154         conflicts=('mysql')
155         provides=("mysql=$_myver" "mariadb=$_myver")
156         options=('emptydirs')
158         cd build
159         make DESTDIR="$pkgdir" install
161         cd "$pkgdir"
162         install -Dm644 "$srcdir/my.cnf" etc/mysql/my.cnf
163         install -Dm644 "$srcdir/mysql-user.conf" usr/lib/sysusers.d/mysql.conf
165         install -dm755 etc/mysqlrouter
166         sed -e 's:@ROUTER_RUNTIMEDIR@:/run/mysqlrouter:' \
167                 -e 's:^logging_folder.*:logging_folder =:' \
168                 "$srcdir/$pkgbase-$_pkgver/packaging/rpm-common/mysqlrouter.conf.in" \
169                 > etc/mysqlrouter/mysqlrouter.conf
170         install -Dm644 "$srcdir/mysqlrouter-user.conf" usr/lib/sysusers.d/mysqlrouter.conf
172         chmod 755 usr
173         rm -vrf usr/{cmake,lib/perconaserver/plugin/debug,lib/tmpfiles.d/mysql{,router}.conf}
175         # Move documentation
176         if [ -f usr/PATENTS ]; then
177                 mv usr/{PATENTS,README.md} usr/share/doc/$pkgname/
178                 rm usr/COPYING.*
179         fi
181         # provided by libperconaserverclient
182         rm usr/bin/mysql_config
183         rm usr/lib/libperconaserverclient*
184         rm -r usr/include/
185         rm usr/share/man/man1/mysql_config.1
186         rm -r usr/share/aclocal usr/lib/pkgconfig
188         # provided by percona-server-clients
189         rm usr/bin/mysql{,admin,check,dump,import,show,slap,pump,binlog,test,_upgrade,_migrate_keyring}
190         rm usr/lib/perconaserver/plugin/authentication_*_client.so
191         rm usr/share/man/man1/mysql{,admin,check,dump,import,show,slap,pump,binlog,_upgrade}.1
193         # not needed
194         rm -r usr/share/mysql-test
195         rm usr/share/doc/percona-server/mysql.info