2 # Copyright (C) 2006-2014 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
13 PKG_MAINTAINER
:=Jo-Philipp Wich
<jow@openwrt.org
>
14 PKG_LICENSE
:=PostgreSQL
16 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
18 http
://ftp9.us.postgresql.org
/pub
/mirrors
/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
:=1fe952c44ed26d7e6a335cf991a9c1c6
25 PKG_MACRO_PATHS
:=config
27 include $(INCLUDE_DIR
)/package.mk
32 DEPENDS
:=+zlib
+libreadline
+libpthread
+libncurses
+shadow-utils
+shadow-su
33 TITLE
:=PostgreSQL client library
34 URL
:=http
://www.postgresql.org
/
38 define Package
/libpq
/description
39 PostgreSQL client library.
42 define Package
/pgsql-cli
45 DEPENDS
:=+libpq
+USE_UCLIBC
:librt
46 TITLE
:=Command Line Interface
(CLI
) to PostgreSQL databases
47 URL
:=http
://www.postgresql.org
/
51 define Package
/pgsql-cli
/description
52 Command Line Interface
(CLI
) to PostgreSQL databases.
55 define Package
/pgsql-server
58 DEPENDS
:=+libpq
+USE_UCLIBC
:librt
59 TITLE
:=PostgreSQL databases Server
60 URL
:=http
://www.postgresql.org
/
62 USERID
:=postgres
=5432:postgres
=5432
65 define Package
/pgsql-server
/description
66 PostgreSQL databases Server.
70 pgac_cv_snprintf_long_long_int_format
="%lld" \
71 pgac_cv_snprintf_size_t_support
=yes
73 ifeq ($(CONFIG_USE_UCLIBC
),y
)
74 # PostgreSQL does not build against uClibc with locales
75 # enabled, due to an uClibc bug, see
76 # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
77 # so overwrite automatic detection and disable locale support
79 pgac_cv_type_locale_t
=no
82 TARGET_CONFIGURE_OPTS
+=$(PGSQL_CONFIG_VARS
)
84 # Need a native ecpg ,pg_config, and zic for build
85 define Build
/Configure
86 (cd
$(PKG_BUILD_DIR
); rm -f config.cache
; \
87 $(PGSQL_CONFIG_VARS
) \
92 --datadir=/usr
/share \
93 --includedir=/usr
/include \
94 --infodir=/usr
/share
/info \
96 --libexecdir
=/usr
/lib \
97 --localstatedir
=/var \
98 --mandir=/usr
/share
/man \
104 --disable-integer-datetimes \
117 --with-system-timezone
=/tmp \
119 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc CC
="$(HOSTCC)" CFLAGS
+="-I../../libpq"
120 mv
$(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg \
121 $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg.host
122 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/timezone CC
="$(HOSTCC)"
123 mv
$(PKG_BUILD_DIR
)/src
/timezone
/zic
$(PKG_BUILD_DIR
)/host-zic
124 $(INSTALL_DIR
) $(STAGING_DIR
)/host
/bin
/
125 $(CP
) $(PKG_BUILD_DIR
)/host-zic
$(STAGING_DIR
)/host
/bin
/zic
126 $(MAKE
) -C
$(PKG_BUILD_DIR
)/src
/bin
/pg_config CC
="$(HOSTCC)"
127 mv
$(PKG_BUILD_DIR
)/src
/bin
/pg_config
/pg_config \
128 $(PKG_BUILD_DIR
)/src
/bin
/pg_config
/pg_config.host
129 $(MAKE
) -C
$(PKG_BUILD_DIR
) distclean
131 (cd
$(PKG_BUILD_DIR
); rm -f config.cache
; \
132 $(TARGET_CONFIGURE_OPTS
) \
133 CFLAGS
="$(TARGET_CFLAGS)" \
134 CPPFLAGS
="$$$$CPPFLAGS $(TARGET_CPPFLAGS)" \
135 LDFLAGS
="$(TARGET_LDFLAGS)" \
137 --target
=$(GNU_TARGET_NAME
) \
138 --host
=$(GNU_TARGET_NAME
) \
139 --build
=$(GNU_HOST_NAME
) \
140 --program-prefix
="" \
141 --program-suffix
="" \
145 --datadir=/usr
/share \
146 --includedir=/usr
/include \
147 --infodir=/usr
/share
/info \
149 --libexecdir
=/usr
/lib \
150 --localstatedir
=/var \
151 --mandir=/usr
/share
/man \
152 --sbindir
=/usr
/sbin \
155 $(DISABLE_LARGEFILE
) \
158 --disable-integer-datetimes \
170 $(if
$(CONFIG_TARGET_avr32
),--disable-spinlocks
) \
172 $(SED
) 's@ECPG = ../../preproc/ecpg@ECPG = ../../preproc/ecpg.host@' $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/test/Makefile.regress
175 TARGET_CFLAGS
+= $(FPIC
) -lpthread
177 # because PROFILE means something else in the project Makefile
181 +$(MAKE
) $(PKG_JOBS
) -C
"$(PKG_BUILD_DIR)" \
182 DESTDIR
="$(PKG_INSTALL_DIR)" \
184 +$(MAKE
) $(PKG_JOBS
) -C
"$(PKG_BUILD_DIR)" \
185 DESTDIR
="$(PKG_INSTALL_DIR)" \
189 define Package
/libpq
/install
190 $(INSTALL_DIR
) $(1)/usr
/lib
191 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpq.so.
* $(1)/usr
/lib
/
194 define Package
/pgsql-cli
/install
195 $(INSTALL_DIR
) $(1)/usr
/bin
196 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/psql
$(1)/usr
/bin
/
199 define Package
/pgsql-server
/install
200 $(INSTALL_DIR
) $(1)/usr
/bin
201 $(INSTALL_DIR
) $(1)/usr
/share
/postgresql
202 $(INSTALL_DIR
) $(1)/usr
/lib
203 $(INSTALL_DIR
) $(1)/etc
/init.d
204 $(INSTALL_DIR
) $(1)/etc
/config
205 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/* $(1)/usr
/bin
206 ln
-sf postgres
$(1)/usr
/bin
/postmaster
208 $(INSTALL_BIN
) .
/files
/postgresql.init
$(1)/etc
/init.d
/postgresql
210 $(CP
) -r
$(PKG_INSTALL_DIR
)/usr
/share
/postgresql
/* \
211 $(1)/usr
/share
/postgresql
213 $(INSTALL_DATA
) .
/files
/postgresql.config
$(1)/etc
/config
/postgresql
216 $(PKG_INSTALL_DIR
)/usr
/lib
/postgresql \
220 define Package
/pgsql-server
/conffiles
221 /etc
/config
/postgresql
224 define Build
/InstallDev
225 $(INSTALL_DIR
) $(1)/usr
/bin
226 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/src
/bin
/pg_config
/pg_config.host
$(1)/usr
/bin
/pg_config
227 $(INSTALL_DIR
) $(1)/usr
/include
228 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpq
$(1)/usr
/include/
229 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/libpq-fe.h
$(1)/usr
/include/
230 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/pg_config.h
$(1)/usr
/include/
231 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/pg_config_manual.h
$(1)/usr
/include/
232 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/postgres_ext.h
$(1)/usr
/include/
233 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/pg_config_ext.h
$(1)/usr
/include/
234 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/postgresql
$(1)/usr
/include/
235 $(INSTALL_DIR
) $(1)/usr
/lib
236 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libpq.
{a
,so
*} $(1)/usr
/lib
/
237 $(CP
) $(PKG_BUILD_DIR
)/src
/interfaces
/ecpg
/preproc
/ecpg.host
$(1)/usr
/bin
/ecpg
238 $(CP
) $(PKG_BUILD_DIR
)/host-zic
$(1)/usr
/bin
/zic
241 $(eval
$(call BuildPackage
,libpq
))
242 $(eval
$(call BuildPackage
,pgsql-cli
))
243 $(eval
$(call BuildPackage
,pgsql-server
))