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