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