3dcae75e8726cc51ac28e6e4a0aad238a356b1af
[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:=2
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 TARGET_CXX=g++-uc
60
61 CONFIGURE_VARS += \
62 CXXFLAGS="$$$$CXXFLAGS -fno-builtin -fno-rtti -nostdinc++" \
63 CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/uClibc++" \
64 LDFLAGS="$$$$LDFLAGS" \
65 LIBS="-nodefaultlibs -luClibc++ -lm $(LIBGCC_S)" \
66 CLIENTCLIBS="-nodefaultlibs -luClibc++ -lm $(LIBGCC_S)" \
67
68
69 define Build/Configure
70 (cd $(PKG_BUILD_DIR); touch \
71 configure.in \
72 aclocal.m4 \
73 Makefile.in \
74 config.h.in \
75 configure \
76 );
77 $(CP) files/lex_hash.h $(PKG_BUILD_DIR)/sql/lex_hash.h
78
79 $(call Build/Configure/Default, \
80 --enable-shared \
81 --enable-static \
82 --enable-thread-safe-client \
83 --disable-assembler \
84 --with-pthread \
85 --with-server \
86 --without-mysqlmanager \
87 --without-raid \
88 --with-mysqld-user=root \
89 --with-unix-socket-path=/tmp \
90 --without-libwrap \
91 --without-pstack \
92 --with-low-memory \
93 --without-embedded-server \
94 --without-query-cache \
95 --without-mysqlfs \
96 --without-vio \
97 --without-ssl \
98 --without-docs \
99 --without-man \
100 --without-bench \
101 --without-readline \
102 --without-debug \
103 --with-named-thread-libs=-lpthread \
104 , \
105 mysql_cv_compress=yes \
106 mysql_cv_gethostname_style=glibc2 \
107 ac_cv_c_stack_direction=-1 \
108 );
109 endef
110
111 TARGET_CFLAGS += $(FPIC)
112
113 define Build/Compile
114 $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
115 SUBDIRS="include" \
116 DESTDIR="$(PKG_INSTALL_DIR)" \
117 all
118 $(MAKE) -C "$(PKG_BUILD_DIR)" \
119 SUBDIRS="include" \
120 DESTDIR="$(PKG_INSTALL_DIR)" \
121 install
122 $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)/libmysql" \
123 CC="g++" \
124 CFLAGS="$(HOST_CFLAGS)" \
125 CPPFLAGS="$(HOST_CFLAGS)" \
126 LDFLAGS="$(HOST_LDFLAGS)" \
127 conf_to_src
128 $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
129 SUBDIRS="libmysql" \
130 DESTDIR="$(PKG_INSTALL_DIR)" \
131 all
132 $(MAKE) -C "$(PKG_BUILD_DIR)" \
133 SUBDIRS="libmysql" \
134 DESTDIR="$(PKG_INSTALL_DIR)" \
135 install
136 $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
137 SUBDIRS="libmysql_r" \
138 DESTDIR="$(PKG_INSTALL_DIR)" \
139 all
140 $(MAKE) -C "$(PKG_BUILD_DIR)" \
141 SUBDIRS="libmysql_r" \
142 DESTDIR="$(PKG_INSTALL_DIR)" \
143 install
144 $(MAKE) -C "$(PKG_BUILD_DIR)" \
145 SUBDIRS="scripts" \
146 DESTDIR="$(PKG_INSTALL_DIR)" \
147 bin_SCRIPTS="mysql_config" \
148 install
149 $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
150 DESTDIR="$(PKG_INSTALL_DIR)" \
151 all
152 $(MAKE) -C "$(PKG_BUILD_DIR)" \
153 DESTDIR="$(PKG_INSTALL_DIR)" \
154 install
155 endef
156
157
158 define Build/InstallDev
159 $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
160 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_config $(1)/usr/bin/
161 ln -sf $(STAGING_DIR)/usr/bin/mysql_config $(2)/bin/
162 $(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(1)/usr/include/
163 # NOTE: needed for MySQL-Python
164 $(CP) $(PKG_BUILD_DIR)/include/mysqld_error.h $(1)/usr/include/mysql/
165 $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql $(1)/usr/lib/
166 rm -f $(1)/usr/lib/mysql/libmysqlclient.la
167 endef
168
169 define Package/libmysqlclient/install
170 $(INSTALL_DIR) $(1)/usr/lib
171 $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient.so.* $(1)/usr/lib/
172 endef
173 define Package/libmysqlclient_r/install
174 $(INSTALL_DIR) $(1)/usr/lib
175 $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient_r.so.* $(1)/usr/lib/
176 endef
177
178 define Package/mysql-server/install
179 $(INSTALL_DIR) $(1)/usr/bin
180 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql $(1)/usr/bin/
181 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/mysqld $(1)/usr/bin/
182 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/myisamchk $(1)/usr/bin/
183 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqladmin $(1)/usr/bin/
184 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqldump $(1)/usr/bin/
185 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_install_db $(1)/usr/bin/
186 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/my_print_defaults $(1)/usr/bin/
187 $(INSTALL_DIR) $(1)/etc/init.d/
188 $(INSTALL_BIN) files/mysqld.init $(1)/etc/init.d/mysqld
189 $(INSTALL_CONF) conf/my.cnf $(1)/etc/
190 $(INSTALL_DIR) $(1)/usr/share/mysql
191 $(INSTALL_DIR) $(1)/usr/share/mysql/english
192 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/english/errmsg.sys $(1)/usr/share/mysql/english
193 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/fill_help_tables.sql $(1)/usr/share/mysql/
194 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables.sql $(1)/usr/share/mysql/
195 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables_data.sql $(1)/usr/share/mysql/
196 endef
197
198 $(eval $(call BuildPackage,mysql-server))
199 $(eval $(call BuildPackage,libmysqlclient))
200 $(eval $(call BuildPackage,libmysqlclient_r))