|
@@ -0,0 +1,254 @@
|
|
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.0.17
|
|
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:=46bf3ef3761c091fb0d2e25012c1709e
|
|
22
|
+PKG_BUILD_PARALLEL:=1
|
|
23
|
+PKG_USE_MIPS16:=0
|
|
24
|
+PKG_FIXUP:=autoreconf
|
|
25
|
+
|
|
26
|
+include $(INCLUDE_DIR)/package.mk
|
|
27
|
+
|
|
28
|
+define Package/libpq
|
|
29
|
+ SECTION:=libs
|
|
30
|
+ CATEGORY:=Libraries
|
|
31
|
+ DEPENDS:=+zlib +libreadline +libpthread +libncurses +shadow-su
|
|
32
|
+ TITLE:=PostgreSQL client library
|
|
33
|
+ URL:=http://www.postgresql.org/
|
|
34
|
+ SUBMENU:=database
|
|
35
|
+endef
|
|
36
|
+
|
|
37
|
+define Package/libpq/description
|
|
38
|
+PostgreSQL client library.
|
|
39
|
+endef
|
|
40
|
+
|
|
41
|
+define Package/pgsql-cli
|
|
42
|
+ SECTION:=utils
|
|
43
|
+ CATEGORY:=Utilities
|
|
44
|
+ DEPENDS:=+libpq
|
|
45
|
+ TITLE:=Command Line Interface (CLI) to PostgreSQL databases
|
|
46
|
+ URL:=http://www.postgresql.org/
|
|
47
|
+ SUBMENU:=database
|
|
48
|
+endef
|
|
49
|
+
|
|
50
|
+define Package/pgsql-cli/description
|
|
51
|
+Command Line Interface (CLI) to PostgreSQL databases.
|
|
52
|
+endef
|
|
53
|
+
|
|
54
|
+define Package/pgsql-server
|
|
55
|
+ SECTION:=utils
|
|
56
|
+ CATEGORY:=Utilities
|
|
57
|
+ DEPENDS:=+libpq
|
|
58
|
+ TITLE:=PostgreSQL databases Server
|
|
59
|
+ URL:=http://www.postgresql.org/
|
|
60
|
+ SUBMENU:=database
|
|
61
|
+endef
|
|
62
|
+
|
|
63
|
+define Package/pgsql-server/description
|
|
64
|
+PostgreSQL databases Server.
|
|
65
|
+endef
|
|
66
|
+
|
|
67
|
+# Need a native ecpg ,pg_config, and zic for build
|
|
68
|
+define Build/Configure
|
|
69
|
+ (cd $(PKG_BUILD_DIR); rm -f config.cache; \
|
|
70
|
+ ./configure \
|
|
71
|
+ --prefix=/usr \
|
|
72
|
+ --exec-prefix=/usr \
|
|
73
|
+ --bindir=/usr/bin \
|
|
74
|
+ --datadir=/usr/share \
|
|
75
|
+ --includedir=/usr/include \
|
|
76
|
+ --infodir=/usr/share/info \
|
|
77
|
+ --libdir=/usr/lib \
|
|
78
|
+ --libexecdir=/usr/lib \
|
|
79
|
+ --localstatedir=/var \
|
|
80
|
+ --mandir=/usr/share/man \
|
|
81
|
+ --sbindir=/usr/sbin \
|
|
82
|
+ --sysconfdir=/etc \
|
|
83
|
+ $(DISABLE_NLS) \
|
|
84
|
+ --enable-shared \
|
|
85
|
+ --enable-static \
|
|
86
|
+ --disable-integer-datetimes \
|
|
87
|
+ --disable-rpath \
|
|
88
|
+ --without-java \
|
|
89
|
+ --without-krb4 \
|
|
90
|
+ --without-krb5 \
|
|
91
|
+ --without-openssl \
|
|
92
|
+ --without-pam \
|
|
93
|
+ --without-perl \
|
|
94
|
+ --without-python \
|
|
95
|
+ --without-readline \
|
|
96
|
+ --without-rendezvous \
|
|
97
|
+ --without-tcl \
|
|
98
|
+ --without-tk \
|
|
99
|
+ --with-zlib="yes" \
|
|
100
|
+ --enable-depend \
|
|
101
|
+ --with-system-timezone=/tmp \
|
|
102
|
+ );
|
|
103
|
+ $(MAKE) -C $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)" CFLAGS+="-I../../libpq"
|
|
104
|
+ mv $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg \
|
|
105
|
+ $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host
|
|
106
|
+ $(MAKE) -C $(PKG_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
|
|
107
|
+ mv $(PKG_BUILD_DIR)/src/timezone/zic $(PKG_BUILD_DIR)/host-zic
|
|
108
|
+ $(INSTALL_DIR) $(STAGING_DIR)/host/bin/
|
|
109
|
+ $(CP) $(PKG_BUILD_DIR)/host-zic $(STAGING_DIR)/host/bin/zic
|
|
110
|
+ $(MAKE) -C $(PKG_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
|
|
111
|
+ mv $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config \
|
|
112
|
+ $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host
|
|
113
|
+ $(MAKE) -C $(PKG_BUILD_DIR) distclean
|
|
114
|
+
|
|
115
|
+ (cd $(PKG_BUILD_DIR); rm -f config.cache; \
|
|
116
|
+ $(TARGET_CONFIGURE_OPTS) \
|
|
117
|
+ CFLAGS="$(TARGET_CFLAGS)" \
|
|
118
|
+ CPPFLAGS="$$$$CPPFLAGS $(TARGET_CPPFLAGS)" \
|
|
119
|
+ LDFLAGS="$(TARGET_LDFLAGS)" \
|
|
120
|
+ ./configure \
|
|
121
|
+ --target=$(GNU_TARGET_NAME) \
|
|
122
|
+ --host=$(GNU_TARGET_NAME) \
|
|
123
|
+ --build=$(GNU_HOST_NAME) \
|
|
124
|
+ --program-prefix="" \
|
|
125
|
+ --program-suffix="" \
|
|
126
|
+ --prefix=/usr \
|
|
127
|
+ --exec-prefix=/usr \
|
|
128
|
+ --bindir=/usr/bin \
|
|
129
|
+ --datadir=/usr/share \
|
|
130
|
+ --includedir=/usr/include \
|
|
131
|
+ --infodir=/usr/share/info \
|
|
132
|
+ --libdir=/usr/lib \
|
|
133
|
+ --libexecdir=/usr/lib \
|
|
134
|
+ --localstatedir=/var \
|
|
135
|
+ --mandir=/usr/share/man \
|
|
136
|
+ --sbindir=/usr/sbin \
|
|
137
|
+ --sysconfdir=/etc \
|
|
138
|
+ $(DISABLE_NLS) \
|
|
139
|
+ $(DISABLE_LARGEFILE) \
|
|
140
|
+ --enable-shared \
|
|
141
|
+ --enable-static \
|
|
142
|
+ --disable-integer-datetimes \
|
|
143
|
+ --disable-rpath \
|
|
144
|
+ --without-java \
|
|
145
|
+ --without-krb4 \
|
|
146
|
+ --without-krb5 \
|
|
147
|
+ --without-openssl \
|
|
148
|
+ --without-pam \
|
|
149
|
+ --without-perl \
|
|
150
|
+ --without-python \
|
|
151
|
+ --without-rendezvous \
|
|
152
|
+ --without-tcl \
|
|
153
|
+ --without-tk \
|
|
154
|
+ --with-zlib="yes" \
|
|
155
|
+ --enable-depend \
|
|
156
|
+ $(if $(CONFIG_TARGET_avr32),--disable-spinlocks) \
|
|
157
|
+ );
|
|
158
|
+ $(SED) 's@ECPG = ../../preproc/ecpg@ECPG = ../../preproc/ecpg.host@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
|
|
159
|
+endef
|
|
160
|
+
|
|
161
|
+TARGET_CFLAGS += $(FPIC) -lpthread
|
|
162
|
+
|
|
163
|
+# because PROFILE means something else in the project Makefile
|
|
164
|
+unexport PROFILE
|
|
165
|
+
|
|
166
|
+define Build/Compile
|
|
167
|
+ +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
|
|
168
|
+ DESTDIR="$(PKG_INSTALL_DIR)" \
|
|
169
|
+ all
|
|
170
|
+ +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
|
|
171
|
+ DESTDIR="$(PKG_INSTALL_DIR)" \
|
|
172
|
+ install
|
|
173
|
+endef
|
|
174
|
+
|
|
175
|
+define Package/libpq/install
|
|
176
|
+ $(INSTALL_DIR) $(1)/usr/lib
|
|
177
|
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
|
|
178
|
+endef
|
|
179
|
+
|
|
180
|
+define Package/pgsql-cli/install
|
|
181
|
+ $(INSTALL_DIR) $(1)/usr/bin
|
|
182
|
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
|
|
183
|
+endef
|
|
184
|
+
|
|
185
|
+define Package/pgsql-server/install
|
|
186
|
+ $(INSTALL_DIR) $(1)/usr/bin
|
|
187
|
+ $(INSTALL_DIR) $(1)/usr/share/postgresql
|
|
188
|
+ $(INSTALL_DIR) $(1)/usr/lib
|
|
189
|
+ $(INSTALL_DIR) $(1)/etc/init.d
|
|
190
|
+ $(INSTALL_DIR) $(1)/etc/config
|
|
191
|
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
|
|
192
|
+ ln -sf postgres $(1)/usr/bin/postmaster
|
|
193
|
+
|
|
194
|
+ $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
|
|
195
|
+
|
|
196
|
+ $(CP) -r $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
|
|
197
|
+ $(1)/usr/share/postgresql
|
|
198
|
+
|
|
199
|
+ $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
|
|
200
|
+
|
|
201
|
+ $(CP) -r \
|
|
202
|
+ $(PKG_INSTALL_DIR)/usr/lib/postgresql \
|
|
203
|
+ $(1)/usr/lib
|
|
204
|
+endef
|
|
205
|
+
|
|
206
|
+define Package/pgsql-server/conffiles
|
|
207
|
+/etc/config/postgresql
|
|
208
|
+endef
|
|
209
|
+
|
|
210
|
+define Package/pgsql-server/postinst
|
|
211
|
+#!/bin/sh
|
|
212
|
+grep -q '^postgres:' /etc/passwd && exit 0
|
|
213
|
+group=$$(grep '^postgres:' /etc/group | cut -f3 -d:)
|
|
214
|
+if [ -z "$${group}" ] ; then
|
|
215
|
+ group=1000
|
|
216
|
+ tst=$$(cat /etc/group | grep ":$${group}:")
|
|
217
|
+ while [ -n "$${tst}" ] ; do
|
|
218
|
+ group=$$(($${group}+1))
|
|
219
|
+ tst=$$(cat /etc/group | grep ":$${group}:")
|
|
220
|
+ done
|
|
221
|
+ echo "postgres:x:$${group}:" >>/etc/group
|
|
222
|
+fi
|
|
223
|
+
|
|
224
|
+user=$$(cat /etc/passwd | grep "^postgres:")
|
|
225
|
+if [ -z "$${user}" ] ; then
|
|
226
|
+ num="$${group}"
|
|
227
|
+ tst=$$(cat /etc/passwd | grep ":.*:$${num}:")
|
|
228
|
+ while [ -n "$${tst}" ] ; do
|
|
229
|
+ num=$$(($${num}+1))
|
|
230
|
+ tst=$$(cat /etc/passwd | grep ":.*:$${num}:")
|
|
231
|
+ done
|
|
232
|
+ echo "postgres:*:$${num}:$${group}:PostgreSQL administrator:/tmp:/bin/ash" >>/etc/passwd
|
|
233
|
+fi
|
|
234
|
+endef
|
|
235
|
+
|
|
236
|
+define Build/InstallDev
|
|
237
|
+ $(INSTALL_DIR) $(1)/usr/bin
|
|
238
|
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host $(1)/usr/bin/pg_config
|
|
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/postgresql $(1)/usr/include/
|
|
246
|
+ $(INSTALL_DIR) $(1)/usr/lib
|
|
247
|
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
|
|
248
|
+ $(CP) $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host $(1)/usr/bin/ecpg
|
|
249
|
+ $(CP) $(PKG_BUILD_DIR)/host-zic $(1)/usr/bin/zic
|
|
250
|
+endef
|
|
251
|
+
|
|
252
|
+$(eval $(call BuildPackage,libpq))
|
|
253
|
+$(eval $(call BuildPackage,pgsql-cli))
|
|
254
|
+$(eval $(call BuildPackage,pgsql-server))
|