[package] add mysql-server (#7384)
[openwrt/svn-archive/archive.git] / libs / mysql / Makefile
1 #
2 # Copyright (C) 2006-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=mysql
11 PKG_VERSION:=5.0.18
12 PKG_RELEASE:=3
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=\
16 http://mysql.planetmirror.com/Downloads/MySQL-5.0/ \
17 http://mysql.he.net/Downloads/MySQL-5.0/ \
18 http://www.linorg.usp.br/mysql/Downloads/MySQL-5.0/ \
19 http://mysql.holywar.net/Downloads/MySQL-5.0/
20 PKG_MD5SUM:=f18153b0239aaa03fc5a751f2d82cb71
21
22 PKG_BUILD_DEPENDS:=libncurses libreadline
23 PKG_FIXUP:=libtool
24
25 include $(INCLUDE_DIR)/package.mk
26
27 define Package/libmysqlclient/Default
28 SECTION:=libs
29 CATEGORY:=Libraries
30 DEPENDS:=+zlib
31 TITLE:=MySQL client library
32 URL:=http://dev.mysql.com/
33 endef
34
35 define Package/mysql-server/Default
36 SECTION:=utils
37 CATEGORY:=Utilities
38 DEPENDS:=+zlib +libmysqlclient +uclibcxx
39 TITLE:=MySQL Server
40 URL:=http://dev.mysql.com/
41 SUBMENU:=database
42 endef
43
44 define Package/mysql-server
45 $(call Package/mysql-server/Default)
46 endef
47
48 define Package/libmysqlclient
49 $(call Package/libmysqlclient/Default)
50 endef
51
52 define Package/libmysqlclient_r
53 $(call Package/libmysqlclient/Default)
54 TITLE += threadsafe
55 endef
56
57 CONFIGURE_VARS += \
58 CXXFLAGS="$$$$CXXFLAGS -fno-builtin -fno-rtti -nostdinc++" \
59 CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/uClibc++" \
60 LDFLAGS="$$$$LDFLAGS" \
61 LIBS="-nodefaultlibs -luClibc++ -lm $(LIBGCC_S)" \
62 CLIENTCLIBS="-nodefaultlibs -luClibc++ -lm $(LIBGCC_S)" \
63
64
65 define Build/Configure
66 (cd $(PKG_BUILD_DIR); touch \
67 configure.in \
68 aclocal.m4 \
69 Makefile.in \
70 config.h.in \
71 configure \
72 );
73
74 $(call Build/Configure/Default, \
75 --enable-shared \
76 --enable-static \
77 --enable-thread-safe-client \
78 --disable-assembler \
79 --with-pthread \
80 --with-server \
81 --without-mysqlmanager \
82 --without-raid \
83 --with-mysqld-user=root \
84 --with-unix-socket-path=/tmp \
85 --without-libwrap \
86 --without-pstack \
87 --with-low-memory \
88 --without-embedded-server \
89 --without-query-cache \
90 --without-mysqlfs \
91 --without-vio \
92 --without-openssl \
93 --without-docs \
94 --without-man \
95 --without-bench \
96 --without-readline \
97 --without-debug \
98 --with-named-thread-libs=-lpthread \
99 , \
100 mysql_cv_compress=yes \
101 mysql_cv_gethostname_style=glibc2 \
102 );
103 endef
104
105 TARGET_CFLAGS += $(FPIC)
106
107 define Build/Compile
108 $(MAKE) -C "$(PKG_BUILD_DIR)" \
109 SUBDIRS="include" \
110 DESTDIR="$(PKG_INSTALL_DIR)" \
111 all install
112 $(MAKE) -C "$(PKG_BUILD_DIR)/libmysql" \
113 CC="$(HOSTCC)" \
114 LINK="$(HOSTCC) -o conf_to_src -lc" \
115 CFLAGS="" \
116 CPPFLAGS="" \
117 conf_to_src
118 $(MAKE) -C "$(PKG_BUILD_DIR)" \
119 SUBDIRS="libmysql" \
120 DESTDIR="$(PKG_INSTALL_DIR)" \
121 all install
122 $(MAKE) -C "$(PKG_BUILD_DIR)" \
123 SUBDIRS="libmysql_r" \
124 DESTDIR="$(PKG_INSTALL_DIR)" \
125 all install
126 $(MAKE) -C "$(PKG_BUILD_DIR)" \
127 SUBDIRS="scripts" \
128 DESTDIR="$(PKG_INSTALL_DIR)" \
129 bin_SCRIPTS="mysql_config" \
130 install
131 $(MAKE) -C "$(PKG_BUILD_DIR)" \
132 DESTDIR="$(PKG_INSTALL_DIR)" \
133 install
134 endef
135
136
137 define Build/InstallDev
138 $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
139 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_config $(1)/usr/bin/
140 ln -sf $(STAGING_DIR)/usr/bin/mysql_config $(2)/bin/
141 $(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(1)/usr/include/
142 # NOTE: needed for MySQL-Python
143 $(CP) $(PKG_BUILD_DIR)/include/mysqld_error.h $(1)/usr/include/mysql/
144 $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql $(1)/usr/lib/
145 rm -f $(1)/usr/lib/mysql/libmysqlclient.la
146 endef
147
148 define Package/libmysqlclient/install
149 $(INSTALL_DIR) $(1)/usr/lib
150 $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient.so.* $(1)/usr/lib/
151 endef
152 define Package/libmysqlclient_r/install
153 $(INSTALL_DIR) $(1)/usr/lib
154 $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient_r.so.* $(1)/usr/lib/
155 endef
156
157 define Package/mysql-server/install
158 $(INSTALL_DIR) $(1)/usr/bin
159 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql $(1)/usr/bin/
160 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/mysqld $(1)/usr/bin/
161 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/myisamchk $(1)/usr/bin/
162 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqladmin $(1)/usr/bin/
163 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqldump $(1)/usr/bin/
164 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_install_db $(1)/usr/bin/
165 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_create_system_tables $(1)/usr/bin/
166 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/my_print_defaults $(1)/usr/bin/
167 $(INSTALL_DIR) $(1)/etc/init.d/
168 $(INSTALL_BIN) files/mysqld.init $(1)/etc/init.d/mysqld
169 $(INSTALL_CONF) conf/my.cnf $(1)/etc/
170 $(INSTALL_DIR) $(1)/usr/share/mysql
171 $(INSTALL_DIR) $(1)/usr/share/mysql/english
172 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/english/errmsg.sys $(1)/usr/share/mysql/english
173 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/fill_help_tables.sql $(1)/usr/share/mysql/
174 endef
175
176 $(eval $(call BuildPackage,mysql-server))
177 $(eval $(call BuildPackage,libmysqlclient))
178 $(eval $(call BuildPackage,libmysqlclient_r))