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_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
17 http
://ftp7.us.postgresql.org
/pub
/postgresql
/source
/v
$(PKG_VERSION
) \
18 http
://ftp8.us.postgresql.org
/pub
/postgresql
/source
/v
$(PKG_VERSION
) \
19 http
://ftp9.us.postgresql.org
/pub
/postgresql
/source
/v
$(PKG_VERSION
) \
20 http
://ftp.be.postgresql.org
/postgresql
/source
/v
$(PKG_VERSION
) \
21 ftp
://ftp-archives.postgresql.org
/pub
/source
/v
$(PKG_VERSION
)
22 PKG_MD5SUM
:=0ae4bd9620e84d3e08dcf923808d14d0
24 PKG_BUILD_DEPENDS
:=libnotimpl
26 include $(INCLUDE_DIR
)/package.mk
31 DEPENDS
:=+zlib
+libreadline
+libncurses
32 TITLE
:=PostgreSQL client library
33 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
/
50 define Package
/pgsql-cli
/description
51 Command Line Interface
(CLI
) to PostgreSQL databases.
54 define Package
/pgsql-server
58 TITLE
:=PostgreSQL databases Server
59 URL
:=http
://www.postgresql.org
/
63 define Package
/pgsql-server
/description
64 PostgreSQL databases Server.
67 # Need a native ecpg ,pg_config, and zic for build
68 define Build
/Configure
69 (cd
$(PKG_BUILD_DIR
); rm -f config.cache
; \
74 --datadir=/usr
/share \
75 --includedir=/usr
/include \
76 --infodir=/usr
/share
/info \
78 --libexecdir
=/usr
/lib \
79 --localstatedir
=/var \
80 --mandir=/usr
/share
/man \
84 $(DISABLE_LARGEFILE
) \
87 --disable-integer-datetimes \
97 --without-rendezvous \
103 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc CC
="$(HOSTCC)" CFLAGS
+="-I../../libpq"
104 mv
$(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg \
105 $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg.host
106 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/timezone CC
="$(HOSTCC)"
107 mv
$(PKG_BUILD_DIR
)/src
/timezone
/zic
$(PKG_BUILD_DIR
)/src
/timezone
/zic.host
108 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/bin
/pg_config CC
="$(HOSTCC)"
109 mv
$(PKG_BUILD_DIR
)/src
/bin
/pg_config
/pg_config \
110 $(PKG_BUILD_DIR
)/src
/bin
/pg_config
/pg_config.host
111 $(MAKE
) -C
$(PKG_BUILD_DIR
) distclean
113 (cd
$(PKG_BUILD_DIR
); rm -f config.cache
; \
114 $(TARGET_CONFIGURE_OPTS
) \
115 CFLAGS
="$(TARGET_CFLAGS)" \
116 CPPFLAGS
="$$$$CPPFLAGS $(TARGET_CPPFLAGS)" \
117 LDFLAGS
="$(TARGET_LDFLAGS)" \
120 --target
=$(GNU_TARGET_NAME
) \
121 --host
=$(GNU_TARGET_NAME
) \
122 --build
=$(GNU_HOST_NAME
) \
123 --program-prefix
="" \
124 --program-suffix
="" \
128 --datadir=/usr
/share \
129 --includedir=/usr
/include \
130 --infodir=/usr
/share
/info \
132 --libexecdir
=/usr
/lib \
133 --localstatedir
=/var \
134 --mandir=/usr
/share
/man \
135 --sbindir
=/usr
/sbin \
138 $(DISABLE_LARGEFILE
) \
141 --disable-integer-datetimes \
150 --without-rendezvous \
156 $(SED
) 's@ECPG = ../../preproc/ecpg@ECPG = ../../preproc/ecpg.host@' $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/test/Makefile.regress
157 $(SED
) 's@\./zic -d@./zic.host -d@' $(PKG_BUILD_DIR
)/src
/timezone
/Makefile
158 # note: unclear if this is needed yet, commenting out for the moment
159 #$(SED) 's@US/Eastern@America/New_York@' $(PKG_BUILD_DIR)/src/timezone/Makefile
163 $(MAKE
) -C
"$(PKG_BUILD_DIR)" \
164 DESTDIR
="$(PKG_INSTALL_DIR)" \
168 define Package
/libpq
/install
169 $(INSTALL_DIR
) $(1)/usr
/lib
170 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpq.so.
* $(1)/usr
/lib
/
173 define Package
/pgsql-cli
/install
174 $(INSTALL_DIR
) $(1)/usr
/bin
175 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/psql
$(1)/usr
/bin
/
178 define Package
/pgsql-server
/install
179 $(INSTALL_DIR
) $(1)/usr
/bin
180 $(INSTALL_DIR
) $(1)/usr
/share
/postgresql
181 $(INSTALL_DIR
) $(1)/usr
/lib
182 $(INSTALL_DIR
) $(1)/etc
/init.d
183 $(INSTALL_DIR
) $(1)/etc
/config
185 $(PKG_INSTALL_DIR
)/usr
/bin
/postgres \
186 $(PKG_INSTALL_DIR
)/usr
/bin
/dropdb \
187 $(PKG_INSTALL_DIR
)/usr
/bin
/clusterdb \
188 $(PKG_INSTALL_DIR
)/usr
/bin
/createdb \
189 $(PKG_INSTALL_DIR
)/usr
/bin
/createlang \
190 $(PKG_INSTALL_DIR
)/usr
/bin
/createuser \
191 $(PKG_INSTALL_DIR
)/usr
/bin
/droplang \
192 $(PKG_INSTALL_DIR
)/usr
/bin
/dropuser \
193 $(PKG_INSTALL_DIR
)/usr
/bin
/initdb \
194 $(PKG_INSTALL_DIR
)/usr
/bin
/ipcclean \
195 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_config \
196 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_controldata \
197 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_ctl \
198 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_dump \
199 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_dumpall \
200 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_restore \
201 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_resetxlog \
202 $(PKG_INSTALL_DIR
)/usr
/bin
/reindexdb \
203 $(PKG_INSTALL_DIR
)/usr
/bin
/vacuumdb \
205 ln
-sf postgres
$(1)/usr
/bin
/postmaster
207 $(INSTALL_BIN
) .
/files
/postgresql.init
$(1)/etc
/init.d
/postgresql
210 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgres.bki \
211 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgres.description \
212 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/conversion_create.sql \
213 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/information_schema.sql \
214 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/pg_hba.conf.sample \
215 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/pg_ident.conf.sample \
216 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/pg_service.conf.sample \
217 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgresql.conf.sample \
218 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/sql_features.txt \
219 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgres.shdescription \
220 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/psqlrc.sample \
221 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/recovery.conf.sample \
222 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/system_views.sql \
223 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/snowball_create.sql \
224 $(1)/usr
/share
/postgresql
226 $(INSTALL_DATA
) .
/files
/postgresql.config
$(1)/etc
/config
/postgresql
229 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/timezone \
230 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/timezonesets \
231 $(1)/usr
/share
/postgresql
234 $(PKG_INSTALL_DIR
)/usr
/lib
/postgresql \
238 define Package
/pgsql-server
/postinst
240 grep
-q
'^postgres:' /etc
/passwd
&& exit
0
242 if
[ -e
/bin
/addgroup
]; then
243 /bin
/addgroup postgres
246 if
[ -e
/bin
/adduser
]; then
247 /bin
/adduser
-h
/tmp
-H
-g
'PostgreSQL administrator' -s
/bin
/ash
-D
-H
-G postgres postgres
252 if
[ -z
"$${RG}" -o
-z
"$${RU}" ]; then
253 echo
"Could not find user utils, you will need to create the postgres user by hand"
257 if
[ "$${RG}" != "0" -o
"$${RU}" != "0" ]; then
258 echo
"Failed to created postgres user"
263 define Build
/InstallDev
264 mkdir
-p
$(1)/usr
/bin
265 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/src
/bin
/pg_config
/pg_config.host
$(1)/usr
/bin
/pg_config
266 mkdir
-p
$(1)/usr
/include
267 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpq
$(1)/usr
/include/
268 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpq-fe.h
$(1)/usr
/include/
269 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/pg_config.h
$(1)/usr
/include/
270 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/postgres_ext.h
$(1)/usr
/include/
271 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/postgresql
$(1)/usr
/include/
272 mkdir
-p
$(1)/usr
/lib
273 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpq.
{a
,so
*} $(1)/usr
/lib
/
274 $(CP
) $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg.host
$(1)/usr
/bin
/ecpg
275 $(CP
) $(PKG_BUILD_DIR
)/src
/timezone
/zic.host
$(1)/usr
/bin
/zic
278 $(eval
$(call BuildPackage
,libpq
))
279 $(eval
$(call BuildPackage
,pgsql-cli
))
280 $(eval
$(call BuildPackage
,pgsql-server
))