[package] update mdnsresponder to 214.3.2 (#8083)
[openwrt/svn-archive/archive.git] / libs / postgresql / Makefile
1 #
2 # Copyright (C) 2006-2009 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:=postgresql
11 PKG_VERSION:=8.3.3
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=\
16 http://ftp7.us.postgresql.org/pub/postgresql/source/v$(PKG_VERSION) \
17 http://ftp8.us.postgresql.org/pub/postgresql/source/v$(PKG_VERSION) \
18 http://ftp9.us.postgresql.org/pub/postgresql/source/v$(PKG_VERSION) \
19 http://ftp.be.postgresql.org/postgresql/source/v$(PKG_VERSION) \
20 ftp://ftp-archives.postgresql.org/pub/source/v$(PKG_VERSION)
21 PKG_MD5SUM:=0ae4bd9620e84d3e08dcf923808d14d0
22 PKG_BUILD_PARALLEL:=1
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/libpq
27 SECTION:=libs
28 CATEGORY:=Libraries
29 DEPENDS:=+zlib +libreadline +libncurses
30 TITLE:=PostgreSQL client library
31 URL:=http://www.postgresql.org/
32 SUBMENU:=database
33 endef
34
35 define Package/libpq/description
36 PostgreSQL client library.
37 endef
38
39 define Package/pgsql-cli
40 SECTION:=utils
41 CATEGORY:=Utilities
42 DEPENDS:=+libpq
43 TITLE:=Command Line Interface (CLI) to PostgreSQL databases
44 URL:=http://www.postgresql.org/
45 SUBMENU:=database
46 endef
47
48 define Package/pgsql-cli/description
49 Command Line Interface (CLI) to PostgreSQL databases.
50 endef
51
52 define Package/pgsql-server
53 SECTION:=utils
54 CATEGORY:=Utilities
55 DEPENDS:=+libpq
56 TITLE:=PostgreSQL databases Server
57 URL:=http://www.postgresql.org/
58 SUBMENU:=database
59 endef
60
61 define Package/pgsql-server/description
62 PostgreSQL databases Server.
63 endef
64
65 # Need a native ecpg ,pg_config, and zic for build
66 define Build/Configure
67 (cd $(PKG_BUILD_DIR); rm -f config.cache; \
68 ./configure \
69 --prefix=/usr \
70 --exec-prefix=/usr \
71 --bindir=/usr/bin \
72 --datadir=/usr/share \
73 --includedir=/usr/include \
74 --infodir=/usr/share/info \
75 --libdir=/usr/lib \
76 --libexecdir=/usr/lib \
77 --localstatedir=/var \
78 --mandir=/usr/share/man \
79 --sbindir=/usr/sbin \
80 --sysconfdir=/etc \
81 $(DISABLE_NLS) \
82 $(DISABLE_LARGEFILE) \
83 --enable-shared \
84 --enable-static \
85 --disable-integer-datetimes \
86 --disable-rpath \
87 --without-java \
88 --without-krb4 \
89 --without-krb5 \
90 --without-openssl \
91 --without-pam \
92 --without-perl \
93 --without-python \
94 --without-readline \
95 --without-rendezvous \
96 --without-tcl \
97 --without-tk \
98 --with-zlib="yes" \
99 --enable-depend \
100 );
101 $(MAKE) -C $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)" CFLAGS+="-I../../libpq"
102 mv $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg \
103 $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host
104 $(MAKE) -C $(PKG_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
105 mv $(PKG_BUILD_DIR)/src/timezone/zic $(PKG_BUILD_DIR)/src/timezone/zic.host
106 $(MAKE) -C $(PKG_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
107 mv $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config \
108 $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host
109 $(MAKE) -C $(PKG_BUILD_DIR) distclean
110
111 (cd $(PKG_BUILD_DIR); rm -f config.cache; \
112 $(TARGET_CONFIGURE_OPTS) \
113 CFLAGS="$(TARGET_CFLAGS)" \
114 CPPFLAGS="$$$$CPPFLAGS $(TARGET_CPPFLAGS)" \
115 LDFLAGS="$(TARGET_LDFLAGS)" \
116 ./configure \
117 --target=$(GNU_TARGET_NAME) \
118 --host=$(GNU_TARGET_NAME) \
119 --build=$(GNU_HOST_NAME) \
120 --program-prefix="" \
121 --program-suffix="" \
122 --prefix=/usr \
123 --exec-prefix=/usr \
124 --bindir=/usr/bin \
125 --datadir=/usr/share \
126 --includedir=/usr/include \
127 --infodir=/usr/share/info \
128 --libdir=/usr/lib \
129 --libexecdir=/usr/lib \
130 --localstatedir=/var \
131 --mandir=/usr/share/man \
132 --sbindir=/usr/sbin \
133 --sysconfdir=/etc \
134 $(DISABLE_NLS) \
135 $(DISABLE_LARGEFILE) \
136 --enable-shared \
137 --enable-static \
138 --disable-integer-datetimes \
139 --disable-rpath \
140 --without-java \
141 --without-krb4 \
142 --without-krb5 \
143 --without-openssl \
144 --without-pam \
145 --without-perl \
146 --without-python \
147 --without-rendezvous \
148 --without-tcl \
149 --without-tk \
150 --with-zlib="yes" \
151 --enable-depend \
152 $(if $(CONFIG_TARGET_avr32),--disable-spinlocks) \
153 );
154 $(SED) 's@ECPG = ../../preproc/ecpg@ECPG = ../../preproc/ecpg.host@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
155 $(SED) 's@\./zic -d@./zic.host -d@' $(PKG_BUILD_DIR)/src/timezone/Makefile
156 # note: unclear if this is needed yet, commenting out for the moment
157 #$(SED) 's@US/Eastern@America/New_York@' $(PKG_BUILD_DIR)/src/timezone/Makefile
158 endef
159
160 TARGET_CFLAGS += $(FPIC)
161
162 define Build/Compile
163 $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
164 DESTDIR="$(PKG_INSTALL_DIR)" \
165 all
166 $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
167 DESTDIR="$(PKG_INSTALL_DIR)" \
168 install
169 endef
170
171 define Package/libpq/install
172 $(INSTALL_DIR) $(1)/usr/lib
173 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
174 endef
175
176 define Package/pgsql-cli/install
177 $(INSTALL_DIR) $(1)/usr/bin
178 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
179 endef
180
181 define Package/pgsql-server/install
182 $(INSTALL_DIR) $(1)/usr/bin
183 $(INSTALL_DIR) $(1)/usr/share/postgresql
184 $(INSTALL_DIR) $(1)/usr/lib
185 $(INSTALL_DIR) $(1)/etc/init.d
186 $(INSTALL_DIR) $(1)/etc/config
187 $(INSTALL_BIN) \
188 $(PKG_INSTALL_DIR)/usr/bin/postgres \
189 $(PKG_INSTALL_DIR)/usr/bin/dropdb \
190 $(PKG_INSTALL_DIR)/usr/bin/clusterdb \
191 $(PKG_INSTALL_DIR)/usr/bin/createdb \
192 $(PKG_INSTALL_DIR)/usr/bin/createlang \
193 $(PKG_INSTALL_DIR)/usr/bin/createuser \
194 $(PKG_INSTALL_DIR)/usr/bin/droplang \
195 $(PKG_INSTALL_DIR)/usr/bin/dropuser \
196 $(PKG_INSTALL_DIR)/usr/bin/initdb \
197 $(PKG_INSTALL_DIR)/usr/bin/ipcclean \
198 $(PKG_INSTALL_DIR)/usr/bin/pg_config \
199 $(PKG_INSTALL_DIR)/usr/bin/pg_controldata \
200 $(PKG_INSTALL_DIR)/usr/bin/pg_ctl \
201 $(PKG_INSTALL_DIR)/usr/bin/pg_dump \
202 $(PKG_INSTALL_DIR)/usr/bin/pg_dumpall \
203 $(PKG_INSTALL_DIR)/usr/bin/pg_restore \
204 $(PKG_INSTALL_DIR)/usr/bin/pg_resetxlog \
205 $(PKG_INSTALL_DIR)/usr/bin/reindexdb \
206 $(PKG_INSTALL_DIR)/usr/bin/vacuumdb \
207 $(1)/usr/bin
208 ln -sf postgres $(1)/usr/bin/postmaster
209
210 $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
211
212 $(INSTALL_DATA) \
213 $(PKG_INSTALL_DIR)/usr/share/postgresql/postgres.bki \
214 $(PKG_INSTALL_DIR)/usr/share/postgresql/postgres.description \
215 $(PKG_INSTALL_DIR)/usr/share/postgresql/conversion_create.sql \
216 $(PKG_INSTALL_DIR)/usr/share/postgresql/information_schema.sql \
217 $(PKG_INSTALL_DIR)/usr/share/postgresql/pg_hba.conf.sample \
218 $(PKG_INSTALL_DIR)/usr/share/postgresql/pg_ident.conf.sample \
219 $(PKG_INSTALL_DIR)/usr/share/postgresql/pg_service.conf.sample \
220 $(PKG_INSTALL_DIR)/usr/share/postgresql/postgresql.conf.sample \
221 $(PKG_INSTALL_DIR)/usr/share/postgresql/sql_features.txt \
222 $(PKG_INSTALL_DIR)/usr/share/postgresql/postgres.shdescription \
223 $(PKG_INSTALL_DIR)/usr/share/postgresql/psqlrc.sample \
224 $(PKG_INSTALL_DIR)/usr/share/postgresql/recovery.conf.sample \
225 $(PKG_INSTALL_DIR)/usr/share/postgresql/system_views.sql \
226 $(PKG_INSTALL_DIR)/usr/share/postgresql/snowball_create.sql \
227 $(1)/usr/share/postgresql
228
229 $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
230
231 $(CP) -r \
232 $(PKG_INSTALL_DIR)/usr/share/postgresql/timezone \
233 $(PKG_INSTALL_DIR)/usr/share/postgresql/timezonesets \
234 $(1)/usr/share/postgresql
235
236 $(CP) -r \
237 $(PKG_INSTALL_DIR)/usr/lib/postgresql \
238 $(1)/usr/lib
239 endef
240
241 define Package/pgsql-server/postinst
242 #!/bin/sh
243 grep -q '^postgres:' /etc/passwd && exit 0
244
245 if [ -e /bin/addgroup ]; then
246 /bin/addgroup postgres
247 RG=$$?
248
249 if [ -e /bin/adduser ]; then
250 /bin/adduser -h /tmp -H -g 'PostgreSQL administrator' -s /bin/ash -D -H -G postgres postgres
251 RU=$$?
252 fi
253 fi
254
255 if [ -z "$${RG}" -o -z "$${RU}" ]; then
256 echo "Could not find user utils, you will need to create the postgres user by hand"
257 exit
258 fi
259
260 if [ "$${RG}" != "0" -o "$${RU}" != "0" ]; then
261 echo "Failed to created postgres user"
262 exit 1
263 fi
264 endef
265
266 define Build/InstallDev
267 $(INSTALL_DIR) $(1)/usr/bin
268 $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host $(1)/usr/bin/pg_config
269 $(INSTALL_DIR) $(1)/usr/include
270 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
271 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
272 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
273 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
274 $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
275 $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
276 $(INSTALL_DIR) $(1)/usr/lib
277 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
278 $(CP) $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host $(1)/usr/bin/ecpg
279 $(CP) $(PKG_BUILD_DIR)/src/timezone/zic.host $(1)/usr/bin/zic
280 endef
281
282 $(eval $(call BuildPackage,libpq))
283 $(eval $(call BuildPackage,pgsql-cli))
284 $(eval $(call BuildPackage,pgsql-server))