Merge pull request #4853 from StevenHessing/noddos
[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:=9.6.4
9 PKG_RELEASE:=1
10 PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
11 PKG_LICENSE:=PostgreSQL
12
13 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
14 PKG_SOURCE_URL:=\
15 https://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
16 http://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
17 ftp://ftp.postgresql.org/pub/source/v$(PKG_VERSION)
18
19 PKG_HASH:=2b3ab16d82e21cead54c08b95ce3ac480696944a68603b6c11b3205b7376ce13
20
21 PKG_USE_MIPS16:=0
22 PKG_FIXUP:=autoreconf
23 PKG_MACRO_PATHS:=config
24 PKG_BUILD_DEPENDS += readline/host postgresql/host
25 PKG_INSTALL:=1
26
27 include $(INCLUDE_DIR)/host-build.mk
28 include $(INCLUDE_DIR)/package.mk
29
30 define Package/libpq
31 SECTION:=libs
32 CATEGORY:=Libraries
33 DEPENDS:=+zlib +libreadline +libpthread +libncursesw
34 TITLE:=PostgreSQL client library
35 URL:=http://www.postgresql.org/
36 SUBMENU:=database
37 endef
38
39 define Package/libpq/description
40 PostgreSQL client library.
41 endef
42
43 define Package/pgsql-cli
44 SECTION:=utils
45 CATEGORY:=Utilities
46 DEPENDS:=+libpq +librt
47 TITLE:=Command Line Interface (CLI) to PostgreSQL databases
48 URL:=http://www.postgresql.org/
49 SUBMENU:=database
50 endef
51
52 define Package/pgsql-cli/description
53 Command Line Interface (CLI) to PostgreSQL databases.
54 endef
55
56 define Package/pgsql-cli-extra
57 SECTION:=utils
58 CATEGORY:=Utilities
59 DEPENDS:=+libpq +librt
60 TITLE:=Command Line extras for PostgreSQL databases
61 URL:=http://www.postgresql.org/
62 SUBMENU:=database
63 endef
64
65 define Package/pgsql-cli-extra/description
66 Command Line extras for PostgreSQL databases.
67 endef
68
69 define Package/pgsql-server
70 SECTION:=utils
71 CATEGORY:=Utilities
72 DEPENDS:=+libpq +librt +pgsql-cli
73 TITLE:=PostgreSQL databases Server
74 URL:=http://www.postgresql.org/
75 SUBMENU:=database
76 USERID:=postgres=5432:postgres=5432
77 endef
78
79 define Package/pgsql-server/description
80 PostgreSQL databases Server.
81 endef
82
83 PGSQL_SERVER_BIN := \
84 pg_archivecleanup \
85 pg_basebackup \
86 pg_controldata \
87 pg_ctl \
88 pg_dump \
89 pg_dumpall \
90 pg_isready \
91 pg_receivexlog \
92 pg_recvlogical \
93 pg_resetxlog \
94 pg_restore \
95 pg_standby \
96 pg_upgrade \
97 pg_xlogdump \
98 postgres \
99 initdb
100
101 PGSQL_CLI_EXTRA_BIN := \
102 clusterdb \
103 createdb \
104 createlang \
105 createuser \
106 dropdb \
107 droplang \
108 dropuser \
109 pgbench \
110 reindexdb \
111 vacuumdb
112
113 PGSQL_CONFIG_VARS:= \
114 pgac_cv_snprintf_long_long_int_format="%lld" \
115 pgac_cv_snprintf_size_t_support=yes
116
117 ifeq ($(CONFIG_USE_UCLIBC),y)
118 # PostgreSQL does not build against uClibc with locales
119 # enabled, due to an uClibc bug, see
120 # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
121 # so overwrite automatic detection and disable locale support
122 PGSQL_CONFIG_VARS+= \
123 pgac_cv_type_locale_t=no
124 endif
125
126 TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
127
128 HOST_CONFIGURE_ARGS += \
129 --disable-nls \
130 --disable-rpath \
131 --without-bonjour \
132 --without-gssapi \
133 --without-ldap \
134 --without-openssl \
135 --without-pam \
136 --without-perl \
137 --without-python \
138 --without-readline \
139 --without-tcl \
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 --with-zlib="yes" \
155 --enable-depend \
156 $(if $(CONFIG_TARGET_avr32),--disable-spinlocks)
157
158 EXTRA_CFLAGS:= -I$(PKG_BUILD_DIR)/src/include/
159
160 # Need a native ecpg, pg_config and zic for build
161 define Host/Compile
162 $(MAKE) -C $(HOST_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
163 $(MAKE) -C $(HOST_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)"
164 $(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/interfaces/ecpg/preproc/ecpg $(STAGING_DIR_HOSTPKG)/bin/
174 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/timezone/zic $(STAGING_DIR_HOSTPKG)/bin/
175 endef
176
177 define Build/Configure
178 $(Build/Configure/Default)
179 $(SED) 's@ECPG = ../../preproc/ecpg@ECPG = $(STAGING_DIR_HOSTPKG)/bin/ecpg@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
180 endef
181
182 TARGET_CFLAGS += $(FPIC) -lpthread
183
184 # because PROFILE means something else in the project Makefile
185 unexport PROFILE
186
187 define Package/libpq/install
188 $(INSTALL_DIR) $(1)/usr/lib
189 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
190 endef
191
192 define Package/pgsql-cli/install
193 $(INSTALL_DIR) $(1)/usr/bin
194 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
195 endef
196
197 define Package/pgsql-cli-extra/install
198 $(INSTALL_DIR) $(1)/usr/bin
199 $(INSTALL_BIN) $(foreach bin,$(PGSQL_CLI_EXTRA_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
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))