change SECTION and CATEGORY to put packages in the right place, change PKG_BUILDDEPs...
[packages.git] / libs / postgresql / 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:=postgresql
12 PKG_VERSION:=7.4.9
13 PKG_RELEASE:=1
14
15 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
17 PKG_SOURCE_URL:=\
18         ftp://ftp3.us.postgresql.org/pub/postgresql/source/v$(PKG_VERSION)/ \
19         ftp://ftp.br.postgresql.org/pub/PostgreSQL/source/v$(PKG_VERSION)/ \
20         ftp://ftp.au.postgresql.org/pub/postgresql/source/v$(PKG_VERSION)/ \
21         ftp://ftp.tw.postgresql.org/pub/postgresql/source/v$(PKG_VERSION)/
22 PKG_MD5SUM:=d7cf0f0a0e1dda19268f55cb1e124c77
23 PKG_CAT:=bzcat
24
25 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
26
27 include $(INCLUDE_DIR)/package.mk
28
29 define Package/libpq
30   SECTION:=libs
31   CATEGORY:=Libraries
32   DEPENDS:=+zlib
33   TITLE:=PostgreSQL client library
34   DESCRIPTION:=PostgreSQL client library.
35   URL:=http://www.postgresql.org/
36 endef
37
38 define Package/pgsql-cli
39   SECTION:=utils
40   CATEGORY:=Utilities
41   DEPENDS:=+libpq
42   TITLE:=Command Line Interface (CLI) to PostgreSQL databases
43   DESCRIPTION:=Command Line Interface (CLI) to PostgreSQL databases.
44   URL:=http://www.postgresql.org/
45 endef
46
47 #       ./configure advertise "--infodir", but does not support it, replaced with "--docdir"
48 define Build/Configure
49         (cd $(PKG_BUILD_DIR); rm -f config.cache; \
50                 $(TARGET_CONFIGURE_OPTS) \
51                 CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
52                 CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
53                 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
54                 ./configure \
55                         --target=$(GNU_TARGET_NAME) \
56                         --host=$(GNU_TARGET_NAME) \
57                         --build=$(GNU_HOST_NAME) \
58                         --program-prefix="" \
59                         --program-suffix="" \
60                         --prefix=/usr \
61                         --exec-prefix=/usr \
62                         --bindir=/usr/bin \
63                         --datadir=/usr/share \
64                         --includedir=/usr/include \
65                         --docdir=/usr/share/info \
66                         --libdir=/usr/lib \
67                         --libexecdir=/usr/lib \
68                         --localstatedir=/var \
69                         --mandir=/usr/share/man \
70                         --sbindir=/usr/sbin \
71                         --sysconfdir=/etc \
72                         $(DISABLE_NLS) \
73                         $(DISABLE_LARGEFILE) \
74                         --enable-shared \
75                         --enable-static \
76                         --disable-integer-datetimes \
77                         --disable-rpath \
78                         --without-java \
79                         --without-krb4 \
80                         --without-krb5 \
81                         --without-openssl \
82                         --without-pam \
83                         --without-perl \
84                         --without-python \
85                         --without-readline \
86                         --without-rendezvous \
87                         --without-tcl \
88                         --without-tk \
89                         --with-zlib="yes" \
90         );
91 endef
92
93 define Build/Compile
94         $(MAKE) -C "$(PKG_BUILD_DIR)/src/include" \
95                 DESTDIR="$(PKG_INSTALL_DIR)" \
96                 all install
97         $(MAKE) -C "$(PKG_BUILD_DIR)/src/interfaces/libpq" \
98                 DESTDIR="$(PKG_INSTALL_DIR)" \
99                 all install
100         $(MAKE) -C "$(PKG_BUILD_DIR)/src/bin/pg_config" \
101                 DESTDIR="$(PKG_INSTALL_DIR)" \
102                 includedir="$(STAGING_DIR)/usr/include" \
103                 libdir="$(STAGING_DIR)/usr/lib" \
104                 all install
105         $(MAKE) -C "$(PKG_BUILD_DIR)/src/bin/psql" \
106                 DESTDIR="$(PKG_INSTALL_DIR)" \
107                 all install
108 endef
109
110 define Package/libpq/install
111         install -d -m0755 $(1)/usr/lib
112         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
113 endef
114
115 define Package/pgsql-cli/install
116         install -d -m0755 $(1)/usr/bin
117         $(CP) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
118 endef
119
120 define Build/InstallDev
121         mkdir -p $(STAGING_DIR)/usr/bin
122         $(CP) $(PKG_INSTALL_DIR)/usr/bin/pg_config $(STAGING_DIR)/usr/bin/
123         mkdir -p $(STAGING_DIR)/usr/include
124         $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(STAGING_DIR)/usr/include/
125         $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(STAGING_DIR)/usr/include/
126         $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(STAGING_DIR)/usr/include/
127         $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(STAGING_DIR)/usr/include/
128         $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(STAGING_DIR)/usr/include/
129         mkdir -p $(STAGING_DIR)/usr/lib
130         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(STAGING_DIR)/usr/lib/
131 endef
132
133 define Build/UninstallDev
134         rm -rf \
135                 $(STAGING_DIR)/usr/bin/pg_config \
136                 $(STAGING_DIR)/usr/include/libpq \
137                 $(STAGING_DIR)/usr/include/libpq-fe.h \
138                 $(STAGING_DIR)/usr/include/pg_config.h \
139                 $(STAGING_DIR)/usr/include/postgres_ext.h \
140                 $(STAGING_DIR)/usr/include/postgresql \
141                 $(STAGING_DIR)/usr/lib/libpq.{a,so*}
142 endef
143
144 $(eval $(call BuildPackage,libpq))
145 $(eval $(call BuildPackage,pgsql-cli))