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
://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
:=bb1cd309ea72f070cb964736f5755847
23 PKG_BUILD_DEPENDS
:=libnotimpl
25 PKG_INSTALL_DIR
:=$(PKG_BUILD_DIR
)/ipkg-install
27 include $(INCLUDE_DIR
)/package.mk
32 DEPENDS
:=+zlib
+libreadline
+libncurses
33 TITLE
:=PostgreSQL client library
34 URL
:=http
://www.postgresql.org
/
37 define Package
/libpq
/description
38 PostgreSQL client library.
41 define Package
/pgsql-cli
45 TITLE
:=Command Line Interface
(CLI
) to PostgreSQL databases
46 URL
:=http
://www.postgresql.org
/
49 define Package
/pgsql-cli
/description
50 Command Line Interface
(CLI
) to PostgreSQL databases.
53 define Package
/pgsql-server
57 TITLE
:=PostgreSQL databases Server
58 URL
:=http
://www.postgresql.org
/
61 define Package
/pgsql-server
/description
62 PostgreSQL databases Server.
65 # Need a native ecpg ,pg_config, and zic for build
66 define Build
/Configure
67 (cd
$(PKG_BUILD_DIR
); rm -f config.cache
; \
72 --datadir=/usr
/share \
73 --includedir=/usr
/include \
74 --infodir=/usr
/share
/info \
76 --libexecdir
=/usr
/lib \
77 --localstatedir
=/var \
78 --mandir=/usr
/share
/man \
82 $(DISABLE_LARGEFILE
) \
85 --disable-integer-datetimes \
95 --without-rendezvous \
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
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)" \
118 --target
=$(GNU_TARGET_NAME
) \
119 --host
=$(GNU_TARGET_NAME
) \
120 --build
=$(GNU_HOST_NAME
) \
121 --program-prefix
="" \
122 --program-suffix
="" \
126 --datadir=/usr
/share \
127 --includedir=/usr
/include \
128 --infodir=/usr
/share
/info \
130 --libexecdir
=/usr
/lib \
131 --localstatedir
=/var \
132 --mandir=/usr
/share
/man \
133 --sbindir
=/usr
/sbin \
136 $(DISABLE_LARGEFILE
) \
139 --disable-integer-datetimes \
148 --without-rendezvous \
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
159 $(MAKE
) -C
"$(PKG_BUILD_DIR)" \
160 DESTDIR
="$(PKG_INSTALL_DIR)" \
164 define Package
/libpq
/install
165 $(INSTALL_DIR
) $(1)/usr
/lib
166 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpq.so.
* $(1)/usr
/lib
/
169 define Package
/pgsql-cli
/install
170 $(INSTALL_DIR
) $(1)/usr
/bin
171 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/psql
$(1)/usr
/bin
/
174 define Package
/pgsql-server
/install
175 $(INSTALL_DIR
) $(1)/usr
/bin
176 $(INSTALL_DIR
) $(1)/usr
/share
/postgresql
177 $(INSTALL_DIR
) $(1)/usr
/lib
178 $(INSTALL_DIR
) $(1)/etc
/init.d
179 $(INSTALL_DIR
) $(1)/etc
/config
181 $(PKG_INSTALL_DIR
)/usr
/bin
/postgres \
182 $(PKG_INSTALL_DIR
)/usr
/bin
/dropdb \
183 $(PKG_INSTALL_DIR
)/usr
/bin
/createdb \
184 $(PKG_INSTALL_DIR
)/usr
/bin
/createuser \
185 $(PKG_INSTALL_DIR
)/usr
/bin
/dropuser \
186 $(PKG_INSTALL_DIR
)/usr
/bin
/initdb \
187 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_config \
188 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_controldata \
189 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_ctl \
190 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_dump \
191 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_dumpall \
192 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_restore \
193 $(PKG_INSTALL_DIR
)/usr
/bin
/vacuumdb \
196 $(INSTALL_BIN
) .
/files
/postgresql.init
$(1)/etc
/init.d
/postgresql
199 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgres.bki \
200 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgres.description \
201 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/conversion_create.sql \
202 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/information_schema.sql \
203 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/pg_hba.conf.sample \
204 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/pg_ident.conf.sample \
205 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/pg_service.conf.sample \
206 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgresql.conf.sample \
207 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/sql_features.txt \
208 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgres.shdescription \
209 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/psqlrc.sample \
210 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/recovery.conf.sample \
211 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/system_views.sql \
212 $(1)/usr
/share
/postgresql
214 $(INSTALL_DATA
) .
/files
/postgresql.config
$(1)/etc
/config
/postgresql
217 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/timezone \
218 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/timezonesets \
219 $(1)/usr
/share
/postgresql
222 $(PKG_INSTALL_DIR
)/usr
/lib
/postgresql \
226 define Package
/pgsql-server
/postinst
228 grep
-q
'^postgres:' /etc
/passwd
&& exit
0
230 if
[ -e
/bin
/addgroup
]; then
231 /bin
/addgroup postgres
234 if
[ -e
/bin
/adduser
]; then
235 /bin
/adduser
-h
/tmp
-H
-g
'PostgreSQL administrator' -s
/bin
/ash
-D
-H
-G postgres postgres
240 if
[ -z
"$${RG}" -o
-z
"$${RU}" ]; then
241 echo
"Could not find user utils, you will need to create the postgres user by hand"
245 if
[ "$${RG}" != "0" -o
"$${RU}" != "0" ]; then
246 echo
"Failed to created postgres user"
251 define Build
/InstallDev
252 mkdir
-p
$(1)/usr
/bin
253 $(CP
) $(PKG_BUILD_DIR
)/src
/bin
/pg_config
/pg_config.host
$(1)/usr
/bin
/pg_config
254 mkdir
-p
$(1)/usr
/include
255 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpq
$(1)/usr
/include/
256 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpq-fe.h
$(1)/usr
/include/
257 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/pg_config.h
$(1)/usr
/include/
258 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/postgres_ext.h
$(1)/usr
/include/
259 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/postgresql
$(1)/usr
/include/
260 mkdir
-p
$(1)/usr
/lib
261 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpq.
{a
,so
*} $(1)/usr
/lib
/
262 $(CP
) $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg.host
$(1)/usr
/bin
/ecpg
263 $(CP
) $(PKG_BUILD_DIR
)/src
/timezone
/zic.host
$(1)/usr
/bin
/zic
266 define Build
/UninstallDev
268 $(STAGING_DIR
)/usr
/bin
/pg_config \
269 $(STAGING_DIR
)/usr
/include/libpq \
270 $(STAGING_DIR
)/usr
/include/libpq-fe.h \
271 $(STAGING_DIR
)/usr
/include/pg_config.h \
272 $(STAGING_DIR
)/usr
/include/postgres_ext.h \
273 $(STAGING_DIR
)/usr
/include/postgresql \
274 $(STAGING_DIR
)/usr
/lib
/libpq.
{a
,so
*} \
275 $(STAGING_DIR
)/usr
/bin
/ecpg \
276 $(STAGING_DIR
)/usr
/bin
/zic
279 $(eval
$(call BuildPackage
,libpq
))
280 $(eval
$(call BuildPackage
,pgsql-cli
))
281 $(eval
$(call BuildPackage
,pgsql-server
))