Merge pull request #14094 from CHKDSK88/crelay-patch
[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:=13.1
9 PKG_RELEASE:=1
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:=12345c83b89aa29808568977f5200d6da00f88a035517f925293355432ffe61f
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
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_archivecleanup \
86 pg_basebackup \
87 pg_controldata \
88 pg_ctl \
89 pg_dump \
90 pg_dumpall \
91 pg_isready \
92 pg_recvlogical \
93 pg_resetwal \
94 pg_restore \
95 pg_standby \
96 pg_upgrade \
97 postgres \
98 initdb
99
100 PGSQL_CLI_EXTRA_BIN := \
101 clusterdb \
102 createdb \
103 createuser \
104 dropdb \
105 dropuser \
106 pgbench \
107 reindexdb \
108 vacuumdb
109
110 PGSQL_CONFIG_VARS:= \
111 pgac_cv_snprintf_long_long_int_format="%lld" \
112 pgac_cv_snprintf_size_t_support=yes \
113 USE_DEV_URANDOM=1 \
114 ZIC=zic
115
116 ifeq ($(CONFIG_USE_UCLIBC),y)
117 # PostgreSQL does not build against uClibc with locales
118 # enabled, due to an uClibc bug, see
119 # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
120 # so overwrite automatic detection and disable locale support
121 PGSQL_CONFIG_VARS+= \
122 pgac_cv_type_locale_t=no
123 endif
124
125 TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
126
127 HOST_CONFIGURE_ARGS += \
128 --disable-nls \
129 --disable-rpath \
130 --without-bonjour \
131 --without-gssapi \
132 --without-ldap \
133 --without-openssl \
134 --without-pam \
135 --without-perl \
136 --without-python \
137 --without-readline \
138 --without-tcl \
139 --without-systemd \
140 --with-zlib="yes" \
141 --enable-depend
142
143 CONFIGURE_ARGS += \
144 $(DISABLE_NLS) \
145 --disable-rpath \
146 --without-bonjour \
147 --without-gssapi \
148 --without-ldap \
149 --without-openssl \
150 --without-pam \
151 --without-perl \
152 --without-python \
153 --without-tcl \
154 --without-systemd \
155 --with-zlib="yes" \
156 --enable-depend \
157 $(if $(CONFIG_arc),--disable-spinlocks)
158
159 HOST_CFLAGS += -std=gnu99
160
161 # Need a native zic and pg_config for build
162 define Host/Compile
163 +$(HOST_MAKE_VARS) MAKELEVEL=0 $(MAKE) -C $(HOST_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
164 +$(HOST_MAKE_VARS) MAKELEVEL=0 $(MAKE) -C $(HOST_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
165 endef
166
167 define Host/Install
168 $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib/
169 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/common/libpgcommon.a $(STAGING_DIR_HOSTPKG)/lib/
170 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/port/libpgport.a $(STAGING_DIR_HOSTPKG)/lib/
171 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/bin/pg_config/pg_config $(STAGING_DIR_HOSTPKG)/lib/
172 $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/
173 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/timezone/zic $(STAGING_DIR_HOSTPKG)/bin/
174 endef
175
176 define Build/Compile
177 $(MAKE) -C $(PKG_BUILD_DIR) MAKELEVEL=0 all contrib
178 endef
179
180 # because PROFILE means something else in the project Makefile
181 unexport PROFILE
182
183 define Package/libpq/install
184 $(INSTALL_DIR) $(1)/usr/lib
185 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
186 endef
187
188 define Package/pgsql-cli/install
189 $(INSTALL_DIR) $(1)/usr/bin
190 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
191 endef
192
193 define Package/pgsql-cli-extra/install
194 $(INSTALL_DIR) $(1)/usr/bin
195 $(INSTALL_BIN) $(foreach bin,$(PGSQL_CLI_EXTRA_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
196 endef
197
198 define Package/pgsql-server/conffiles
199 /etc/config/postgresql
200 endef
201
202 define Package/pgsql-server/install
203 $(INSTALL_DIR) $(1)/usr/bin
204 $(INSTALL_BIN) $(foreach bin,$(PGSQL_SERVER_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
205
206 ln -sf postgres $(1)/usr/bin/postmaster
207
208 $(INSTALL_DIR) $(1)/usr/share/postgresql
209 $(CP) $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
210 $(1)/usr/share/postgresql
211
212 $(INSTALL_DIR) $(1)/usr/lib
213 $(CP) $(PKG_INSTALL_DIR)/usr/lib/postgresql \
214 $(1)/usr/lib/
215
216 $(INSTALL_DIR) $(1)/lib/functions
217 $(INSTALL_BIN) ./files/postgresql.sh $(1)/lib/functions/
218
219 $(INSTALL_DIR) $(1)/etc/config
220 $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
221
222 $(INSTALL_DIR) $(1)/etc/init.d
223 $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
224 endef
225
226 define Build/InstallDev
227 $(INSTALL_DIR) $(1)/usr/bin
228 $(CP) $(STAGING_DIR_HOSTPKG)/lib/pg_config $(1)/usr/bin
229 $(INSTALL_DIR) $(1)/host/bin/
230 $(LN) $(STAGING_DIR)/usr/bin/pg_config $(1)/host/bin
231 $(INSTALL_DIR) $(1)/usr/include
232 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
233 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
234 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
235 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
236 $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
237 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
238 $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
239 $(INSTALL_DIR) $(1)/usr/lib
240 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
241 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
242 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpq.pc $(1)/usr/lib/pkgconfig/
243 endef
244
245 $(eval $(call HostBuild))
246 $(eval $(call BuildPackage,libpq))
247 $(eval $(call BuildPackage,pgsql-cli))
248 $(eval $(call BuildPackage,pgsql-cli-extra))
249 $(eval $(call BuildPackage,pgsql-server))