Merge pull request #18055 from pprindeville/bind-subpackage-ddns-confgen
[feed/packages.git] / libs / postgresql / Makefile
1 # This is free software, licensed under the GNU General Public License v2.
2 # See /LICENSE for more information.
3 #
4
5 include $(TOPDIR)/rules.mk
6
7 PKG_NAME:=postgresql
8 PKG_VERSION:=14.2
9 PKG_RELEASE:=$(AUTORELEASE)
10 PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
11 PKG_LICENSE:=PostgreSQL
12 PKG_CPE_ID:=cpe:/a:postgresql:postgresql
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=\
16 https://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
17 http://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
18 ftp://ftp.postgresql.org/pub/source/v$(PKG_VERSION)
19
20 PKG_HASH:=2cf78b2e468912f8101d695db5340cf313c2e9f68a612fb71427524e8c9a977a
21
22 PKG_USE_MIPS16:=0
23 PKG_FIXUP:=autoreconf
24 PKG_MACRO_PATHS:=config
25 PKG_BUILD_DEPENDS:=postgresql/host
26 PKG_INSTALL:=1
27
28 include $(INCLUDE_DIR)/host-build.mk
29 include $(INCLUDE_DIR)/package.mk
30
31 define Package/libpq
32 SECTION:=libs
33 CATEGORY:=Libraries
34 DEPENDS:=+libpthread
35 TITLE:=PostgreSQL client library
36 URL:=http://www.postgresql.org/
37 SUBMENU:=Database
38 endef
39
40 define Package/libpq/description
41 PostgreSQL client library.
42 endef
43
44 define Package/pgsql-cli
45 SECTION:=utils
46 CATEGORY:=Utilities
47 DEPENDS:=+libncursesw +libpq +libreadline +librt +zlib
48 TITLE:=Command Line Interface (CLI) to PostgreSQL databases
49 URL:=http://www.postgresql.org/
50 SUBMENU:=Database
51 endef
52
53 define Package/pgsql-cli/description
54 Command Line Interface (CLI) to PostgreSQL databases.
55 endef
56
57 define Package/pgsql-cli-extra
58 SECTION:=utils
59 CATEGORY:=Utilities
60 DEPENDS:=+libncursesw +libpq +libreadline +librt +zlib
61 TITLE:=Command Line extras for PostgreSQL databases
62 URL:=http://www.postgresql.org/
63 SUBMENU:=Database
64 endef
65
66 define Package/pgsql-cli-extra/description
67 Command Line extras for PostgreSQL databases.
68 endef
69
70 define Package/pgsql-server
71 SECTION:=utils
72 CATEGORY:=Utilities
73 DEPENDS:=+pgsql-cli +blockd
74 TITLE:=PostgreSQL databases Server
75 URL:=http://www.postgresql.org/
76 SUBMENU:=Database
77 USERID:=postgres=5432:postgres=5432
78 endef
79
80 define Package/pgsql-server/description
81 PostgreSQL databases Server.
82 endef
83
84 PGSQL_SERVER_BIN := \
85 pg_amcheck \
86 pg_archivecleanup \
87 pg_basebackup \
88 pg_checksums \
89 pg_controldata \
90 pg_ctl \
91 pg_dump \
92 pg_dumpall \
93 pg_isready \
94 pg_recvlogical \
95 pg_receivewal \
96 pg_resetwal \
97 pg_restore \
98 pg_rewind \
99 pg_upgrade \
100 pg_verifybackup \
101 pg_waldump \
102 postgres \
103 initdb
104
105 PGSQL_CLI_EXTRA_BIN := \
106 clusterdb \
107 createdb \
108 createuser \
109 dropdb \
110 dropuser \
111 oid2name \
112 pgbench \
113 reindexdb \
114 vacuumdb \
115 vacuumlo
116
117 PGSQL_CONFIG_VARS:= \
118 pgac_cv_snprintf_long_long_int_format="%lld" \
119 pgac_cv_snprintf_size_t_support=yes \
120 USE_DEV_URANDOM=1 \
121 ac_cv_file__dev_urandom="/dev/urandom" \
122 ZIC=zic
123
124 ifeq ($(CONFIG_USE_UCLIBC),y)
125 # PostgreSQL does not build against uClibc with locales
126 # enabled, due to an uClibc bug, see
127 # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
128 # so overwrite automatic detection and disable locale support
129 PGSQL_CONFIG_VARS+= \
130 pgac_cv_type_locale_t=no
131 endif
132
133 TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
134
135 HOST_CONFIGURE_ARGS += \
136 --disable-nls \
137 --disable-rpath \
138 --without-bonjour \
139 --without-gssapi \
140 --without-ldap \
141 --without-openssl \
142 --without-pam \
143 --without-perl \
144 --without-python \
145 --without-readline \
146 --without-tcl \
147 --without-systemd \
148 --with-zlib="yes" \
149 --enable-depend
150
151 CONFIGURE_ARGS += \
152 $(DISABLE_NLS) \
153 --disable-rpath \
154 --without-bonjour \
155 --without-gssapi \
156 --without-ldap \
157 --without-openssl \
158 --without-pam \
159 --without-perl \
160 --without-python \
161 --without-tcl \
162 --without-systemd \
163 --with-zlib="yes" \
164 --enable-depend \
165 $(if $(CONFIG_arc),--disable-spinlocks)
166
167 HOST_CFLAGS += -std=gnu99
168
169 # Need a native zic and pg_config for build
170 define Host/Compile
171 +$(HOST_MAKE_VARS) MAKELEVEL=0 $(MAKE) -C $(HOST_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
172 +$(HOST_MAKE_VARS) MAKELEVEL=0 $(MAKE) -C $(HOST_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
173 endef
174
175 define Host/Install
176 $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib/
177 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/common/libpgcommon.a $(STAGING_DIR_HOSTPKG)/lib/
178 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/port/libpgport.a $(STAGING_DIR_HOSTPKG)/lib/
179 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/bin/pg_config/pg_config $(STAGING_DIR_HOSTPKG)/lib/
180 $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/
181 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/timezone/zic $(STAGING_DIR_HOSTPKG)/bin/
182 endef
183
184 define Build/Compile
185 $(MAKE) -C $(PKG_BUILD_DIR) MAKELEVEL=0 all contrib
186 endef
187
188 # because PROFILE means something else in the project Makefile
189 unexport PROFILE
190
191 define Package/libpq/install
192 $(INSTALL_DIR) $(1)/usr/lib
193 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
194 endef
195
196 define Package/pgsql-cli/install
197 $(INSTALL_DIR) $(1)/usr/bin
198 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
199 endef
200
201 define Package/pgsql-cli-extra/install
202 $(INSTALL_DIR) $(1)/usr/bin
203 $(INSTALL_BIN) $(foreach bin,$(PGSQL_CLI_EXTRA_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
204 endef
205
206 define Package/pgsql-server/conffiles
207 /etc/config/postgresql
208 endef
209
210 define Package/pgsql-server/install
211 $(INSTALL_DIR) $(1)/usr/bin
212 $(INSTALL_BIN) $(foreach bin,$(PGSQL_SERVER_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
213
214 ln -sf postgres $(1)/usr/bin/postmaster
215
216 $(INSTALL_DIR) $(1)/usr/share/postgresql
217 $(CP) $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
218 $(1)/usr/share/postgresql
219
220 $(INSTALL_DIR) $(1)/usr/lib
221 $(CP) $(PKG_INSTALL_DIR)/usr/lib/postgresql \
222 $(1)/usr/lib/
223
224 $(INSTALL_DIR) $(1)/lib/functions
225 $(INSTALL_BIN) ./files/postgresql.sh $(1)/lib/functions/
226
227 $(INSTALL_DIR) $(1)/etc/config
228 $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
229
230 $(INSTALL_DIR) $(1)/etc/init.d
231 $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
232 endef
233
234 define Build/InstallDev
235 $(INSTALL_DIR) $(1)/usr/bin
236 $(CP) $(STAGING_DIR_HOSTPKG)/lib/pg_config $(1)/usr/bin
237 $(INSTALL_DIR) $(1)/host/bin/
238 $(LN) $(STAGING_DIR)/usr/bin/pg_config $(1)/host/bin
239 $(INSTALL_DIR) $(1)/usr/include
240 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
241 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
242 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
243 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
244 $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
245 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
246 $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
247 $(INSTALL_DIR) $(1)/usr/lib
248 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
249 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
250 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpq.pc $(1)/usr/lib/pkgconfig/
251 endef
252
253 $(eval $(call HostBuild))
254 $(eval $(call BuildPackage,libpq))
255 $(eval $(call BuildPackage,pgsql-cli))
256 $(eval $(call BuildPackage,pgsql-cli-extra))
257 $(eval $(call BuildPackage,pgsql-server))