jobextra/mariadb/PKGBUILD

262 lines
8.8 KiB
Bash
Raw Normal View History

2022-03-20 13:34:07 +01:00
#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
2022-03-20 13:34:07 +01:00
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website : https://pozol.eu
2022-03-20 13:34:07 +01:00
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgbase=mariadb
pkgname=('mariadb-libs' 'mariadb-clients' 'mariadb' 'mytop')
pkgdesc='Fast SQL database server, derived from MySQL w/o systemd and zstd'
pkgver=11.2.3
2023-08-13 10:25:17 +02:00
pkgrel=01
2022-03-20 13:34:07 +01:00
url='https://mariadb.org/'
makedepends=('boost' 'bzip2' 'cmake' 'cracklib' 'curl' 'jemalloc' 'judy' 'krb5' 'libaio'
2023-06-15 17:40:01 +02:00
'libxcrypt' 'libxml2' 'lz4' 'openssl' 'pcre2' 'zlib' 'xz')
#options=('debug')
2022-03-20 13:34:07 +01:00
# The default links with mirror redirection fail for signatures, specific
# mirrors may be out of date every now and then. Let's use the upstream
# rsync source via https and hope it does not hurt them too much.
# https://mariadb.com/kb/en/library/mirror-sites-for-mariadb/
source=("https://rsync.osuosl.org/pub/mariadb/mariadb-${pkgver}/source/mariadb-${pkgver}.tar.gz"{,.asc}
mariadb.sysusers.conf
2023-08-13 10:25:17 +02:00
mariadb.tmpfile.conf)
2023-07-06 00:41:12 +02:00
# 0001-arch-specific.patch
2022-03-20 13:34:07 +01:00
prepare() {
cd $pkgbase-$pkgver/
2022-03-20 13:34:07 +01:00
# Arch Linux specific patches:
# * enable PrivateTmp for a little bit more security
# * force preloading jemalloc for memory management
# * make systemd-tmpfiles create MYSQL_DATADIR
## patch -Np1 < ../0001-arch-specific.patch
2023-07-06 00:41:12 +02:00
}
2022-03-20 13:34:07 +01:00
build() {
local _cmake_options=(
# build options
-DCOMPILATION_COMMENT="joborun Linux"
2022-03-20 13:34:07 +01:00
-DCMAKE_BUILD_TYPE=RelWithDebInfo
2023-07-06 00:41:12 +02:00
#-DCMAKE_BUILD_TYPE=Debug
#-DMYSQL_MAINTAINER_MODE=WARN
2022-03-20 13:34:07 +01:00
-Wno-dev
# file paths
# /etc
-DINSTALL_SYSCONFDIR=/etc
-DINSTALL_SYSCONF2DIR=/etc/my.cnf.d
# /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
# /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
-DWITH_EMBEDDED_SERVER=ON
-DWITH_EXTRA_CHARSETS=complex
-DWITH_JEMALLOC=ON
-DWITH_LIBWRAP=OFF
2023-06-15 17:40:01 +02:00
-DWITH_PCRE2=system
2022-03-20 13:34:07 +01:00
-DWITH_READLINE=ON
-DWITH_SSL=system
-DWITH_SYSTEMD=no
-DWITH_UNIT_TESTS=OFF
-DWITH_ZLIB=system
-DWITH_ZSTD=OFF
-DWITH_XZ=ON
2022-03-20 13:34:07 +01:00
-DPLUGIN_TOKUDB=NO
)
2023-11-15 09:39:01 +01: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}"
2022-03-20 13:34:07 +01:00
mkdir build
cd build
cmake ../"$pkgbase-$pkgver" "${_cmake_options[@]}"
make
}
#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-06-15 17:40:01 +02:00
depends=('liburing' 'libxcrypt' 'libcrypt.so' 'openssl' 'pcre2' 'zlib')
2022-03-20 13:34:07 +01:00
optdepends=('krb5: for gssapi authentication')
conflicts=('libmysqlclient' 'libmariadbclient' 'mariadb-connector-c')
provides=('libmariadbclient' 'mariadb-connector-c' 'libmariadb.so' 'libmariadbd.so')
replaces=('libmariadbclient')
cd build
for dir in libmariadb libmysqld libservices include; do
make -C "$dir" DESTDIR="$pkgdir" install
done
2022-11-15 16:45:12 +01:00
# remove static libraries
rm "${pkgdir}"/usr/lib/*.a
# remove man pages
rm -r "${pkgdir}"/usr/share/man
2022-03-20 13:34:07 +01:00
ln -s mariadb_config "$pkgdir"/usr/bin/mariadb-config
ln -s mariadb_config "$pkgdir"/usr/bin/mysql_config
2023-06-15 17:40:01 +02:00
install -D -m0644 "$srcdir"/"$pkgbase-$pkgver"/man/mariadb_config.1 "$pkgdir"/usr/share/man/man1/mariadb_config.1
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
2022-03-20 13:34:07 +01:00
install -D -m0644 support-files/mariadb.pc "$pkgdir"/usr/share/pkgconfig/mariadb.pc
install -D -m0644 "$srcdir"/"$pkgbase-$pkgver"/support-files/mysql.m4 "$pkgdir"/usr/share/aclocal/mysql.m4
}
package_mariadb-clients() {
pkgdesc='MariaDB client tools'
depends=("mariadb-libs=${pkgver}" 'jemalloc' 'ncurses')
2022-03-20 13:34:07 +01:00
conflicts=('mysql-clients')
provides=("mysql-clients=$pkgver")
2022-11-15 16:45:12 +01:00
make -C build/client DESTDIR="$pkgdir" install
2022-03-20 13:34:07 +01:00
# install man pages
2022-11-15 16:45:12 +01: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
done
2022-03-20 13:34:07 +01:00
}
package_mariadb() {
pkgdesc='Fast SQL database server, derived from MySQL'
backup=('etc/my.cnf'
'etc/my.cnf.d/client.cnf'
'etc/my.cnf.d/enable_encryption.preset'
'etc/my.cnf.d/mysql-clients.cnf'
'etc/my.cnf.d/provider_bzip2.cnf'
'etc/my.cnf.d/provider_lz4.cnf'
'etc/my.cnf.d/provider_lzma.cnf'
'etc/my.cnf.d/s3.cnf'
'etc/my.cnf.d/server.cnf'
2022-03-20 13:34:07 +01:00
'etc/my.cnf.d/spider.cnf'
'etc/security/user_map.conf')
#
# install=mariadb.install # this is systemd specific post install manipulation
#
depends=( "mariadb-clients=${pkgver}" 'bzip2' 'libxml2' 'lz4' 'libxml2')
2022-03-20 13:34:07 +01:00
optdepends=('cracklib: for cracklib plugin'
'curl: for ha_s3 plugin'
'galera: for MariaDB cluster with Galera WSREP'
'judy: for Open Query GRAPH (OQGraph) computation engine'
'python-mysqlclient: for myrocks_hotbackup'
'perl-dbd-mariadb: for mariadb-hotcopy, mariadb-convert-table-format and mariadb-setpermission'
'xz: lzma provider')
conflicts=('mysql')
provides=("mysql=$pkgver")
options=('emptydirs')
cd build
make DESTDIR="$pkgdir" install
cd "$pkgdir"
# no SysV init, please!
2023-08-22 04:22:04 +02:00
# rm -r etc/logrotate.d
# rm usr/bin/rcmysql
# rm usr/share/mysql/{binary-configure,mysql{,d_multi}.server}
2022-03-20 13:34:07 +01:00
install -Dm0644 "$srcdir"/mariadb.tmpfile.conf "$pkgdir"/usr/lib/tmpfiles.d/mariadb.conf
install -Dm0644 "$srcdir"/mariadb.sysusers.conf "$pkgdir"/usr/lib/sysusers.d/mariadb.conf
# move to proper licenses directories
install -d usr/share/licenses/mariadb
mv usr/share/doc/mariadb/COPYING* usr/share/licenses/mariadb/
# move it where one might look for it
mv usr/share/{groonga{,-normalizer-mysql},doc/mariadb/}
# 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/
# provided by mariadb-libs
rm usr/bin/{mariadb{_,-},mysql_}config
rm -r usr/include/
2022-11-15 16:45:12 +01:00
rm usr/share/man/man1/{mariadb,mysql}_config.1
2022-03-20 13:34:07 +01:00
rm -r usr/share/aclocal
rm usr/lib/lib*
rm -r usr/lib/pkgconfig
2022-05-26 20:59:56 +02:00
rm usr/lib/mysql/plugin/{auth_gssapi_client,caching_sha2_password,client_ed25519,dialog,mysql_clear_password,sha256_password,zstd}.so
2022-03-20 13:34:07 +01:00
# provided by mariadb-clients
2022-11-15 16:45:12 +01:00
for bin in $(find "${pkgdir}"/../mariadb-clients/usr/bin/ ! -type d); do
rm "${pkgdir}"/usr/bin/"$(basename "${bin}")" "${pkgdir}"/usr/share/man/man1/"$(basename "${bin}")".1
done
2022-03-20 13:34:07 +01:00
# provided by mytop
rm usr/bin/mytop
# not needed
2023-08-22 04:22:04 +02:00
# rm -r usr/{mysql-test,sql-bench}
rm -r usr/{mariadb-test,sql-bench}
2022-03-20 13:34:07 +01:00
rm usr/share/man/man1/mysql-test-run.pl.1
}
package_mytop() {
pkgdesc='Top clone for MariaDB'
depends=('perl' 'perl-dbd-mariadb' 'perl-term-readkey')
install -D -m0755 build/scripts/mytop "$pkgdir"/usr/bin/mytop
}
#---- arch license gpg-key & sha256sums ----
2022-03-20 13:34:07 +01:00
arch=(x86_64)
2022-03-20 13:34:07 +01:00
license=('GPL')
#validpgpkeys=('199369E5404BD5FC7D2FE43BCBCB082A1BB943DB') # MariaDB Package Signing Key <package-signing-key@mariadb.org>
validpgpkeys=('177F4010FE56CA3336300305F1656F24C74CD1D8') # MariaDB Signing Key <signing-key@mariadb.org>
2022-03-20 13:34:07 +01:00
sha256sums=(14a0bba0c2847eb3f69a4637f55798f8abe10904cd1dd22899c9b0a39c43e35f # mariadb-11.2.3.tar.gz
352fd00a362318e22e1ddffe817c4c50b6197d9d616ae6585ad9edbdfca806a8 # mariadb-11.2.3.tar.gz.asc
2022-11-15 16:45:12 +01:00
711b4e7cf40e2b1ab132655a8d64f5a721027296f7a5731ffa70b504b3d805cd # mariadb.sysusers.conf
2023-08-13 10:25:17 +02:00
5ff8916c32c87ac45f05171669ff94e5a1a81c6bd7e6516b63fd9db8723916fc) # mariadb.tmpfile.conf
2022-09-17 21:07:26 +02:00
## 114186990260555ca78a150eb5b0df397d7b41054f953677db1fdfdf4f8b45fe mariadb-11.2.3-01-x86_64.pkg.tar.lz
## e32d1b096fd1cec00dee274b4024a81df508da0e0c6ac561e278d9bac818e4d1 mariadb-clients-11.2.3-01-x86_64.pkg.tar.lz
## 75f6e1052af667a4f92cee67b4750c53d29a6366632d521685ddde04a0426181 mariadb-libs-11.2.3-01-x86_64.pkg.tar.lz
## f22b25013dc40a0358415deebd11dc697e0352e9c4d8e15513c1a79d24b83928 mytop-11.2.3-01-x86_64.pkg.tar.lz
2023-06-15 17:40:01 +02:00