InstallDev should be using (1) and not (STAGING_DIR)
[packages.git] / libs / mysql / Makefile
1
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=mysql
12 PKG_VERSION:=5.0.18
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=\
17         http://mysql.planetmirror.com/Downloads/MySQL-5.0/ \
18         http://mysql.he.net/Downloads/MySQL-5.0/ \
19         http://www.linorg.usp.br/mysql/Downloads/MySQL-5.0/ \
20         http://mysql.holywar.net/Downloads/MySQL-5.0/
21 PKG_MD5SUM:=f18153b0239aaa03fc5a751f2d82cb71
22 PKG_CAT:=zcat
23
24 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
25 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
26
27 PKG_BUILD_DEPENDS:=libncurses libreadline
28
29 include $(INCLUDE_DIR)/package.mk
30
31 define Package/libmysqlclient
32   SECTION:=libs
33   CATEGORY:=Libraries
34   DEPENDS:=+zlib
35   TITLE:=MySQL client library
36   URL:=http://dev.mysql.com/
37 endef
38
39 define Build/Configure
40         (cd $(PKG_BUILD_DIR); touch \
41                 configure.in \
42                 aclocal.m4 \
43                 Makefile.in \
44                 config.h.in \
45                 configure \
46         );
47         $(call Build/Configure/Default, \
48                 --enable-shared \
49                 --enable-static \
50                 --disable-assembler \
51                 --with-pthread \
52                 --without-raid \
53                 --with-unix-socket-path=/tmp \
54                 --without-libwrap \
55                 --without-pstack \
56                 --with-low-memory \
57                 --without-server \
58                 --without-embedded-server \
59                 --without-query-cache \
60                 --without-mysqlfs \
61                 --without-vio \
62                 --without-openssl \
63                 --without-docs \
64                 --without-bench \
65                 --without-readline \
66                 --with-named-thread-libs=-lpthread \
67                 , \
68                 mysql_cv_compress=yes \
69                 mysql_cv_gethostname_style=glibc2 \
70         );
71 endef
72
73 define Build/Compile
74         rm -rf $(PKG_INSTALL_DIR)
75         mkdir -p $(PKG_INSTALL_DIR)
76         $(MAKE) -C "$(PKG_BUILD_DIR)" \
77                 SUBDIRS="include" \
78                 DESTDIR="$(PKG_INSTALL_DIR)" \
79                 all install
80         $(MAKE) -C "$(PKG_BUILD_DIR)/libmysql" \
81                 CC="$(HOSTCC)" \
82                 LINK="$(HOSTCC) -o conf_to_src -lc" \
83                 CFLAGS="" \
84                 CPPFLAGS="" \
85                 conf_to_src
86         $(MAKE) -C "$(PKG_BUILD_DIR)" \
87                 SUBDIRS="libmysql" \
88                 DESTDIR="$(PKG_INSTALL_DIR)" \
89                 all install
90         $(MAKE) -C "$(PKG_BUILD_DIR)" \
91                 SUBDIRS="scripts" \
92                 DESTDIR="$(PKG_INSTALL_DIR)" \
93                 bin_SCRIPTS="mysql_config" \
94                 install
95 endef
96
97 define Build/InstallDev
98         mkdir -p $(1)/usr/bin
99         $(CP) $(PKG_INSTALL_DIR)/usr/bin/mysql_config $(1)/usr/bin/
100         mkdir -p $(1)/usr/include
101         $(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(1)/usr/include/
102         # NOTE: needed for MySQL-Python
103         $(CP) $(PKG_BUILD_DIR)/include/mysqld_error.h $(1)/usr/include/mysql/
104         mkdir -p $(1)/usr/lib
105         $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql $(1)/usr/lib/
106         rm -f $(1)/usr/lib/mysql/libmysqlclient.la
107 endef
108
109 define Build/UninstallDev
110         rm -rf \
111                 $(STAGING_DIR)/usr/bin/mysql_config \
112                 $(STAGING_DIR)/usr/include/mysql \
113                 $(STAGING_DIR)/usr/lib/mysql
114 endef
115
116 define Package/libmysqlclient/install
117         $(INSTALL_DIR) $(1)/usr/lib
118         $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient.so.* $(1)/usr/lib/
119 endef
120
121 $(eval $(call BuildPackage,libmysqlclient))