PKGBUILDs/extra/mariadb/PKGBUILD

267 lines
9.1 KiB
Bash
Raw Normal View History

2024-05-20 20:26:16 +00:00
# Maintainer: Christian Hesse <eworm@archlinux.org>
2014-12-05 16:47:24 +00:00
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - disable mroonga storage engine (doesn't build on ARM)
2023-02-21 01:51:37 +00:00
# - build v7 with -j1
2014-12-05 16:47:24 +00:00
2024-08-14 10:24:08 +00:00
# ➡️ The mariadb package will be latest stable (GA / General Availability)
# release, regardless of rolling or long-term release.
# ➡️ The mariadb-lts package will be latest long-term release not packaged
# in mariadb. So mariadb-lts will always be behind mariadb, please do not
# flag out-of-date too early!
# https://mariadb.com/kb/en/mariadb-server-release-dates/
2014-12-05 16:47:24 +00:00
pkgbase=mariadb
2019-01-18 13:29:56 +00:00
pkgname=('mariadb-libs' 'mariadb-clients' 'mariadb' 'mytop')
pkgdesc='Fast SQL database server, derived from MySQL'
2024-08-19 10:24:43 +00:00
pkgver=11.5.2
2024-06-03 00:09:01 +00:00
pkgrel=1
2017-12-31 00:00:39 +00:00
arch=('x86_64')
2024-08-19 10:24:43 +00:00
license=('GPL-2.0-only')
2018-08-09 21:12:37 +00:00
url='https://mariadb.org/'
2024-05-20 20:26:16 +00:00
makedepends=('git' 'boost' 'bzip2' 'cmake' 'cracklib' 'curl' 'jemalloc' 'judy' 'krb5' 'liburing'
2023-07-06 21:10:46 +00:00
'libxcrypt' 'libxml2' 'lz4' 'openssl' 'pcre2' 'systemd' 'zlib' 'zstd' 'xz')
2023-02-08 14:23:34 +00:00
validpgpkeys=('177F4010FE56CA3336300305F1656F24C74CD1D8') # MariaDB Signing Key <signing-key@mariadb.org>
2024-05-20 20:26:16 +00:00
source=("mariadb::git+https://github.com/MariaDB/server.git#tag=mariadb-${pkgver}?signed"
'git+https://github.com/MariaDB/mariadb-connector-c.git'
'git+https://github.com/facebook/rocksdb.git'
'git+https://github.com/codership/wsrep-lib.git'
'git+https://github.com/wolfSSL/wolfssl.git'
'git+https://github.com/mariadb-corporation/libmarias3.git'
'git+https://github.com/mariadb-corporation/mariadb-columnstore-engine.git'
2021-11-13 00:00:43 +00:00
'0001-arch-specific.patch')
2024-08-19 10:24:43 +00:00
sha256sums=('da69a53d27a52b64c15b5c665c2d48d7ed362ae51d01f32edd0b29f69b8f8e96'
2024-05-20 20:26:16 +00:00
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
2016-10-04 13:32:14 +00:00
'SKIP'
2024-08-19 10:24:43 +00:00
'08c2c661159f4a7c54a764bb13459e37cbccdf98a93c2cf151d53f600f1fa35d')
2014-12-05 16:47:24 +00:00
2016-07-24 21:17:42 +00:00
prepare() {
2024-05-20 20:26:16 +00:00
cd mariadb/
# setup git submodules
git config --file=.gitmodules submodule.libmariadb.url ../mariadb-connector-c/
git config --file=.gitmodules submodule.storage/rocksdb/rocksdb.url ../rocksdb/
git config --file=.gitmodules submodule.wsrep-lib.url ../wsrep-lib/
git config --file=.gitmodules submodule.extra/wolfssl/wolfssl.url ../wolfssl/
git config --file=.gitmodules submodule.storage/maria/libmarias3.url ../libmarias3/
git config --file=.gitmodules submodule.storage/columnstore/columnstore.url ../mariadb-columnstore-engine/
git submodule init
git -c protocol.file.allow=always submodule update
2017-05-15 23:47:24 +00:00
2019-02-24 21:19:41 +00:00
# Arch Linux specific patches:
2016-07-24 21:17:42 +00:00
# * enable PrivateTmp for a little bit more security
2019-01-18 13:29:56 +00:00
# * force preloading jemalloc for memory management
2020-05-14 14:06:22 +00:00
# * make systemd-tmpfiles create MYSQL_DATADIR
2019-02-24 21:19:41 +00:00
patch -Np1 < ../0001-arch-specific.patch
2016-07-24 21:17:42 +00:00
}
2014-12-05 16:47:24 +00:00
build() {
2023-02-21 01:51:37 +00:00
[[ $CARCH == "armv7h" ]] && MAKEFLAGS="-j1"
2019-01-18 13:29:56 +00:00
local _cmake_options=(
# build options
2019-09-14 14:05:11 +00:00
-DCOMPILATION_COMMENT="Arch Linux"
2019-01-18 13:29:56 +00:00
-DCMAKE_BUILD_TYPE=RelWithDebInfo
2023-07-06 21:10:46 +00:00
#-DCMAKE_BUILD_TYPE=Debug
#-DMYSQL_MAINTAINER_MODE=WARN
2019-01-18 13:29:56 +00:00
-Wno-dev
# file paths
# /etc
2019-06-27 22:48:06 +00:00
-DINSTALL_SYSCONFDIR=/etc
-DINSTALL_SYSCONF2DIR=/etc/my.cnf.d
2019-01-18 13:29:56 +00:00
# /run
-DINSTALL_UNIX_ADDRDIR=/run/mysqld/mysqld.sock
# /usr
-DCMAKE_INSTALL_PREFIX=/usr
# /usr/bin /usr/include
-DINSTALL_SCRIPTDIR=bin
-DINSTALL_INCLUDEDIR=include/mysql
# /usr/lib
-DINSTALL_PLUGINDIR=lib/mysql/plugin
-DINSTALL_SYSTEMD_UNITDIR=/usr/lib/systemd/system/
-DINSTALL_SYSTEMD_SYSUSERSDIR=/usr/lib/sysusers.d/
-DINSTALL_SYSTEMD_TMPFILESDIR=/usr/lib/tmpfiles.d/
# /usr/share
-DINSTALL_SHAREDIR=share
-DINSTALL_SUPPORTFILESDIR=share/mysql
-DINSTALL_MYSQLSHAREDIR=share/mysql
-DINSTALL_DOCREADMEDIR=share/doc/mariadb
-DINSTALL_DOCDIR=share/doc/mariadb
-DINSTALL_MANDIR=share/man
# /var
-DMYSQL_DATADIR=/var/lib/mysql
# default settings
-DDEFAULT_CHARSET=utf8mb4
-DDEFAULT_COLLATION=utf8mb4_unicode_ci
# features
-DENABLED_LOCAL_INFILE=ON
-DPLUGIN_EXAMPLE=NO
-DPLUGIN_FEDERATED=NO
-DPLUGIN_FEEDBACK=NO
-DWITHOUT_MROONGA_STORAGE_ENGINE=1
-DWITH_EMBEDDED_SERVER=ON
-DWITH_EXTRA_CHARSETS=complex
-DWITH_JEMALLOC=ON
-DWITH_LIBWRAP=OFF
2023-07-06 21:10:46 +00:00
-DWITH_PCRE2=system
2019-01-18 13:29:56 +00:00
-DWITH_READLINE=ON
-DWITH_SSL=system
-DWITH_SYSTEMD=yes
-DWITH_UNIT_TESTS=OFF
-DWITH_ZLIB=system
)
2023-11-16 14:13:35 +00:00
# this uses malloc_usable_size, which is incompatible with fortification level 3
export CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
export CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
2014-12-05 16:47:24 +00:00
mkdir build
cd build
2024-05-20 20:26:16 +00:00
cmake ../mariadb/ "${_cmake_options[@]}"
2014-12-05 16:47:24 +00:00
make
}
2019-01-18 13:29:56 +00:00
check() {
cd build/mysql-test
# Takes *really* long, so disabled by default.
#./mtr --parallel=5 --mem --force --max-test-fail=0
}
package_mariadb-libs() {
pkgdesc='MariaDB libraries'
2023-07-06 21:10:46 +00:00
depends=('liburing' 'libxcrypt' 'libcrypt.so' 'openssl' 'pcre2' 'zlib' 'zstd')
2020-08-18 01:20:05 +00:00
optdepends=('krb5: for gssapi authentication')
2019-01-18 13:29:56 +00:00
conflicts=('libmysqlclient' 'libmariadbclient' 'mariadb-connector-c')
2020-05-14 14:06:22 +00:00
provides=('libmariadbclient' 'mariadb-connector-c' 'libmariadb.so' 'libmariadbd.so')
2019-01-18 13:29:56 +00:00
replaces=('libmariadbclient')
2014-12-05 16:47:24 +00:00
cd build
2017-06-01 12:35:49 +00:00
2019-01-18 13:29:56 +00:00
for dir in libmariadb libmysqld libservices include; do
make -C "$dir" DESTDIR="$pkgdir" install
2014-12-05 16:47:24 +00:00
done
2022-11-05 02:28:39 +00:00
# remove static libraries
rm "${pkgdir}"/usr/lib/*.a
# remove man pages
rm -r "${pkgdir}"/usr/share/man
2024-05-20 20:26:16 +00:00
2021-05-12 03:18:27 +00:00
ln -s mariadb_config "$pkgdir"/usr/bin/mariadb-config
2019-01-18 13:29:56 +00:00
ln -s mariadb_config "$pkgdir"/usr/bin/mysql_config
2024-05-20 20:26:16 +00:00
install -D -m0644 "$srcdir"/mariadb/man/mariadb_config.1 "$pkgdir"/usr/share/man/man1/mariadb_config.1
2023-07-06 21:10:46 +00:00
ln -s mariadb_config.1 "$pkgdir"/usr/share/man/man1/mariadb-config.1
ln -s mariadb_config.1 "$pkgdir"/usr/share/man/man1/mysql_config.1
2017-06-01 12:35:49 +00:00
install -D -m0644 support-files/mariadb.pc "$pkgdir"/usr/share/pkgconfig/mariadb.pc
2024-05-20 20:26:16 +00:00
install -D -m0644 "$srcdir"/mariadb/support-files/mysql.m4 "$pkgdir"/usr/share/aclocal/mysql.m4
2014-12-05 16:47:24 +00:00
}
package_mariadb-clients() {
pkgdesc='MariaDB client tools'
2023-03-30 12:22:27 +00:00
depends=("mariadb-libs=${pkgver}" 'jemalloc' 'ncurses')
2014-12-05 16:47:24 +00:00
conflicts=('mysql-clients')
2024-05-20 20:26:16 +00:00
provides=("mysql-clients=${pkgver}")
2014-12-05 16:47:24 +00:00
2022-11-05 02:28:39 +00:00
make -C build/client DESTDIR="${pkgdir}" install
2024-05-20 20:26:16 +00:00
2014-12-05 16:47:24 +00:00
# install man pages
2022-11-05 02:28:39 +00:00
make -C build/man DESTDIR="${srcdir}"/client-man install
install -d -m0755 "${pkgdir}"/usr/share/man/man1/
for man in $(find "${pkgdir}"/usr/bin/ ! -type d); do
install -D -m0644 -t "${pkgdir}"/usr/share/man/man1/ "${srcdir}"/client-man/usr/share/man/man1/"$(basename "${man}")".1
2024-05-20 20:26:16 +00:00
done
2014-12-05 16:47:24 +00:00
}
package_mariadb() {
2019-01-18 13:29:56 +00:00
pkgdesc='Fast SQL database server, derived from MySQL'
2019-06-27 22:48:06 +00:00
backup=('etc/my.cnf'
'etc/my.cnf.d/client.cnf'
'etc/my.cnf.d/enable_encryption.preset'
'etc/my.cnf.d/mysql-clients.cnf'
2022-02-18 17:51:24 +00:00
'etc/my.cnf.d/provider_bzip2.cnf'
'etc/my.cnf.d/provider_lz4.cnf'
'etc/my.cnf.d/provider_lzma.cnf'
2020-08-18 01:20:05 +00:00
'etc/my.cnf.d/s3.cnf'
2022-02-18 17:51:24 +00:00
'etc/my.cnf.d/server.cnf'
2020-08-18 01:20:05 +00:00
'etc/my.cnf.d/spider.cnf'
2020-05-14 14:06:22 +00:00
'etc/security/user_map.conf')
2014-12-05 16:47:24 +00:00
install=mariadb.install
2024-08-14 10:24:08 +00:00
depends=("mariadb-clients=${pkgver}" 'bzip2' 'coreutils' 'libxml2' 'lz4'
'systemd-libs' 'zstd')
2020-10-07 17:47:06 +00:00
optdepends=('cracklib: for cracklib plugin'
'curl: for ha_s3 plugin'
2020-08-18 01:20:05 +00:00
'galera: for MariaDB cluster with Galera WSREP'
2021-12-22 21:28:57 +00:00
'judy: for Open Query GRAPH (OQGraph) computation engine'
2022-02-18 17:51:24 +00:00
'perl-dbd-mariadb: for mariadb-hotcopy, mariadb-convert-table-format and mariadb-setpermission'
2021-05-12 03:18:27 +00:00
'python-mysqlclient: for myrocks_hotbackup'
2022-02-18 17:51:24 +00:00
'xz: lzma provider')
2014-12-05 16:47:24 +00:00
conflicts=('mysql')
2024-08-14 10:24:08 +00:00
provides=("mariadb-server=${pkgver}" "mysql=${pkgver}")
2014-12-05 16:47:24 +00:00
options=('emptydirs')
cd build
2017-06-01 12:35:49 +00:00
2014-12-05 16:47:24 +00:00
make DESTDIR="$pkgdir" install
2017-01-08 16:59:42 +00:00
cd "$pkgdir"
2019-01-18 13:29:56 +00:00
# no SysV init, please!
2019-06-27 22:48:06 +00:00
rm -r etc/logrotate.d
2019-01-18 13:29:56 +00:00
rm usr/bin/rcmysql
rm usr/share/mysql/{binary-configure,mysql{,d_multi}.server}
2014-12-05 16:47:24 +00:00
2017-01-08 16:59:42 +00:00
# move to proper licenses directories
install -d usr/share/licenses/mariadb
mv usr/share/doc/mariadb/COPYING* usr/share/licenses/mariadb/
2019-01-18 13:29:56 +00:00
# move it where one might look for it
2019-02-24 22:05:38 +00:00
#mv usr/share/{groonga{,-normalizer-mysql},doc/mariadb/}
2015-05-08 12:45:16 +00:00
2020-05-14 14:06:22 +00:00
# move to pam directories
install -d {etc,usr/lib}/security
mv usr/share/user_map.conf etc/security/
mv usr/share/pam_user_map.so usr/lib/security/
2019-01-18 13:29:56 +00:00
# already installed to real systemd unit directory or useless
rm -r usr/share/mysql/systemd/
rm -r usr/lib/systemd/system/mariadb@bootstrap.service.d
2017-12-31 00:00:39 +00:00
2019-01-18 13:29:56 +00:00
# provided by mariadb-libs
2021-05-12 03:18:27 +00:00
rm usr/bin/{mariadb{_,-},mysql_}config
2014-12-05 16:47:24 +00:00
rm -r usr/include/
2022-11-05 02:28:39 +00:00
rm usr/share/man/man1/{mariadb,mysql}_config.1
2020-05-14 14:06:22 +00:00
rm -r usr/share/aclocal
2019-01-18 13:29:56 +00:00
rm usr/lib/lib*
2020-05-14 14:06:22 +00:00
rm -r usr/lib/pkgconfig
2022-05-31 15:53:57 +00:00
rm usr/lib/mysql/plugin/{auth_gssapi_client,caching_sha2_password,client_ed25519,dialog,mysql_clear_password,sha256_password,zstd}.so
2014-12-05 16:47:24 +00:00
# provided by mariadb-clients
2024-05-20 20:26:16 +00:00
for bin in $(find "${pkgdir}/../${pkgbase}-clients/usr/bin/" ! -type d); do
2022-11-05 02:28:39 +00:00
rm "${pkgdir}"/usr/bin/"$(basename "${bin}")" "${pkgdir}"/usr/share/man/man1/"$(basename "${bin}")".1
done
2014-12-05 16:47:24 +00:00
# provided by mytop
rm usr/bin/mytop
# not needed
2023-08-24 18:34:20 +00:00
rm -r usr/{mariadb-test,sql-bench}
2014-12-05 16:47:24 +00:00
rm usr/share/man/man1/mysql-test-run.pl.1
}
2019-01-18 13:29:56 +00:00
package_mytop() {
pkgdesc='Top clone for MariaDB'
2020-10-07 17:47:06 +00:00
depends=('perl' 'perl-dbd-mariadb' 'perl-term-readkey')
2019-01-18 13:29:56 +00:00
2020-10-07 17:47:06 +00:00
install -D -m0755 build/scripts/mytop "$pkgdir"/usr/bin/mytop
2019-01-18 13:29:56 +00:00
}