1################################################################################ 2# 3# mariadb 4# 5################################################################################ 6 7MARIADB_VERSION = 10.3.30 8MARIADB_SITE = https://downloads.mariadb.org/interstitial/mariadb-$(MARIADB_VERSION)/source 9MARIADB_LICENSE = GPL-2.0 (server), GPL-2.0 with FLOSS exception (GPL client library), LGPL-2.0 (LGPL client library) 10# Tarball no longer contains LGPL license text 11# https://jira.mariadb.org/browse/MDEV-12297 12MARIADB_LICENSE_FILES = README.md COPYING 13MARIADB_CPE_ID_VENDOR = mariadb 14MARIADB_SELINUX_MODULES = mysql 15MARIADB_INSTALL_STAGING = YES 16MARIADB_PROVIDES = mysql 17 18MARIADB_DEPENDENCIES = \ 19 host-mariadb \ 20 ncurses \ 21 openssl \ 22 zlib \ 23 libaio \ 24 libxml2 25 26# use bundled GPL-2.0+ licensed readline as package/readline is GPL-3.0+ 27MARIADB_CONF_OPTS += -DWITH_READLINE=ON 28 29# We won't need unit tests 30MARIADB_CONF_OPTS += -DWITH_UNIT_TESTS=0 31 32# Mroonga needs libstemmer. Some work still needs to be done before it can be 33# included in buildroot. Disable it for now. 34MARIADB_CONF_OPTS += -DWITHOUT_MROONGA=1 35 36# This value is determined automatically during straight compile by compiling 37# and running a test code. You cannot do that during cross-compile. However the 38# stack grows downward in most if not all modern systems. The only exception I 39# am aware of is PA-RISC which is not supported by buildroot. Therefore it makes 40# sense to hardcode the value. If an arch is added the stack of which grows up 41# one should expect unpredictable behavior at run time. 42MARIADB_CONF_OPTS += -DSTACK_DIRECTION=-1 43 44# Jemalloc was added for TokuDB. Since its configure script seems somewhat broken 45# when it comes to cross-compilation we shall disable it and also disable TokuDB. 46MARIADB_CONF_OPTS += -DWITH_JEMALLOC=no -DWITHOUT_TOKUDB=1 47 48# RocksDB fails to build in some configurations with the following build error: 49# ./output/build/mariadb-10.2.17/storage/rocksdb/rocksdb/utilities/backupable/backupable_db.cc:327:38: 50# error: field 'result' has incomplete type 'std::promise<rocksdb::BackupEngineImpl::CopyOrCreateResult>' 51# std::promise<CopyOrCreateResult> result; 52# 53# To work around the issue, we disable RocksDB 54MARIADB_CONF_OPTS += -DWITHOUT_ROCKSDB=1 55 56# Make it explicit that we are cross-compiling 57MARIADB_CONF_OPTS += -DCMAKE_CROSSCOMPILING=1 58 59# Explicitly disable dtrace to avoid detection of a host version 60MARIADB_CONF_OPTS += -DENABLE_DTRACE=0 61 62ifeq ($(BR2_PACKAGE_MARIADB_SERVER),y) 63ifeq ($(BR2_PACKAGE_MARIADB_SERVER_EMBEDDED),y) 64MARIADB_CONF_OPTS += -DWITH_EMBEDDED_SERVER=ON 65else 66MARIADB_CONF_OPTS += -DWITH_EMBEDDED_SERVER=OFF 67endif 68else 69MARIADB_CONF_OPTS += -DWITHOUT_SERVER=ON 70endif 71 72MARIADB_CXXFLAGS = $(TARGET_CXXFLAGS) 73 74ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) 75MARIADB_CXXFLAGS += -latomic 76endif 77 78MARIADB_CONF_OPTS += \ 79 -DCMAKE_CXX_FLAGS="$(MARIADB_CXXFLAGS)" \ 80 -DINSTALL_DOCDIR=share/doc/mariadb-$(MARIADB_VERSION) \ 81 -DINSTALL_DOCREADMEDIR=share/doc/mariadb-$(MARIADB_VERSION) \ 82 -DINSTALL_MANDIR=share/man \ 83 -DINSTALL_MYSQLSHAREDIR=share/mysql \ 84 -DINSTALL_MYSQLTESTDIR=share/mysql/test \ 85 -DINSTALL_PLUGINDIR=lib/mysql/plugin \ 86 -DINSTALL_SBINDIR=sbin \ 87 -DINSTALL_SCRIPTDIR=bin \ 88 -DINSTALL_SQLBENCHDIR=share/mysql/bench \ 89 -DINSTALL_SUPPORTFILESDIR=share/mysql \ 90 -DMYSQL_DATADIR=/var/lib/mysql \ 91 -DMYSQL_UNIX_ADDR=$(MYSQL_SOCKET) 92 93HOST_MARIADB_DEPENDENCIES = host-openssl 94HOST_MARIADB_CONF_OPTS += -DWITH_SSL=system 95 96# Some helpers must be compiled for host in order to crosscompile mariadb for 97# the target. They are then included by import_executables.cmake which is 98# generated during the build of the host helpers. It is not necessary to build 99# the whole host package, only the "import_executables" target. 100# -DIMPORT_EXECUTABLES=$(HOST_MARIADB_BUILDDIR)/import_executables.cmake 101# must then be passed to cmake during target build. 102# see also https://mariadb.com/kb/en/mariadb/cross-compiling-mariadb/ 103HOST_MARIADB_MAKE_OPTS = import_executables 104 105MARIADB_CONF_OPTS += \ 106 -DIMPORT_EXECUTABLES=$(HOST_MARIADB_BUILDDIR)/import_executables.cmake 107 108# Don't install host-mariadb. We just need to build import_executable 109# Therefore only run 'true' and do nothing, not even the default action. 110HOST_MARIADB_INSTALL_CMDS = true 111 112ifeq ($(BR2_PACKAGE_MARIADB_SERVER),y) 113define MARIADB_USERS 114 mysql -1 mysql -1 * /var/lib/mysql - - MySQL Server 115endef 116 117define MARIADB_INSTALL_INIT_SYSV 118 $(INSTALL) -D -m 0755 package/mariadb/S97mysqld \ 119 $(TARGET_DIR)/etc/init.d/S97mysqld 120endef 121 122define MARIADB_INSTALL_INIT_SYSTEMD 123 $(INSTALL) -D -m 644 package/mariadb/mysqld.service \ 124 $(TARGET_DIR)/usr/lib/systemd/system/mysqld.service 125endef 126endif 127 128# We don't need mysql_config or mariadb_config on the target as it's 129# only useful in staging. We also don't need the test suite on the target. 130define MARIADB_POST_INSTALL 131 mkdir -p $(TARGET_DIR)/var/lib/mysql 132 $(RM) $(TARGET_DIR)/usr/bin/mysql_config 133 $(RM) $(TARGET_DIR)/usr/bin/mariadb_config 134 $(RM) -r $(TARGET_DIR)/usr/share/mysql/test 135endef 136 137MARIADB_POST_INSTALL_TARGET_HOOKS += MARIADB_POST_INSTALL 138 139# overwrite cross-compiled mariadb_config executable by an native one 140define MARIADB_POST_STAGING_INSTALL 141 $(HOSTCC) -I$(@D)/libmariadb/include \ 142 -o $(STAGING_DIR)/usr/bin/mariadb_config \ 143 $(@D)/libmariadb/mariadb_config/mariadb_config.c 144endef 145MARIADB_POST_INSTALL_STAGING_HOOKS += MARIADB_POST_STAGING_INSTALL 146 147$(eval $(cmake-package)) 148$(eval $(host-cmake-package)) 149