APKBUILD 13.4 KB
Newer Older
1
# Contributor: Sergei Lukin <sergej.lukin@gmail.com>
2
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
3
4
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
5
# Contributor: TBK <alpine@jjtc.eu>
6
# Contributor: Marcel Haazen <marcel@haazen.xyz>
7
# Contributor: Jake Buchholz <tomalok@gmail.com>
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
8
9
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mariadb
J0WI's avatar
J0WI committed
10
11
pkgver=10.5.5
pkgrel=0
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
12
pkgdesc="A fast SQL database server"
J0WI's avatar
J0WI committed
13
url="https://www.mariadb.org/"
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
14
15
pkgusers="mysql"
pkggroups="mysql"
Timo Teräs's avatar
Timo Teräs committed
16
arch="all"
TBK's avatar
TBK committed
17
license="GPL-2.0-or-later"
18
depends="$pkgname-common"
TBK's avatar
TBK committed
19
_mytopdeps="perl perl-dbi perl-dbd-mysql perl-getopt-long perl-socket perl-term-readkey"
20
depends_dev="openssl-dev zlib-dev mariadb-connector-c-dev"
21
makedepends="$depends_dev bison cmake curl-dev libaio-dev libarchive-dev libevent-dev
J0WI's avatar
J0WI committed
22
	libxml2-dev ncurses-dev pcre2-dev readline-dev xz-dev linux-headers linux-pam-dev
TBK's avatar
TBK committed
23
	$_mytopdeps"
24
install="$pkgname.pre-install $pkgname-common.post-upgrade"
25
26
subpackages="$pkgname-static $pkgname-test:mytest $pkgname-embedded-dev:_embedded_dev
	$pkgname-doc $pkgname-dev $pkgname-common $pkgname-openrc
TBK's avatar
TBK committed
27
	$pkgname-client $pkgname-bench $pkgname-backup $pkgname-embedded $pkgname-mytop
28
	$pkgname-server-utils:_server_utils
29
	mysql mysql-client:_compat_client mysql-bench:_compat_bench"
30
options="suid"
31
32

case "$CARCH" in
Leo's avatar
Leo committed
33
34
35
36
37
	x86|s390x|mips64) _enable_rocksdb=NO ;;
	*)
		_enable_rocksdb=YES
		subpackages="$subpackages $pkgname-plugin-rocksdb:_plugin_rocksdb"
		;;
38
39
esac

Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
40
source="https://downloads.mariadb.org/interstitial/mariadb-$pkgver/source/mariadb-$pkgver.tar.gz
41
	$pkgname.initd
J0WI's avatar
J0WI committed
42
	ppc-remove-glibc-dep.patch
43
	disable-failing-test.patch
44
	"
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
45

46
# secfixes:
47
48
49
50
51
#   10.4.13-r0:
#     - CVE-2020-2752
#     - CVE-2020-2760
#     - CVE-2020-2812
#     - CVE-2020-2814
52
53
#   10.4.12-r0:
#     - CVE-2020-2574
54
55
56
#   10.4.10-r0:
#     - CVE-2019-2938
#     - CVE-2019-2974
57
58
59
60
61
62
#   10.4.7-r0:
#     - CVE-2019-2805
#     - CVE-2019-2740
#     - CVE-2019-2739
#     - CVE-2019-2737
#     - CVE-2019-2758
63
64
65
66
#   10.3.15-r0:
#     - CVE-2019-2614
#     - CVE-2019-2627
#     - CVE-2019-2628
67
68
69
#   10.3.13-r0:
#     - CVE-2019-2510
#     - CVE-2019-2537
70
71
72
73
74
75
76
77
78
79
80
81
82
#   10.3.11-r0:
#     - CVE-2018-3282
#     - CVE-2016-9843
#     - CVE-2018-3174
#     - CVE-2018-3143
#     - CVE-2018-3156
#     - CVE-2018-3251
#     - CVE-2018-3185
#     - CVE-2018-3277
#     - CVE-2018-3162
#     - CVE-2018-3173
#     - CVE-2018-3200
#     - CVE-2018-3284
TBK's avatar
TBK committed
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#   10.2.15-r0:
#     - CVE-2018-2786
#     - CVE-2018-2759
#     - CVE-2018-2777
#     - CVE-2018-2810
#     - CVE-2018-2782
#     - CVE-2018-2784
#     - CVE-2018-2787
#     - CVE-2018-2766
#     - CVE-2018-2755
#     - CVE-2018-2819
#     - CVE-2018-2817
#     - CVE-2018-2761
#     - CVE-2018-2781
#     - CVE-2018-2771
TBK's avatar
TBK committed
98
#     - CVE-2018-2813
99
100
101
#   10.1.22-r0:
#     - CVE-2017-3313
#     - CVE-2017-3302
102
103
104
105
106
107
108
109
110
111
112
113
114
#   10.1.21-r0:
#     - CVE-2016-6664
#     - CVE-2017-3238
#     - CVE-2017-3243
#     - CVE-2017-3244
#     - CVE-2017-3257
#     - CVE-2017-3258
#     - CVE-2017-3265
#     - CVE-2017-3291
#     - CVE-2017-3312
#     - CVE-2017-3317
#     - CVE-2017-3318

115
116
117
# Notes:
# Available plugins https://mariadb.com/kb/en/library/list-of-plugins/
# All cmake configuration options can be displayed with: cmake ../server -LH
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
118
119
build() {
	cmake . -DBUILD_CONFIG=mysql_release \
120
		-DCMAKE_BUILD_TYPE=MinSizeRel \
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
121
		-DCMAKE_INSTALL_PREFIX=/usr \
122
123
		-DSYSCONFDIR=/etc \
		-DSYSCONF2DIR=/etc/my.cnf.d \
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
124
		-DMYSQL_DATADIR=/var/lib/mysql \
125
		-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock \
126
127
		-DDEFAULT_CHARSET=utf8mb4 \
		-DDEFAULT_COLLATION=utf8mb4_general_ci \
128
		-DENABLED_LOCAL_INFILE=ON \
129
		-DINSTALL_INFODIR=share/info \
130
		-DINSTALL_MANDIR=share/man \
131
		-DINSTALL_PLUGINDIR=lib/$pkgname/plugin \
132
133
		-DINSTALL_SCRIPTDIR=bin \
		-DINSTALL_INCLUDEDIR=include/mysql \
134
135
136
137
138
		-DINSTALL_DOCREADMEDIR=share/doc/$pkgname \
		-DINSTALL_SUPPORTFILESDIR=share/$pkgname \
		-DINSTALL_MYSQLSHAREDIR=share/$pkgname \
		-DINSTALL_DOCDIR=share/doc/$pkgname \
		-DTMPDIR=/var/tmp \
139
140
141
142
143
144
145
146
147
148
149
150
151
		-DCONNECT_WITH_MYSQL=ON \
		-DCONNECT_WITH_LIBXML2=system \
		-DCONNECT_WITH_ODBC=NO \
		-DCONNECT_WITH_JDBC=NO \
		-DPLUGIN_ARCHIVE=YES \
		-DPLUGIN_ARIA=YES \
		-DPLUGIN_BLACKHOLE=YES \
		-DPLUGIN_CASSANDRA=NO \
		-DPLUGIN_CSV=YES \
		-DPLUGIN_MYISAM=YES \
		-DPLUGIN_MROONGA=NO \
		-DPLUGIN_OQGRAPH=NO \
		-DPLUGIN_PARTITION=YES \
152
		-DPLUGIN_ROCKSDB=$_enable_rocksdb \
153
154
155
		-DPLUGIN_SPHINX=NO \
		-DPLUGIN_TOKUDB=NO \
		-DPLUGIN_AUTH_GSSAPI=NO \
156
		-DPLUGIN_AUTH_GSSAPI_CLIENT=OFF \
157
158
159
160
161
162
163
164
165
		-DPLUGIN_CRACKLIB_PASSWORD_CHECK=NO \
		-DWITH_ASAN=OFF \
		-DWITH_EMBEDDED_SERVER=ON \
		-DWITH_EXTRA_CHARSETS=complex \
		-DWITH_INNODB_BZIP2=OFF \
		-DWITH_INNODB_LZ4=OFF \
		-DWITH_INNODB_LZMA=ON \
		-DWITH_INNODB_LZO=OFF \
		-DWITH_INNODB_SNAPPY=OFF \
166
167
168
169
170
		-DWITH_ROCKSDB_BZIP2=OFF \
		-DWITH_ROCKSDB_JEMALLOC=OFF \
		-DWITH_ROCKSDB_LZ4=OFF \
		-DWITH_ROCKSDB_ZSTD=OFF \
		-DWITH_ROCKSDB_SNAPPY=OFF \
171
172
173
174
175
176
177
		-DWITH_JEMALLOC=NO \
		-DWITH_LIBARCHIVE=system \
		-DWITH_LIBNUMA=NO \
		-DWITH_LIBWRAP=OFF \
		-DWITH_LIBWSEP=OFF \
		-DWITH_MARIABACKUP=ON \
		-DWITH_PCRE=system \
178
		-DWITH_READLINE=ON \
179
		-DWITH_SYSTEMD=no \
180
		-DWITH_SSL=system \
181
182
183
		-DWITH_VALGRIND=OFF \
		-DWITH_ZLIB=system \
		-DSKIP_TESTS=ON # Disables the client lib tests since a running server is needed
184
185
186
187
188

	# print config options to log
	cmake -L

	make
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
189
190
}

191
check() {
192
	# exclude test-connect which seems to be buggy. testsuite does not set port env var
J0WI's avatar
J0WI committed
193
	ctest -E '(test-connect)'
194
195
}

Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
196
package() {
A. Wilcox's avatar
A. Wilcox committed
197
	make DESTDIR="$pkgdir/" install
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
198

199
	install -Dm 755 "$startdir"/$pkgname.initd \
A. Wilcox's avatar
A. Wilcox committed
200
		"$pkgdir"/etc/init.d/$pkgname
201
	mkdir -p "$pkgdir"/etc/my.cnf.d
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
202
203
204
205
206
207
208

	# mysql-test includes one executable that doesn't belong under
	# /usr/share, so move it and provide a symlink
	mv "$pkgdir"/usr/mysql-test/lib/My/SafeProcess/my_safe_process \
		"$pkgdir"/usr/bin
	ln -s ../../../../bin/my_safe_process \
		"$pkgdir"/usr/mysql-test/lib/My/SafeProcess/my_safe_process
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232


	# remove files provided by mariadb-connector-c
	rm \
		"$pkgdir"/usr/bin/mariadb_config \
		"$pkgdir"/usr/bin/mysql_config \
		"$pkgdir"/usr/include/mysql/errmsg.h \
		"$pkgdir"/usr/include/mysql/ma_list.h \
		"$pkgdir"/usr/include/mysql/ma_pvio.h \
		"$pkgdir"/usr/include/mysql/ma_tls.h \
		"$pkgdir"/usr/include/mysql/mariadb/ma_io.h \
		"$pkgdir"/usr/include/mysql/mariadb_com.h \
		"$pkgdir"/usr/include/mysql/mariadb_ctype.h \
		"$pkgdir"/usr/include/mysql/mariadb_dyncol.h \
		"$pkgdir"/usr/include/mysql/mariadb_stmt.h \
		"$pkgdir"/usr/include/mysql/mariadb_version.h \
		"$pkgdir"/usr/include/mysql/mysql.h \
		"$pkgdir"/usr/include/mysql/mysql/client_plugin.h \
		"$pkgdir"/usr/include/mysql/mysql/plugin_auth.h \
		"$pkgdir"/usr/include/mysql/mysql/plugin_auth_common.h \
		"$pkgdir"/usr/include/mysql/mysql_version.h \
		"$pkgdir"/usr/include/mysql/mysqld_error.h \
		"$pkgdir"/usr/lib/$pkgname/plugin/dialog.so \
		"$pkgdir"/usr/lib/$pkgname/plugin/mysql_clear_password.so \
Kaarle Ritvanen's avatar
Kaarle Ritvanen committed
233
		"$pkgdir"/usr/lib/$pkgname/plugin/sha256_password.so \
234
		"$pkgdir"/usr/lib/$pkgname/plugin/caching_sha2_password.so \
Kaarle Ritvanen's avatar
Kaarle Ritvanen committed
235
		"$pkgdir"/usr/lib/$pkgname/plugin/client_ed25519.so \
236
237
		"$pkgdir"/usr/lib/libmysqlclient.so \
		"$pkgdir"/usr/lib/libmysqlclient_r.so \
238
239
		"$pkgdir"/usr/lib/libmariadb.so* \
		"$pkgdir"/usr/lib/pkgconfig/libmariadb.pc
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299

	cat >"$pkgdir"/etc/my.cnf<<-EOF
	# This group is read both both by the client and the server
	# use it for options that affect everything
	[client-server]

	# This group is read by the server
	[mysqld]

	# Disabling symbolic-links is recommended to prevent assorted security risks
	symbolic-links=0

	# include all files from the config directory
	!includedir /etc/my.cnf.d
	EOF

	cat >"$pkgdir"/etc/my.cnf.d/mariadb-server.cnf<<-EOF
	#
	# These groups are read by MariaDB server.
	# Use it for options that only the server (but not clients) should see

	# this is read by the standalone daemon and embedded servers
	[server]

	# this is only for the mysqld standalone daemon
	[mysqld]
	skip-networking

	# Galera-related settings
	[galera]
	# Mandatory settings
	#wsrep_on=ON
	#wsrep_provider=
	#wsrep_cluster_address=
	#binlog_format=row
	#default_storage_engine=InnoDB
	#innodb_autoinc_lock_mode=2
	#
	# Allow server to accept connections on all interfaces.
	#
	#bind-address=0.0.0.0
	#
	# Optional setting
	#wsrep_slave_threads=1
	#innodb_flush_log_at_trx_commit=0

	# this is only for embedded server
	[embedded]

	# This group is only read by MariaDB servers, not by MySQL.
	# If you use the same .cnf file for MySQL and MariaDB,
	# you can put MariaDB-only options here
	[mariadb]

	# This group is only read by MariaDB-10.3 servers.
	# If you use the same .cnf file for MariaDB of different versions,
	# use this group for options that older servers don't understand
	[mariadb-10.3]

	EOF
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
300
301
}

302
dev() {
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
303
	default_dev
304
305
	replaces="libmysqlclient mysql-dev"
	provides="mysql-dev=$pkgver-r$pkgrel"
306
	mkdir -p "$subpkgdir"/usr/bin
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
307
308
309
}

common() {
310
	pkgdesc="MariaDB common files for both server and client"
311
	replaces="mysql-common"
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
312
	depends=
313
	mkdir -p "$subpkgdir"/usr/share/$pkgname \
314
		"$subpkgdir"/etc/mysql \
315
		"$subpkgdir"/usr/lib/$pkgname/plugin
316
	mv "$pkgdir"/etc/my.* "$subpkgdir"/etc/
317
318
319
320
321
	local lang="charsets danish english french greek italian korean norwegian-ny
		portuguese russian slovak swedish czech dutch estonian german
		hungarian japanese norwegian polish romanian serbian spanish
		ukrainian"
	for l in $lang; do
322
323
		mv "$pkgdir"/usr/share/$pkgname/$l \
			"$subpkgdir"/usr/share/$pkgname/
324
	done
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
325
326
327
328
}

mytest() {
	pkgdesc="The test suite distributed with MariaDB"
A. Wilcox's avatar
A. Wilcox committed
329
	mkdir -p "$subpkgdir"/usr/bin
330
	mv "$pkgdir"/usr/bin/mysql_client_test \
331
		"$pkgdir"/usr/bin/mysql_client_test_embedded \
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
332
		"$pkgdir"/usr/bin/my_safe_process \
333
334
335
336
		"$pkgdir"/usr/bin/mariadb-client-test \
		"$pkgdir"/usr/bin/mariadb-client-test-embedded \
		"$pkgdir"/usr/bin/mariadb-test \
		"$pkgdir"/usr/bin/mariadb-test-embedded \
337
338
		"$pkgdir"/usr/bin/mysqltest \
		"$pkgdir"/usr/bin/mysqltest_embedded \
A. Wilcox's avatar
A. Wilcox committed
339
		"$subpkgdir"/usr/bin/
340
341
	mv "$pkgdir"/usr/mysql-test \
		"$subpkgdir"/usr/
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
342
343
344
}

client() {
345
	pkgdesc="Client for the MariaDB database"
346
	depends="mariadb-common=$pkgver-r$pkgrel"
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
347
	install=""
348
	local bins="myisam_ftdump mysql mysqlaccess mysqladmin
349
350
		mysqlcheck mysqldump mysqldumpslow mysql_find_rows
		mysql_fix_extensions mysqlimport mysqlshow mysql_waitpid"
351
352
353
	local symlinks="mariadb mariadb-access mariadb-admin mariadb-check
		mariadb-dump mariadb-dumpslow mariadb-find-rows mariadb-fix-extensions
		mariadb-import mariadb-show mariadb-waitpid"
A. Wilcox's avatar
A. Wilcox committed
354
	mkdir -p "$subpkgdir"/usr/bin/
355
	for i in $bins $symlinks; do
356
		mv "$pkgdir"/usr/bin/$i "$subpkgdir"/usr/bin/
Łukasz Jendrysik's avatar
Łukasz Jendrysik committed
357
358
359
360
361
362
363
364
365
366
	done
}

bench() {
	pkgdesc="MariaDB benchmark scripts and data"
	replaces="mariadb"
	mkdir -p "$subpkgdir"/usr/share/
	mv "$pkgdir"/usr/sql-bench "$subpkgdir"/usr/share
}

367
368
_compat() {
	pkgdesc="Dummy package for $1 migration"
369
	depends="$2"
370
371
372
	mkdir -p "$subpkgdir"
}

373
374
375
mysql() { _compat mysql mariadb; }
_compat_client() { _compat mysql-client mariadb-client; }
_compat_bench() { _compat mysql-bench mariadb-client; }
376

377
static() {
378
	pkgdesc="Static libraries for MariaDB"
379
380
381
382
383
384
385
386
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
}

backup() {
	pkgdesc="The mariabackup tool for physical online backups"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/mariabackup \
387
		"$pkgdir"/usr/bin/mariadb-backup \
388
389
390
391
392
393
394
395
		"$pkgdir"/usr/bin/mbstream \
		"$subpkgdir"/usr/bin/
}

embedded() {
	pkgdesc="MariaDB as an embeddable library"
	depends="$pkgname-common=$pkgver-r$pkgrel"
	mkdir -p "$subpkgdir"/usr/lib
396
	mv "$pkgdir"/usr/lib/libmariadbd.so.* "$subpkgdir"/usr/lib/
397
398
399
400
401
402
403
404
405
406
407
}


_embedded_dev() {
	pkgdesc="MariaDB as an embeddable library - development files"
	# this package only contains a symlink, but we want avoid pull in
	# libmysqld (embedded) unless needed
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libmysqld.so "$subpkgdir"/usr/lib/
}

TBK's avatar
TBK committed
408
409
410
411
412
413
414
mytop() {
	pkgdesc="Command line tool used for monitoring MariaDB performance"
	depends="$_mytopdeps"
	mkdir -p "$subpkgdir"/usr/bin/
	mv "$pkgdir"/usr/bin/mytop "$subpkgdir"/usr/bin/
}

415
416
417
418
419
420
421
_server_utils() {
	pkgdesc="Non-essential server utilities for MariaDB/MySQL applications"
	depends="perl $pkgname-common=$pkgver-r$pkgrel"
	mkdir -p "$subpkgdir"/usr/bin
	# perl utils
	mv \
		"$pkgdir"/usr/bin/mysql_convert_table_format \
422
		"$pkgdir"/usr/bin/mariadb-convert-table-format \
423
		"$pkgdir"/usr/bin/mysql_setpermission \
424
		"$pkgdir"/usr/bin/mariadb-setpermission \
425
		"$pkgdir"/usr/bin/mysqld_multi \
426
		"$pkgdir"/usr/bin/mariadbd-multi \
427
		"$pkgdir"/usr/bin/mysqlhotcopy \
428
		"$pkgdir"/usr/bin/mariadb-hotcopy \
429
430
431
432
		"$subpkgdir"/usr/bin/
	# tools that can be used remotely and other tools
	mv \
		"$pkgdir"/usr/bin/mysql_upgrade \
433
		"$pkgdir"/usr/bin/mariadb-upgrade \
434
435
		"$pkgdir"/usr/bin/perror \
		"$pkgdir"/usr/bin/mysqld_safe_helper \
436
		"$pkgdir"/usr/bin/mariadbd-safe-helper \
437
438
439
		"$subpkgdir"/usr/bin/
}

440
441
442
443
444
445
_plugin_rocksdb() {
	pkgdesc="MariaDB plugin for RocksDB (MyRocks)"
	url="https://mariadb.com/kb/en/library/myrocks/"
	depends="$pkgname=$pkgver-r$pkgrel"
	mkdir -p "$subpkgdir"/usr/lib/mariadb/plugin
	mv "$pkgdir"/usr/lib/mariadb/plugin/ha_rocksdb.so \
J0WI's avatar
J0WI committed
446
		"$subpkgdir"/usr/lib/mariadb/plugin/ha_rocksdb.so
447
448
}

J0WI's avatar
J0WI committed
449
sha512sums="09bed291b39142f8e2f40eabbb443f6f384368b331406a09fd92d3d27ecc75644219066850d89495ed65c6f0d3ac32d51e29e65375331dcc2de4801313178d45  mariadb-10.5.5.tar.gz
450
c352969f6665b0ffa387f7b185a5dea7751f4b16c12c809627857b27321efa09159369d7dd5c852d6159a9f173cb895fb601f0c52a1fa6e3527899520030964c  mariadb.initd
451
452
e9ae4613f1d8c5f0a59b39a3548c46e50674ae78e7457d0e64c49f7e1573125c13634bbce7e29179bb8865a423171f852f43b96f7ef95619a95f02edcfc71efd  ppc-remove-glibc-dep.patch
0f5f2147e80b21abe65ccdee72b7d820ea1459112802e44f63d00d9247704d6a5562fce146a255e02f7367bc5d81cffe4e7c39758d533bf5ec9a6544a2a25738  disable-failing-test.patch"