Makefile 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. #
  2. # Copyright (C) 2006-2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. include $(INCLUDE_DIR)/uclibc++.mk
  9. PKG_NAME:=mysql
  10. PKG_VERSION:=5.1.73
  11. PKG_RELEASE:=2
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  13. PKG_SOURCE_URL:=\
  14. http://mysql.he.net/Downloads/MySQL-5.1/ \
  15. http://www.linorg.usp.br/mysql/Downloads/MySQL-5.1/ \
  16. http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.1/ \
  17. http://mirror.switch.ch/ftp/mirror/mysql/Downloads/MySQL-5.1/
  18. PKG_MD5SUM:=887f869bcc757957067b9198f707f32f
  19. PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
  20. PKG_LICENSE:=GPL-2.0
  21. PKG_BUILD_DEPENDS:=libncurses libreadline
  22. PKG_BUILD_PARALLEL:=1
  23. PKG_USE_MIPS16:=0
  24. PKG_FIXUP:=libtool
  25. include $(INCLUDE_DIR)/package.mk
  26. define Package/libmysqlclient/Default
  27. SECTION:=libs
  28. CATEGORY:=Libraries
  29. DEPENDS:=$(CXX_DEPENDS) +zlib
  30. TITLE:=MySQL client library
  31. URL:=http://dev.mysql.com/
  32. endef
  33. define Package/mysql-server
  34. SECTION:=utils
  35. CATEGORY:=Utilities
  36. DEPENDS:=+libmysqlclient +libpthread +libncursesw +libreadline
  37. TITLE:=MySQL Server
  38. URL:=http://dev.mysql.com/
  39. SUBMENU:=database
  40. endef
  41. define Package/libmysqlclient
  42. $(call Package/libmysqlclient/Default)
  43. endef
  44. define Package/libmysqlclient-r
  45. $(call Package/libmysqlclient/Default)
  46. TITLE += threadsafe
  47. DEPENDS+= +libpthread
  48. endef
  49. ifneq ($(CONFIG_USE_UCLIBCXX),)
  50. TARGET_CXX=g++-uc
  51. endif
  52. TARGET_CFLAGS += $(FPIC)
  53. CONFIGURE_ARGS += \
  54. --enable-shared \
  55. --enable-static \
  56. --enable-thread-safe-client \
  57. --disable-assembler \
  58. --with-pthread \
  59. --with-server \
  60. --without-mysqlmanager \
  61. --with-mysqld-user=root \
  62. --with-unix-socket-path=/tmp \
  63. --without-libwrap \
  64. --with-low-memory \
  65. --without-embedded-server \
  66. --without-query-cache \
  67. --without-ssl \
  68. --without-docs \
  69. --without-man \
  70. --without-readline \
  71. --without-debug \
  72. --with-named-thread-libs=-lpthread
  73. CONFIGURE_VARS += \
  74. mysql_cv_compress=yes \
  75. mysql_cv_gethostname_style=glibc2 \
  76. mysql_cv_gcc_atomic_builtins=yes \
  77. mysql_cv_gcc_atomic_builtins_pthread_t=yes \
  78. ac_cv_c_stack_direction=-1
  79. define Build/Compile
  80. +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
  81. SUBDIRS="include" \
  82. DESTDIR="$(PKG_INSTALL_DIR)" \
  83. all
  84. $(MAKE) -C "$(PKG_BUILD_DIR)" \
  85. SUBDIRS="include" \
  86. DESTDIR="$(PKG_INSTALL_DIR)" \
  87. install
  88. g++ -I $(PKG_BUILD_DIR)/include \
  89. -o $(PKG_BUILD_DIR)/sql/gen_lex_hash \
  90. $(PKG_BUILD_DIR)/sql/gen_lex_hash.cc
  91. +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)/libmysql" \
  92. CC="g++" \
  93. CFLAGS="$(HOST_CFLAGS)" \
  94. CPPFLAGS="$(HOST_CFLAGS)" \
  95. LDFLAGS="$(HOST_LDFLAGS)" \
  96. conf_to_src
  97. +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
  98. SUBDIRS="libmysql" \
  99. DESTDIR="$(PKG_INSTALL_DIR)" \
  100. all
  101. $(MAKE) -C "$(PKG_BUILD_DIR)" \
  102. SUBDIRS="libmysql" \
  103. DESTDIR="$(PKG_INSTALL_DIR)" \
  104. install
  105. +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
  106. SUBDIRS="libmysql_r" \
  107. DESTDIR="$(PKG_INSTALL_DIR)" \
  108. all
  109. $(MAKE) -C "$(PKG_BUILD_DIR)" \
  110. SUBDIRS="libmysql_r" \
  111. DESTDIR="$(PKG_INSTALL_DIR)" \
  112. install
  113. $(MAKE) -C "$(PKG_BUILD_DIR)" \
  114. SUBDIRS="scripts" \
  115. DESTDIR="$(PKG_INSTALL_DIR)" \
  116. bin_SCRIPTS="mysql_config" \
  117. install
  118. +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
  119. DESTDIR="$(PKG_INSTALL_DIR)" \
  120. all
  121. $(MAKE) -C "$(PKG_BUILD_DIR)" \
  122. DESTDIR="$(PKG_INSTALL_DIR)" \
  123. install
  124. endef
  125. define Build/InstallDev
  126. $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
  127. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_config $(1)/usr/bin/
  128. ln -sf $(STAGING_DIR)/usr/bin/mysql_config $(2)/bin/
  129. $(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(1)/usr/include/
  130. # NOTE: needed for MySQL-Python
  131. $(CP) $(PKG_BUILD_DIR)/include/mysqld_error.h $(1)/usr/include/mysql/
  132. $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql $(1)/usr/lib/
  133. rm -f $(1)/usr/lib/mysql/libmysqlclient.la
  134. endef
  135. define Package/libmysqlclient/install
  136. $(INSTALL_DIR) $(1)/usr/lib
  137. $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient.so.* $(1)/usr/lib/
  138. endef
  139. define Package/libmysqlclient-r/install
  140. $(INSTALL_DIR) $(1)/usr/lib
  141. $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient_r.so.* $(1)/usr/lib/
  142. endef
  143. define Package/mysql-server/install
  144. $(INSTALL_DIR) $(1)/usr/bin
  145. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql $(1)/usr/bin/
  146. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/mysqld $(1)/usr/bin/
  147. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/myisamchk $(1)/usr/bin/
  148. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqladmin $(1)/usr/bin/
  149. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqldump $(1)/usr/bin/
  150. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_install_db $(1)/usr/bin/
  151. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/my_print_defaults $(1)/usr/bin/
  152. $(INSTALL_DIR) $(1)/etc/init.d/
  153. $(INSTALL_BIN) files/mysqld.init $(1)/etc/init.d/mysqld
  154. $(INSTALL_CONF) conf/my.cnf $(1)/etc/
  155. $(INSTALL_DIR) $(1)/usr/share/mysql
  156. $(INSTALL_DIR) $(1)/usr/share/mysql/english
  157. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/english/errmsg.sys $(1)/usr/share/mysql/english
  158. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/fill_help_tables.sql $(1)/usr/share/mysql/
  159. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables.sql $(1)/usr/share/mysql/
  160. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables_data.sql $(1)/usr/share/mysql/
  161. endef
  162. define Package/mysql-server/conffiles
  163. /etc/my.cnf
  164. endef
  165. $(eval $(call BuildPackage,mysql-server))
  166. $(eval $(call BuildPackage,libmysqlclient))
  167. $(eval $(call BuildPackage,libmysqlclient-r))