libmicrohttpd: build parallel
[feed/packages.git] / libs / postgresql / Makefile
1 #
2 # Copyright (C) 2006-2014 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=postgresql
11 PKG_VERSION:=9.4.4
12 PKG_RELEASE:=1
13 PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
14 PKG_LICENSE:=PostgreSQL
15
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
17 PKG_SOURCE_URL:=\
18 http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v$(PKG_VERSION) \
19 http://ftp.be.postgresql.org/postgresql/source/v$(PKG_VERSION) \
20 ftp://ftp-archives.postgresql.org/pub/source/v$(PKG_VERSION)
21 PKG_MD5SUM:=1fe952c44ed26d7e6a335cf991a9c1c6
22 PKG_BUILD_PARALLEL:=1
23 PKG_USE_MIPS16:=0
24 PKG_FIXUP:=autoreconf
25 PKG_MACRO_PATHS:=config
26
27 include $(INCLUDE_DIR)/package.mk
28
29 define Package/libpq
30 SECTION:=libs
31 CATEGORY:=Libraries
32 DEPENDS:=+zlib +libreadline +libpthread +libncurses +shadow-utils +shadow-su
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 +USE_UCLIBC: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-server
56 SECTION:=utils
57 CATEGORY:=Utilities
58 DEPENDS:=+libpq +USE_UCLIBC:librt
59 TITLE:=PostgreSQL databases Server
60 URL:=http://www.postgresql.org/
61 SUBMENU:=database
62 USERID:=postgres=5432:postgres=5432
63 endef
64
65 define Package/pgsql-server/description
66 PostgreSQL databases Server.
67 endef
68
69 PGSQL_CONFIG_VARS:= \
70 pgac_cv_snprintf_long_long_int_format="%lld" \
71 pgac_cv_snprintf_size_t_support=yes
72
73 ifeq ($(CONFIG_USE_UCLIBC),y)
74 # PostgreSQL does not build against uClibc with locales
75 # enabled, due to an uClibc bug, see
76 # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
77 # so overwrite automatic detection and disable locale support
78 PGSQL_CONFIG_VARS+= \
79 pgac_cv_type_locale_t=no
80 endif
81
82 TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
83
84 # Need a native ecpg ,pg_config, and zic for build
85 define Build/Configure
86 (cd $(PKG_BUILD_DIR); rm -f config.cache; \
87 $(PGSQL_CONFIG_VARS) \
88 ./configure \
89 --prefix=/usr \
90 --exec-prefix=/usr \
91 --bindir=/usr/bin \
92 --datadir=/usr/share \
93 --includedir=/usr/include \
94 --infodir=/usr/share/info \
95 --libdir=/usr/lib \
96 --libexecdir=/usr/lib \
97 --localstatedir=/var \
98 --mandir=/usr/share/man \
99 --sbindir=/usr/sbin \
100 --sysconfdir=/etc \
101 $(DISABLE_NLS) \
102 --enable-shared \
103 --enable-static \
104 --disable-integer-datetimes \
105 --disable-rpath \
106 --without-bonjour \
107 --without-gssapi \
108 --without-ldap \
109 --without-openssl \
110 --without-pam \
111 --without-perl \
112 --without-python \
113 --without-readline \
114 --without-tcl \
115 --with-zlib="yes" \
116 --enable-depend \
117 --with-system-timezone=/tmp \
118 );
119 $(MAKE) -C $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)" CFLAGS+="-I../../libpq"
120 mv $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg \
121 $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host
122 $(MAKE) -C $(PKG_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
123 mv $(PKG_BUILD_DIR)/src/timezone/zic $(PKG_BUILD_DIR)/host-zic
124 $(INSTALL_DIR) $(STAGING_DIR)/host/bin/
125 $(CP) $(PKG_BUILD_DIR)/host-zic $(STAGING_DIR)/host/bin/zic
126 $(MAKE) -C $(PKG_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
127 mv $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config \
128 $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host
129 $(MAKE) -C $(PKG_BUILD_DIR) distclean
130
131 (cd $(PKG_BUILD_DIR); rm -f config.cache; \
132 $(TARGET_CONFIGURE_OPTS) \
133 CFLAGS="$(TARGET_CFLAGS)" \
134 CPPFLAGS="$$$$CPPFLAGS $(TARGET_CPPFLAGS)" \
135 LDFLAGS="$(TARGET_LDFLAGS)" \
136 ./configure \
137 --target=$(GNU_TARGET_NAME) \
138 --host=$(GNU_TARGET_NAME) \
139 --build=$(GNU_HOST_NAME) \
140 --program-prefix="" \
141 --program-suffix="" \
142 --prefix=/usr \
143 --exec-prefix=/usr \
144 --bindir=/usr/bin \
145 --datadir=/usr/share \
146 --includedir=/usr/include \
147 --infodir=/usr/share/info \
148 --libdir=/usr/lib \
149 --libexecdir=/usr/lib \
150 --localstatedir=/var \
151 --mandir=/usr/share/man \
152 --sbindir=/usr/sbin \
153 --sysconfdir=/etc \
154 $(DISABLE_NLS) \
155 $(DISABLE_LARGEFILE) \
156 --enable-shared \
157 --enable-static \
158 --disable-integer-datetimes \
159 --disable-rpath \
160 --without-bonjour \
161 --without-gssapi \
162 --without-ldap \
163 --without-openssl \
164 --without-pam \
165 --without-perl \
166 --without-python \
167 --without-tcl \
168 --with-zlib="yes" \
169 --enable-depend \
170 $(if $(CONFIG_TARGET_avr32),--disable-spinlocks) \
171 );
172 $(SED) 's@ECPG = ../../preproc/ecpg@ECPG = ../../preproc/ecpg.host@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
173 endef
174
175 TARGET_CFLAGS += $(FPIC) -lpthread
176
177 # because PROFILE means something else in the project Makefile
178 unexport PROFILE
179
180 define Build/Compile
181 +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
182 DESTDIR="$(PKG_INSTALL_DIR)" \
183 all
184 +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
185 DESTDIR="$(PKG_INSTALL_DIR)" \
186 install
187 endef
188
189 define Package/libpq/install
190 $(INSTALL_DIR) $(1)/usr/lib
191 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
192 endef
193
194 define Package/pgsql-cli/install
195 $(INSTALL_DIR) $(1)/usr/bin
196 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
197 endef
198
199 define Package/pgsql-server/install
200 $(INSTALL_DIR) $(1)/usr/bin
201 $(INSTALL_DIR) $(1)/usr/share/postgresql
202 $(INSTALL_DIR) $(1)/usr/lib
203 $(INSTALL_DIR) $(1)/etc/init.d
204 $(INSTALL_DIR) $(1)/etc/config
205 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
206 ln -sf postgres $(1)/usr/bin/postmaster
207
208 $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
209
210 $(CP) -r $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
211 $(1)/usr/share/postgresql
212
213 $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
214
215 $(CP) -r \
216 $(PKG_INSTALL_DIR)/usr/lib/postgresql \
217 $(1)/usr/lib
218 endef
219
220 define Package/pgsql-server/conffiles
221 /etc/config/postgresql
222 endef
223
224 define Build/InstallDev
225 $(INSTALL_DIR) $(1)/usr/bin
226 $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host $(1)/usr/bin/pg_config
227 $(INSTALL_DIR) $(1)/usr/include
228 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
229 $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
230 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
231 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
232 $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
233 $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
234 $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
235 $(INSTALL_DIR) $(1)/usr/lib
236 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
237 $(CP) $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host $(1)/usr/bin/ecpg
238 $(CP) $(PKG_BUILD_DIR)/host-zic $(1)/usr/bin/zic
239 endef
240
241 $(eval $(call BuildPackage,libpq))
242 $(eval $(call BuildPackage,pgsql-cli))
243 $(eval $(call BuildPackage,pgsql-server))