From f7272222218c360740e55c91b15530e54f494a6b Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Sun, 8 Jul 2018 09:54:28 +0200 Subject: [PATCH 1/2] mariadb: fix CPPFLAGS handling The mariadb build system ignores CPPFLAGS. Add them to CFLAGS as a workaround. Signed-off-by: Sebastian Kemper --- utils/mariadb/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/mariadb/Makefile b/utils/mariadb/Makefile index 439ec941f..e32c20b43 100644 --- a/utils/mariadb/Makefile +++ b/utils/mariadb/Makefile @@ -174,6 +174,10 @@ include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk +# Pass CPPFLAGS in the CFLAGS as otherwise the build system will +# ignore them. +TARGET_CFLAGS+=$(TARGET_CPPFLAGS) + define Package/mariadb/install/bin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $(1)/usr/bin endef From 5702078dd0e94adf1a7f671d1037b16131d10244 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Sun, 8 Jul 2018 09:59:15 +0200 Subject: [PATCH 2/2] mariadb: fix uClibc builds mariadb 10.2.x depends on iconv. glibc and musl include iconv, uclibc does not. So for uclibc builds a depend on libiconv-full is required. Signed-off-by: Sebastian Kemper --- utils/mariadb/Makefile | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/utils/mariadb/Makefile b/utils/mariadb/Makefile index e32c20b43..1a2c51482 100644 --- a/utils/mariadb/Makefile +++ b/utils/mariadb/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mariadb PKG_VERSION:=10.2.16 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL := \ @@ -36,6 +36,7 @@ CMAKE_INSTALL:=1 PLUGIN_DIR:=/usr/lib/mysql/plugin MARIADB_COMMON_DEPENDS := \ + +USE_UCLIBC:libiconv-full \ +libatomic \ +libopenssl \ +libstdcpp \ @@ -384,6 +385,13 @@ CMAKE_OPTIONS += \ -DPLUGIN_AUTH_GSSAPI_CLIENT=NO \ -DPLUGIN_CRACKLIB_PASSWORD_CHECK=NO +# musl and glibc include their own iconv, but uclibc does not +ifneq ($(CONFIG_USE_UCLIBC),) +CMAKE_OPTIONS += \ + -DICONV_INCLUDE_DIR=$(STAGING_DIR)/usr/lib/libiconv-full/include \ + -DICONV_LIBRARIES=$(STAGING_DIR)/usr/lib/libiconv-full/lib/libiconv.so +endif + CMAKE_OPTIONS += \ $(foreach p,$(MARIADB_SERVER_PLUGINS),-D$(plugin-$(p))=$(if $(CONFIG_PACKAGE_$(PKG_NAME)-server-plugin-$(subst _,-,$(p))),DYNAMIC,NO)) @@ -426,6 +434,20 @@ define Host/Install $(INSTALL_DATA) $(HOST_BUILD_DIR)/import_executables.cmake $(1)/share/mariadb endef +# 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 do not set the variable when building +# against libiconv-full. + +define Build/Prepare + $(call Build/Prepare/Default) +ifneq ($(CONFIG_USE_UCLIBC),) + $(SED) '/ADD_DEFINITIONS(-DLIBICONV_PLUG)/d' $(PKG_BUILD_DIR)/libmariadb/libmariadb/CMakeLists.txt +endif +endef + 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