1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
# Merged with official ABS mariadb PKGBUILD by João, 2021/07/22 (all respective contributors apply herein)
# Maintainer: João Figueiredo & chaotic-aur <islandc0der@chaotic.cx>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Christian Hesse <mail@eworm.de>
pkgbase=mariadb-git
pkgname=(mariadb-libs-git mariadb-clients-git mariadb-git mytop-git)
pkgdesc='Fast SQL database server, derived from MySQL'
pkgver=10.7_r193394.gc5ae2c49711
pkgrel=1
arch=($CARCH)
license=(GPL)
url='https://mariadb.org/'
makedepends=(git boost bzip2 cmake jemalloc libaio libxcrypt libxml2 lz4 lzo openssl systemd zlib zstd curl krb5 cracklib)
conflicts=(${pkgbase%-git})
provides=(${pkgbase%-git})
source=("$pkgbase::git+https://github.com/MariaDB/server.git"
0001-arch-specific.patch)
sha256sums=('SKIP'
'3289efb3452d199aec872115f35da3f1d6fd4ce774615076690e9bc8afae1460')
pkgver() {
cd $pkgbase
_ver="$(grep -m1 '^Source:' debian/control | cut -d '-' -f2 | tr - .)"
echo "${_ver}_r$(git rev-list --count HEAD).g$(git rev-parse --short HEAD)"
}
prepare() {
cd $pkgbase
# 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
}
build() {
local _cmake_options=(
# build options
-DCOMPILATION_COMMENT="Arch Linux"
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-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
-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
-DWITH_EMBEDDED_SERVER=ON
-DWITH_EXTRA_CHARSETS=complex
-DWITH_JEMALLOC=ON
-DWITH_LIBWRAP=OFF
-DWITH_PCRE=bundled
-DWITH_READLINE=ON
-DWITH_SSL=system
-DWITH_SYSTEMD=yes
-DWITH_UNIT_TESTS=OFF
-DWITH_ZLIB=system
)
cmake -B build -S $pkgbase "${_cmake_options[@]}"
cmake --build build
}
## Takes *really* long, so disabled by default.
# check() {
# cd build/mysql-test
# ./mtr --parallel=5 --mem --force --max-test-fail=0
# }
package_mariadb-libs-git() {
pkgdesc='MariaDB libraries'
depends=(bzip2 libaio libxcrypt libcrypt.so lz4 lzo openssl xz zlib)
optdepends=('krb5: for gssapi authentication')
conflicts=(mariadb-libs libmysqlclient{,-git} libmariadbclient{,-git} mariadb-connector-c{,-git})
provides=(mariadb-libs libmariadbclient{,-git} mariadb-connector-c{,-git} libmariadb.so libmariadbd.so)
replaces=(libmariadbclient-git)
for dir in libmariadb libmysqld libservices include; do
DESTDIR="$pkgdir" cmake --install "build/$dir"
done
ln -s build/mariadb_config "$pkgdir"/usr/bin/mariadb-config
ln -s build/mariadb_config "$pkgdir"/usr/bin/mysql_config
install -D -m0644 $pkgbase/man/mysql_config.1 "$pkgdir"/usr/share/man/man1/mysql_config.1
install -D -m0644 build/support-files/mariadb.pc "$pkgdir"/usr/share/pkgconfig/mariadb.pc
install -D -m0644 $pkgbase/support-files/mysql.m4 "$pkgdir"/usr/share/aclocal/mysql.m4
cd "$pkgdir"
# remove static libraries
rm usr/lib/*.a
# remove man pages
rm -r usr/share/man
}
package_mariadb-clients-git() {
pkgdesc='MariaDB client tools'
depends=(mariadb-libs-git=$pkgver jemalloc)
conflicts=(mysql-clients{,-git})
provides=(mysql-clients=$pkgver)
DESTDIR="$pkgdir" cmake --install build/client
# install man pages
for man in mysql mysql_plugin mysql_upgrade mysqladmin mysqlbinlog mysqlcheck mysqldump mysqlimport mysqlshow mysqlslap mysqltest; do
install -D -m0644 $pkgbase/man/"$man.1" "$pkgdir"/usr/share/man/man1/"$man.1"
done
}
package_mariadb-git() {
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/server.cnf'
'etc/my.cnf.d/s3.cnf'
'etc/my.cnf.d/spider.cnf'
'etc/security/user_map.conf')
install=mariadb.install
depends=(mariadb-clients-git=$pkgver systemd-libs libxml2 zstd)
optdepends=('cracklib: for cracklib plugin'
'curl: for ha_s3 plugin'
'galera: for MariaDB cluster with Galera WSREP'
'python-mysqlclient: for myrocks_hotbackup'
'perl-dbd-mariadb: for mariadb-hotcopy, mariadb-convert-table-format and mariadb-setpermission')
conflicts=(mysql{,-git})
provides=(mysql=$pkgver)
options=(emptydirs)
DESTDIR="$pkgdir" cmake --install build
cd "$pkgdir"
# no SysV init, please!
rm -r etc/logrotate.d
rm usr/bin/rcmysql
rm usr/share/mysql/{binary-configure,mysql{,d_multi}.server}
# 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/
# 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
# provided by mariadb-libs
rm usr/bin/{mariadb{_,-},mysql_}config
rm -r usr/include/
rm usr/share/man/man1/mysql_config.1
rm -r usr/share/aclocal
rm usr/lib/lib*
rm -r usr/lib/pkgconfig
rm usr/lib/mysql/plugin/{auth_gssapi_client,caching_sha2_password,client_ed25519,dialog,mysql_clear_password,sha256_password}.so
# provided by mariadb-clients
rm usr/bin/mysql{,_plugin,_upgrade,admin,binlog,check,dump,import,show,slap,test}
rm usr/bin/mariadb{,-{admin,binlog,check,conv,dump,import,plugin,show,slap,test,upgrade}}
rm usr/share/man/man1/mysql{,_plugin,_upgrade,admin,binlog,check,dump,import,show,slap,test}.1
# provided by mytop
rm usr/bin/mytop
# not needed
rm -r usr/{mysql-test,sql-bench}
rm usr/share/man/man1/mysql-test-run.pl.1
}
package_mytop-git() {
pkgdesc='Top clone for MariaDB'
depends=(perl perl-dbd-mariadb perl-term-readkey)
install -D -m0755 build/scripts/mytop "$pkgdir"/usr/bin/mytop
}
|