2 # Copyright (C) 2006-2009 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
14 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
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
23 include $(INCLUDE_DIR
)/package.mk
28 DEPENDS
:=+zlib
+libreadline
+libncurses
29 TITLE
:=PostgreSQL client library
30 URL
:=http
://www.postgresql.org
/
34 define Package
/libpq
/description
35 PostgreSQL client library.
38 define Package
/pgsql-cli
42 TITLE
:=Command Line Interface
(CLI
) to PostgreSQL databases
43 URL
:=http
://www.postgresql.org
/
47 define Package
/pgsql-cli
/description
48 Command Line Interface
(CLI
) to PostgreSQL databases.
51 define Package
/pgsql-server
55 TITLE
:=PostgreSQL databases Server
56 URL
:=http
://www.postgresql.org
/
60 define Package
/pgsql-server
/description
61 PostgreSQL databases Server.
64 # Need a native ecpg ,pg_config, and zic for build
65 define Build
/Configure
66 (cd
$(PKG_BUILD_DIR
); rm -f config.cache
; \
71 --datadir=/usr
/share \
72 --includedir=/usr
/include \
73 --infodir=/usr
/share
/info \
75 --libexecdir
=/usr
/lib \
76 --localstatedir
=/var \
77 --mandir=/usr
/share
/man \
81 $(DISABLE_LARGEFILE
) \
84 --disable-integer-datetimes \
94 --without-rendezvous \
100 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc CC
="$(HOSTCC)" CFLAGS
+="-I../../libpq"
101 mv
$(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg \
102 $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg.host
103 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/timezone CC
="$(HOSTCC)"
104 mv
$(PKG_BUILD_DIR
)/src
/timezone
/zic
$(PKG_BUILD_DIR
)/src
/timezone
/zic.host
105 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/bin
/pg_config CC
="$(HOSTCC)"
106 mv
$(PKG_BUILD_DIR
)/src
/bin
/pg_config
/pg_config \
107 $(PKG_BUILD_DIR
)/src
/bin
/pg_config
/pg_config.host
108 $(MAKE
) -C
$(PKG_BUILD_DIR
) distclean
110 (cd
$(PKG_BUILD_DIR
); rm -f config.cache
; \
111 $(TARGET_CONFIGURE_OPTS
) \
112 CFLAGS
="$(TARGET_CFLAGS)" \
113 CPPFLAGS
="$$$$CPPFLAGS $(TARGET_CPPFLAGS)" \
114 LDFLAGS
="$(TARGET_LDFLAGS)" \
116 --target
=$(GNU_TARGET_NAME
) \
117 --host
=$(GNU_TARGET_NAME
) \
118 --build
=$(GNU_HOST_NAME
) \
119 --program-prefix
="" \
120 --program-suffix
="" \
124 --datadir=/usr
/share \
125 --includedir=/usr
/include \
126 --infodir=/usr
/share
/info \
128 --libexecdir
=/usr
/lib \
129 --localstatedir
=/var \
130 --mandir=/usr
/share
/man \
131 --sbindir
=/usr
/sbin \
134 $(DISABLE_LARGEFILE
) \
137 --disable-integer-datetimes \
146 --without-rendezvous \
151 $(if
$(CONFIG_TARGET_avr32
),--disable-spinlocks
) \
153 $(SED
) 's@ECPG = ../../preproc/ecpg@ECPG = ../../preproc/ecpg.host@' $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/test/Makefile.regress
154 $(SED
) 's@\./zic -d@./zic.host -d@' $(PKG_BUILD_DIR
)/src
/timezone
/Makefile
155 # note: unclear if this is needed yet, commenting out for the moment
156 #$(SED) 's@US/Eastern@America/New_York@' $(PKG_BUILD_DIR)/src/timezone/Makefile
159 TARGET_CFLAGS
+= $(FPIC
)
162 $(MAKE
) -C
"$(PKG_BUILD_DIR)" \
163 DESTDIR
="$(PKG_INSTALL_DIR)" \
167 define Package
/libpq
/install
168 $(INSTALL_DIR
) $(1)/usr
/lib
169 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpq.so.
* $(1)/usr
/lib
/
172 define Package
/pgsql-cli
/install
173 $(INSTALL_DIR
) $(1)/usr
/bin
174 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/psql
$(1)/usr
/bin
/
177 define Package
/pgsql-server
/install
178 $(INSTALL_DIR
) $(1)/usr
/bin
179 $(INSTALL_DIR
) $(1)/usr
/share
/postgresql
180 $(INSTALL_DIR
) $(1)/usr
/lib
181 $(INSTALL_DIR
) $(1)/etc
/init.d
182 $(INSTALL_DIR
) $(1)/etc
/config
184 $(PKG_INSTALL_DIR
)/usr
/bin
/postgres \
185 $(PKG_INSTALL_DIR
)/usr
/bin
/dropdb \
186 $(PKG_INSTALL_DIR
)/usr
/bin
/clusterdb \
187 $(PKG_INSTALL_DIR
)/usr
/bin
/createdb \
188 $(PKG_INSTALL_DIR
)/usr
/bin
/createlang \
189 $(PKG_INSTALL_DIR
)/usr
/bin
/createuser \
190 $(PKG_INSTALL_DIR
)/usr
/bin
/droplang \
191 $(PKG_INSTALL_DIR
)/usr
/bin
/dropuser \
192 $(PKG_INSTALL_DIR
)/usr
/bin
/initdb \
193 $(PKG_INSTALL_DIR
)/usr
/bin
/ipcclean \
194 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_config \
195 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_controldata \
196 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_ctl \
197 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_dump \
198 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_dumpall \
199 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_restore \
200 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_resetxlog \
201 $(PKG_INSTALL_DIR
)/usr
/bin
/reindexdb \
202 $(PKG_INSTALL_DIR
)/usr
/bin
/vacuumdb \
204 ln
-sf postgres
$(1)/usr
/bin
/postmaster
206 $(INSTALL_BIN
) .
/files
/postgresql.init
$(1)/etc
/init.d
/postgresql
209 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgres.bki \
210 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgres.description \
211 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/conversion_create.sql \
212 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/information_schema.sql \
213 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/pg_hba.conf.sample \
214 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/pg_ident.conf.sample \
215 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/pg_service.conf.sample \
216 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgresql.conf.sample \
217 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/sql_features.txt \
218 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgres.shdescription \
219 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/psqlrc.sample \
220 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/recovery.conf.sample \
221 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/system_views.sql \
222 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/snowball_create.sql \
223 $(1)/usr
/share
/postgresql
225 $(INSTALL_DATA
) .
/files
/postgresql.config
$(1)/etc
/config
/postgresql
228 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/timezone \
229 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/timezonesets \
230 $(1)/usr
/share
/postgresql
233 $(PKG_INSTALL_DIR
)/usr
/lib
/postgresql \
237 define Package
/pgsql-server
/postinst
239 grep
-q
'^postgres:' /etc
/passwd
&& exit
0
241 if
[ -e
/bin
/addgroup
]; then
242 /bin
/addgroup postgres
245 if
[ -e
/bin
/adduser
]; then
246 /bin
/adduser
-h
/tmp
-H
-g
'PostgreSQL administrator' -s
/bin
/ash
-D
-H
-G postgres postgres
251 if
[ -z
"$${RG}" -o
-z
"$${RU}" ]; then
252 echo
"Could not find user utils, you will need to create the postgres user by hand"
256 if
[ "$${RG}" != "0" -o
"$${RU}" != "0" ]; then
257 echo
"Failed to created postgres user"
262 define Build
/InstallDev
263 $(INSTALL_DIR
) $(1)/usr
/bin
264 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/src
/bin
/pg_config
/pg_config.host
$(1)/usr
/bin
/pg_config
265 $(INSTALL_DIR
) $(1)/usr
/include
266 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpq
$(1)/usr
/include/
267 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpq-fe.h
$(1)/usr
/include/
268 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/pg_config.h
$(1)/usr
/include/
269 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/postgres_ext.h
$(1)/usr
/include/
270 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/postgresql
$(1)/usr
/include/
271 $(INSTALL_DIR
) $(1)/usr
/lib
272 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpq.
{a
,so
*} $(1)/usr
/lib
/
273 $(CP
) $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg.host
$(1)/usr
/bin
/ecpg
274 $(CP
) $(PKG_BUILD_DIR
)/src
/timezone
/zic.host
$(1)/usr
/bin
/zic
277 $(eval
$(call BuildPackage
,libpq
))
278 $(eval
$(call BuildPackage
,pgsql-cli
))
279 $(eval
$(call BuildPackage
,pgsql-server
))