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 http
://ftp7.us.postgresql.org
/pub
/postgresql
/source
/v
$(PKG_VERSION
) \
19 http
://ftp8.us.postgresql.org
/pub
/postgresql
/source
/v
$(PKG_VERSION
) \
20 http
://ftp9.us.postgresql.org
/pub
/postgresql
/source
/v
$(PKG_VERSION
) \
21 http
://ftp.be.postgresql.org
/postgresql
/source
/v
$(PKG_VERSION
) \
22 ftp
://ftp-archives.postgresql.org
/pub
/source
/v
$(PKG_VERSION
)
23 PKG_MD5SUM
:=53d6816eac7442f9bc8103439ebee22e
25 PKG_BUILD_DEPENDS
:=libnotimpl
27 PKG_INSTALL_DIR
:=$(PKG_BUILD_DIR
)/ipkg-install
29 include $(INCLUDE_DIR
)/package.mk
34 DEPENDS
:=+zlib
+libreadline
+libncurses
35 TITLE
:=PostgreSQL client library
36 URL
:=http
://www.postgresql.org
/
40 define Package
/libpq
/description
41 PostgreSQL client library.
44 define Package
/pgsql-cli
48 TITLE
:=Command Line Interface
(CLI
) to PostgreSQL databases
49 URL
:=http
://www.postgresql.org
/
53 define Package
/pgsql-cli
/description
54 Command Line Interface
(CLI
) to PostgreSQL databases.
57 define Package
/pgsql-server
61 TITLE
:=PostgreSQL databases Server
62 URL
:=http
://www.postgresql.org
/
66 define Package
/pgsql-server
/description
67 PostgreSQL databases Server.
70 # Need a native ecpg ,pg_config, and zic for build
71 define Build
/Configure
72 (cd
$(PKG_BUILD_DIR
); rm -f config.cache
; \
77 --datadir=/usr
/share \
78 --includedir=/usr
/include \
79 --infodir=/usr
/share
/info \
81 --libexecdir
=/usr
/lib \
82 --localstatedir
=/var \
83 --mandir=/usr
/share
/man \
87 $(DISABLE_LARGEFILE
) \
90 --disable-integer-datetimes \
100 --without-rendezvous \
106 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc CC
="$(HOSTCC)" CFLAGS
+="-I../../libpq"
107 mv
$(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg \
108 $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg.host
109 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/timezone CC
="$(HOSTCC)"
110 mv
$(PKG_BUILD_DIR
)/src
/timezone
/zic
$(PKG_BUILD_DIR
)/src
/timezone
/zic.host
111 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/bin
/pg_config CC
="$(HOSTCC)"
112 mv
$(PKG_BUILD_DIR
)/src
/bin
/pg_config
/pg_config \
113 $(PKG_BUILD_DIR
)/src
/bin
/pg_config
/pg_config.host
114 $(MAKE
) -C
$(PKG_BUILD_DIR
) distclean
116 (cd
$(PKG_BUILD_DIR
); rm -f config.cache
; \
117 $(TARGET_CONFIGURE_OPTS
) \
118 CFLAGS
="$(TARGET_CFLAGS)" \
119 CPPFLAGS
="$$$$CPPFLAGS $(TARGET_CPPFLAGS)" \
120 LDFLAGS
="$(TARGET_LDFLAGS)" \
123 --target
=$(GNU_TARGET_NAME
) \
124 --host
=$(GNU_TARGET_NAME
) \
125 --build
=$(GNU_HOST_NAME
) \
126 --program-prefix
="" \
127 --program-suffix
="" \
131 --datadir=/usr
/share \
132 --includedir=/usr
/include \
133 --infodir=/usr
/share
/info \
135 --libexecdir
=/usr
/lib \
136 --localstatedir
=/var \
137 --mandir=/usr
/share
/man \
138 --sbindir
=/usr
/sbin \
141 $(DISABLE_LARGEFILE
) \
144 --disable-integer-datetimes \
153 --without-rendezvous \
159 $(SED
) 's@ECPG = ../../preproc/ecpg@ECPG = ../../preproc/ecpg.host@' $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/test/Makefile.regress
160 $(SED
) 's@\./zic -d@./zic.host -d@' $(PKG_BUILD_DIR
)/src
/timezone
/Makefile
161 # note: unclear if this is needed yet, commenting out for the moment
162 #$(SED) 's@US/Eastern@America/New_York@' $(PKG_BUILD_DIR)/src/timezone/Makefile
166 $(MAKE
) -C
"$(PKG_BUILD_DIR)" \
167 DESTDIR
="$(PKG_INSTALL_DIR)" \
171 define Package
/libpq
/install
172 $(INSTALL_DIR
) $(1)/usr
/lib
173 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpq.so.
* $(1)/usr
/lib
/
176 define Package
/pgsql-cli
/install
177 $(INSTALL_DIR
) $(1)/usr
/bin
178 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/psql
$(1)/usr
/bin
/
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
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 \
208 ln
-sf postgres
$(1)/usr
/bin
/postmaster
210 $(INSTALL_BIN
) .
/files
/postgresql.init
$(1)/etc
/init.d
/postgresql
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 $(1)/usr
/share
/postgresql
228 $(INSTALL_DATA
) .
/files
/postgresql.config
$(1)/etc
/config
/postgresql
231 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/timezone \
232 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/timezonesets \
233 $(1)/usr
/share
/postgresql
236 $(PKG_INSTALL_DIR
)/usr
/lib
/postgresql \
240 define Package
/pgsql-server
/postinst
242 grep
-q
'^postgres:' /etc
/passwd
&& exit
0
244 if
[ -e
/bin
/addgroup
]; then
245 /bin
/addgroup postgres
248 if
[ -e
/bin
/adduser
]; then
249 /bin
/adduser
-h
/tmp
-H
-g
'PostgreSQL administrator' -s
/bin
/ash
-D
-H
-G postgres postgres
254 if
[ -z
"$${RG}" -o
-z
"$${RU}" ]; then
255 echo
"Could not find user utils, you will need to create the postgres user by hand"
259 if
[ "$${RG}" != "0" -o
"$${RU}" != "0" ]; then
260 echo
"Failed to created postgres user"
265 define Build
/InstallDev
266 mkdir
-p
$(1)/usr
/bin
267 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/src
/bin
/pg_config
/pg_config.host
$(1)/usr
/bin
/pg_config
268 mkdir
-p
$(1)/usr
/include
269 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpq
$(1)/usr
/include/
270 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpq-fe.h
$(1)/usr
/include/
271 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/pg_config.h
$(1)/usr
/include/
272 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/postgres_ext.h
$(1)/usr
/include/
273 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/postgresql
$(1)/usr
/include/
274 mkdir
-p
$(1)/usr
/lib
275 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpq.
{a
,so
*} $(1)/usr
/lib
/
276 $(CP
) $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg.host
$(1)/usr
/bin
/ecpg
277 $(CP
) $(PKG_BUILD_DIR
)/src
/timezone
/zic.host
$(1)/usr
/bin
/zic
280 $(eval
$(call BuildPackage
,libpq
))
281 $(eval
$(call BuildPackage
,pgsql-cli
))
282 $(eval
$(call BuildPackage
,pgsql-server
))