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
:=cb47771004d53505200ffd00ac45bc32
23 PKG_INSTALL_DIR
:=$(PKG_BUILD_DIR
)/ipkg-install
25 include $(INCLUDE_DIR
)/package.mk
31 TITLE
:=PostgreSQL client library
32 DESCRIPTION
:=PostgreSQL client library.
33 URL
:=http
://www.postgresql.org
/
36 define Package
/pgsql-cli
40 TITLE
:=Command Line Interface
(CLI
) to PostgreSQL databases
41 DESCRIPTION
:=Command Line Interface
(CLI
) to PostgreSQL databases.
42 URL
:=http
://www.postgresql.org
/
45 define Package
/pgsql-server
48 DEPENDS
:=+libpq @C99_MATH
49 TITLE
:=PostgreSQL databases Server
50 DESCRIPTION
:=PostgreSQL databases Server.
51 URL
:=http
://www.postgresql.org
/
54 # Need a native ecpg and zic for build
55 define Build
/Configure
56 (cd
$(PKG_BUILD_DIR
); rm -f config.cache
; \
61 --datadir=/usr
/share \
62 --includedir=/usr
/include \
63 --infodir=/usr
/share
/info \
65 --libexecdir
=/usr
/lib \
66 --localstatedir
=/var \
67 --mandir=/usr
/share
/man \
71 $(DISABLE_LARGEFILE
) \
74 --disable-integer-datetimes \
84 --without-rendezvous \
89 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc CC
="gcc" CFLAGS
+="-I../../libpq"
90 mv
$(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg \
91 $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg.host
92 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/timezone CC
="gcc"
93 mv
$(PKG_BUILD_DIR
)/src
/timezone
/zic
$(PKG_BUILD_DIR
)/src
/timezone
/zic.host
94 $(MAKE
) -C
$(PKG_BUILD_DIR
) distclean
96 (cd
$(PKG_BUILD_DIR
); rm -f config.cache
; \
97 $(TARGET_CONFIGURE_OPTS
) \
98 CFLAGS
="$(TARGET_CFLAGS)" \
99 CPPFLAGS
="$$$$CPPFLAGS $(EXTRA_CPPFLAGS)" \
100 LDFLAGS
="$(EXTRA_LDFLAGS)" \
102 --target
=$(GNU_TARGET_NAME
) \
103 --host
=$(GNU_TARGET_NAME
) \
104 --build
=$(GNU_HOST_NAME
) \
105 --program-prefix
="" \
106 --program-suffix
="" \
110 --datadir=/usr
/share \
111 --includedir=/usr
/include \
112 --infodir=/usr
/share
/info \
114 --libexecdir
=/usr
/lib \
115 --localstatedir
=/var \
116 --mandir=/usr
/share
/man \
117 --sbindir
=/usr
/sbin \
120 $(DISABLE_LARGEFILE
) \
123 --disable-integer-datetimes \
133 --without-rendezvous \
138 $(SED
) 's@ECPG = ../../preproc/ecpg@ECPG = ../../preproc/ecpg.host@' $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/test/Makefile.regress
139 $(SED
) 's@\./zic -d@./zic.host -d@' $(PKG_BUILD_DIR
)/src
/timezone
/Makefile
143 $(MAKE
) -C
"$(PKG_BUILD_DIR)" \
144 DESTDIR
="$(PKG_INSTALL_DIR)" \
148 define Package
/libpq
/install
149 $(INSTALL_DIR
) $(1)/usr
/lib
150 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpq.so.
* $(1)/usr
/lib
/
153 define Package
/pgsql-cli
/install
154 $(INSTALL_DIR
) $(1)/usr
/bin
155 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/psql
$(1)/usr
/bin
/
158 define Package
/pgsql-server
/install
159 $(INSTALL_DIR
) $(1)/usr
/bin
160 $(INSTALL_DIR
) $(1)/usr
/share
/postgresql
161 $(INSTALL_DIR
) $(1)/usr
/lib
162 $(INSTALL_DIR
) $(1)/etc
/init.d
163 $(INSTALL_DIR
) $(1)/etc
/config
165 $(PKG_INSTALL_DIR
)/usr
/bin
/postgres \
166 $(PKG_INSTALL_DIR
)/usr
/bin
/dropdb \
167 $(PKG_INSTALL_DIR
)/usr
/bin
/createdb \
168 $(PKG_INSTALL_DIR
)/usr
/bin
/createuser \
169 $(PKG_INSTALL_DIR
)/usr
/bin
/dropuser \
170 $(PKG_INSTALL_DIR
)/usr
/bin
/initdb \
171 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_config \
172 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_controldata \
173 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_ctl \
174 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_dump \
175 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_dumpall \
176 $(PKG_INSTALL_DIR
)/usr
/bin
/pg_restore \
177 $(PKG_INSTALL_DIR
)/usr
/bin
/vacuumdb \
180 $(INSTALL_BIN
) .
/files
/postgresql.init
$(1)/etc
/init.d
/postgresql
183 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgres.bki \
184 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgres.description \
185 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/conversion_create.sql \
186 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/information_schema.sql \
187 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/pg_hba.conf.sample \
188 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/pg_ident.conf.sample \
189 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/pg_service.conf.sample \
190 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgresql.conf.sample \
191 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/sql_features.txt \
192 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/postgres.shdescription \
193 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/psqlrc.sample \
194 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/recovery.conf.sample \
195 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/system_views.sql \
196 $(1)/usr
/share
/postgresql
198 $(INSTALL_DATA
) .
/files
/postgresql.config
$(1)/etc
/config
/postgresql
201 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/timezone \
202 $(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/timezonesets \
203 $(1)/usr
/share
/postgresql
206 $(PKG_INSTALL_DIR
)/usr
/lib
/postgresql \
210 define Package
/pgsql-server
/postinst
212 grep
-q
'^postgres:' /etc
/passwd
&& exit
0
214 if
[ -e
/bin
/addgroup
]; then
215 /bin
/addgroup postgres
218 if
[ -e
/bin
/adduser
]; then
219 /bin
/adduser
-h
/tmp
-H
-g
'PostgreSQL administrator' -s
/bin
/ash
-D
-H
-G postgres postgres
224 if
[ -z
"$${RG}" -o
-z
"$${RU}" ]; then
225 echo
"Could not find user utils, you will need to create the postgres user by hand"
229 if
[ "$${RG}" != "0" -o
"$${RU}" != "0" ]; then
230 echo
"Failed to created postgres user"
235 define Build
/InstallDev
236 mkdir
-p
$(STAGING_DIR
)/usr
/bin
237 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/pg_config
$(STAGING_DIR
)/usr
/bin
/
238 mkdir
-p
$(STAGING_DIR
)/usr
/include
239 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpq
$(STAGING_DIR
)/usr
/include/
240 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpq-fe.h
$(STAGING_DIR
)/usr
/include/
241 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/pg_config.h
$(STAGING_DIR
)/usr
/include/
242 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/postgres_ext.h
$(STAGING_DIR
)/usr
/include/
243 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/postgresql
$(STAGING_DIR
)/usr
/include/
244 mkdir
-p
$(STAGING_DIR
)/usr
/lib
245 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpq.
{a
,so
*} $(STAGING_DIR
)/usr
/lib
/
246 $(CP
) $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg.host
$(STAGING_DIR
)/usr
/bin
/ecpg
247 $(CP
) $(PKG_BUILD_DIR
)/src
/timezone
/zic.host
$(STAGING_DIR
)/usr
/bin
/zic
250 define Build
/UninstallDev
252 $(STAGING_DIR
)/usr
/bin
/pg_config \
253 $(STAGING_DIR
)/usr
/include/libpq \
254 $(STAGING_DIR
)/usr
/include/libpq-fe.h \
255 $(STAGING_DIR
)/usr
/include/pg_config.h \
256 $(STAGING_DIR
)/usr
/include/postgres_ext.h \
257 $(STAGING_DIR
)/usr
/include/postgresql \
258 $(STAGING_DIR
)/usr
/lib
/libpq.
{a
,so
*} \
259 $(STAGING_DIR
)/usr
/bin
/ecpg \
260 $(STAGING_DIR
)/usr
/bin
/zic
263 $(eval
$(call BuildPackage
,libpq
))
264 $(eval
$(call BuildPackage
,pgsql-cli
))
265 $(eval
$(call BuildPackage
,pgsql-server
))