bc9c1026bb67cefcee7086e40b8590d0fca354a7
[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.4.12
9 PKG_RELEASE:=2
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 PKG_MD5SUM:=fca055481875d1c49e31c28443f56472a1474b3fbe25b7ae64440c6118f82e64
19 PKG_BUILD_PARALLEL:=1
20 PKG_USE_MIPS16:=0
21 PKG_FIXUP:=autoreconf
22 PKG_MACRO_PATHS:=config
23 PKG_BUILD_DEPENDS += postgresql/host
24 PKG_INSTALL:=1
25
26 include $(INCLUDE_DIR)/host-build.mk
27 include $(INCLUDE_DIR)/package.mk
28
29 define Package/libpq
30 SECTION:=libs
31 CATEGORY:=Libraries
32 DEPENDS:=+zlib +libreadline +libpthread +libncursesw
33 TITLE:=PostgreSQL client library
34 URL:=http://www.postgresql.org/
35 SUBMENU:=database
36 endef
37
38 define Package/libpq/description
39 PostgreSQL client library.
40 endef
41
42 define Package/pgsql-cli
43 SECTION:=utils
44 CATEGORY:=Utilities
45 DEPENDS:=+libpq +librt
46 TITLE:=Command Line Interface (CLI) to PostgreSQL databases
47 URL:=http://www.postgresql.org/
48 SUBMENU:=database
49 endef
50
51 define Package/pgsql-cli/description
52 Command Line Interface (CLI) to PostgreSQL databases.
53 endef
54
55 define Package/pgsql-cli-extra
56 SECTION:=utils
57 CATEGORY:=Utilities
58 DEPENDS:=+libpq +librt
59 TITLE:=Command Line extras for PostgreSQL databases
60 URL:=http://www.postgresql.org/
61 SUBMENU:=database
62 endef
63
64 define Package/pgsql-cli-extra/description
65 Command Line extras for PostgreSQL databases.
66 endef
67
68 define Package/pgsql-server
69 SECTION:=utils
70 CATEGORY:=Utilities
71 DEPENDS:=+libpq +librt +pgsql-cli
72 TITLE:=PostgreSQL databases Server
73 URL:=http://www.postgresql.org/
74 SUBMENU:=database
75 USERID:=postgres=5432:postgres=5432
76 endef
77
78 define Package/pgsql-server/description
79 PostgreSQL databases Server.
80 endef
81
82 PGSQL_CLI_EXTRA_BIN := \
83 clusterdb \
84 createdb \
85 createlang \
86 createuser \
87 dropdb \
88 droplang \
89 dropuser \
90 pgbench \
91 reindexdb \
92 vacuumdb
93
94 PGSQL_CONFIG_VARS:= \
95 pgac_cv_snprintf_long_long_int_format="%lld" \
96 pgac_cv_snprintf_size_t_support=yes
97
98 ifeq ($(CONFIG_USE_UCLIBC),y)
99 # PostgreSQL does not build against uClibc with locales
100 # enabled, due to an uClibc bug, see
101 # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
102 # so overwrite automatic detection and disable locale support
103 PGSQL_CONFIG_VARS+= \
104 pgac_cv_type_locale_t=no
105 endif
106
107 TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
108
109 HOST_CONFIGURE_ARGS += \
110 $(DISABLE_NLS) \
111 --disable-rpath \
112 --without-bonjour \
113 --without-gssapi \
114 --without-ldap \
115 --without-openssl \
116 --without-pam \
117 --without-perl \
118 --without-python \
119 --without-readline \
120 --without-tcl \
121 --with-zlib="yes" \
122 --enable-depend
123
124 CONFIGURE_ARGS += \
125 --disable-rpath \
126 --without-bonjour \
127 --without-gssapi \
128 --without-ldap \
129 --without-openssl \
130 --without-pam \
131 --without-perl \
132 --without-python \
133 --without-tcl \
134 --with-zlib="yes" \
135 --enable-depend \
136 $(if $(CONFIG_TARGET_avr32),--disable-spinlocks)
137
138 # Need a native ecpg ,pg_config, and zic for build
139 define Host/Compile
140 $(MAKE) -C $(HOST_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)"
141 $(MAKE) -C $(HOST_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
142 $(MAKE) -C $(HOST_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
143 endef
144
145 define Host/Install
146 $(INSTALL_DIR) $(STAGING_DIR)/host/bin/
147 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/bin/pg_config/pg_config $(STAGING_DIR)/host/bin/
148 $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/
149 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg $(STAGING_DIR_HOSTPKG)/bin/
150 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/timezone/zic $(STAGING_DIR_HOSTPKG)/bin/
151 endef
152
153 define Build/Configure
154 $(Build/Configure/Default)
155 $(SED) 's@ECPG = ../../preproc/ecpg@ECPG = $(STAGING_DIR_HOSTPKG)/bin/ecpg@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
156 endef
157
158 TARGET_CFLAGS += $(FPIC) -lpthread
159
160 # because PROFILE means something else in the project Makefile
161 unexport PROFILE
162
163 define Package/libpq/install
164 $(INSTALL_DIR) $(1)/usr/lib
165 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
166 endef
167
168 define Package/pgsql-cli/install
169 $(INSTALL_DIR) $(1)/usr/bin
170 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
171 endef
172
173 define Package/pgsql-cli-extra/install
174 $(INSTALL_DIR) $(1)/usr/bin
175 $(INSTALL_BIN) $(foreach bin,$(PGSQL_CLI_EXTRA_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
176 endef
177
178 define Package/pgsql-server/install
179 $(INSTALL_DIR) $(1)/usr/bin
180 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pg_* $(PKG_INSTALL_DIR)/usr/bin/postgres \
181 $(PKG_INSTALL_DIR)/usr/bin/initdb $(1)/usr/bin/
182 ln -sf postgres $(1)/usr/bin/postmaster
183
184 $(INSTALL_DIR) $(1)/usr/share/postgresql
185 $(CP) $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
186 $(1)/usr/share/postgresql
187
188 $(INSTALL_DIR) $(1)/usr/lib
189 $(CP) $(PKG_INSTALL_DIR)/usr/lib/postgresql \
190 $(1)/usr/lib/
191
192 $(INSTALL_DIR) $(1)/lib/functions
193 $(INSTALL_BIN) ./files/postgresql.sh $(1)/lib/functions/
194
195 $(INSTALL_DIR) $(1)/etc/config
196 $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
197
198 $(INSTALL_DIR) $(1)/etc/init.d
199 $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
200 endef
201
202 define Build/InstallDev
203 $(INSTALL_DIR) $(1)/usr/bin
204 $(LN) $(STAGING_DIR)/host/bin/pg_config $(1)/usr/bin
205 $(INSTALL_DIR) $(1)/usr/include
206 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
207 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
208 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
209 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
210 $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
211 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
212 $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
213 $(INSTALL_DIR) $(1)/usr/lib
214 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
215 endef
216
217 $(eval $(call HostBuild))
218 $(eval $(call BuildPackage,libpq))
219 $(eval $(call BuildPackage,pgsql-cli))
220 $(eval $(call BuildPackage,pgsql-cli-extra))
221 $(eval $(call BuildPackage,pgsql-server))