mysql: switch from MySQL to Mariadblilik-openwrt-22.03
@ -0,0 +1,542 @@ | |||
# | |||
# Copyright (C) 2018 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 | |||
PKG_VERSION:=10.1.32 | |||
PKG_RELEASE:=1 | |||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | |||
PKG_SOURCE_URL:=https://downloads.mariadb.org/interstitial/$(PKG_NAME)-$(PKG_VERSION)/source | |||
PKG_HASH:=0e2aae6a6a190d07c8e36e87dd43377057fa82651ca3c583462563f3e9369096 | |||
PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net> | |||
PKG_LICENSE:=GPL-2.0 | |||
PKG_LICENSE_FILES:=COPYING | |||
HOST_BUILD_PARALLEL:=1 | |||
PKG_BUILD_PARALLEL:=1 | |||
PKG_USE_MIPS16:=0 | |||
HOST_BUILD_DEPENDS:=libxml2/host | |||
PKG_BUILD_DEPENDS:=mariadb/host | |||
CMAKE_INSTALL:=1 | |||
PLUGIN_DIR:=/usr/lib/mysql/plugin | |||
MARIADB_COMMON_DEPENDS := \ | |||
+libatomic \ | |||
+libopenssl \ | |||
+libstdcpp \ | |||
+zlib | |||
MARIADB_SERVER_PLUGINS := \ | |||
adt_null \ | |||
auth_0x0100 \ | |||
auth_ed25519 \ | |||
auth_socket \ | |||
auth_test_plugin \ | |||
client_ed25519 \ | |||
debug_key_management \ | |||
dialog_examples \ | |||
disks \ | |||
example_key_management \ | |||
feedback \ | |||
file_key_management \ | |||
ha_archive \ | |||
ha_blackhole \ | |||
ha_connect \ | |||
ha_example \ | |||
ha_federated \ | |||
ha_federatedx \ | |||
ha_innodb \ | |||
ha_spider \ | |||
ha_test_sql_discovery \ | |||
handlersocket \ | |||
libdaemon_example \ | |||
locales \ | |||
metadata_lock_info \ | |||
mypluglib \ | |||
qa_auth_client \ | |||
qa_auth_interface \ | |||
qa_auth_server \ | |||
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_$(PKG_NAME)-server-plugin-%,$(subst _,-,$(MARIADB_SERVER_PLUGINS))) \ | |||
CONFIG_PACKAGE_mariadb-server | |||
plugin-adt_null := PLUGIN_AUDIT_NULL | |||
plugin-auth_0x0100 := PLUGIN_AUTH_0X0100 | |||
plugin-auth_ed25519 := PLUGIN_AUTH_ED25519 | |||
plugin-auth_socket := PLUGIN_AUTH_SOCKET | |||
plugin-auth_test_plugin := PLUGIN_AUTH_TEST_PLUGIN | |||
plugin-client_ed25519 := PLUGIN_CLIENT_ED25519 | |||
plugin-debug_key_management := PLUGIN_DEBUG_KEY_MANAGEMENT | |||
plugin-dialog_examples := PLUGIN_DIALOG_EXAMPLES | |||
plugin-disks := PLUGIN_DISKS | |||
plugin-example_key_management := PLUGIN_EXAMPLE_KEY_MANAGEMENT | |||
plugin-feedback := PLUGIN_FEEDBACK | |||
plugin-file_key_management := PLUGIN_FILE_KEY_MANAGEMENT | |||
plugin-ha_archive := PLUGIN_ARCHIVE | |||
plugin-ha_blackhole := PLUGIN_BLACKHOLE | |||
plugin-ha_connect := PLUGIN_CONNECT | |||
plugin-ha_example := PLUGIN_EXAMPLE | |||
plugin-ha_federated := PLUGIN_FEDERATED | |||
plugin-ha_federatedx := PLUGIN_FEDERATEDX | |||
plugin-ha_innodb := PLUGIN_INNOBASE | |||
plugin-ha_spider := PLUGIN_SPIDER | |||
plugin-ha_test_sql_discovery := PLUGIN_TEST_SQL_DISCOVERY | |||
plugin-handlersocket := PLUGIN_HANDLERSOCKET | |||
plugin-libdaemon_example := PLUGIN_DAEMON_EXAMPLE | |||
plugin-locales := PLUGIN_LOCALES | |||
plugin-metadata_lock_info := PLUGIN_METADATA_LOCK_INFO | |||
plugin-mypluglib := PLUGIN_FTEXAMPLE | |||
plugin-qa_auth_client := PLUGIN_QA_AUTH_CLIENT | |||
plugin-qa_auth_interface := PLUGIN_QA_AUTH_INTERFACE | |||
plugin-qa_auth_server := PLUGIN_QA_AUTH_SERVER | |||
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 | |||
plugin-wsrep_info := PLUGIN_WSREP_INFO | |||
MARIADB_CLIENT := \ | |||
mysql \ | |||
mysqlcheck | |||
MARIADB_CLIENT_EXTRA := \ | |||
mysql_find_rows \ | |||
mysql_waitpid \ | |||
mysqlaccess \ | |||
mysqladmin \ | |||
mysqldump \ | |||
mysqlimport \ | |||
mysqlshow \ | |||
mysqlslap \ | |||
mytop | |||
MARIADB_SERVER := \ | |||
innochecksum \ | |||
my_print_defaults \ | |||
mysql_install_db \ | |||
mysql_upgrade \ | |||
mysqld | |||
MARIADB_SERVER_EXTRA := \ | |||
aria* \ | |||
mariabackup \ | |||
msql2mysql \ | |||
myisam_ftdump \ | |||
myisamchk \ | |||
myisamlog \ | |||
myisampack \ | |||
mysql_convert_table_format \ | |||
mysql_fix_extensions \ | |||
mysql_plugin \ | |||
mysql_secure_installation \ | |||
mysql_setpermission \ | |||
mysql_tzinfo_to_sql \ | |||
mysqlbinlog \ | |||
mysqld_multi \ | |||
mysqld_safe \ | |||
mysqld_safe_helper \ | |||
mysqldumpslow \ | |||
mysqlhotcopy \ | |||
perror \ | |||
replace \ | |||
resolve_stack_dump | |||
include $(INCLUDE_DIR)/package.mk | |||
include $(INCLUDE_DIR)/host-build.mk | |||
include $(INCLUDE_DIR)/cmake.mk | |||
define Package/mariadb/install/bin | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $(1)/usr/bin | |||
endef | |||
define Package/mariadb/description/Default | |||
MariaDB is a fast, stable and true multi-user, multi-threaded SQL | |||
database server. SQL (Structured Query Language) is the most popular | |||
database query language in the world. The main goals of MariaDB are | |||
speed, robustness and ease of use. | |||
endef | |||
define Package/libmariadbclient | |||
SECTION:=libs | |||
CATEGORY:=Libraries | |||
DEPENDS:=$(MARIADB_COMMON_DEPENDS) | |||
TITLE:=MariaDB database client library | |||
URL:=https://mariadb.org/ | |||
PROVIDES:=libmysqlclient libmysqlclient-r | |||
endef | |||
define Package/libmariadbclient/description | |||
$(call Package/mariadb/description/Default) | |||
This package includes the client library. | |||
endef | |||
define Package/mariadb/Default | |||
SECTION:=utils | |||
CATEGORY:=Utilities | |||
URL:=https://mariadb.org/ | |||
SUBMENU:=database | |||
endef | |||
define Package/mariadb-client | |||
$(call Package/mariadb/Default) | |||
TITLE:=MariaDB database core client binaries | |||
DEPENDS:= \ | |||
$(MARIADB_COMMON_DEPENDS) \ | |||
+libncursesw | |||
endef | |||
define Package/mariadb-client/description | |||
$(call Package/mariadb/description/Default) | |||
This package includes the following core client binaries: | |||
$(subst $(space),$(newline),$(MARIADB_CLIENT)) | |||
endef | |||
define Package/mariadb-client-extra | |||
$(call Package/mariadb/Default) | |||
TITLE:=MariaDB database extra client binaries | |||
DEPENDS:=mariadb-client | |||
endef | |||
define Package/mariadb-client-extra/description | |||
$(call Package/mariadb/description/Default) | |||
This package includes the following extra client binaries: | |||
$(subst $(space),$(newline),$(MARIADB_CLIENT_EXTRA)) | |||
endef | |||
define Package/mariadb-extra-charsets | |||
$(call Package/mariadb/Default) | |||
TITLE:=MariaDB database extra character sets | |||
DEPENDS:=mariadb-server | |||
endef | |||
define Package/mariadb-extra-charsets/description | |||
$(call Package/mariadb/description/Default) | |||
The MariaDB server packaged by OpenWrt only provides support for UTF-8. | |||
This package contains single Byte character sets and collations that can | |||
be added at run time. | |||
endef | |||
define Package/mariadb-server | |||
$(call Package/mariadb/Default) | |||
DEPENDS:= \ | |||
$(MARIADB_COMMON_DEPENDS) \ | |||
+!arc:libaio \ | |||
+liblzma \ | |||
+libpcre \ | |||
+resolveip | |||
TITLE:=MariaDB database core server binaries | |||
MENU:=1 | |||
PROVIDES:=mysql-server | |||
endef | |||
define Package/mariadb-server/description | |||
$(call Package/mariadb/description/Default) | |||
This package includes the following core server binaries: | |||
$(subst $(space),$(newline),$(MARIADB_SERVER)) | |||
endef | |||
define Package/mariadb-server-extra | |||
$(call Package/mariadb/Default) | |||
TITLE:=MariaDB database extra server binaries | |||
DEPENDS:=mariadb-server | |||
endef | |||
define Package/mariadb-server-extra/description | |||
$(call Package/mariadb/description/Default) | |||
This package includes the following extra server binaries: | |||
$(subst $(space),$(newline),$(MARIADB_SERVER_EXTRA)) | |||
endef | |||
# We won't need unit tests | |||
CMAKE_OPTIONS += -DWITH_UNIT_TESTS=0 | |||
# This value is determined automatically during straight compile by compiling | |||
# and running a test code. You cannot do that during cross-compile. However the | |||
# stack grows downward in most if not all modern systems. The only exception | |||
# according to buildroot is PA-RISC which is not supported by OpenWrt as far as | |||
# I know. Therefore it makes sense to hardcode the value. If an arch is added | |||
# the stack of which grows up one should expect unpredictable behavior at run | |||
# time. | |||
CMAKE_OPTIONS += -DSTACK_DIRECTION=-1 | |||
# Jemalloc was added for TokuDB. Since its configure script seems somewhat broken | |||
# when it comes to cross-compilation we shall disable it and also disable TokuDB. | |||
CMAKE_OPTIONS += -DWITH_JEMALLOC=no -DWITHOUT_TOKUDB=1 | |||
# Make it explicit that we are cross-compiling | |||
CMAKE_OPTIONS += -DCMAKE_CROSSCOMPILING=1 | |||
# Explicitly disable dtrace to avoid detection of a host version | |||
CMAKE_OPTIONS += -DENABLE_DTRACE=0 | |||
# Prevent mariadb from messing with OpenWrt's C(XX)FLAGS | |||
CMAKE_OPTIONS += -DSECURITY_HARDENED=OFF | |||
ifeq ($(CONFIG_PACKAGE_mariadb-server),) | |||
CMAKE_OPTIONS += -DWITHOUT_SERVER=ON | |||
else | |||
CMAKE_OPTIONS += -DWITHOUT_SERVER=OFF | |||
endif | |||
CMAKE_OPTIONS += \ | |||
-DCONNECT_WITH_JDBC=NO \ | |||
-DCONNECT_WITH_LIBXML2=system \ | |||
-DCONNECT_WITH_ODBC=NO \ | |||
-DDEFAULT_CHARSET=utf8 \ | |||
-DDEFAULT_COLLATION=utf8_general_ci \ | |||
-DDISABLE_SHARED=NO \ | |||
-DENABLED_PROFILING=OFF \ | |||
-DENABLE_STATIC_LIBS=OFF \ | |||
-DINSTALL_DOCDIR=share/doc/mariadb \ | |||
-DINSTALL_DOCREADMEDIR=share/doc/mariadb \ | |||
-DINSTALL_MANDIR=share/man \ | |||
-DINSTALL_MYSQLSHAREDIR=share/mysql \ | |||
-DINSTALL_MYSQLTESTDIR="" \ | |||
-DINSTALL_PLUGINDIR=lib/mysql/plugin \ | |||
-DINSTALL_SBINDIR=bin \ | |||
-DINSTALL_SCRIPTDIR=bin \ | |||
-DINSTALL_SQLBENCHDIR="" \ | |||
-DINSTALL_SUPPORTFILESDIR=share/mysql \ | |||
-DMYSQLD_USER=root \ | |||
-DMYSQL_DATADIR=/var/lib/mysql \ | |||
-DMYSQL_UNIX_ADDR=/var/run/mysqld.sock \ | |||
-DSKIP_TESTS=ON \ | |||
-DWITH_ASAN=OFF \ | |||
-DWITH_EMBEDDED_SERVER=OFF \ | |||
-DWITH_EXTRA_CHARSETS=none \ | |||
-DWITH_INNODB_BZIP2=OFF \ | |||
-DWITH_INNODB_LZ4=OFF \ | |||
-DWITH_INNODB_LZMA=ON \ | |||
-DWITH_INNODB_LZO=OFF \ | |||
-DWITH_INNODB_SNAPPY=OFF \ | |||
-DWITH_LIBEDIT=OFF \ | |||
-DWITH_LIBNUMA=NO \ | |||
-DWITH_LIBWRAP=OFF \ | |||
-DWITH_LIBWSEP=OFF \ | |||
-DWITH_MARIABACKUP=ON \ | |||
-DWITH_PCRE=system \ | |||
-DWITH_READLINE=OFF \ | |||
-DWITH_SAFEMALLOC=OFF \ | |||
-DWITH_SSL=system \ | |||
-DWITH_SYSTEMD=no \ | |||
-DWITH_VALGRIND=OFF \ | |||
-DWITH_ZLIB=system | |||
# Default-disable some modules | |||
CMAKE_OPTIONS += \ | |||
-DPLUGIN_CASSANDRA=NO \ | |||
-DPLUGIN_MROONGA=NO \ | |||
-DPLUGIN_OQGRAPH=NO \ | |||
-DPLUGIN_ROCKSDB=NO \ | |||
-DPLUGIN_SPHINX=NO \ | |||
-DPLUGIN_TOKUDB=NO \ | |||
-DPLUGIN_AUTH_PAM=NO \ | |||
-DPLUGIN_AUTH_GSSAPI=NO \ | |||
-DPLUGIN_AUTH_GSSAPI_CLIENT=NO \ | |||
-DPLUGIN_CRACKLIB_PASSWORD_CHECK=NO | |||
CMAKE_OPTIONS += \ | |||
$(foreach p,$(MARIADB_SERVER_PLUGINS),-D$(plugin-$(p))=$(if $(CONFIG_PACKAGE_$(PKG_NAME)-server-plugin-$(subst _,-,$(p))),DYNAMIC,NO)) | |||
# 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. | |||
# | |||
# Add "$(STAGING_DIR_HOSTPKG)/lib" to the RPATH of the host helpers, | |||
# otherwise they might not find the location of a library at run time. | |||
CMAKE_HOST_OPTIONS += \ | |||
-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE \ | |||
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \ | |||
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \ | |||
-DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOSTPKG)/lib" \ | |||
-DCMAKE_SKIP_RPATH=FALSE \ | |||
-DWITHOUT_SERVER=OFF \ | |||
-DWITHOUT_TOKUDB=1 | |||
# Some helpers must be compiled for host in order to crosscompile mariadb for | |||
# the target. They are then included by import_executables.cmake which is | |||
# generated during the build of the host helpers. It is not necessary to build | |||
# the whole host package, only the "import_executables" target. | |||
# -DIMPORT_EXECUTABLES=$(HOST_BUILD_DIR)/import_executables.cmake | |||
# must then be passed to cmake during target build. | |||
# see also https://mariadb.com/kb/en/mariadb/cross-compiling-mariadb/ | |||
CMAKE_OPTIONS += -DIMPORT_EXECUTABLES=$(STAGING_DIR_HOSTPKG)/share/mariadb/import_executables.cmake | |||
define Host/Compile | |||
$(call Host/Compile/Default,import_executables) | |||
endef | |||
define Host/Install | |||
$(SED) 's|$(HOST_BUILD_DIR)|$(STAGING_DIR_HOSTPKG)/share/mariadb|' $(HOST_BUILD_DIR)/import_executables.cmake | |||
$(INSTALL_DIR) $(1)/share/mariadb/{dbug,extra,scripts,sql} | |||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/dbug/factorial $(1)/share/mariadb/dbug | |||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/extra/comp_err $(1)/share/mariadb/extra | |||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/scripts/comp_sql $(1)/share/mariadb/scripts | |||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/sql/{gen_lex_hash,gen_lex_token} $(1)/share/mariadb/sql | |||
$(INSTALL_DATA) $(HOST_BUILD_DIR)/import_executables.cmake $(1)/share/mariadb | |||
endef | |||
define Build/InstallDev | |||
$(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(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/libmysqlclient*.so* $(1)/usr/lib/ | |||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/pkgconfig/mariadb.pc $(1)/usr/lib/pkgconfig | |||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/aclocal/mysql.m4 $(1)/usr/share/aclocal | |||
endef | |||
define Package/libmariadbclient/install | |||
$(INSTALL_DIR) $(1)$(PLUGIN_DIR) | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libmysqlclient*.so* $(1)/usr/lib/ | |||
$(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) | |||
endef | |||
define Package/mariadb-client/install | |||
$(INSTALL_DIR) $(1)/usr/bin | |||
$(foreach b,$(MARIADB_CLIENT),$(call Package/mariadb/install/bin,$(1),$(b));) | |||
endef | |||
define Package/mariadb-client-extra/install | |||
$(INSTALL_DIR) $(1)/usr/bin | |||
$(foreach b,$(MARIADB_CLIENT_EXTRA),$(call Package/mariadb/install/bin,$(1),$(b));) | |||
endef | |||
define Package/mariadb-extra-charsets/install | |||
$(INSTALL_DIR) $(1)/usr/share/mysql/charsets | |||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/charsets/* $(1)/usr/share/mysql/charsets | |||
endef | |||
define Package/mariadb-server/install | |||
$(INSTALL_DIR) $(1)/usr/bin | |||
$(foreach b,$(MARIADB_SERVER),$(call Package/mariadb/install/bin,$(1),$(b));) | |||
$(INSTALL_DIR) $(1)/etc/init.d/ | |||
$(INSTALL_DIR) $(1)/etc/mysql | |||
$(INSTALL_BIN) files/mysqld.init $(1)/etc/init.d/mysqld | |||
$(INSTALL_CONF) conf/my.cnf $(1)/etc/mysql | |||
$(INSTALL_DIR) $(1)$(PLUGIN_DIR) | |||
$(INSTALL_CONF) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/daemon_example.ini $(1)$(PLUGIN_DIR) | |||
$(INSTALL_DIR) $(1)/usr/share/mysql/english | |||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/english/errmsg.sys $(1)/usr/share/mysql/english | |||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/fill_help_tables.sql $(1)/usr/share/mysql/ | |||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/maria_add_gis_sp_bootstrap.sql $(1)/usr/share/mysql/ | |||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_performance_tables.sql $(1)/usr/share/mysql/ | |||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables.sql $(1)/usr/share/mysql/ | |||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables_data.sql $(1)/usr/share/mysql/ | |||
endef | |||
define Package/mariadb-server-extra/install | |||
$(INSTALL_DIR) $(1)/usr/bin | |||
$(foreach b,$(MARIADB_SERVER_EXTRA),$(call Package/mariadb/install/bin,$(1),$(b));) | |||
endef | |||
define Package/mariadb-server/conffiles | |||
/etc/mysql/my.cnf | |||
/usr/lib/mysql/plugin/daemon_example.ini | |||
endef | |||
define BuildPlugin | |||
define Package/$(PKG_NAME)-server-plugin-$(subst _,-,$(1)) | |||
$$(call Package/mariadb/Default) | |||
TITLE:=MariaDB database plugin | |||
DEPENDS:=mariadb-server $(patsubst +%,+PACKAGE_$(PKG_NAME)-server-plugin-$(subst _,-,$(1)):%,$(2)) | |||
endef | |||
define Package/$(PKG_NAME)-server-plugin-$(subst _,-,$(1))/description | |||
$$(call Package/mariadb/description/Default) | |||
This package provides the $(1) plugin. | |||
endef | |||
define Package/$(PKG_NAME)-server-plugin-$(subst _,-,$(1))/install | |||
$(INSTALL_DIR) $$(1)$(PLUGIN_DIR) | |||
$(INSTALL_BIN) \ | |||
$(PKG_INSTALL_DIR)$(PLUGIN_DIR)/$(1).so \ | |||
$$(1)$(PLUGIN_DIR) | |||
endef | |||
$$(eval $$(call BuildPackage,$(PKG_NAME)-server-plugin-$(subst _,-,$(1)))) | |||
endef | |||
$(eval $(call HostBuild)) | |||
$(eval $(call BuildPackage,libmariadbclient)) | |||
$(eval $(call BuildPackage,mariadb-client)) | |||
$(eval $(call BuildPackage,mariadb-client-extra)) | |||
$(eval $(call BuildPackage,mariadb-extra-charsets)) | |||
$(eval $(call BuildPackage,mariadb-server)) | |||
$(eval $(call BuildPackage,mariadb-server-extra)) | |||
$(eval $(call BuildPlugin,adt_null,)) | |||
$(eval $(call BuildPlugin,auth_0x0100,)) | |||
$(eval $(call BuildPlugin,auth_ed25519,)) | |||
$(eval $(call BuildPlugin,auth_socket,)) | |||
$(eval $(call BuildPlugin,auth_test_plugin,)) | |||
$(eval $(call BuildPlugin,client_ed25519,)) | |||
$(eval $(call BuildPlugin,debug_key_management,)) | |||
$(eval $(call BuildPlugin,dialog_examples,)) | |||
$(eval $(call BuildPlugin,disks,)) | |||
$(eval $(call BuildPlugin,example_key_management,)) | |||
$(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_innodb,)) | |||
$(eval $(call BuildPlugin,ha_spider,)) | |||
$(eval $(call BuildPlugin,ha_test_sql_discovery,)) | |||
$(eval $(call BuildPlugin,handlersocket,)) | |||
$(eval $(call BuildPlugin,libdaemon_example,)) | |||
$(eval $(call BuildPlugin,locales,)) | |||
$(eval $(call BuildPlugin,metadata_lock_info,)) | |||
$(eval $(call BuildPlugin,mypluglib,)) | |||
$(eval $(call BuildPlugin,qa_auth_client,)) | |||
$(eval $(call BuildPlugin,qa_auth_interface,)) | |||
$(eval $(call BuildPlugin,qa_auth_server,)) | |||
$(eval $(call BuildPlugin,query_cache_info,)) | |||
$(eval $(call BuildPlugin,query_response_time,)) | |||
$(eval $(call BuildPlugin,semisync_master,)) | |||
$(eval $(call BuildPlugin,semisync_slave,)) | |||
$(eval $(call BuildPlugin,server_audit,)) | |||
$(eval $(call BuildPlugin,simple_password_check,)) | |||
$(eval $(call BuildPlugin,sql_errlog,)) | |||
$(eval $(call BuildPlugin,wsrep_info,)) |
@ -0,0 +1,11 @@ | |||
--- 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() | |||
ENDIF() | |||
IF(NOT HAVE_PCRE_STACK_GUARD OR NOT PCRE_STACK_SIZE_OK OR |
@ -0,0 +1,18 @@ | |||
--- a/configure.cmake | |||
+++ b/configure.cmake | |||
@@ -1107,9 +1107,12 @@ SET(CMAKE_EXTRA_INCLUDE_FILES) | |||
CHECK_STRUCT_HAS_MEMBER("struct dirent" d_ino "dirent.h" STRUCT_DIRENT_HAS_D_INO) | |||
CHECK_STRUCT_HAS_MEMBER("struct dirent" d_namlen "dirent.h" STRUCT_DIRENT_HAS_D_NAMLEN) | |||
SET(SPRINTF_RETURNS_INT 1) | |||
-CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H) | |||
-IF(NOT HAVE_UCONTEXT_H) | |||
- CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_UCONTEXT_H) | |||
+CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_HEADER) | |||
+IF(NOT HAVE_UCONTEXT_HEADER) | |||
+ CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_UCONTEXT_HEADER) | |||
+ENDIF() | |||
+IF(HAVE_UCONTEXT_HEADER) | |||
+ CHECK_FUNCTION_EXISTS(makecontext HAVE_UCONTEXT_H) | |||
ENDIF() | |||
IF(HAVE_UCONTEXT_H) | |||
CHECK_FUNCTION_EXISTS(makecontext HAVE_UCONTEXT_H) |
@ -0,0 +1,121 @@ | |||
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> | |||
--- 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=") | |||
@@ -1038,7 +1038,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) | |||
+ 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-1301 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 | |||
+#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 | |||
--- a/include/atomic/nolock.h | |||
+++ b/include/atomic/nolock.h | |||
@@ -17,7 +17,7 @@ | |||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ | |||
#if defined(__i386__) || defined(_MSC_VER) || defined(__x86_64__) \ | |||
- || defined(HAVE_GCC_ATOMIC_BUILTINS) \ | |||
+ || defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_GCC_C11_ATOMICS) \ | |||
|| defined(HAVE_SOLARIS_ATOMIC) | |||
# ifdef MY_ATOMIC_MODE_DUMMY | |||
@@ -41,7 +41,7 @@ | |||
# elif __GNUC__ | |||
# if defined(HAVE_SOLARIS_ATOMIC) | |||
# include "solaris.h" | |||
-# elif defined(HAVE_GCC_ATOMIC_BUILTINS) | |||
+# elif defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_GCC_C11_ATOMICS) | |||
# include "gcc_builtins.h" | |||
# elif defined(__i386__) || defined(__x86_64__) | |||
# include "x86-gcc.h" | |||
--- a/mysys/CMakeLists.txt | |||
+++ b/mysys/CMakeLists.txt | |||
@@ -78,6 +78,10 @@ IF(HAVE_BFD_H) | |||
TARGET_LINK_LIBRARIES(mysys bfd) | |||
ENDIF(HAVE_BFD_H) | |||
+IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC) | |||
+ TARGET_LINK_LIBRARIES(mysys atomic) | |||
+ENDIF() | |||
+ | |||
IF (WIN32) | |||
TARGET_LINK_LIBRARIES(mysys IPHLPAPI) | |||
ENDIF(WIN32) | |||
--- a/sql/CMakeLists.txt | |||
+++ b/sql/CMakeLists.txt | |||
@@ -165,6 +165,10 @@ TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATI | |||
${SSL_LIBRARIES} | |||
${LIBSYSTEMD}) | |||
+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) |
@ -0,0 +1,262 @@ | |||
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> | |||
--- | |||
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 | |||
/***********************************************************************/ | |||
--- a/storage/connect/valblk.cpp | |||
+++ b/storage/connect/valblk.cpp | |||
@@ -266,14 +266,14 @@ bool TYPBLK<TYPE>::Init(PGLOBAL g, bool | |||
template <class TYPE> | |||
char *TYPBLK<TYPE>::GetCharString(char *p, int n) | |||
{ | |||
- sprintf(p, Fmt, Typp[n]); | |||
+ sprintf(p, Fmt, UnalignedRead(n)); | |||
return p; | |||
} // end of GetCharString | |||
template <> | |||
char *TYPBLK<double>::GetCharString(char *p, int n) | |||
{ | |||
- sprintf(p, Fmt, Prec, Typp[n]); | |||
+ sprintf(p, Fmt, Prec, UnalignedRead(n)); | |||
return p; | |||
} // end of GetCharString | |||
@@ -289,7 +289,7 @@ void TYPBLK<TYPE>::SetValue(PVAL valp, i | |||
ChkTyp(valp); | |||
if (!(b = valp->IsNull())) | |||
- Typp[n] = GetTypedValue(valp); | |||
+ UnalignedWrite(n, GetTypedValue(valp)); | |||
else | |||
Reset(n); | |||
@@ -351,9 +351,9 @@ void TYPBLK<TYPE>::SetValue(PCSZ p, int | |||
ulonglong val = CharToNumber(p, strlen(p), maxval, Unsigned, &minus); | |||
if (minus && val < maxval) | |||
- Typp[n] = (TYPE)(-(signed)val); | |||
+ UnalignedWrite(n, (TYPE)(-(signed)val)); | |||
else | |||
- Typp[n] = (TYPE)val; | |||
+ UnalignedWrite(n, (TYPE)val); | |||
SetNull(n, false); | |||
} // end of SetValue | |||
@@ -396,7 +396,7 @@ void TYPBLK<double>::SetValue(PCSZ p, in | |||
throw Type; | |||
} // endif Check | |||
- Typp[n] = atof(p); | |||
+ UnalignedWrite(n, atof(p)); | |||
SetNull(n, false); | |||
} // end of SetValue | |||
@@ -428,7 +428,7 @@ void TYPBLK<TYPE>::SetValue(PVBLK pv, in | |||
ChkTyp(pv); | |||
if (!(b = pv->IsNull(n2) && Nullable)) | |||
- Typp[n1] = GetTypedValue(pv, n2); | |||
+ UnalignedWrite(n1, GetTypedValue(pv, n2)); | |||
else | |||
Reset(n1); | |||
@@ -479,10 +479,10 @@ void TYPBLK<TYPE>::SetMin(PVAL valp, int | |||
{ | |||
CheckParms(valp, n) | |||
TYPE tval = GetTypedValue(valp); | |||
- TYPE& tmin = Typp[n]; | |||
+ TYPE tmin = UnalignedRead(n); | |||
if (tval < tmin) | |||
- tmin = tval; | |||
+ UnalignedWrite(n, tval); | |||
} // end of SetMin | |||
@@ -494,10 +494,10 @@ void TYPBLK<TYPE>::SetMax(PVAL valp, int | |||
{ | |||
CheckParms(valp, n) | |||
TYPE tval = GetTypedValue(valp); | |||
- TYPE& tmin = Typp[n]; | |||
+ TYPE tmin = UnalignedRead(n); | |||
if (tval > tmin) | |||
- tmin = tval; | |||
+ UnalignedWrite(n, tval); | |||
} // end of SetMax | |||
@@ -511,8 +511,7 @@ void TYPBLK<TYPE>::SetValues(PVBLK pv, i | |||
CheckType(pv) | |||
TYPE *lp = ((TYPBLK*)pv)->Typp; | |||
- for (register int i = k; i < n; i++) // TODO | |||
- Typp[i] = lp[i]; | |||
+ memcpy(Typp + k, lp + k, sizeof(TYPE) * n); | |||
} // end of SetValues | |||
#endif // 0 | |||
@@ -523,7 +522,7 @@ void TYPBLK<TYPE>::SetValues(PVBLK pv, i | |||
template <class TYPE> | |||
void TYPBLK<TYPE>::Move(int i, int j) | |||
{ | |||
- Typp[j] = Typp[i]; | |||
+ UnalignedWrite(j, UnalignedRead(i)); | |||
MoveNull(i, j); | |||
} // end of Move | |||
@@ -537,7 +536,7 @@ int TYPBLK<TYPE>::CompVal(PVAL vp, int n | |||
ChkIndx(n); | |||
ChkTyp(vp); | |||
#endif // _DEBUG | |||
- TYPE mlv = Typp[n]; | |||
+ TYPE mlv = UnalignedRead(n); | |||
TYPE vlv = GetTypedValue(vp); | |||
return (vlv > mlv) ? 1 : (vlv < mlv) ? (-1) : 0; | |||
@@ -549,8 +548,8 @@ int TYPBLK<TYPE>::CompVal(PVAL vp, int n | |||
template <class TYPE> | |||
int TYPBLK<TYPE>::CompVal(int i1, int i2) | |||
{ | |||
- TYPE lv1 = Typp[i1]; | |||
- TYPE lv2 = Typp[i2]; | |||
+ TYPE lv1 = UnalignedRead(i1); | |||
+ TYPE lv2 = UnalignedRead(i2); | |||
return (lv1 > lv2) ? 1 : (lv1 < lv2) ? (-1) : 0; | |||
} // end of CompVal | |||
@@ -587,7 +586,7 @@ int TYPBLK<TYPE>::Find(PVAL vp) | |||
TYPE n = GetTypedValue(vp); | |||
for (i = 0; i < Nval; i++) | |||
- if (n == Typp[i]) | |||
+ if (n == UnalignedRead(i)) | |||
break; | |||
return (i < Nval) ? i : (-1); | |||
@@ -603,7 +602,7 @@ int TYPBLK<TYPE>::GetMaxLength(void) | |||
int i, n, m; | |||
for (i = n = 0; i < Nval; i++) { | |||
- m = sprintf(buf, Fmt, Typp[i]); | |||
+ m = sprintf(buf, Fmt, UnalignedRead(i)); | |||
n = MY_MAX(n, m); | |||
} // endfor i | |||
@@ -1333,7 +1332,7 @@ char *DATBLK::GetCharString(char *p, int | |||
char *vp; | |||
if (Dvalp) { | |||
- Dvalp->SetValue(Typp[n]); | |||
+ Dvalp->SetValue(UnalignedRead(n)); | |||
vp = Dvalp->GetCharString(p); | |||
} else | |||
vp = TYPBLK<int>::GetCharString(p, n); | |||
@@ -1349,7 +1348,7 @@ void DATBLK::SetValue(PCSZ p, int n) | |||
if (Dvalp) { | |||
// Decode the string according to format | |||
Dvalp->SetValue_psz(p); | |||
- Typp[n] = Dvalp->GetIntValue(); | |||
+ UnalignedWrite(n, Dvalp->GetIntValue()); | |||
} else | |||
TYPBLK<int>::SetValue(p, n); | |||
@ -0,0 +1,14 @@ | |||
Author: James Cowgill <jcowgill@debian.org> | |||
Description: fix FTBFS on 32-bit mips* | |||
Bug-Debian: #864298 | |||
--- a/storage/innobase/include/os0sync.h | |||
+++ b/storage/innobase/include/os0sync.h | |||
@@ -37,6 +37,7 @@ Created 9/6/1995 Heikki Tuuri | |||
#include "univ.i" | |||
#include "ut0lst.h" | |||
+#include "sync0types.h" | |||
/** CPU cache line size */ | |||
#ifdef __powerpc__ |
@ -0,0 +1,25 @@ | |||
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> | |||
--- | |||
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 | |||
@@ -34,6 +34,10 @@ IF(NOT VERSION) | |||
SET(DEFAULT_MACHINE "mips") | |||
ENDIF() | |||
+ IF(NOT 64BIT AND CMAKE_SYSTEM_PROCESSOR MATCHES "^mips64") | |||
+ SET(DEFAULT_MACHINE "mips") | |||
+ ENDIF() | |||
+ | |||
IF(CMAKE_SYSTEM_NAME MATCHES "Windows") | |||
SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 0) | |||
SET(DEFAULT_PLATFORM "win") |
@ -0,0 +1,75 @@ | |||
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 | |||
@@ -86,8 +86,7 @@ private: | |||
independent way by using YieldProcessor. */ | |||
# define UT_RELAX_CPU() YieldProcessor() | |||
# elif defined(__powerpc__) | |||
-#include <sys/platform/ppc.h> | |||
-# define UT_RELAX_CPU() __ppc_get_timebase() | |||
+# define UT_RELAX_CPU() __builtin_ppc_get_timebase() | |||
# else | |||
# define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */ | |||
# endif | |||
@@ -101,9 +100,8 @@ private: | |||
#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") | |||
# 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 | |||
@@ -89,8 +89,7 @@ private: | |||
independent way by using YieldProcessor. */ | |||
# define UT_RELAX_CPU() YieldProcessor() | |||
# elif defined(__powerpc__) | |||
-#include <sys/platform/ppc.h> | |||
-# define UT_RELAX_CPU() __ppc_get_timebase() | |||
+# define UT_RELAX_CPU() __builtin_ppc_get_timebase() | |||
# else | |||
# define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */ | |||
# endif | |||
@@ -104,9 +103,8 @@ private: | |||
#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") | |||
# else | |||
# define UT_LOW_PRIORITY_CPU() ((void)0) | |||
# define UT_RESUME_PRIORITY_CPU() ((void)0) |
@ -1,186 +0,0 @@ | |||
# | |||
# Copyright (C) 2006-2018 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
include $(INCLUDE_DIR)/uclibc++.mk | |||
PKG_NAME:=mysql | |||
PKG_VERSION:=5.1.73 | |||
PKG_RELEASE:=3 | |||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | |||
PKG_SOURCE_URL:=\ | |||
http://mysql.he.net/Downloads/MySQL-5.1/ \ | |||
http://www.linorg.usp.br/mysql/Downloads/MySQL-5.1/ \ | |||
http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.1/ \ | |||
http://mirror.switch.ch/ftp/mirror/mysql/Downloads/MySQL-5.1/ | |||
PKG_HASH:=05ebe21305408b24407d14b77607a3e5ffa3c300e03f1359d3066f301989dcb5 | |||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io> | |||
PKG_LICENSE:=GPL-2.0 | |||
PKG_BUILD_PARALLEL:=1 | |||
PKG_USE_MIPS16:=0 | |||
PKG_FIXUP:=libtool | |||
include $(INCLUDE_DIR)/package.mk | |||
define Package/libmysqlclient/Default | |||
SECTION:=libs | |||
CATEGORY:=Libraries | |||
DEPENDS:=$(CXX_DEPENDS) +zlib | |||
TITLE:=MySQL client library | |||
URL:=http://dev.mysql.com/ | |||
endef | |||
define Package/mysql-server | |||
SECTION:=utils | |||
CATEGORY:=Utilities | |||
DEPENDS:=+libmysqlclient +libpthread +libncurses +libreadline | |||
TITLE:=MySQL Server | |||
URL:=http://dev.mysql.com/ | |||
SUBMENU:=database | |||
endef | |||
define Package/libmysqlclient | |||
$(call Package/libmysqlclient/Default) | |||
endef | |||
define Package/libmysqlclient-r | |||
$(call Package/libmysqlclient/Default) | |||
TITLE += threadsafe | |||
DEPENDS+= +libpthread | |||
endef | |||
ifneq ($(CONFIG_USE_UCLIBCXX),) | |||
TARGET_CXX=g++-uc | |||
endif | |||
CONFIGURE_ARGS += \ | |||
--enable-shared \ | |||
--enable-static \ | |||
--enable-thread-safe-client \ | |||
--disable-assembler \ | |||
--with-pthread \ | |||
--with-server \ | |||
--without-mysqlmanager \ | |||
--with-mysqld-user=root \ | |||
--with-unix-socket-path=/tmp \ | |||
--without-libwrap \ | |||
--with-low-memory \ | |||
--without-embedded-server \ | |||
--without-query-cache \ | |||
--without-ssl \ | |||
--without-docs \ | |||
--without-man \ | |||
--without-readline \ | |||
--without-debug \ | |||
--with-named-thread-libs=-lpthread | |||
CONFIGURE_VARS += \ | |||
mysql_cv_compress=yes \ | |||
mysql_cv_gethostname_style=glibc2 \ | |||
mysql_cv_gcc_atomic_builtins=yes \ | |||
mysql_cv_gcc_atomic_builtins_pthread_t=yes \ | |||
ac_cv_c_stack_direction=-1 | |||
define Build/Compile | |||
+$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \ | |||
SUBDIRS="include" \ | |||
DESTDIR="$(PKG_INSTALL_DIR)" \ | |||
all | |||
$(MAKE) -C "$(PKG_BUILD_DIR)" \ | |||
SUBDIRS="include" \ | |||
DESTDIR="$(PKG_INSTALL_DIR)" \ | |||
install | |||
g++ -I $(PKG_BUILD_DIR)/include \ | |||
-o $(PKG_BUILD_DIR)/sql/gen_lex_hash \ | |||
$(PKG_BUILD_DIR)/sql/gen_lex_hash.cc | |||
+$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)/libmysql" \ | |||
CC="g++" \ | |||
CFLAGS="$(HOST_CFLAGS)" \ | |||
CPPFLAGS="$(HOST_CFLAGS)" \ | |||
LDFLAGS="$(HOST_LDFLAGS)" \ | |||
conf_to_src | |||
+$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \ | |||
SUBDIRS="libmysql" \ | |||
DESTDIR="$(PKG_INSTALL_DIR)" \ | |||
all | |||
$(MAKE) -C "$(PKG_BUILD_DIR)" \ | |||
SUBDIRS="libmysql" \ | |||
DESTDIR="$(PKG_INSTALL_DIR)" \ | |||
install | |||
+$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \ | |||
SUBDIRS="libmysql_r" \ | |||
DESTDIR="$(PKG_INSTALL_DIR)" \ | |||
all | |||
$(MAKE) -C "$(PKG_BUILD_DIR)" \ | |||
SUBDIRS="libmysql_r" \ | |||
DESTDIR="$(PKG_INSTALL_DIR)" \ | |||
install | |||
$(MAKE) -C "$(PKG_BUILD_DIR)" \ | |||
SUBDIRS="scripts" \ | |||
DESTDIR="$(PKG_INSTALL_DIR)" \ | |||
bin_SCRIPTS="mysql_config" \ | |||
install | |||
+$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \ | |||
DESTDIR="$(PKG_INSTALL_DIR)" \ | |||
all | |||
$(MAKE) -C "$(PKG_BUILD_DIR)" \ | |||
DESTDIR="$(PKG_INSTALL_DIR)" \ | |||
install | |||
endef | |||
define Build/InstallDev | |||
$(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_config $(1)/usr/bin/ | |||
ln -sf $(STAGING_DIR)/usr/bin/mysql_config $(2)/bin/ | |||
$(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(1)/usr/include/ | |||
# NOTE: needed for MySQL-Python | |||
$(CP) $(PKG_BUILD_DIR)/include/mysqld_error.h $(1)/usr/include/mysql/ | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql $(1)/usr/lib/ | |||
rm -f $(1)/usr/lib/mysql/libmysqlclient.la | |||
endef | |||
define Package/libmysqlclient/install | |||
$(INSTALL_DIR) $(1)/usr/lib | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient.so.* $(1)/usr/lib/ | |||
endef | |||
define Package/libmysqlclient-r/install | |||
$(INSTALL_DIR) $(1)/usr/lib | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient_r.so.* $(1)/usr/lib/ | |||
endef | |||
define Package/mysql-server/install | |||
$(INSTALL_DIR) $(1)/usr/bin | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql $(1)/usr/bin/ | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/mysqld $(1)/usr/bin/ | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/myisamchk $(1)/usr/bin/ | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqladmin $(1)/usr/bin/ | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqldump $(1)/usr/bin/ | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_install_db $(1)/usr/bin/ | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/my_print_defaults $(1)/usr/bin/ | |||
$(INSTALL_DIR) $(1)/etc/init.d/ | |||
$(INSTALL_BIN) files/mysqld.init $(1)/etc/init.d/mysqld | |||
$(INSTALL_CONF) conf/my.cnf $(1)/etc/ | |||
$(INSTALL_DIR) $(1)/usr/share/mysql | |||
$(INSTALL_DIR) $(1)/usr/share/mysql/english | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/english/errmsg.sys $(1)/usr/share/mysql/english | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/fill_help_tables.sql $(1)/usr/share/mysql/ | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables.sql $(1)/usr/share/mysql/ | |||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables_data.sql $(1)/usr/share/mysql/ | |||
endef | |||
define Package/mysql-server/conffiles | |||
/etc/my.cnf | |||
endef | |||
$(eval $(call BuildPackage,mysql-server)) | |||
$(eval $(call BuildPackage,libmysqlclient)) | |||
$(eval $(call BuildPackage,libmysqlclient-r)) |
@ -1,179 +0,0 @@ | |||
--- a/storage/innodb_plugin/plug.in | |||
+++ b/storage/innodb_plugin/plug.in | |||
@@ -56,10 +56,8 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [ | |||
esac | |||
AC_SUBST(INNODB_DYNAMIC_CFLAGS) | |||
- AC_MSG_CHECKING(whether GCC atomic builtins are available) | |||
- # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not | |||
- AC_TRY_RUN( | |||
- [ | |||
+ AC_CACHE_CHECK([whether GCC atomic builtins are available], | |||
+ [mysql_cv_gcc_atomic_builtins], [AC_TRY_RUN([ | |||
int main() | |||
{ | |||
long x; | |||
@@ -96,21 +94,18 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [ | |||
return(0); | |||
} | |||
- ], | |||
- [ | |||
- AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1], | |||
- [GCC atomic builtins are available]) | |||
- AC_MSG_RESULT(yes) | |||
- ], | |||
- [ | |||
- AC_MSG_RESULT(no) | |||
- ] | |||
- ) | |||
+ ], [mysql_cv_gcc_atomic_builtins=yes], | |||
+ [mysql_cv_gcc_atomic_builtins=no], | |||
+ [mysql_cv_gcc_atomic_builtins=no])]) | |||
+ | |||
+ if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then | |||
+ AC_DEFINE(HAVE_IB_GCC_ATOMIC_BUILTINS, 1, | |||
+ [Define to 1 if compiler provides atomic builtins.]) | |||
+ fi | |||
- AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins) | |||
- # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not | |||
- AC_TRY_RUN( | |||
- [ | |||
+ | |||
+ AC_CACHE_CHECK([whether pthread_t can be used by GCC atomic builtins], | |||
+ [mysql_cv_gcc_atomic_builtins_pthread_t], [AC_TRY_RUN([ | |||
#include <pthread.h> | |||
#include <string.h> | |||
@@ -127,16 +122,14 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [ | |||
return(0); | |||
} | |||
- ], | |||
- [ | |||
- AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1], | |||
- [pthread_t can be used by GCC atomic builtins]) | |||
- AC_MSG_RESULT(yes) | |||
- ], | |||
- [ | |||
- AC_MSG_RESULT(no) | |||
- ] | |||
- ) | |||
+ ], [mysql_cv_gcc_atomic_builtins_pthread_t=yes], | |||
+ [mysql_cv_gcc_atomic_builtins_pthread_t=no], | |||
+ [mysql_cv_gcc_atomic_builtins_pthread_t=no])]) | |||
+ | |||
+ if test "x$mysql_cv_gcc_atomic_builtins_pthread_t" = xyes; then | |||
+ AC_DEFINE(HAVE_IB_ATOMIC_PTHREAD_T_GCC, 1, | |||
+ [Define to 1 if pthread_t can be used by GCC atomic builtins]) | |||
+ fi | |||
AC_MSG_CHECKING(whether Solaris libc atomic functions are available) | |||
# Define HAVE_IB_SOLARIS_ATOMICS if _all_ of the following | |||
@@ -156,7 +149,6 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [ | |||
AC_DEFINE([HAVE_IB_SOLARIS_ATOMICS], [1], | |||
[Define to 1 if Solaris libc atomic functions are available] | |||
) | |||
- fi | |||
AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions) | |||
# either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not | |||
@@ -230,6 +222,8 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [ | |||
AC_MSG_RESULT(no) | |||
] | |||
) | |||
+ fi | |||
+ | |||
]) | |||
# vim: set ft=config: | |||
--- a/sql/gen_lex_hash.cc | |||
+++ b/sql/gen_lex_hash.cc | |||
@@ -344,55 +344,6 @@ void print_find_structs() | |||
} | |||
-static void usage(int version) | |||
-{ | |||
- printf("%s Ver 3.6 Distrib %s, for %s (%s)\n", | |||
- my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); | |||
- if (version) | |||
- return; | |||
- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); | |||
- puts("This program generates a perfect hashing function for the sql_lex.cc"); | |||
- printf("Usage: %s [OPTIONS]\n\n", my_progname); | |||
- my_print_help(my_long_options); | |||
-} | |||
- | |||
- | |||
-extern "C" my_bool | |||
-get_one_option(int optid, const struct my_option *opt __attribute__((unused)), | |||
- char *argument __attribute__((unused))) | |||
-{ | |||
- switch(optid) { | |||
- case 'V': | |||
- usage(1); | |||
- exit(0); | |||
- case 'I': | |||
- case '?': | |||
- usage(0); | |||
- exit(0); | |||
- case '#': | |||
- DBUG_PUSH(argument ? argument : default_dbug_option); | |||
- break; | |||
- } | |||
- return 0; | |||
-} | |||
- | |||
- | |||
-static int get_options(int argc, char **argv) | |||
-{ | |||
- int ho_error; | |||
- | |||
- if ((ho_error= handle_options(&argc, &argv, my_long_options, get_one_option))) | |||
- exit(ho_error); | |||
- | |||
- if (argc >= 1) | |||
- { | |||
- usage(0); | |||
- exit(1); | |||
- } | |||
- return(0); | |||
-} | |||
- | |||
- | |||
int check_dup_symbols(SYMBOL *s1, SYMBOL *s2) | |||
{ | |||
if (s1->length!=s2->length || strncmp(s1->name,s2->name,s1->length)) | |||
@@ -443,12 +394,6 @@ int check_duplicates() | |||
int main(int argc,char **argv) | |||
{ | |||
- MY_INIT(argv[0]); | |||
- DBUG_PROCESS(argv[0]); | |||
- | |||
- if (get_options(argc,(char **) argv)) | |||
- exit(1); | |||
- | |||
/* Broken up to indicate that it's not advice to you, gentle reader. */ | |||
printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n"); | |||
@@ -549,7 +494,6 @@ static SYMBOL *get_hash_symbol(const cha | |||
}\n\ | |||
}\n" | |||
); | |||
- my_end(0); | |||
exit(0); | |||
} | |||
--- a/sql/Makefile.am | |||
+++ b/sql/Makefile.am | |||
@@ -26,7 +26,6 @@ INCLUDES = @ZLIB_INCLUDES@ \ | |||
WRAPLIBS= @WRAPLIBS@ | |||
SUBDIRS = share | |||
libexec_PROGRAMS = mysqld | |||
-EXTRA_PROGRAMS = gen_lex_hash | |||
bin_PROGRAMS = mysql_tzinfo_to_sql | |||
noinst_LTLIBRARIES= libndb.la \ |