2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
9 include $(TOPDIR)/rules.mk
15 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
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
25 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
27 include $(INCLUDE_DIR)/package.mk
33 TITLE:=PostgreSQL client library
34 DESCRIPTION:=PostgreSQL client library.
35 URL:=http://www.postgresql.org/
38 define Package/pgsql-cli
42 TITLE:=Command Line Interface (CLI) to PostgreSQL databases
43 DESCRIPTION:=Command Line Interface (CLI) to PostgreSQL databases.
44 URL:=http://www.postgresql.org/
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" \
55 --target=$(GNU_TARGET_NAME) \
56 --host=$(GNU_TARGET_NAME) \
57 --build=$(GNU_HOST_NAME) \
63 --datadir=/usr/share \
64 --includedir=/usr/include \
65 --docdir=/usr/share/info \
67 --libexecdir=/usr/lib \
68 --localstatedir=/var \
69 --mandir=/usr/share/man \
73 $(DISABLE_LARGEFILE) \
76 --disable-integer-datetimes \
86 --without-rendezvous \
94 $(MAKE) -C "$(PKG_BUILD_DIR)/src/include" \
95 DESTDIR="$(PKG_INSTALL_DIR)" \
97 $(MAKE) -C "$(PKG_BUILD_DIR)/src/interfaces/libpq" \
98 DESTDIR="$(PKG_INSTALL_DIR)" \
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" \
105 $(MAKE) -C "$(PKG_BUILD_DIR)/src/bin/psql" \
106 DESTDIR="$(PKG_INSTALL_DIR)" \
110 define Package/libpq/install
111 install -d -m0755 $(1)/usr/lib
112 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
115 define Package/pgsql-cli/install
116 install -d -m0755 $(1)/usr/bin
117 $(CP) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
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/
133 define Build/UninstallDev
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*}
144 $(eval $(call BuildPackage,libpq))
145 $(eval $(call BuildPackage,pgsql-cli))