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