aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2019-11-17 18:18:31 -0800
committerGitHub <noreply@github.com>2019-11-17 18:18:31 -0800
commitc3af7141c673d5f2efe8a1e9014b101f430423f3 (patch)
treeffc46fa14cc1d6dc83dc98fffe87aab8b785e4ef
parent50b825e7faf0f1b5e1a260280fbe6c5b9916bc8d (diff)
parent4a67c844db9c1e80bb385f40c137586cc5fba652 (diff)
Merge pull request #10570 from micmac1/maria-10.4
mariadb: major bump to 10.4, split off lib package
-rw-r--r--libs/libmariadb/Makefile188
-rw-r--r--libs/libmariadb/conf/50-client.cnf (renamed from utils/mariadb/conf/50-client.cnf)0
-rwxr-xr-xlibs/libmariadb/files/mysql_config61
-rw-r--r--libs/libmariadb/patches/fix-ucontext-header.patch11
-rw-r--r--utils/mariadb-common/Makefile49
-rw-r--r--utils/mariadb-common/conf/my.cnf (renamed from utils/mariadb/conf/my.cnf)0
-rw-r--r--utils/mariadb/Makefile209
-rw-r--r--utils/mariadb/files/mysqld.init2
-rw-r--r--utils/mariadb/patches/100-fix_hostname.patch2
-rw-r--r--utils/mariadb/patches/110-pcre.cmake.patch41
-rw-r--r--utils/mariadb/patches/130-c11_atomics.patch138
-rw-r--r--utils/mariadb/patches/140-mips-connect-unaligned.patch229
-rw-r--r--utils/mariadb/patches/160-mips-machine.patch22
-rw-r--r--utils/mariadb/patches/170-ppc-remove-glibc-dep.patch114
-rw-r--r--utils/mariadb/patches/180-libedit.patch105
-rw-r--r--utils/mariadb/patches/180-relax-mysql_install-db-wrt-pam-tool.patch39
16 files changed, 673 insertions, 537 deletions
diff --git a/libs/libmariadb/Makefile b/libs/libmariadb/Makefile
new file mode 100644
index 000000000..ea56c2cc3
--- /dev/null
+++ b/libs/libmariadb/Makefile
@@ -0,0 +1,188 @@
+#
+# Copyright (C) 2019 Sebastian Kemper <sebastian_ml@gmx.net>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libmariadb
+PKG_VERSION:=3.1.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=mariadb-connector-c-$(PKG_VERSION)-src.tar.gz
+PKG_SOURCE_URL := \
+ https://mirror.netcologne.de/mariadb/connector-c-$(PKG_VERSION) \
+ https://mirror.lstn.net/mariadb/connector-c-$(PKG_VERSION) \
+ https://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/connector-c-$(PKG_VERSION) \
+ https://downloads.mariadb.org/interstitial/connector-c-$(PKG_VERSION)
+
+PKG_HASH:=a9de5fedd1a7805c86e23be49b9ceb79a86b090ad560d51495d7ba5952a9d9d5
+PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
+PKG_LICENSE:=LGPL-2.1
+PKG_LICENSE_FILES:=COPYING.LIB
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/mariadb-connector-c-$(PKG_VERSION)-src
+
+PKG_CPE_ID:=cpe:/a:mariadb:mariadb
+
+PKG_BUILD_PARALLEL:=1
+
+CMAKE_INSTALL:=1
+
+MARIADB_CONF_DIR:=/etc/mysql
+MARIADB_PLUGIN_DIR:=/usr/lib/mariadb/plugin
+
+MARIADB_PORT=3306
+MARIADB_SOCKET=/var/run/mysqld/mysqld.sock
+
+MARIADB_CLIENT_PLUGINS := \
+ auth_gssapi_client \
+ remote_io
+
+PKG_CONFIG_DEPENDS := \
+ $(patsubst %,CONFIG_PACKAGE_$(PKG_NAME)-plugin-%,$(subst _,-,$(MARIADB_CLIENT_PLUGINS)))
+
+plugin-auth_gssapi_client := CLIENT_PLUGIN_AUTH_GSSAPI_CLIENT
+plugin-remote_io := CLIENT_PLUGIN_REMOTE_IO
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+include $(INCLUDE_DIR)/nls.mk
+
+# Pass CPPFLAGS in the CFLAGS as otherwise the build system will
+# ignore them.
+TARGET_CFLAGS+=$(TARGET_CPPFLAGS)
+
+define Package/$(PKG_NAME)/install/plugin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)$(MARIADB_PLUGIN_DIR)/$(2).so $(1)$(MARIADB_PLUGIN_DIR)
+endef
+
+define Package/$(PKG_NAME)/Default
+ SECTION:=libs
+ CATEGORY:=Libraries
+ URL:=https://mariadb.org/
+ SUBMENU:=Database
+endef
+
+define Package/$(PKG_NAME)/description/Default
+MariaDB is a very fast and robust SQL database server.
+endef
+
+define Package/$(PKG_NAME)
+ $(call Package/$(PKG_NAME)/Default)
+ DEPENDS:=+mariadb-common \
+ $(ICONV_DEPENDS) \
+ +libopenssl \
+ +zlib
+ TITLE:=MariaDB database client library
+ MENU:=1
+ PROVIDES:=libmariadbclient libmysqlclient libmysqlclient-r
+ ABI_VERSION:=3
+endef
+
+define Package/$(PKG_NAME)/conffiles
+$(MARIADB_CONF_DIR)/conf.d/50-client.cnf
+endef
+
+define Package/$(PKG_NAME)/description
+$(call Package/$(PKG_NAME)/description/Default)
+
+This package includes the client library.
+
+endef
+
+# We won't need unit tests
+CMAKE_OPTIONS += -DWITH_UNIT_TESTS=0
+
+# Make it explicit that we are cross-compiling
+CMAKE_OPTIONS += -DCMAKE_CROSSCOMPILING=1
+
+CMAKE_OPTIONS += \
+ -DINSTALL_INCLUDEDIR=include/mysql \
+ -DINSTALL_LIBDIR=lib \
+ -DINSTALL_PLUGINDIR=lib/mariadb/plugin \
+ -DMARIADB_UNIX_ADDR=$(MARIADB_SOCKET) \
+ -DWITH_EXTERNAL_ZLIB=YES \
+ -DWITH_MYSQLCOMPAT=ON \
+ -DWITH_SSL=OPENSSL
+
+# Help MariaDB find the correct libiconv.
+# nls.mk sets it up so that with CONFIG_BUILD_NLS libiconv-full would be used,
+# otherwise libiconv-stub (independent of the selected libc). MariaDB needs a
+# leg up to find/pick the right lib.
+CMAKE_OPTIONS += \
+ -DICONV_INCLUDE_DIR=$(ICONV_PREFIX)/include \
+ -DICONV_LIBRARIES=$(ICONV_PREFIX)/lib/libiconv.$(if $(CONFIG_BUILD_NLS),so,a)
+
+CMAKE_OPTIONS += \
+ $(foreach p,$(MARIADB_CLIENT_PLUGINS),-D$(plugin-$(p))=$(if $(CONFIG_PACKAGE_$(PKG_NAME)-plugin-$(subst _,-,$(p))),DYNAMIC,OFF))
+
+# LIBICONV_PLUG is used in GNU's libiconv for redefinition of exports [e.g.
+# from libiconv_open() to iconv_open()]. But in OpenWrt this variable is not set
+# when building libiconv-full. So when MariaDB sets LIBICONV_PLUG it expects
+# iconv_open() to be available for example, which is not the case - only
+# libiconv_open() is. To address this prevent the variable from being set.
+# libiconv-stub does not use this variable, so there is no harm in always doing
+# this.
+
+define Build/Prepare
+ $(call Build/Prepare/Default)
+ $(SED) '/ADD_DEFINITIONS(-DLIBICONV_PLUG)/d' $(PKG_BUILD_DIR)/CMakeLists.txt
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/include $(1)/usr/lib/mysql $(1)/usr/lib/pkgconfig $(2)/bin
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(1)/usr/include
+ cd $(1)/usr/include/mysql; $(LN) mariadb_version.h mysql_version.h
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{mariadb,mysqlclient}*.so* $(1)/usr/lib
+ cd $(1)/usr/lib/mysql; $(LN) ../lib{mariadb,mysqlclient}*.so* .
+ $(INSTALL_BIN) files/mysql_config $(1)/usr/bin
+ $(LN) $(STAGING_DIR)/usr/bin/mysql_config $(2)/bin
+ $(SED) 's/PORT/$(MARIADB_PORT)/' $(1)/usr/bin/mysql_config
+ $(SED) 's|PLUGIN_DIR|$(MARIADB_PLUGIN_DIR)|' $(1)/usr/bin/mysql_config
+ $(SED) 's|SOCKET|$(MARIADB_SOCKET)|' $(1)/usr/bin/mysql_config
+ cd "$(PKG_BUILD_DIR)/mariadb_config"; \
+ CLIENT_VERSION=`sed -n 's|^#define[[:blank:]]*VERSION[[:blank:]]*"\([0-9.]*\)"|\1|p' mariadb_config.c`; \
+ $(SED) "s/VERSION/$$$${CLIENT_VERSION}/" $(1)/usr/bin/mysql_config
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libmariadb.pc $(1)/usr/lib/pkgconfig
+endef
+
+define Package/$(PKG_NAME)/install
+ $(INSTALL_DIR) $(1)$(MARIADB_CONF_DIR)/conf.d
+ $(INSTALL_DIR) $(1)$(MARIADB_PLUGIN_DIR)
+ $(INSTALL_BIN) \
+ $(PKG_INSTALL_DIR)$(MARIADB_PLUGIN_DIR)/caching_sha2_password.so \
+ $(PKG_INSTALL_DIR)$(MARIADB_PLUGIN_DIR)/client_ed25519.so \
+ $(PKG_INSTALL_DIR)$(MARIADB_PLUGIN_DIR)/dialog.so \
+ $(PKG_INSTALL_DIR)$(MARIADB_PLUGIN_DIR)/mysql_clear_password.so \
+ $(PKG_INSTALL_DIR)$(MARIADB_PLUGIN_DIR)/sha256_password.so \
+ $(1)$(MARIADB_PLUGIN_DIR)
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libmariadb.so.$(ABI_VERSION) $(1)/usr/lib
+ $(INSTALL_CONF) conf/50-client.cnf $(1)$(MARIADB_CONF_DIR)/conf.d
+endef
+
+define BuildPlugin
+ define Package/$(PKG_NAME)-plugin-$(subst _,-,$(1))
+ $(call Package/$(PKG_NAME)/Default)
+ TITLE:=$(PKG_NAME) plugin
+ DEPENDS:=$(PKG_NAME) $(patsubst +%,+PACKAGE_$(PKG_NAME)-plugin-$(subst _,-,$(1)):%,$(2))
+ endef
+ define Package/$(PKG_NAME)-plugin-$(subst _,-,$(1))/description
+ $(call Package/$(PKG_NAME)/description/Default)
+
+This package provides the $(1) plugin.
+
+ endef
+ define Package/$(PKG_NAME)-plugin-$(subst _,-,$(1))/install
+ $(INSTALL_DIR) $$(1)$(MARIADB_PLUGIN_DIR)
+ $(call Package/$(PKG_NAME)/install/plugin,$$(1),$(1))
+ endef
+ $$(eval $$(call BuildPackage,$(PKG_NAME)-plugin-$(subst _,-,$(1))))
+endef
+
+$(eval $(call BuildPackage,$(PKG_NAME)))
+
+$(eval $(call BuildPlugin,auth_gssapi_client,+krb5-libs))
+$(eval $(call BuildPlugin,remote_io,+libcurl))
diff --git a/utils/mariadb/conf/50-client.cnf b/libs/libmariadb/conf/50-client.cnf
index de2b89f5e..de2b89f5e 100644
--- a/utils/mariadb/conf/50-client.cnf
+++ b/libs/libmariadb/conf/50-client.cnf
diff --git a/libs/libmariadb/files/mysql_config b/libs/libmariadb/files/mysql_config
new file mode 100755
index 000000000..5c4dfbd79
--- /dev/null
+++ b/libs/libmariadb/files/mysql_config
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+PCFILE=libmariadb
+
+command -v pkg-config > /dev/null 2>&1
+ret="$?"
+if [ "$ret" -ne 0 ]; then
+ echo pkg-config not found >&2
+ exit 1
+fi
+
+pkg-config $PCFILE > /dev/null 2>&1
+ret="$?"
+if [ "$ret" -ne 0 ]; then
+ echo $PCFILE pkg-config file missing >&2
+ exit 1
+fi
+
+cflags=$(pkg-config $PCFILE --cflags)
+include=$(pkg-config $PCFILE --cflags)
+libs=$(pkg-config $PCFILE --libs)
+plugindir=PLUGIN_DIR
+socket=SOCKET
+port=PORT
+version=VERSION
+
+usage () {
+ cat <<EOF
+Usage: $0 [OPTIONS]
+Options:
+ --cflags [$cflags]
+ --include [$include]
+ --libs [$libs]
+ --libs_r [$libs]
+ --plugindir [$plugindir]
+ --socket [$socket]
+ --port [$port]
+ --version [$version]
+EOF
+ exit "$1"
+}
+
+if test $# -le 0; then usage 0 ; fi
+
+while test $# -gt 0; do
+ case $1 in
+ --cflags) echo "$cflags" ;;
+ --include) echo "$include" ;;
+ --libs) echo "$libs" ;;
+ --libs_r) echo "$libs" ;;
+ --plugindir) echo "$plugindir" ;;
+ --socket) echo "$socket" ;;
+ --port) echo "$port" ;;
+ --version) echo "$version" ;;
+ *) usage 1 >&2 ;;
+ esac
+
+ shift
+done
+
+exit 0
diff --git a/libs/libmariadb/patches/fix-ucontext-header.patch b/libs/libmariadb/patches/fix-ucontext-header.patch
new file mode 100644
index 000000000..8e409729b
--- /dev/null
+++ b/libs/libmariadb/patches/fix-ucontext-header.patch
@@ -0,0 +1,11 @@
+--- a/cmake/CheckIncludeFiles.cmake
++++ b/cmake/CheckIncludeFiles.cmake
+@@ -46,4 +46,7 @@
+ CHECK_INCLUDE_FILES (sys/un.h HAVE_SYS_UN_H)
+ CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
+ CHECK_INCLUDE_FILES (utime.h HAVE_UTIME_H)
+-CHECK_INCLUDE_FILES (ucontext.h HAVE_UCONTEXT_H)
++CHECK_INCLUDE_FILES (ucontext.h HAVE_UCONTEXT_HEADER)
++IF(HAVE_UCONTEXT_HEADER)
++ CHECK_FUNCTION_EXISTS(makecontext HAVE_UCONTEXT_H)
++ENDIF(HAVE_UCONTEXT_HEADER)
diff --git a/utils/mariadb-common/Makefile b/utils/mariadb-common/Makefile
new file mode 100644
index 000000000..ce87718d6
--- /dev/null
+++ b/utils/mariadb-common/Makefile
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2019 Sebastian Kemper <sebastian_ml@gmx.net>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=mariadb-common
+PKG_VERSION:=1.0
+PKG_RELEASE:=1
+
+PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
+PKG_LICENSE:=GPL-2.0
+
+CONF_DIR:=/etc/mysql
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mariadb-common
+ SECTION:=utils
+ CATEGORY:=Utilities
+ URL:=https://mariadb.org/
+ SUBMENU:=Database
+ TITLE:=MariaDB database common files
+ DEPENDS:=
+endef
+
+define Package/mariadb-common/conffiles
+$(CONF_DIR)/my.cnf
+endef
+
+define Package/mariadb-common/description
+MariaDB is a very fast and robust SQL database server.
+
+This package includes shared files, for example $(CONF_DIR)/my.cnf.
+
+endef
+
+define Package/mariadb-common/install
+ $(INSTALL_DIR) $(1)$(CONF_DIR)
+ $(INSTALL_CONF) conf/my.cnf $(1)$(CONF_DIR)
+endef
+
+define Build/Compile
+endef
+
+$(eval $(call BuildPackage,mariadb-common))
diff --git a/utils/mariadb/conf/my.cnf b/utils/mariadb-common/conf/my.cnf
index 7583c7cae..7583c7cae 100644
--- a/utils/mariadb/conf/my.cnf
+++ b/utils/mariadb-common/conf/my.cnf
diff --git a/utils/mariadb/Makefile b/utils/mariadb/Makefile
index df26bc568..2cef40083 100644
--- a/utils/mariadb/Makefile
+++ b/utils/mariadb/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=mariadb
-PKG_VERSION:=10.2.26
+PKG_VERSION:=10.4.10
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
@@ -18,10 +18,10 @@ PKG_SOURCE_URL := \
https://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/$(PKG_NAME)-$(PKG_VERSION)/source \
https://downloads.mariadb.org/interstitial/$(PKG_NAME)-$(PKG_VERSION)/source
-PKG_HASH:=152fe941c4f2a352b2b3a4db1ef64e70235fd9ff055af62ad7bda9f2b2191528
+PKG_HASH:=cd50fddf86c2a47405737e342f78ebd40d5716f0fb32b976245de713bed01421
PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
-PKG_LICENSE:=GPL-2.0 LGPL-2.1
-PKG_LICENSE_FILES:=COPYING THIRDPARTY libmariadb/COPYING.LIB
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=COPYING THIRDPARTY
PKG_CPE_ID:=cpe:/a:mariadb:mariadb
@@ -39,6 +39,8 @@ CONF_DIR:=/etc/mysql
PLUGIN_DIR:=/usr/lib/mariadb/plugin
SHARE_DIR:=/usr/share/mariadb
+MARIADB_SOCKET=/var/run/mysqld/mysqld.sock
+
MARIADB_DISABLE_ENGINES := \
cassandra \
example \
@@ -56,15 +58,14 @@ MARIADB_DISABLE_PLUGINS := \
daemon_example \
debug_key_management \
example_key_management \
- fulltext
-
-MARIADB_LIB_PLUGINS := \
- auth_gssapi_client
+ fulltext \
+ versioning
MARIADB_SERVER_PLUGINS := \
auth_ed25519 \
auth_gssapi \
auth_pam \
+ auth_pam_v1 \
disks \
feedback \
file_key_management \
@@ -80,23 +81,19 @@ MARIADB_SERVER_PLUGINS := \
metadata_lock_info \
query_cache_info \
query_response_time \
- semisync_master \
- semisync_slave \
server_audit \
simple_password_check \
sql_errlog \
wsrep_info
PKG_CONFIG_DEPENDS := \
- $(patsubst %,CONFIG_PACKAGE_lib$(PKG_NAME)-plugin-%,$(subst _,-,$(MARIADB_LIB_PLUGINS))) \
$(patsubst %,CONFIG_PACKAGE_$(PKG_NAME)-server-plugin-%,$(subst _,-,$(MARIADB_SERVER_PLUGINS))) \
CONFIG_PACKAGE_mariadb-server
-plugin-auth_gssapi_client := PLUGIN_AUTH_GSSAPI_CLIENT
-
plugin-auth_ed25519 := PLUGIN_AUTH_ED25519
plugin-auth_gssapi := PLUGIN_AUTH_GSSAPI
plugin-auth_pam := PLUGIN_AUTH_PAM
+plugin-auth_pam_v1 := PLUGIN_AUTH_PAM_V1
plugin-disks := PLUGIN_DISKS
plugin-feedback := PLUGIN_FEEDBACK
plugin-file_key_management := PLUGIN_FILE_KEY_MANAGEMENT
@@ -112,8 +109,6 @@ plugin-locales := PLUGIN_LOCALES
plugin-metadata_lock_info := PLUGIN_METADATA_LOCK_INFO
plugin-query_cache_info := PLUGIN_QUERY_CACHE_INFO
plugin-query_response_time := PLUGIN_QUERY_RESPONSE_TIME
-plugin-semisync_master := PLUGIN_SEMISYNC_MASTER
-plugin-semisync_slave := PLUGIN_SEMISYNC_SLAVE
plugin-server_audit := PLUGIN_SERVER_AUDIT
plugin-simple_password_check := PLUGIN_SIMPLE_PASSWORD_CHECK
plugin-sql_errlog := PLUGIN_SQL_ERRLOG
@@ -142,7 +137,11 @@ MARIADB_SERVER := \
mysqld
MARIADB_SERVER_EXTRA := \
- aria* \
+ aria_chk \
+ aria_dump_log \
+ aria_ftdump \
+ aria_pack \
+ aria_read_log \
mariabackup \
msql2mysql \
myisam_ftdump \
@@ -162,7 +161,10 @@ MARIADB_SERVER_EXTRA := \
perror \
replace \
resolve_stack_dump \
- wsrep_sst_*
+ wsrep_sst_mariabackup \
+ wsrep_sst_mysqldump \
+ wsrep_sst_rsync \
+ wsrep_sst_rsync_wan
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
@@ -193,6 +195,9 @@ endef
define Package/mariadb/install/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $(1)/usr/bin
+ cd "$(PKG_INSTALL_DIR)/usr/bin"; find . -maxdepth 1 -type l \
+ -regex './$(subst mysql,mariadb[-]*,$(subst _,-,$(2)))' \
+ | xargs -I{} $(CP) {} "$(1)/usr/bin"
endef
define Package/mariadb/install/plugin
@@ -203,32 +208,6 @@ define Package/mariadb/description/Default
MariaDB is a very fast and robust SQL database server.
endef
-define Package/libmariadb/Default
- SECTION:=libs
- CATEGORY:=Libraries
- URL:=https://mariadb.org/
-endef
-
-define Package/libmariadb
- $(call Package/libmariadb/Default)
- DEPENDS:=+mariadb-common \
- $(MARIADB_COMMON_DEPENDS)
- TITLE:=MariaDB database client library
- MENU:=1
- PROVIDES:=libmariadbclient libmysqlclient libmysqlclient-r
-endef
-
-define Package/libmariadb/conffiles
-$(CONF_DIR)/conf.d/50-client.cnf
-endef
-
-define Package/libmariadb/description
-$(call Package/mariadb/description/Default)
-
-This package includes the client library.
-
-endef
-
define Package/mariadb/Default
SECTION:=utils
CATEGORY:=Utilities
@@ -287,23 +266,6 @@ $(subst $(space),$(newline),$(MARIADB_CLIENT_EXTRA))
endef
-define Package/mariadb-common
- $(call Package/mariadb/Default)
- TITLE:=MariaDB database common files
- DEPENDS:=
-endef
-
-define Package/mariadb-common/conffiles
-$(CONF_DIR)/my.cnf
-endef
-
-define Package/mariadb-common/description
-$(call Package/mariadb/description/Default)
-
-This package includes shared files, for example $(CONF_DIR)/my.cnf.
-
-endef
-
define Package/mariadb-server
$(call Package/mariadb/Default)
DEPENDS:=mariadb-server-base
@@ -411,9 +373,9 @@ CMAKE_OPTIONS += \
-DINSTALL_SCRIPTDIR=bin \
-DINSTALL_SQLBENCHDIR="" \
-DINSTALL_SUPPORTFILESDIR=share/mariadb \
- -DINSTALL_UNIX_ADDRDIR=/var/run/mysqld/mysqld.sock \
+ -DINSTALL_UNIX_ADDRDIR=$(MARIADB_SOCKET) \
-DMYSQL_DATADIR=/var/lib/mysql \
- -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
+ -DMYSQL_UNIX_ADDR=$(MARIADB_SOCKET) \
-DSKIP_TESTS=ON \
-DWITH_DEBUG=OFF \
-DWITH_EMBEDDED_SERVER=OFF \
@@ -426,6 +388,7 @@ CMAKE_OPTIONS += \
-DWITH_LIBARCHIVE=OFF \
-DWITH_LIBWRAP=OFF \
-DWITH_MARIABACKUP=ON \
+ -DWITH_NUMA=OFF \
-DWITH_PCRE=system \
-DWITH_SAFEMALLOC=OFF \
-DWITH_SSL=system \
@@ -442,9 +405,13 @@ CMAKE_OPTIONS += \
-DICONV_LIBRARIES=$(ICONV_PREFIX)/lib/libiconv.$(if $(CONFIG_BUILD_NLS),so,a)
CMAKE_OPTIONS += \
- $(foreach p,$(MARIADB_LIB_PLUGINS),-D$(plugin-$(p))=$(if $(CONFIG_PACKAGE_lib$(PKG_NAME)-plugin-$(subst _,-,$(p))),DYNAMIC,OFF)) \
$(foreach p,$(MARIADB_SERVER_PLUGINS),-D$(plugin-$(p))=$(if $(CONFIG_PACKAGE_$(PKG_NAME)-server-plugin-$(subst _,-,$(p))),DYNAMIC,NO))
+# Disable some client library plugins
+CMAKE_OPTIONS += \
+ -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF \
+ -DCLIENT_PLUGIN_REMOTE_IO=OFF
+
# Set CMAKE_FIND_ROOT_PATH_MODE_INCLUDE and CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
# to BOTH as otherwise the host build will not find some required dependencies
# installed on the host machine, like ncurses.
@@ -505,27 +472,9 @@ define Build/Prepare
$(foreach p,$(MARIADB_DISABLE_PLUGINS),$(call Package/mariadb/disable/plugin,$(PKG_BUILD_DIR),$(p));)
endef
+# Define Build/InstallDev, otherwise build system starts installing files into
+# staging area, which would interfere with mariadb-connector-c.
define Build/InstallDev
- $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib/mysql $(1)/usr/lib/pkgconfig $(1)/usr/share/aclocal
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_config $(1)/usr/bin
- $(LN) $(STAGING_DIR)/usr/bin/mysql_config $(2)/bin
- $(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(1)/usr/include
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{mariadb,mysqlclient}*.so* $(1)/usr/lib
- cd $(1)/usr/lib/mysql; $(LN) ../lib{mariadb,mysqlclient}*.so* .
- $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libmariadb.pc $(1)/usr/lib/pkgconfig
- $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/aclocal/mysql.m4 $(1)/usr/share/aclocal
-endef
-
-define Package/libmariadb/install
- $(INSTALL_DIR) $(1)$(CONF_DIR)/conf.d
- $(INSTALL_DIR) $(1)$(PLUGIN_DIR)
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{mariadb,mysqlclient}*.so* $(1)/usr/lib
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/caching_sha2_password.so $(1)$(PLUGIN_DIR)
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/client_ed25519.so $(1)$(PLUGIN_DIR)
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/dialog.so $(1)$(PLUGIN_DIR)
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/mysql_clear_password.so $(1)$(PLUGIN_DIR)
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/sha256_password.so $(1)$(PLUGIN_DIR)
- $(INSTALL_CONF) conf/50-client.cnf $(1)$(CONF_DIR)/conf.d
endef
define Package/mariadb-client/install
@@ -547,11 +496,6 @@ define Package/mariadb-client-extra/install
$(foreach b,$(MARIADB_CLIENT_EXTRA),$(call Package/mariadb/install/bin,$(1),$(b));)
endef
-define Package/mariadb-common/install
- $(INSTALL_DIR) $(1)$(CONF_DIR)
- $(INSTALL_CONF) conf/my.cnf $(1)$(CONF_DIR)
-endef
-
define Package/mariadb-server/install
$(INSTALL_DIR) $(1)/usr/bin
$(foreach b,$(MARIADB_SERVER),$(call Package/mariadb/install/bin,$(1),$(b));)
@@ -575,66 +519,81 @@ define Package/mariadb-server-base/install
$(INSTALL_DATA) $(PKG_INSTALL_DIR)$(SHARE_DIR)/mysql_performance_tables.sql $(1)$(SHARE_DIR)
$(INSTALL_DATA) $(PKG_INSTALL_DIR)$(SHARE_DIR)/mysql_system_tables.sql $(1)$(SHARE_DIR)
$(INSTALL_DATA) $(PKG_INSTALL_DIR)$(SHARE_DIR)/mysql_system_tables_data.sql $(1)$(SHARE_DIR)
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)$(SHARE_DIR)/mysql_test_db.sql $(1)$(SHARE_DIR)
endef
define Package/mariadb-server-extra/install
$(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/bin/wsrep_sst_common $(1)/usr/bin
$(SED) 's,/bin/bash,/bin/sh,g' $(PKG_INSTALL_DIR)/usr/bin/wsrep_sst_*
$(foreach b,$(MARIADB_SERVER_EXTRA),$(call Package/mariadb/install/bin,$(1),$(b));)
+ cd $(1)/usr/bin; $(LN) mariabackup mariadb-backup
endef
define BuildPlugin
- define Package/$(1)-plugin-$(subst _,-,$(2))
- $(call Package/$(subst mariadb-server,mariadb,$(1))/Default)
- TITLE:=$(1) plugin
- DEPENDS:=$(1) $(patsubst +%,+PACKAGE_$(1)-plugin-$(subst _,-,$(2)):%,$(3))
+ define Package/mariadb-server-plugin-$(subst _,-,$(1))
+ $(call Package/mariadb/Default)
+ TITLE:=mariadb-server plugin
+ DEPENDS:=mariadb-server $(patsubst +%,+PACKAGE_mariadb-server-plugin-$(subst _,-,$(1)):%,$(2))
endef
- define Package/$(1)-plugin-$(subst _,-,$(2))/description
+ define Package/mariadb-server-plugin-$(subst _,-,$(1))/description
$(call Package/mariadb/description/Default)
-This package provides the $(2) plugin.
+This package provides the $(1) plugin.
endef
- define Package/$(1)-plugin-$(subst _,-,$(2))/install
+ define Package/mariadb-server-plugin-$(subst _,-,$(1))/install
$(INSTALL_DIR) $$(1)$(PLUGIN_DIR)
- $(call Package/mariadb/install/plugin,$$(1),$(2))
+ $(call Package/mariadb/install/plugin,$$(1),$(1))
+ifeq ($(1),auth_pam)
+ $(CP) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/auth_pam_tool_dir \
+ $$(1)$(PLUGIN_DIR)
+endif
+ifeq ($(1),ha_spider)
+ $(INSTALL_DIR) $$(1)$(SHARE_DIR)
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)$(SHARE_DIR)/install_spider.sql \
+ $$(1)$(SHARE_DIR)
+endif
endef
- $$(eval $$(call BuildPackage,$(1)-plugin-$(subst _,-,$(2))))
+ $$(eval $$(call BuildPackage,mariadb-server-plugin-$(subst _,-,$(1))))
+endef
+
+define Package/mariadb-server-plugin-auth-pam/postinst
+#!/bin/sh
+if [ -z "$${IPKG_INSTROOT}" ]; then
+ chown mariadb /usr/lib/mariadb/plugin/auth_pam_tool_dir > /dev/null 2>&1
+fi
+exit 0
endef
$(eval $(call HostBuild))
-$(eval $(call BuildPackage,libmariadb))
$(eval $(call BuildPackage,mariadb-client))
$(eval $(call BuildPackage,mariadb-client-base))
$(eval $(call BuildPackage,mariadb-client-extra))
-$(eval $(call BuildPackage,mariadb-common))
$(eval $(call BuildPackage,mariadb-server))
$(eval $(call BuildPackage,mariadb-server-base))
$(eval $(call BuildPackage,mariadb-server-extra))
-$(eval $(call BuildPlugin,libmariadb,auth_gssapi_client,+krb5-libs))
-$(eval $(call BuildPlugin,mariadb-server,auth_ed25519,))
-$(eval $(call BuildPlugin,mariadb-server,auth_gssapi,+krb5-libs))
-$(eval $(call BuildPlugin,mariadb-server,auth_pam,+libpam))
-$(eval $(call BuildPlugin,mariadb-server,disks,))
-$(eval $(call BuildPlugin,mariadb-server,feedback,))
-$(eval $(call BuildPlugin,mariadb-server,file_key_management,))
-$(eval $(call BuildPlugin,mariadb-server,ha_archive,))
-$(eval $(call BuildPlugin,mariadb-server,ha_blackhole,))
-$(eval $(call BuildPlugin,mariadb-server,ha_connect,+libxml2))
-$(eval $(call BuildPlugin,mariadb-server,ha_federated,))
-$(eval $(call BuildPlugin,mariadb-server,ha_federatedx,))
-$(eval $(call BuildPlugin,mariadb-server,ha_sphinx,))
-$(eval $(call BuildPlugin,mariadb-server,ha_spider,))
-$(eval $(call BuildPlugin,mariadb-server,handlersocket,))
-$(eval $(call BuildPlugin,mariadb-server,locales,))
-$(eval $(call BuildPlugin,mariadb-server,metadata_lock_info,))
-$(eval $(call BuildPlugin,mariadb-server,query_cache_info,))
-$(eval $(call BuildPlugin,mariadb-server,query_response_time,))
-$(eval $(call BuildPlugin,mariadb-server,semisync_master,))
-$(eval $(call BuildPlugin,mariadb-server,semisync_slave,))
-$(eval $(call BuildPlugin,mariadb-server,server_audit,))
-$(eval $(call BuildPlugin,mariadb-server,simple_password_check,))
-$(eval $(call BuildPlugin,mariadb-server,sql_errlog,))
-$(eval $(call BuildPlugin,mariadb-server,wsrep_info,))
-
+$(eval $(call BuildPlugin,auth_ed25519,))
+$(eval $(call BuildPlugin,auth_gssapi,+krb5-libs))
+$(eval $(call BuildPlugin,auth_pam,+libpam))
+$(eval $(call BuildPlugin,auth_pam_v1,+libpam))
+$(eval $(call BuildPlugin,disks,))
+$(eval $(call BuildPlugin,feedback,))
+$(eval $(call BuildPlugin,file_key_management,))
+$(eval $(call BuildPlugin,ha_archive,))
+$(eval $(call BuildPlugin,ha_blackhole,))
+$(eval $(call BuildPlugin,ha_connect,+libxml2))
+$(eval $(call BuildPlugin,ha_federated,))
+$(eval $(call BuildPlugin,ha_federatedx,))
+$(eval $(call BuildPlugin,ha_sphinx,))
+$(eval $(call BuildPlugin,ha_spider,))
+$(eval $(call BuildPlugin,handlersocket,))
+$(eval $(call BuildPlugin,locales,))
+$(eval $(call BuildPlugin,metadata_lock_info,))
+$(eval $(call BuildPlugin,query_cache_info,))
+$(eval $(call BuildPlugin,query_response_time,))
+$(eval $(call BuildPlugin,server_audit,))
+$(eval $(call BuildPlugin,simple_password_check,))
+$(eval $(call BuildPlugin,sql_errlog,))
+$(eval $(call BuildPlugin,wsrep_info,))
diff --git a/utils/mariadb/files/mysqld.init b/utils/mariadb/files/mysqld.init
index 66afb35bc..284e00aaa 100644
--- a/utils/mariadb/files/mysqld.init
+++ b/utils/mariadb/files/mysqld.init
@@ -131,7 +131,7 @@ start_service() {
}
'
- if [ ! -f "$datadir/mysql/tables_priv.MYD" ]; then
+ if [ ! -f "$datadir/mysql/tables_priv.MAD" ]; then
local args="--force"
local basedir=$(mysqld_get_param basedir)
[ -n "$basedir" ] && args="$args --basedir=$basedir"
diff --git a/utils/mariadb/patches/100-fix_hostname.patch b/utils/mariadb/patches/100-fix_hostname.patch
index ae1ce0e22..1e20f4f92 100644
--- a/utils/mariadb/patches/100-fix_hostname.patch
+++ b/utils/mariadb/patches/100-fix_hostname.patch
@@ -1,6 +1,6 @@
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
-@@ -410,7 +410,7 @@ fi
+@@ -419,7 +419,7 @@ fi
# Try to determine the hostname
diff --git a/utils/mariadb/patches/110-pcre.cmake.patch b/utils/mariadb/patches/110-pcre.cmake.patch
index 6e1d0b259..2d370a317 100644
--- a/utils/mariadb/patches/110-pcre.cmake.patch
+++ b/utils/mariadb/patches/110-pcre.cmake.patch
@@ -1,11 +1,36 @@
+From: =?utf-8?q?Ond=C5=99ej_Sur=C3=BD?= <ondrej@debian.org>
+Date: Wed, 22 Nov 2017 06:05:45 +0000
+Subject: Revert to using system pcre library
+
+---
+ cmake/pcre.cmake | 16 ++--------------
+ 1 file changed, 2 insertions(+), 14 deletions(-)
+
--- a/cmake/pcre.cmake
+++ b/cmake/pcre.cmake
-@@ -14,6 +14,8 @@ MACRO (CHECK_PCRE)
- return -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0) < 256;
- }" PCRE_STACK_SIZE_OK)
- SET(CMAKE_REQUIRED_LIBRARIES)
-+ ELSE()
-+ SET(PCRE_STACK_SIZE_OK TRUE)
- ENDIF()
+@@ -1,23 +1,11 @@
+-INCLUDE (CheckCSourceRuns)
+-
+ SET(WITH_PCRE "auto" CACHE STRING
+ "Which pcre to use (possible values are 'bundled', 'system', or 'auto')")
+
+ MACRO (CHECK_PCRE)
+ IF(WITH_PCRE STREQUAL "system" OR WITH_PCRE STREQUAL "auto")
+- CHECK_LIBRARY_EXISTS(pcre pcre_stack_guard "" HAVE_PCRE_STACK_GUARD)
+- IF(NOT CMAKE_CROSSCOMPILING)
+- SET(CMAKE_REQUIRED_LIBRARIES "pcre")
+- CHECK_C_SOURCE_RUNS("
+- #include <pcre.h>
+- int main() {
+- return -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0) < 256;
+- }" PCRE_STACK_SIZE_OK)
+- SET(CMAKE_REQUIRED_LIBRARIES)
+- ENDIF()
++ CHECK_LIBRARY_EXISTS(pcre pcre_stack_guard "" HAVE_PCRE)
ENDIF()
- IF(NOT HAVE_PCRE_STACK_GUARD OR NOT PCRE_STACK_SIZE_OK OR
+- IF(NOT HAVE_PCRE_STACK_GUARD OR NOT PCRE_STACK_SIZE_OK OR
+- WITH_PCRE STREQUAL "bundled")
++ IF(NOT HAVE_PCRE OR WITH_PCRE STREQUAL "bundled")
+ IF (WITH_PCRE STREQUAL "system")
+ MESSAGE(FATAL_ERROR "system pcre is not found or unusable")
+ ENDIF()
diff --git a/utils/mariadb/patches/130-c11_atomics.patch b/utils/mariadb/patches/130-c11_atomics.patch
index 00a636305..7c8f1e7cf 100644
--- a/utils/mariadb/patches/130-c11_atomics.patch
+++ b/utils/mariadb/patches/130-c11_atomics.patch
@@ -1,112 +1,64 @@
-Description: Fix mips missing atomics primitives
- On mips we don't have native support for 64bit atomic operations. Make use
- of libatomic to emulate them.
Author: Vicențiu Ciorbaru <vicentiu@mariadb.org>
+Date: Fri Dec 21 19:14:04 2018 +0200
+
+ Link with libatomic to enable C11 atomics support
+
+ Some architectures (mips) require libatomic to support proper
+ atomic operations. Check first if support is available without
+ linking, otherwise use the library.
--- a/configure.cmake
+++ b/configure.cmake
-@@ -128,7 +128,7 @@ IF(UNIX)
- ENDIF()
- FIND_PACKAGE(Threads)
-
-- SET(CMAKE_REQUIRED_LIBRARIES
-+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES
- ${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${LIBEXECINFO})
- # Need explicit pthread for gcc -fsanitize=address
- IF(CMAKE_USE_PTHREADS_INIT AND CMAKE_C_FLAGS MATCHES "-fsanitize=")
-@@ -952,7 +952,26 @@ ELSEIF(NOT WITH_ATOMIC_OPS)
- long long int *ptr= &var;
- return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
- }"
-- HAVE_GCC_C11_ATOMICS)
-+ HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC)
-+ IF(HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC)
+@@ -866,7 +866,25 @@ int main()
+ long long int *ptr= &var;
+ return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
+ }"
+-HAVE_GCC_C11_ATOMICS)
++HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC)
++IF (HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC)
++ SET(HAVE_GCC_C11_ATOMICS True)
++ELSE()
++ SET(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
++ LIST(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
++ CHECK_CXX_SOURCE_COMPILES("
++ int main()
++ {
++ long long int var= 1;
++ long long int *ptr= &var;
++ return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
++ }"
++ HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
++ IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
+ SET(HAVE_GCC_C11_ATOMICS True)
-+ ELSE()
-+ SET(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
-+ LIST(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
-+ CHECK_CXX_SOURCE_COMPILES("
-+ int main()
-+ {
-+ long long int var= 1;
-+ long long int *ptr= &var;
-+ return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
-+ }"
-+ HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
-+ IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
-+ SET(HAVE_GCC_C11_ATOMICS True)
-+ ELSE()
-+ SET(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES})
-+ ENDIF()
+ ENDIF()
- ELSE()
- MESSAGE(FATAL_ERROR "${WITH_ATOMIC_OPS} is not a valid value for WITH_ATOMIC_OPS!")
- ENDIF()
---- a/include/atomic/gcc_builtins.h
-+++ b/include/atomic/gcc_builtins.h
-@@ -16,6 +16,7 @@
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
-
-+#if defined (HAVE_GCC_ATOMIC_BUILTINS)
- #define make_atomic_add_body(S) \
- v= __sync_fetch_and_add(a, v);
- #define make_atomic_fas_body(S) \
-@@ -26,6 +27,20 @@
- sav= __sync_val_compare_and_swap(a, cmp_val, set);\
- if (!(ret= (sav == cmp_val))) *cmp= sav
++ SET(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES})
++ENDIF()
-+#elif defined(HAVE_GCC_C11_ATOMICS)
-+
-+#define make_atomic_add_body(S) \
-+ v= __atomic_fetch_add(a, v, __ATOMIC_SEQ_CST)
-+#define make_atomic_fas_body(S) \
-+ v= __atomic_exchange_n(a, v, __ATOMIC_SEQ_CST)
-+#define make_atomic_cas_body(S) \
-+ int ## S sav; \
-+ ret= __atomic_compare_exchange_n(a, cmp, set, \
-+ 0, \
-+ __ATOMIC_SEQ_CST,\
-+ __ATOMIC_SEQ_CST);
-+#endif
-+
- #ifdef MY_ATOMIC_MODE_DUMMY
- #define make_atomic_load_body(S) ret= *a
- #define make_atomic_store_body(S) *a= v
+ IF(WITH_VALGRIND)
+ SET(HAVE_valgrind 1)
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
-@@ -81,6 +81,10 @@ IF(HAVE_BFD_H)
- TARGET_LINK_LIBRARIES(mysys bfd)
- ENDIF(HAVE_BFD_H)
+@@ -72,6 +72,10 @@ TARGET_LINK_LIBRARIES(mysys dbug strings
+ ${LIBNSL} ${LIBM} ${LIBRT} ${LIBDL} ${LIBSOCKET} ${LIBEXECINFO} ${CRC32_LIBRARY})
+ DTRACE_INSTRUMENT(mysys)
-+IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
++IF (HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
+ TARGET_LINK_LIBRARIES(mysys atomic)
+ENDIF()
+
- IF (WIN32)
- TARGET_LINK_LIBRARIES(mysys IPHLPAPI)
- ENDIF(WIN32)
+ IF(HAVE_BFD_H)
+ TARGET_LINK_LIBRARIES(mysys bfd)
+ ENDIF(HAVE_BFD_H)
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
-@@ -170,6 +170,10 @@ TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATI
- ${SSL_LIBRARIES}
- ${LIBSYSTEMD})
+@@ -190,6 +190,10 @@ ELSE()
+ SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL})
+ ENDIF()
-+IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
++IF (HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
+ TARGET_LINK_LIBRARIES(sql atomic)
+ENDIF()
+
- IF(WIN32)
- SET(MYSQLD_SOURCE main.cc nt_servc.cc message.rc)
- TARGET_LINK_LIBRARIES(sql psapi)
---- a/include/my_atomic.h
-+++ b/include/my_atomic.h
-@@ -126,7 +126,7 @@
- #include "atomic/generic-msvc.h"
- #elif defined(HAVE_SOLARIS_ATOMIC)
- #include "atomic/solaris.h"
--#elif defined(HAVE_GCC_ATOMIC_BUILTINS)
-+#elif defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_GCC_C11_ATOMICS)
- #include "atomic/gcc_builtins.h"
- #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
- #include "atomic/x86-gcc.h"
+
+ IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS)
+
diff --git a/utils/mariadb/patches/140-mips-connect-unaligned.patch b/utils/mariadb/patches/140-mips-connect-unaligned.patch
index 501eb53ca..7eceffa24 100644
--- a/utils/mariadb/patches/140-mips-connect-unaligned.patch
+++ b/utils/mariadb/patches/140-mips-connect-unaligned.patch
@@ -1,109 +1,15 @@
-Description: Handle unaligned buffers in connect's TYPBLK class
- On MIPS platforms (and probably others) unaligned memory access results in a
- bus error. In the connect storage engine, block data for some data formats is
- stored packed in memory and the TYPBLK class is used to read values from it.
- Since TYPBLK does not have special handling for this packed memory, it can
- quite easily result in unaligned memory accesses.
- .
- The simple way to fix this is to perform all accesses to the main buffer
- through memcpy. With GCC and optimizations turned on, this call to memcpy is
- completely optimized away on architectures where unaligned accesses are ok
- (like x86).
-Author: James Cowgill <jcowgill@debian.org>
+From: Debian MySQL Maintainers <pkg-mysql-maint@lists.alioth.debian.org>
+Date: Thu, 10 Aug 2017 20:40:28 +0200
+Subject: mips-connect-unaligned
+
---
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/storage/connect/valblk.h
-+++ b/storage/connect/valblk.h
-@@ -139,6 +139,7 @@ class VALBLK : public BLOCK {
- int Prec; // Precision of float values
- }; // end of class VALBLK
-
-+
- /***********************************************************************/
- /* Class TYPBLK: represents a block of typed values. */
- /***********************************************************************/
-@@ -151,40 +152,41 @@ class TYPBLK : public VALBLK {
- // Implementation
- virtual bool Init(PGLOBAL g, bool check);
- virtual int GetVlen(void) {return sizeof(TYPE);}
-- virtual char GetTinyValue(int n) {return (char)Typp[n];}
-- virtual uchar GetUTinyValue(int n) {return (uchar)Typp[n];}
-- virtual short GetShortValue(int n) {return (short)Typp[n];}
-- virtual ushort GetUShortValue(int n) {return (ushort)Typp[n];}
-- virtual int GetIntValue(int n) {return (int)Typp[n];}
-- virtual uint GetUIntValue(int n) {return (uint)Typp[n];}
-- virtual longlong GetBigintValue(int n) {return (longlong)Typp[n];}
-- virtual ulonglong GetUBigintValue(int n) {return (ulonglong)Typp[n];}
-- virtual double GetFloatValue(int n) {return (double)Typp[n];}
-+
-+ virtual char GetTinyValue(int n) {return (char)UnalignedRead(n);}
-+ virtual uchar GetUTinyValue(int n) {return (uchar)UnalignedRead(n);}
-+ virtual short GetShortValue(int n) {return (short)UnalignedRead(n);}
-+ virtual ushort GetUShortValue(int n) {return (ushort)UnalignedRead(n);}
-+ virtual int GetIntValue(int n) {return (int)UnalignedRead(n);}
-+ virtual uint GetUIntValue(int n) {return (uint)UnalignedRead(n);}
-+ virtual longlong GetBigintValue(int n) {return (longlong)UnalignedRead(n);}
-+ virtual ulonglong GetUBigintValue(int n) {return (ulonglong)UnalignedRead(n);}
-+ virtual double GetFloatValue(int n) {return (double)UnalignedRead(n);}
- virtual char *GetCharString(char *p, int n);
-- virtual void Reset(int n) {Typp[n] = 0;}
-+ virtual void Reset(int n) {UnalignedWrite(n, 0);}
-
- // Methods
- using VALBLK::SetValue;
- virtual void SetValue(PCSZ sp, int n);
- virtual void SetValue(const char *sp, uint len, int n);
- virtual void SetValue(short sval, int n)
-- {Typp[n] = (TYPE)sval; SetNull(n, false);}
-+ {UnalignedWrite(n, (TYPE)sval); SetNull(n, false);}
- virtual void SetValue(ushort sval, int n)
-- {Typp[n] = (TYPE)sval; SetNull(n, false);}
-+ {UnalignedWrite(n, (TYPE)sval); SetNull(n, false);}
- virtual void SetValue(int lval, int n)
-- {Typp[n] = (TYPE)lval; SetNull(n, false);}
-+ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);}
- virtual void SetValue(uint lval, int n)
-- {Typp[n] = (TYPE)lval; SetNull(n, false);}
-+ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);}
- virtual void SetValue(longlong lval, int n)
-- {Typp[n] = (TYPE)lval; SetNull(n, false);}
-+ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);}
- virtual void SetValue(ulonglong lval, int n)
-- {Typp[n] = (TYPE)lval; SetNull(n, false);}
-+ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);}
- virtual void SetValue(double fval, int n)
-- {Typp[n] = (TYPE)fval; SetNull(n, false);}
-+ {UnalignedWrite(n, (TYPE)fval); SetNull(n, false);}
- virtual void SetValue(char cval, int n)
-- {Typp[n] = (TYPE)cval; SetNull(n, false);}
-+ {UnalignedWrite(n, (TYPE)cval); SetNull(n, false);}
- virtual void SetValue(uchar cval, int n)
-- {Typp[n] = (TYPE)cval; SetNull(n, false);}
-+ {UnalignedWrite(n, (TYPE)cval); SetNull(n, false);}
- virtual void SetValue(PVAL valp, int n);
- virtual void SetValue(PVBLK pv, int n1, int n2);
- virtual void SetMin(PVAL valp, int n);
-@@ -206,6 +208,17 @@ class TYPBLK : public VALBLK {
- // Members
- TYPE* const &Typp;
- const char *Fmt;
-+
-+ // Unaligned access
-+ TYPE UnalignedRead(int n) const {
-+ TYPE result;
-+ memcpy(&result, Typp + n, sizeof(TYPE));
-+ return result;
-+ }
-+
-+ void UnalignedWrite(int n, TYPE value) {
-+ memcpy(Typp + n, &value, sizeof(TYPE));
-+ }
- }; // end of class TYPBLK
-
- /***********************************************************************/
+ storage/connect/valblk.cpp | 41 ++++++++++++++++++-------------------
+ storage/connect/valblk.h | 51 +++++++++++++++++++++++++++++-----------------
+ 2 files changed, 52 insertions(+), 40 deletions(-)
+
--- a/storage/connect/valblk.cpp
+++ b/storage/connect/valblk.cpp
-@@ -266,14 +266,14 @@ bool TYPBLK<TYPE>::Init(PGLOBAL g, bool
+@@ -268,14 +268,14 @@ bool TYPBLK<TYPE>::Init(PGLOBAL g, bool
template <class TYPE>
char *TYPBLK<TYPE>::GetCharString(char *p, int n)
{
@@ -120,7 +26,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
return p;
} // end of GetCharString
-@@ -289,7 +289,7 @@ void TYPBLK<TYPE>::SetValue(PVAL valp, i
+@@ -291,7 +291,7 @@ void TYPBLK<TYPE>::SetValue(PVAL valp, i
ChkTyp(valp);
if (!(b = valp->IsNull()))
@@ -129,7 +35,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
else
Reset(n);
-@@ -351,9 +351,9 @@ void TYPBLK<TYPE>::SetValue(PCSZ p, int
+@@ -353,9 +353,9 @@ void TYPBLK<TYPE>::SetValue(PCSZ p, int
ulonglong val = CharToNumber(p, strlen(p), maxval, Unsigned, &minus);
if (minus && val < maxval)
@@ -141,7 +47,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
SetNull(n, false);
} // end of SetValue
-@@ -396,7 +396,7 @@ void TYPBLK<double>::SetValue(PCSZ p, in
+@@ -398,7 +398,7 @@ void TYPBLK<double>::SetValue(PCSZ p, in
throw Type;
} // endif Check
@@ -150,7 +56,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
SetNull(n, false);
} // end of SetValue
-@@ -428,7 +428,7 @@ void TYPBLK<TYPE>::SetValue(PVBLK pv, in
+@@ -430,7 +430,7 @@ void TYPBLK<TYPE>::SetValue(PVBLK pv, in
ChkTyp(pv);
if (!(b = pv->IsNull(n2) && Nullable))
@@ -159,7 +65,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
else
Reset(n1);
-@@ -479,10 +479,10 @@ void TYPBLK<TYPE>::SetMin(PVAL valp, int
+@@ -481,10 +481,10 @@ void TYPBLK<TYPE>::SetMin(PVAL valp, int
{
CheckParms(valp, n)
TYPE tval = GetTypedValue(valp);
@@ -172,7 +78,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
} // end of SetMin
-@@ -494,10 +494,10 @@ void TYPBLK<TYPE>::SetMax(PVAL valp, int
+@@ -496,10 +496,10 @@ void TYPBLK<TYPE>::SetMax(PVAL valp, int
{
CheckParms(valp, n)
TYPE tval = GetTypedValue(valp);
@@ -185,7 +91,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
} // end of SetMax
-@@ -511,8 +511,7 @@ void TYPBLK<TYPE>::SetValues(PVBLK pv, i
+@@ -513,8 +513,7 @@ void TYPBLK<TYPE>::SetValues(PVBLK pv, i
CheckType(pv)
TYPE *lp = ((TYPBLK*)pv)->Typp;
@@ -195,7 +101,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
} // end of SetValues
#endif // 0
-@@ -523,7 +522,7 @@ void TYPBLK<TYPE>::SetValues(PVBLK pv, i
+@@ -525,7 +524,7 @@ void TYPBLK<TYPE>::SetValues(PVBLK pv, i
template <class TYPE>
void TYPBLK<TYPE>::Move(int i, int j)
{
@@ -204,7 +110,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
MoveNull(i, j);
} // end of Move
-@@ -537,7 +536,7 @@ int TYPBLK<TYPE>::CompVal(PVAL vp, int n
+@@ -539,7 +538,7 @@ int TYPBLK<TYPE>::CompVal(PVAL vp, int n
ChkIndx(n);
ChkTyp(vp);
#endif // _DEBUG
@@ -213,7 +119,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
TYPE vlv = GetTypedValue(vp);
return (vlv > mlv) ? 1 : (vlv < mlv) ? (-1) : 0;
-@@ -549,8 +548,8 @@ int TYPBLK<TYPE>::CompVal(PVAL vp, int n
+@@ -551,8 +550,8 @@ int TYPBLK<TYPE>::CompVal(PVAL vp, int n
template <class TYPE>
int TYPBLK<TYPE>::CompVal(int i1, int i2)
{
@@ -224,7 +130,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
return (lv1 > lv2) ? 1 : (lv1 < lv2) ? (-1) : 0;
} // end of CompVal
-@@ -587,7 +586,7 @@ int TYPBLK<TYPE>::Find(PVAL vp)
+@@ -589,7 +588,7 @@ int TYPBLK<TYPE>::Find(PVAL vp)
TYPE n = GetTypedValue(vp);
for (i = 0; i < Nval; i++)
@@ -233,7 +139,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
break;
return (i < Nval) ? i : (-1);
-@@ -603,7 +602,7 @@ int TYPBLK<TYPE>::GetMaxLength(void)
+@@ -605,7 +604,7 @@ int TYPBLK<TYPE>::GetMaxLength(void)
int i, n, m;
for (i = n = 0; i < Nval; i++) {
@@ -242,7 +148,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
n = MY_MAX(n, m);
} // endfor i
-@@ -1333,7 +1332,7 @@ char *DATBLK::GetCharString(char *p, int
+@@ -1335,7 +1334,7 @@ char *DATBLK::GetCharString(char *p, int
char *vp;
if (Dvalp) {
@@ -251,7 +157,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
vp = Dvalp->GetCharString(p);
} else
vp = TYPBLK<int>::GetCharString(p, n);
-@@ -1349,7 +1348,7 @@ void DATBLK::SetValue(PCSZ p, int n)
+@@ -1351,7 +1350,7 @@ void DATBLK::SetValue(PCSZ p, int n)
if (Dvalp) {
// Decode the string according to format
Dvalp->SetValue_psz(p);
@@ -260,3 +166,92 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
} else
TYPBLK<int>::SetValue(p, n);
+--- a/storage/connect/valblk.h
++++ b/storage/connect/valblk.h
+@@ -139,6 +139,7 @@ class VALBLK : public BLOCK {
+ int Prec; // Precision of float values
+ }; // end of class VALBLK
+
++
+ /***********************************************************************/
+ /* Class TYPBLK: represents a block of typed values. */
+ /***********************************************************************/
+@@ -151,40 +152,41 @@ class TYPBLK : public VALBLK {
+ // Implementation
+ virtual bool Init(PGLOBAL g, bool check);
+ virtual int GetVlen(void) {return sizeof(TYPE);}
+- virtual char GetTinyValue(int n) {return (char)Typp[n];}
+- virtual uchar GetUTinyValue(int n) {return (uchar)Typp[n];}
+- virtual short GetShortValue(int n) {return (short)Typp[n];}
+- virtual ushort GetUShortValue(int n) {return (ushort)Typp[n];}
+- virtual int GetIntValue(int n) {return (int)Typp[n];}
+- virtual uint GetUIntValue(int n) {return (uint)Typp[n];}
+- virtual longlong GetBigintValue(int n) {return (longlong)Typp[n];}
+- virtual ulonglong GetUBigintValue(int n) {return (ulonglong)Typp[n];}
+- virtual double GetFloatValue(int n) {return (double)Typp[n];}
++
++ virtual char GetTinyValue(int n) {return (char)UnalignedRead(n);}
++ virtual uchar GetUTinyValue(int n) {return (uchar)UnalignedRead(n);}
++ virtual short GetShortValue(int n) {return (short)UnalignedRead(n);}
++ virtual ushort GetUShortValue(int n) {return (ushort)UnalignedRead(n);}
++ virtual int GetIntValue(int n) {return (int)UnalignedRead(n);}
++ virtual uint GetUIntValue(int n) {return (uint)UnalignedRead(n);}
++ virtual longlong GetBigintValue(int n) {return (longlong)UnalignedRead(n);}
++ virtual ulonglong GetUBigintValue(int n) {return (ulonglong)UnalignedRead(n);}
++ virtual double GetFloatValue(int n) {return (double)UnalignedRead(n);}
+ virtual char *GetCharString(char *p, int n);
+- virtual void Reset(int n) {Typp[n] = 0;}
++ virtual void Reset(int n) {UnalignedWrite(n, 0);}
+
+ // Methods
+ using VALBLK::SetValue;
+ virtual void SetValue(PCSZ sp, int n);
+ virtual void SetValue(const char *sp, uint len, int n);
+ virtual void SetValue(short sval, int n)
+- {Typp[n] = (TYPE)sval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)sval); SetNull(n, false);}
+ virtual void SetValue(ushort sval, int n)
+- {Typp[n] = (TYPE)sval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)sval); SetNull(n, false);}
+ virtual void SetValue(int lval, int n)
+- {Typp[n] = (TYPE)lval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);}
+ virtual void SetValue(uint lval, int n)
+- {Typp[n] = (TYPE)lval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);}
+ virtual void SetValue(longlong lval, int n)
+- {Typp[n] = (TYPE)lval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);}
+ virtual void SetValue(ulonglong lval, int n)
+- {Typp[n] = (TYPE)lval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);}
+ virtual void SetValue(double fval, int n)
+- {Typp[n] = (TYPE)fval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)fval); SetNull(n, false);}
+ virtual void SetValue(char cval, int n)
+- {Typp[n] = (TYPE)cval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)cval); SetNull(n, false);}
+ virtual void SetValue(uchar cval, int n)
+- {Typp[n] = (TYPE)cval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)cval); SetNull(n, false);}
+ virtual void SetValue(PVAL valp, int n);
+ virtual void SetValue(PVBLK pv, int n1, int n2);
+ virtual void SetMin(PVAL valp, int n);
+@@ -206,6 +208,17 @@ class TYPBLK : public VALBLK {
+ // Members
+ TYPE* const &Typp;
+ const char *Fmt;
++
++ // Unaligned access
++ TYPE UnalignedRead(int n) const {
++ TYPE result;
++ memcpy(&result, Typp + n, sizeof(TYPE));
++ return result;
++ }
++
++ void UnalignedWrite(int n, TYPE value) {
++ memcpy(Typp + n, &value, sizeof(TYPE));
++ }
+ }; // end of class TYPBLK
+
+ /***********************************************************************/
diff --git a/utils/mariadb/patches/160-mips-machine.patch b/utils/mariadb/patches/160-mips-machine.patch
index f7d083243..06d6dd546 100644
--- a/utils/mariadb/patches/160-mips-machine.patch
+++ b/utils/mariadb/patches/160-mips-machine.patch
@@ -1,17 +1,13 @@
-Description: Fix DEFAULT_MACHINE on mips
- The DEFAULT_MACHINE constant is calculated from the CMAKE_SYSTEM_PROCESSOR
- variable which contains the processor which built mariadb. Since most Debian
- buildds run on 64-bit hardware even though they build 32-bit binaries,
- DEFAULT_MACHINE previously contained "mips64" on 32-bit builds. This confuses
- some mroonga tests which rely on DEFAULT_MACHINE to detect 64-bitness.
- .
- This patch fixes the value of DEFAULT_MACHINE so it always contains just "mips"
- on 32-bit mips builds.
-Author: James Cowgill <jcowgill@debian.org>
+From: Debian MySQL Maintainers <pkg-mysql-maint@lists.alioth.debian.org>
+Date: Thu, 10 Aug 2017 20:40:29 +0200
+Subject: mips-machine
+
---
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- mariadb-10.1.orig/cmake/package_name.cmake
-+++ mariadb-10.1/cmake/package_name.cmake
+ cmake/package_name.cmake | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/cmake/package_name.cmake
++++ b/cmake/package_name.cmake
@@ -34,6 +34,10 @@ IF(NOT VERSION)
SET(DEFAULT_MACHINE "mips")
ENDIF()
diff --git a/utils/mariadb/patches/170-ppc-remove-glibc-dep.patch b/utils/mariadb/patches/170-ppc-remove-glibc-dep.patch
index 84637a47d..b66b63776 100644
--- a/utils/mariadb/patches/170-ppc-remove-glibc-dep.patch
+++ b/utils/mariadb/patches/170-ppc-remove-glibc-dep.patch
@@ -1,79 +1,45 @@
-From f5cf70d9d1dc7f4cbeffb7fb75cbbe08720e3873 Mon Sep 17 00:00:00 2001
-From: Gustavo Romero <gromero@br.ibm.com>
-Date: Sun, 26 Mar 2017 15:08:15 +0000
-Subject: [PATCH] Remove dependency on glibc on PPC
-
-Remove dependency on glibc by using gcc builtin function and no glibc
-wrappers.
-
-Currently there are no surrogates in musl for:
-
- __ppc_get_timebase()
- __ppc_set_ppr_low()
- __ppc_set_ppr_med()
-
-however glibc __ppc_get_timebase() is just a wrapper for GCC builtin
-__builtin_get_timebase() available since GCC 4.8 [1], so assuming that
-aports on ppc64le will never be built using GCC < 4.8 we can just
-switch directly to the GCC builtin function.
-
-Also __ppc_set_ppr_{low,med}() are not available on musl but both
-are simple glibc wrappers on a single asm instruction, hence there
-is no harm in using asm directly instead. Actually, using asm
-directly was the first solution adopted in MariaDB [2].
-
-[1] https://goo.gl/jxLV6O
-[2] https://goo.gl/9bjuVC
-
---- a/storage/xtradb/include/ut0ut.h
-+++ b/storage/xtradb/include/ut0ut.h
-@@ -83,9 +83,8 @@ private:
- the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
- independent way by using YieldProcessor. */
- # define UT_RELAX_CPU() YieldProcessor()
--# elif defined(__powerpc__) && defined __GLIBC__
--#include <sys/platform/ppc.h>
--# define UT_RELAX_CPU() __ppc_get_timebase()
-+# elif defined(__powerpc__)
-+# define UT_RELAX_CPU() __builtin_ppc_get_timebase()
- # else
- # define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
- # endif
-@@ -99,9 +98,8 @@ private:
- #endif
+--- a/include/my_cpu.h
++++ b/include/my_cpu.h
+@@ -24,17 +24,16 @@
+ */
- # if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
+ #ifdef _ARCH_PWR8
-#include <sys/platform/ppc.h>
--# define UT_LOW_PRIORITY_CPU() __ppc_set_ppr_low()
--# define UT_RESUME_PRIORITY_CPU() __ppc_set_ppr_med()
-+# define UT_LOW_PRIORITY_CPU() __asm__ __volatile__ ("or 1,1,1")
-+# define UT_RESUME_PRIORITY_CPU() __asm__ __volatile__ ("or 2,2,2")
- # else
- # define UT_LOW_PRIORITY_CPU() ((void)0)
- # define UT_RESUME_PRIORITY_CPU() ((void)0)
---- a/storage/innobase/include/ut0ut.h
-+++ b/storage/innobase/include/ut0ut.h
-@@ -68,9 +68,8 @@ Created 1/20/1994 Heikki Tuuri
- the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
- independent way by using YieldProcessor. */
- # define UT_RELAX_CPU() YieldProcessor()
--#elif defined(__powerpc__) && defined __GLIBC__
--# include <sys/platform/ppc.h>
--# define UT_RELAX_CPU() __ppc_get_timebase()
-+#elif defined(__powerpc__)
-+# define UT_RELAX_CPU() __builtin_ppc_get_timebase()
+ /* Very low priority */
+-#define HMT_very_low() __ppc_set_ppr_very_low()
++#define HMT_very_low() asm volatile("or 31,31,31")
+ /* Low priority */
+-#define HMT_low() __ppc_set_ppr_low()
++#define HMT_low() asm volatile ("or 1,1,1")
+ /* Medium low priority */
+-#define HMT_medium_low() __ppc_set_ppr_med_low()
++#define HMT_medium_low() asm volatile ("or 6,6,6")
+ /* Medium priority */
+-#define HMT_medium() __ppc_set_ppr_med()
++#define HMT_medium() asm volatile ("or 2,2,2")
+ /* Medium high priority */
+-#define HMT_medium_high() __ppc_set_ppr_med_high()
++#define HMT_medium_high() asm volatile("or 5,5,5")
+ /* High priority */
+ #define HMT_high() asm volatile("or 3,3,3")
#else
- # define UT_RELAX_CPU() do { \
- volatile int32 volatile_var; \
-@@ -88,9 +87,8 @@ Created 1/20/1994 Heikki Tuuri
+@@ -72,7 +71,7 @@ static inline void MY_RELAX_CPU(void)
+ __asm__ __volatile__ ("pause");
#endif
-
- #if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
--# include <sys/platform/ppc.h>
--# define UT_LOW_PRIORITY_CPU() __ppc_set_ppr_low()
--# define UT_RESUME_PRIORITY_CPU() __ppc_set_ppr_med()
-+# define UT_LOW_PRIORITY_CPU() __asm__ __volatile__ ("or 1,1,1")
-+# define UT_RESUME_PRIORITY_CPU() __asm__ __volatile__ ("or 2,2,2")
+ #elif defined(_ARCH_PWR8)
+- __ppc_get_timebase();
++ __builtin_ppc_get_timebase();
#else
- # define UT_LOW_PRIORITY_CPU() ((void)0)
- # define UT_RESUME_PRIORITY_CPU() ((void)0)
+ int32 var, oldval = 0;
+ my_atomic_cas32_strong_explicit(&var, &oldval, 1, MY_MEMORY_ORDER_RELAXED,
+--- a/storage/tokudb/PerconaFT/portability/toku_time.h
++++ b/storage/tokudb/PerconaFT/portability/toku_time.h
+@@ -124,7 +124,7 @@ static inline tokutime_t toku_time_now(v
+ __asm __volatile__ ("mrs %[rt], cntvct_el0" : [rt] "=r" (result));
+ return result;
+ #elif defined(__powerpc__)
+- return __ppc_get_timebase();
++ return __builtin_ppc_get_timebase();
+ #else
+ #error No timer implementation for this platform
+ #endif
diff --git a/utils/mariadb/patches/180-libedit.patch b/utils/mariadb/patches/180-libedit.patch
deleted file mode 100644
index edf1ea7f8..000000000
--- a/utils/mariadb/patches/180-libedit.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-commit 2220f7458ef90829eacc457167a28aeba75ca1bc
-Author: Sebastian Kemper <sebastian_ml@gmx.net>
-Date: Sun Dec 9 21:19:24 2018 +0100
-
- cmake: support new libedit interface
-
- libedit changed it's interface a while ago. MariaDB's cmake file doesn't
- recognize the new interface, the compile test fails:
-
- /mariadb-10.2.19/CMakeFiles/CMakeTmp/src.cxx: In function 'int main(int, char**)':
- /mariadb-10.2.19/CMakeFiles/CMakeTmp/src.cxx:6:47: error: invalid conversion from 'char*' to 'int' [-fpermissive]
- int res= (*rl_completion_entry_function)(0,0);
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
-
- Fix this by adding a detection for the new interface as well.
-
- In client/mysql.cc the ifdefs for the new readline interface are
- extended to also check for the new libedit interface. They work the same
- way.
-
- Run-tested on a MIPS machine.
-
- Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
-
---- a/client/mysql.cc
-+++ b/client/mysql.cc
-@@ -2578,7 +2578,7 @@ C_MODE_END
- if not.
- */
-
--#if defined(USE_NEW_READLINE_INTERFACE)
-+#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_NEW_LIBEDIT_INTERFACE)
- static int fake_magic_space(int, int);
- extern "C" char *no_completion(const char*,int)
- #elif defined(USE_LIBEDIT_INTERFACE)
-@@ -2660,7 +2660,7 @@ static int not_in_history(const char *li
- }
-
-
--#if defined(USE_NEW_READLINE_INTERFACE)
-+#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_NEW_LIBEDIT_INTERFACE)
- static int fake_magic_space(int, int)
- #else
- static int fake_magic_space(const char *, int)
-@@ -2677,7 +2677,7 @@ static void initialize_readline (char *n
- rl_readline_name = name;
-
- /* Tell the completer that we want a crack first. */
--#if defined(USE_NEW_READLINE_INTERFACE)
-+#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_NEW_LIBEDIT_INTERFACE)
- rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion;
- rl_completion_entry_function= (rl_compentry_func_t*)&no_completion;
-
-@@ -2707,7 +2707,7 @@ static char **new_mysql_completion(const
- int end __attribute__((unused)))
- {
- if (!status.batch && !quick)
--#if defined(USE_NEW_READLINE_INTERFACE)
-+#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_NEW_LIBEDIT_INTERFACE)
- return rl_completion_matches(text, new_command_generator);
- #else
- return completion_matches((char *)text, (CPFunction *)new_command_generator);
---- a/cmake/readline.cmake
-+++ b/cmake/readline.cmake
-@@ -160,8 +160,20 @@ MACRO (MYSQL_FIND_SYSTEM_LIBEDIT)
- int res= (*rl_completion_entry_function)(0,0);
- completion_matches(0,0);
- }"
-- LIBEDIT_INTERFACE)
-- SET(USE_LIBEDIT_INTERFACE ${LIBEDIT_INTERFACE})
-+ LIBEDIT_HAVE_COMPLETION_INT)
-+
-+ CHECK_CXX_SOURCE_COMPILES("
-+ #include <stdio.h>
-+ #include <readline.h>
-+ int main(int argc, char **argv)
-+ {
-+ char res= *(*rl_completion_entry_function)(0,0);
-+ completion_matches(0,0);
-+ }"
-+ LIBEDIT_HAVE_COMPLETION_CHAR)
-+ IF(LIBEDIT_HAVE_COMPLETION_INT OR LIBEDIT_HAVE_COMPLETION_CHAR)
-+ SET(USE_LIBEDIT_INTERFACE 1)
-+ ENDIF()
- ENDIF()
- ENDMACRO()
-
-@@ -187,6 +199,7 @@ MACRO (MYSQL_CHECK_READLINE)
- IF(USE_LIBEDIT_INTERFACE)
- SET(MY_READLINE_INCLUDE_DIR ${LIBEDIT_INCLUDE_DIR})
- SET(MY_READLINE_LIBRARY ${LIBEDIT_LIBRARY} ${CURSES_LIBRARY})
-+ SET(USE_NEW_LIBEDIT_INTERFACE ${LIBEDIT_HAVE_COMPLETION_CHAR})
- ELSE()
- MYSQL_USE_BUNDLED_READLINE()
- ENDIF()
---- a/config.h.cmake
-+++ b/config.h.cmake
-@@ -113,6 +113,7 @@
- /* Readline */
- #cmakedefine HAVE_HIST_ENTRY 1
- #cmakedefine USE_LIBEDIT_INTERFACE 1
-+#cmakedefine USE_NEW_LIBEDIT_INTERFACE 1
- #cmakedefine USE_NEW_READLINE_INTERFACE 1
-
- #cmakedefine FIONREAD_IN_SYS_IOCTL 1
diff --git a/utils/mariadb/patches/180-relax-mysql_install-db-wrt-pam-tool.patch b/utils/mariadb/patches/180-relax-mysql_install-db-wrt-pam-tool.patch
new file mode 100644
index 000000000..37b331efa
--- /dev/null
+++ b/utils/mariadb/patches/180-relax-mysql_install-db-wrt-pam-tool.patch
@@ -0,0 +1,39 @@
+--- a/scripts/mysql_install_db.sh
++++ b/scripts/mysql_install_db.sh
+@@ -359,6 +359,14 @@ then
+ exit 1
+ fi
+ plugindir=`find_in_dirs --dir auth_pam.so $basedir/lib*/plugin $basedir/lib*/mysql/plugin $basedir/lib/*/mariadb19/plugin`
++ # Upstream assumes all plugins will be always installed, but in OpenWrt we can
++ # install a server without plugins if we want to.
++ if test -z "$plugindir"
++ then
++ echo "Could not find plugin directory." >&2
++ echo "Will continue with \"/usr/lib/mariadb/plugin\"." >&2
++ plugindir=/usr/lib/mariadb/plugin
++ fi
+ pamtooldir=$plugindir
+ # relative from where the script was run for a relocatable install
+ elif test -n "$dirname0" -a -x "$rel_mysqld" -a ! "$rel_mysqld" -ef "@sbindir@/mysqld"
+@@ -478,7 +486,9 @@ do
+ fi
+ done
+
+-if test -n "$user"
++# There should be no need for this on OpenWrt. If this turns out to be a wrong guess then
++# we can revisit.
++if test -n ""
+ then
+ chown $user "$pamtooldir/auth_pam_tool_dir" && \
+ chmod 0700 "$pamtooldir/auth_pam_tool_dir"
+@@ -499,6 +509,10 @@ then
+ echo
+ fi
+ fi
++fi
++
++if test -n "$user"
++then
+ args="$args --user=$user"
+ fi
+