Mail archive
alpine-devel

[alpine-devel] [PATCH] testing/mariadb: new aport

From: Łukasz Jendrysik <scadu_at_yandex.com>
Date: Sat, 3 Jan 2015 13:02:12 +0100

An initial commit preparing Alpine for migration to MariaDB.

Signed-off-by: Łukasz Jendrysik <scadu_at_yandex.com>
---
 testing/mariadb/APKBUILD                 | 194 +++++++++++++++++++++++++++++++
 testing/mariadb/fix-xtradb-storage.patch |  38 ++++++
 testing/mariadb/mariadb.initd            |  58 +++++++++
 3 files changed, 290 insertions(+)
 create mode 100644 testing/mariadb/APKBUILD
 create mode 100644 testing/mariadb/fix-xtradb-storage.patch
 create mode 100644 testing/mariadb/mariadb.initd
diff --git a/testing/mariadb/APKBUILD b/testing/mariadb/APKBUILD
new file mode 100644
index 0000000..cf2d8b3
--- /dev/null
+++ b/testing/mariadb/APKBUILD
_at_@ -0,0 +1,194 @@
+# Contributor: Łukasz Jendrysik <scadu_at_yandex.com>
+# Contributor: Carlo Landmeter <clandmeter_at_gmail.com>
+# Maintainer: Natanael Copa <ncopa_at_alpinelinux.org>
+pkgname=mariadb
+pkgver=5.5.41
+pkgrel=0
+pkgdesc="A fast SQL database server"
+url="http://www.mariadb.org"
+pkgusers="mysql"
+pkggroups="mysql"
+arch="all"
+license='GPL'
+depends=""
+depends_dev="openssl-dev zlib-dev"
+makedepends="cmake openssl-dev zlib-dev readline-dev libaio-dev ncurses-dev jemalloc-dev glib linux-headers libc-dev"
+source="https://downloads.mariadb.org/interstitial/mariadb-$pkgver/source/mariadb-$pkgver.tar.gz
+$pkgname.initd
+fix-xtradb-storage.patch
+"
+
+subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-common $pkgname-client $pkgname-bench $pkgname-test:mytest"
+
+_builddir="$srcdir/$pkgname-$pkgver"
+
+prepare() {
+	cd "$_builddir"
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+}
+
+build() {
+	cd "$_builddir"
+	cmake . -DBUILD_CONFIG=mysql_release \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DSYSCONFDIR=/etc/mysql \
+		-DMYSQL_DATADIR=/var/lib/mysql \
+    	-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock \
+    	-DDEFAULT_CHARSET=utf8 \
+    	-DDEFAULT_COLLATION=utf8_general_ci \
+    	-DENABLED_LOCAL_INFILE=ON \
+    	-DINSTALL_INFODIR=share/mysql/docs \
+    	-DINSTALL_MANDIR=share/man \
+    	-DINSTALL_PLUGINDIR=lib/mysql/plugin \
+    	-DINSTALL_SCRIPTDIR=bin \
+    	-DINSTALL_INCLUDEDIR=include/mysql \
+    	-DINSTALL_DOCREADMEDIR=share/mysql \
+    	-DINSTALL_SUPPORTFILESDIR=share/mysql \
+    	-DINSTALL_MYSQLSHAREDIR=share/mysql \
+    	-DINSTALL_DOCDIR=share/mysql/docs \
+    	-DINSTALL_SHAREDIR=share/mysql \
+    	-DWITH_READLINE=ON \
+    	-DWITH_ZLIB=system \
+    	-DWITH_SSL=system \
+    	-DWITH_LIBWRAP=OFF \
+    	-DWITH_EXTRA_CHARSETS=complex \
+    	-DWITH_EMBEDDED_SERVER=ON \
+    	-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
+    	-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
+    	-DWITH_INNOBASE_STORAGE_ENGINE=1 \
+    	-DWITH_PARTITION_STORAGE_ENGINE=1 \
+    	-DWITH_TOKUDB_STORAGE_ENGINE=1 \
+		-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
+    	-DWITHOUT_FEDERATED_STORAGE_ENGINE=1 \
+    	-DWITHOUT_PBXT_STORAGE_ENGINE=1 \
+		|| return 1
+        make || return 1
+}
+
+package() {
+        cd "$_builddir"
+        make DESTDIR="$pkgdir/" install || return 1
+
+        install -Dm 755 "$startdir"/$pkgname.initd \
+		"$pkgdir"/etc/init.d/$pkgname || return 1
+
+	# use small example config as default, which has tcp disabled
+	install -D  "$pkgdir"/usr/share/mysql/my-medium.cnf \
+		"$pkgdir"/etc/mysql/my.cnf || return 1
+
+        install -dDo mysql "$pkgdir"/var/log/mysql || return 1
+        install -dDo mysql "$pkgdir"/var/run/mysqld || return 1
+
+	# libmysqlclient_r is no more.  Upstream tries to replace it with
+	# symlinks but that really doesn't work (wrong soname in particular).
+	# We'll keep just the devel libmysqlclient_r.so link, so that
+	# rebuilding without any source change is enough to get rid of
+	# dependency on libmysqlclient_r.
+	rm -f "$pkgdir"/usr/lib/libmysqlclient_r.so*
+	ln -s libmysqlclient.so "$pkgdir"/usr/lib/libmysqlclient_r.so
+
+	# 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
+
+}
+
+dev(){
+	default_dev
+	replaces="libmysqlclient"
+}
+
+libs() {
+	pkgdesc="MariaDB client library"
+	replaces="mariadb libmysqlclient"
+	depends="mariadb-common"
+	mkdir -p "$subpkgdir"/usr/lib \
+		"$subpkgdir"/usr/share/mysql \
+		|| return 1
+	mv "$pkgdir"/usr/lib/libmysqlclient.so* \
+		"$subpkgdir"/usr/lib/ \
+		|| return 1
+}
+
+common() {
+	pkgdesc="MariaDB common files for boh server and client"
+	replaces="mariadb"
+	depends=
+	mkdir -p "$subpkgdir"/usr/share/mysql \
+	mv "$pkgdir"/etc "$subpkgdir"/ || return 1
+	mv	"$pkgdir"/usr/share/mysql/english \
+		"$pkgdir"/usr/share/mysql/czech \
+		"$pkgdir"/usr/share/mysql/danish \
+		"$pkgdir"/usr/share/mysql/dutch \
+		"$pkgdir"/usr/share/mysql/estonian \
+		"$pkgdir"/usr/share/mysql/french \
+		"$pkgdir"/usr/share/mysql/german \
+		"$pkgdir"/usr/share/mysql/greek \
+		"$pkgdir"/usr/share/mysql/hungarian \
+		"$pkgdir"/usr/share/mysql/italian \
+		"$pkgdir"/usr/share/mysql/japanese \
+		"$pkgdir"/usr/share/mysql/korean \
+		"$pkgdir"/usr/share/mysql/norwegian \
+		"$pkgdir"/usr/share/mysql/norwegian-ny \
+		"$pkgdir"/usr/share/mysql/polish \
+		"$pkgdir"/usr/share/mysql/portuguese \
+		"$pkgdir"/usr/share/mysql/romanian \
+		"$pkgdir"/usr/share/mysql/russian \
+		"$pkgdir"/usr/share/mysql/serbian \
+		"$pkgdir"/usr/share/mysql/slovak \
+		"$pkgdir"/usr/share/mysql/spanish \
+		"$pkgdir"/usr/share/mysql/swedish \
+		"$pkgdir"/usr/share/mysql/ukrainian \
+		"$pkgdir"/usr/share/mysql/charsets \
+		"$subpkgdir"/usr/share/mysql/ \
+		|| return 1
+}
+
+mytest() {
+	pkgdesc="The test suite distributed with MariaDB"
+		mkdir -p "$subpkgdir"/usr/bin || return 1
+		mv "$pkgdir"/usr/bin/mysql_client_test \
+		"$pkgdir"/usr/mysql-test \
+		"$pkgdir"/usr/bin/my_safe_process \
+		"$subpkgdir"/usr/bin/ \
+		|| return 1
+}
+
+client() {
+	pkgdesc="client for the MariaDB database"
+	depends="mariadb-common"
+	install=""
+	local bins="myisam_ftdump mysql mysqlaccess mysqladmin mysqlbug
+	mysqlcheck mysqldump mysqldumpslow mysql_find_rows
+	mysql_fix_extensions mysqlimport mysqlshow mysql_waitpid"
+
+	mkdir -p "$subpkgdir"/usr/bin/ || return 1
+
+	for i in $bins; do
+		mv "$pkgdir"/usr/bin/${i} "$subpkgdir"/usr/bin/ || return 1
+	done
+}
+
+bench() {
+	pkgdesc="MariaDB benchmark scripts and data"
+	replaces="mariadb"
+	mkdir -p "$subpkgdir"/usr/share/
+	mv "$pkgdir"/usr/sql-bench "$subpkgdir"/usr/share
+}
+
+md5sums="d2415efc6a6d73d7a58f3c79bb42f2e8  mariadb-5.5.41.tar.gz
+01fe0055305d8f974c35d0898245014b  mariadb.initd
+0bc35376a413719e77808ab778378517  fix-xtradb-storage.patch"
+sha256sums="a16dc62e4bcabecd5c483f2f8b657483a8c51934e7be5ad4ab21b8baea1f5332  mariadb-5.5.41.tar.gz
+cbf3c99c41310033ed092b38ae0f55bc74334ce4531a6c82f21feff26f25008d  mariadb.initd
+b83ee0bdf0f1c40f563dc227cb3fa1060ca859cb42222886f66550a3c2fe0b7a  fix-xtradb-storage.patch"
+sha512sums="727ce6994966a42602ea8f735f34b1b3c342d08b9dae2667e465805bff36e68bf69b582ec0b844b25fb7024f9b25a39280160c2935f639491a1c3654d3166953  mariadb-5.5.41.tar.gz
+fccc31e8e67dc21087c4feb3a36d2ac129dccfe6d393172b58834b408faa85ab6f9f70ec423c88ab7613df9ae258a8db990f3c48d69ef2a1906f7e3b4e18c892  mariadb.initd
+64505f8a65ceb4e3568b81ba4e58c8c92264f12c3d16a5bf3e9c26978ba6e4f120f653b74a9cabb252540559f1019647ab070a067d90e6cb75ccc4bfca0126bd  fix-xtradb-storage.patch"
diff --git a/testing/mariadb/fix-xtradb-storage.patch b/testing/mariadb/fix-xtradb-storage.patch
new file mode 100644
index 0000000..096e87a
--- /dev/null
+++ b/testing/mariadb/fix-xtradb-storage.patch
_at_@ -0,0 +1,38 @@
+--- mariadb-5.5.41/storage/xtradb/include/os0stacktrace.h.orig	2014-12-19 11:57:31.000000000 +0100
++++ mariadb-5.5.41/storage/xtradb/include/os0stacktrace.h	2014-12-27 12:41:11.952594278 +0100
+_at_@ -20,7 +20,7 @@
+ #ifndef os0stacktrace_h
+ #define os0stacktrace_h
+ 
+-#ifdef __linux__
++#if defined (__linux__) && HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS
+ #if HAVE_EXECINFO_H
+ #include <execinfo.h>
+ #endif
+_at_@ -40,5 +40,5 @@
+ 	siginfo_t* info,     /*!< in: signal information */
+ 	void*      ucontext);/*!< in: signal context */
+ 
+-#endif /*  __linux__ */
++#endif /* defined (__linux__) && HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS */
+ #endif /* os0stacktrace.h */
+--- mariadb-5.5.41/storage/xtradb/srv/srv0start.c.orig	2014-12-19 11:57:32.000000000 +0100
++++ mariadb-5.5.41/storage/xtradb/srv/srv0start.c	2014-12-27 12:48:08.798016960 +0100
+_at_@ -1274,7 +1274,7 @@
+ 	stacktrace feature. */
+ 
+ 	if (srv_use_stacktrace) {
+-#ifdef __linux__
++#if defined (__linux__) && HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS
+ 		 struct sigaction sigact;
+ 
+ 		 sigact.sa_sigaction = os_stacktrace_print;
+_at_@ -1287,7 +1287,7 @@
+ 			 srv_use_stacktrace = FALSE;
+ 
+ 		 }
+-#endif /* __linux__ */
++#endif /* defined (__linux__) && HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS */
+ 	}
+ 
+ 
diff --git a/testing/mariadb/mariadb.initd b/testing/mariadb/mariadb.initd
new file mode 100644
index 0000000..2763285
--- /dev/null
+++ b/testing/mariadb/mariadb.initd
_at_@ -0,0 +1,58 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql.init,v 1.7 2004/07/14 21:41:15 agriffis Exp $
+
+extra_stopped_commands="setup"
+pidfile=/var/run/mysqld/mysqld.pid
+
+depend() {
+	need net
+	after firewall
+	use dns
+}
+
+setup() {
+	ebegin "Creating a new MySQL database"
+	mysql_install_db --user=mysql --rpm
+	eend $?
+}
+
+checkconfig() {
+	if [ ! -f /etc/mysql/my.cnf ] ; then
+		eerror "No /etc/mysql/my.cnf file exists!"
+	fi
+
+	dir=`my_print_defaults mysqld | grep -- --datadir | sed -e "s|^.*=\(.*\)|\1|"`
+
+	dir=${dir:-/var/lib/mysql}
+	[ -d ${dir}/mysql ] && return 0
+
+	if [ -z "$AUTO_SETUP" ] ; then
+		eerror "Database not found in $dir"
+		eerror "You can run '/etc/init.d/mysql setup' to setup a new database."
+		return 1
+	fi
+	setup
+}
+
+start() {
+	checkconfig || return 1
+	ebegin "Starting mysqld"
+	start-stop-daemon --pidfile $pidfile \
+		--start \
+		--background \
+		--stdout /dev/null \
+		--stderr /dev/null \
+		--wait 1500 \
+		-- \
+		/usr/bin/mysqld_safe --pid-file=$pidfile
+	eend $?
+}
+
+stop () {
+	ebegin "Stopping mysqld"
+	start-stop-daemon --stop --quiet \
+		--pidfile $pidfile --retry 20
+	eend $?
+}
-- 
2.2.1
---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Sat Jan 03 2015 - 13:02:12 GMT