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:=Daniel Golle <daniel@makrotopia.org>
14 PKG_LICENSE:=PostgreSQL
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
18 https://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
19 http://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
20 ftp://ftp.postgresql.org/pub/source/v$(PKG_VERSION)
21 PKG_MD5SUM:=cf5e571164ad66028ecd7dd8819e3765470d45bcd440d258b686be7e69c76ed0
25 PKG_MACRO_PATHS:=config
26 PKG_BUILD_DEPENDS += postgresql/host
28 include $(INCLUDE_DIR)/host-build.mk
29 include $(INCLUDE_DIR)/package.mk
34 DEPENDS:=+zlib +libreadline +libpthread +libncursesw
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
47 DEPENDS:=+libpq +librt
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-cli-extra
60 DEPENDS:=+libpq +librt
61 TITLE:=Command Line extras for PostgreSQL databases
62 URL:=http://www.postgresql.org/
66 define Package/pgsql-cli-extra/description
67 Command Line extras for PostgreSQL databases.
70 define Package/pgsql-server
73 DEPENDS:=+libpq +librt +pgsql-cli
74 TITLE:=PostgreSQL databases Server
75 URL:=http://www.postgresql.org/
77 USERID:=postgres=5432:postgres=5432
80 define Package/pgsql-server/description
81 PostgreSQL databases Server.
84 PGSQL_CLI_EXTRA_BIN := \
97 pgac_cv_snprintf_long_long_int_format="%lld" \
98 pgac_cv_snprintf_size_t_support=yes
100 ifeq ($(CONFIG_USE_UCLIBC),y)
101 # PostgreSQL does not build against uClibc with locales
102 # enabled, due to an uClibc bug, see
103 # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
104 # so overwrite automatic detection and disable locale support
105 PGSQL_CONFIG_VARS+= \
106 pgac_cv_type_locale_t=no
109 TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
111 HOST_CONFIGURE_ARGS += \
138 $(if $(CONFIG_TARGET_avr32),--disable-spinlocks)
140 # Need a native ecpg ,pg_config, and zic for build
142 $(MAKE) -C $(HOST_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)"
143 $(MAKE) -C $(HOST_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
144 $(MAKE) -C $(HOST_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
148 $(INSTALL_DIR) $(STAGING_DIR)/usr/bin/
149 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/bin/pg_config/pg_config $(STAGING_DIR)/usr/bin/
150 $(INSTALL_DIR) $(STAGING_DIR)/host/bin/
151 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg $(STAGING_DIR)/host/bin/
152 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/timezone/zic $(STAGING_DIR)/host/bin/
155 define Build/Configure
156 $(Build/Configure/Default)
157 $(SED) 's@ECPG = ../../preproc/ecpg@ECPG = $(STAGING_DIR)/host/bin/ecpg@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
160 TARGET_CFLAGS += $(FPIC) -lpthread
162 # because PROFILE means something else in the project Makefile
166 +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
167 DESTDIR="$(PKG_INSTALL_DIR)" \
169 +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
170 DESTDIR="$(PKG_INSTALL_DIR)" \
174 define Package/libpq/install
175 $(INSTALL_DIR) $(1)/usr/lib
176 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
179 define Package/pgsql-cli/install
180 $(INSTALL_DIR) $(1)/usr/bin
181 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
184 define Package/pgsql-cli-extra/install
185 $(INSTALL_DIR) $(1)/usr/bin
186 $(INSTALL_BIN) $(foreach bin,$(PGSQL_CLI_EXTRA_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
189 define Package/pgsql-server/install
190 $(INSTALL_DIR) $(1)/usr/bin
191 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pg_* $(PKG_INSTALL_DIR)/usr/bin/postgres \
192 $(PKG_INSTALL_DIR)/usr/bin/initdb $(1)/usr/bin/
193 ln -sf postgres $(1)/usr/bin/postmaster
195 $(INSTALL_DIR) $(1)/usr/share/postgresql
196 $(CP) $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
197 $(1)/usr/share/postgresql
199 $(INSTALL_DIR) $(1)/usr/lib
200 $(CP) $(PKG_INSTALL_DIR)/usr/lib/postgresql \
203 $(INSTALL_DIR) $(1)/lib/functions
204 $(INSTALL_BIN) ./files/postgresql.sh $(1)/lib/functions/
206 $(INSTALL_DIR) $(1)/etc/config
207 $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
209 $(INSTALL_DIR) $(1)/etc/init.d
210 $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
213 define Build/InstallDev
214 $(INSTALL_DIR) $(1)/usr/bin
215 $(INSTALL_DIR) $(1)/usr/include
216 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
217 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
218 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
219 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
220 $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
221 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
222 $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
223 $(INSTALL_DIR) $(1)/usr/lib
224 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
227 $(eval $(call HostBuild))
228 $(eval $(call BuildPackage,libpq))
229 $(eval $(call BuildPackage,pgsql-cli))
230 $(eval $(call BuildPackage,pgsql-cli-extra))
231 $(eval $(call BuildPackage,pgsql-server))