mariadb.mk 5.8 KB

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