mariadb.mk 4.9 KB

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