mariadb.mk 4.9 KB

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