blob: 288a2d183da5d9dbbb72f1c0a15832d757c13f8f [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001SUMMARY = "PostgreSQL is a powerful, open source relational database system."
2DESCRIPTION = "\
3 PostgreSQL is an advanced Object-Relational database management system \
4 (DBMS) that supports almost all SQL constructs (including \
5 transactions, subselects and user-defined types and functions). The \
6 postgresql package includes the client programs and libraries that \
7 you'll need to access a PostgreSQL DBMS server. These PostgreSQL \
8 client programs are programs that directly manipulate the internal \
9 structure of PostgreSQL databases on a PostgreSQL server. These client \
10 programs can be located on the same machine with the PostgreSQL \
11 server, or may be on a remote machine which accesses a PostgreSQL \
12 server over a network connection. This package contains the docs \
13 in HTML for the whole package, as well as command-line utilities for \
14 managing PostgreSQL databases on a PostgreSQL server. \
15 \
16 If you want to manipulate a PostgreSQL database on a local or remote \
17 PostgreSQL server, you need this package. You also need to install \
18 this package if you're installing the postgresql-server package. \
19"
20HOMEPAGE = "http://www.postgresql.com"
21LICENSE = "BSD"
22DEPENDS = "zlib readline tzcode-native"
23INC_PR = "r0"
24
25ARM_INSTRUCTION_SET = "arm"
26
27SRC_URI = "http://ftp.postgresql.org/pub/source/v${PV}/${BP}.tar.bz2 \
28 file://postgresql.init \
29 file://postgresql-bashprofile \
30 file://postgresql.pam \
31 file://postgresql-setup \
32 file://postgresql.service \
33 file://0001-Use-pkg-config-for-libxml2-detection.patch \
34 file://postgresql-CVE-2016-0766.patch \
35 file://postgresql-CVE-2016-0773.patch \
36"
37
38LEAD_SONAME = "libpq.so"
39
40# LDFLAGS for shared libraries
41export LDFLAGS_SL = "${LDFLAGS}"
42
43inherit autotools pkgconfig perlnative pythonnative useradd update-rc.d systemd
44
45SYSTEMD_SERVICE_${PN} = "postgresql.service"
46SYSTEMD_AUTO_ENABLE_${PN} = "disable"
47
48DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}"
49pkg_postinst_${PN} () {
50 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then
51 if [ -n "$D" ]; then
52 OPTS="--root=$D"
53 fi
54 systemctl $OPTS mask postgresql-server.service
55 fi
56}
57
58enable_pam = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
59PACKAGECONFIG ??= "${enable_pam} openssl python uuid libxml tcl nls libxml perl"
60PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam,"
61PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl,"
62PACKAGECONFIG[python] = "--with-python,--without-python,python,python"
63PACKAGECONFIG[uuid] = "--with-ossp-uuid,--without-ossp-uuid,ossp-uuid,"
64# when tcl native package is fixed change WORKDIR to STAGING_BINDIR_CROSS
65PACKAGECONFIG[tcl] = "--with-tcl --with-tclconfig=${STAGING_BINDIR_CROSS},--without-tcl,tcl,"
66PACKAGECONFIG[nls] = "--enable-nls,--disable-nls,,"
67PACKAGECONFIG[libxml] = "--with-libxml,--without-libxml,libxml2,libxml2"
68PACKAGECONFIG[perl] = "--with-perl,--without-perl,perl,perl"
69
70EXTRA_OECONF += "--enable-thread-safety --disable-rpath \
71 --datadir=${datadir}/${BPN} \
72 --sysconfdir=${sysconfdir}/${BPN} \
73"
74EXTRA_OECONF_sh4 += "--disable-spinlocks"
75EXTRA_OECONF_aarch64 += "--disable-spinlocks"
76
77PACKAGES_DYNAMIC += "^${PN}-plperl ^${PN}-plperl-dbg \
78 ^${PN}-pltcl ^${PN}-pltcl-dbg \
79 ^${PN}-plpython ^${PN}-plpython-dbg \
80"
81
82python populate_packages_prepend() {
83
84 def fill_more(name, dbg=True):
85 if name is None or name.strip() == "":
86 return
87
88 fpack=d.getVar('PACKAGES', False) or ""
89 fpack="${PN}-" + name + " " + fpack
90 if dbg:
91 fpack="${PN}-" + name + "-dbg" + " " + fpack
92 d.setVar('PACKAGES', fpack)
93
94 conf=(d.getVar('PACKAGECONFIG', True) or "").split()
95 pack=d.getVar('PACKAGES', False) or ""
96 bb.debug(1, "PACKAGECONFIG=%s" % conf)
97 bb.debug(1, "PACKAGES1=%s" % pack )
98
99 if "perl" in conf :
100 fill_more("plperl")
101
102 if "tcl" in conf:
103 fill_more("pltcl")
104
105 if "python" in conf:
106 fill_more("plpython")
107
108 pack=d.getVar('PACKAGES', True) or ""
109 bb.debug(1, "PACKAGES2=%s" % pack)
110
111}
112
113do_configure() {
114 # do_configure_prepend
115 # make sure configure finds python includdirs with these envs
116 export BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
117 STAGING_INCDIR=${STAGING_INCDIR} \
118 STAGING_LIBDIR=${STAGING_LIBDIR}
119
120 # do_configure
121 autotools_do_configure
122
123 # do_configure_append
124 # workaround perl package related bugs
125 sed -i -e "s:-L/usr/local/lib:-L=/usr/local/lib:g" \
126 ${B}/src/Makefile.global
127 LIBPNA="\${STAGING_LIBDIR_NATIVE}/perl-native"
128 LIBNA="\${STAGING_LIBDIR_NATIVE}"
129 BLIBNA="\${STAGING_BASE_LIBDIR_NATIVE}"
130 sed -i -e "/^perl_archlibexp/s:${LIBPNA}:${STAGING_LIBDIR}:g" \
131 ${B}/src/Makefile.global
132 sed -i -e "/^perl_privlibexp/s:${LIBPNA}:${STAGING_LIBDIR}:g" \
133 ${B}/src/Makefile.global
134 # remove the rpath, replace with correct lib path
135 sed -i \
136 -e "/^perl_embed_ldflags/s:-Wl,-rpath,${LIBNA}::g" \
137 -e "/^perl_embed_ldflags/s:-Wl,-rpath,${BLIBNA}::g" \
138 -e "/^perl_embed_ldflags/s:-Wl,-rpath-link,${LIBNA}::g" \
139 -e "/^perl_embed_ldflags/s:-Wl,-rpath-link,${BLIBNA}::g" \
140 -e "/^perl_embed_ldflags/s:${LIBPNA}:${STAGING_LIBDIR}:g" \
141 -e "/^perl_embed_ldflags/s:${LIBNA}:${STAGING_LIBDIR}:g" \
142 -e "/^perl_embed_ldflags/s:${BLIBNA}:${STAGING_BASELIBDIR}:g" \
143 -e "/^TCLSH/s:=.*:= ${bindir}/tclsh:g" \
144 ${B}/src/Makefile.global
145
146 if ${@bb.utils.contains('PACKAGECONFIG', 'perl', 'true', 'false', d)}; then
147 # workaround perl package's libperl.so problem
148 # we are using perlnative so this perl should have same version
149 perl_version=`perl -v 2>/dev/null | \
150 sed -n 's/This is perl.*v[a-z ]*\([0-9]\.[0-9][0-9.]*\).*$/\1/p'`
151 if [ ! -h "${STAGING_LIBDIR}/perl/$perl_version/CORE/libperl.so" -a \
152 ! -h "${STAGING_LIBDIR}/libperl.so" ]; then
153 ln -sf ../../../libperl.so.5 \
154 ${STAGING_LIBDIR}/perl/$perl_version/CORE/libperl.so
155 fi
156 fi
157}
158
159do_compile_append() {
160 oe_runmake -C contrib all
161}
162
163# server needs to configure user and group
164usernum = "28"
165groupnum = "28"
166USERADD_PACKAGES = "${PN}"
167USERADD_PARAM_${PN} = "-M -g postgres -o -r -d ${localstatedir}/lib/${BPN} \
168 -s /bin/bash -c 'PostgreSQL Server' -u ${usernum} postgres"
169GROUPADD_PARAM_${PN} = "-g ${groupnum} -o -r postgres"
170
171INITSCRIPT_PACKAGES = "${PN}"
172INITSCRIPT_NAME = "${BPN}-server"
173INITSCRIPT_PARAMS = "start 64 . stop 36 0 1 2 3 4 5 6 ."
174
175do_install_append() {
176 # install contrib
177 oe_runmake DESTDIR=${D} -C contrib install
178 # install tutorial
179 install -d -m 0755 ${D}${libdir}/${BPN}/tutorial
180 install ${B}/src/tutorial/* ${D}${libdir}/${BPN}/tutorial
181
182 # install COPYRIGHT README HISTORY
183 install -d -m 0755 ${D}${docdir}/${BPN}
184 for i in ${B}/{COPYRIGHT,README,HISTORY} ${B}/doc/{KNOWN_BUGS,MISSING_FEATURES,README*,bug.template}; do
185 [ -f $i ] && install $i ${D}${docdir}/${BPN}
186 done
187
188 # install dirs and server init
189 install -d ${D}${sysconfdir}/init.d
190 install -m 0755 ${WORKDIR}/${BPN}.init ${D}${sysconfdir}/init.d/${BPN}-server
191 sed -i -e "s/^PGVERSION=.*$/PGVERSION=${PV}/g" ${D}${sysconfdir}/init.d/${BPN}-server
192 install -m 0755 ${WORKDIR}/${BPN}-setup ${D}${bindir}/${BPN}-setup
193 install -d -m 700 ${D}${localstatedir}/lib/${BPN}/data
194 install -d -m 700 ${D}${localstatedir}/lib/${BPN}/backups
195 install -m 644 ${WORKDIR}/${BPN}-bashprofile ${D}${localstatedir}/lib/${BPN}/.bash_profile
196 chown -R postgres:postgres ${D}${localstatedir}/lib/${BPN}
197 # multiple server config directory
198 install -d -m 700 ${D}${sysconfdir}/default/${BPN}
199
200 if [ "${@d.getVar('enable_pam', True)}" = "pam" ]; then
201 install -d ${D}${sysconfdir}/pam.d
202 install -m 644 ${WORKDIR}/postgresql.pam ${D}${sysconfdir}/pam.d/postgresql
203 fi
204
205 # Install systemd unit files
206 install -d ${D}${systemd_unitdir}/system
207 install -m 0644 ${WORKDIR}/postgresql.service ${D}${systemd_unitdir}/system
208 sed -i -e 's,@BINDIR@,${bindir},g' \
209 ${D}${systemd_unitdir}/system/postgresql.service
210}
211
212SSTATE_SCAN_FILES += "Makefile.global"
213
214PACKAGES =+ "${PN}-client ${PN}-server-dev ${PN}-timezone \
215 libecpg-compat-dbg libecpg-compat libecpg-compat-dev \
216 libecpg-dbg libecpg libecpg-dev libecpg-staticdev libecpg-doc \
217 libpq-dbg libpq libpq-dev libpq-staticdev \
218 libpgtypes-dbg libpgtypes libpgtypes-staticdev libpgtypes-dev \
219 ${PN}-contrib ${PN}-contrib-dbg \
220"
221
222FILES_${PN} += "${sysconfdir}/init.d/${BPN}-server \
223 ${localstatedir}/lib/${BPN}/data ${localstatedir}/lib/${BPN}/backups \
224 ${localstatedir}/lib/${BPN}/.bash_profile ${sysconfdir}/default/${BPN} \
225 ${libdir}/${BPN}/dict_snowball.so ${libdir}/${BPN}/plpgsql.so \
226 ${libdir}/${BPN}/euc2004_sjis2004.so \
227 ${libdir}/${BPN}/libpqwalreceiver.so \
228 ${libdir}/${BPN}/*_and_*.so \
229 ${@'${sysconfdir}/pam.d/postgresql' \
230 if 'pam' == d.getVar('enable_pam', True) \
231 else ''} \
232"
233
234FILES_${PN}-dbg += " ${libdir}/${BPN}/.debug/dict_snowball.so \
235 ${libdir}/${BPN}/.debug/plpgsql.so \
236 ${libdir}/${BPN}/.debug/euc2004_sjis2004.so \
237 ${libdir}/${BPN}/.debug/libpqwalreceiver.so \
238 ${libdir}/${BPN}/.debug/*_and_*.so \
239"
240
241FILES_${PN}-client = "${bindir}/clusterdb \
242 ${bindir}/createdb \
243 ${bindir}/createlang \
244 ${bindir}/createuser \
245 ${bindir}/dropdb \
246 ${bindir}/droplang \
247 ${bindir}/dropuser \
248 ${bindir}/pg_dump \
249 ${bindir}/pg_dumpall \
250 ${bindir}/pg_restore \
251 ${bindir}/psql \
252 ${bindir}/reindexdb \
253 ${bindir}/vacuumdb \
254 ${bindir}/vacuumlo \
255 ${datadir}/${BPN}/psqlrc.sample \
256"
257FILES_${PN}-client-doc = "${mandir}/man1/clusterdb.* \
258 ${mandir}/man1/createdb.* ${mandir}/man1/createlang.* \
259 ${mandir}/man1/createuser.* ${mandir}/man1/dropdb.* \
260 ${mandir}/man1/droplang.* ${mandir}/man1/dropuser.* \
261 ${mandir}/man1/pg_dump.* ${mandir}/man1/pg_dumpall.* \
262 ${mandir}/man1/pg_restore.* ${mandir}/man1/psql.* \
263 ${mandir}/man1/reindexdb.* ${mandir}/man1/vacuumdb.* \
264 ${mandir}/man7/* \
265"
266FILES_${PN}-doc += "${docdir}/${BPN}/html ${libdir}/${BPN}/tutorial/ \
267 ${mandir}/man1/initdb.* ${mandir}/man1/pg_controldata.* \
268 ${mandir}/man1/pg_ctl.* ${mandir}/man1/pg_resetxlog.* \
269 ${mandir}/man1/postgres.* ${mandir}/man1/postmaster.* \
270"
271FILES_${PN}-timezone = "${datadir}/${BPN}/timezone \
272 ${datadir}/${BPN}/timezonesets \
273"
274RDEPENDS_${PN} += "${PN}-timezone"
275FILES_${PN}-server-dev = "${includedir}/${BPN}/server"
276
277FILES_libecpg = "${libdir}/libecpg*${SOLIBS}"
278FILES_libecpg-dbg = "${libdir}/.debug/libecpg*"
279FILES_libecpg-dev = "${libdir}/libecpg*${SOLIBSDEV} \
280 ${libdir}/libpgtypes*${SOLIBSDEV} \
281 ${includedir}/ecpg*.h ${includedir}/${BPN}/ecpg*.h \
282 ${includedir}/pgtypes*.h ${includedir}/${BPN}/informix \
283 ${includedir}/sql3types.h ${includedir}/sqlca.h \
284"
285FILES_libecpg-doc = "${mandir}/man1/ecpg.*"
286FILES_libecpg-staticdev = "${libdir}/libecpg*.a"
287SECTION_libecpg-staticdev = "devel"
288RDEPENDS_libecpg-staticdev = "libecpg-dev (= ${EXTENDPKGV})"
289
290FILES_libpq = "${libdir}/libpq*${SOLIBS}"
291FILES_libpq-dbg = "${libdir}/.debug/libpq* ${libdir}/${BPN}/pgxs/src/test/regress/.debug/*"
292FILES_libpq-dev = "${libdir}/libpq*${SOLIBSDEV} \
293 ${includedir} \
294"
295FILES_libpq-staticdev = "${libdir}/libpq*.a ${libdir}/libpgport.a"
296SECTION_libpq-staticdev = "devel"
297RDEPENDS_libpq-staticdev = "libpq-dev (= ${EXTENDPKGV})"
298
299FILES_libecpg-compat = "${libdir}/libecpg_compat*${SOLIBS}"
300FILES_libecpg-compat-dbg = "${libdir}/.debug/libecpg_compat*"
301FILES_libecpg-compat-dev = "${libdir}/libecpg_compat*${SOLIBS}"
302FILES_libpgtypes = "${libdir}/libpgtypes*${SOLIBS}"
303FILES_libpgtypes-dbg = "${libdir}/.debug/libpgtypes*"
304FILES_libpgtypes-staticdev = "${libdir}/libpgtypes*.a"
305FILES_libpgtypes-dev = "${libdir}/libpgtypes*${SOLIBS} ${includedir}/pgtypes*.h"
306
307FILES_${PN}-contrib = " ${bindir}/oid2name ${bindir}/pg_standby \
308 ${bindir}/pgbench ${bindir}/vacuumlo \
309 ${S}/contrib/spi/*.example \
310 ${libdir}/${BPN}/_int.so ${libdir}/${BPN}/adminpack.so \
311 ${libdir}/${BPN}/autoinc.so ${libdir}/${BPN}/auto_explain.so \
312 ${libdir}/${BPN}/auth_delay.so ${libdir}/${BPN}/btree_gin.so \
313 ${libdir}/${BPN}/btree_gist.so ${libdir}/${BPN}/.so \
314 ${libdir}/${BPN}/chkpass.so ${libdir}/${BPN}/citext.so \
315 ${libdir}/${BPN}/cube.so ${libdir}/${BPN}/dblink.so \
316 ${libdir}/${BPN}/dict_int.so ${libdir}/${BPN}/dict_xsyn.so \
317 ${libdir}/${BPN}/dummy_seclabel.so ${libdir}/${BPN}/earthdistance.so \
318 ${libdir}/${BPN}/file_fdw.so ${libdir}/${BPN}/fuzzystrmatch.so \
319 ${libdir}/${BPN}/hstore.so ${libdir}/${BPN}/insert_username.so \
320 ${libdir}/${BPN}/isn.so ${libdir}/${BPN}/lo.so \
321 ${libdir}/${BPN}/ltree.so ${libdir}/${BPN}/moddatetime.so \
322 ${libdir}/${BPN}/pageinspect.so ${libdir}/${BPN}/pg_buffercache.so \
323 ${libdir}/${BPN}/pg_freespacemap.so ${libdir}/${BPN}/pg_trgm.so \
324 ${libdir}/${BPN}/pgcrypto.so ${libdir}/${BPN}/pgrowlocks.so \
325 ${libdir}/${BPN}/pgstattuple.so ${libdir}/${BPN}/pg_stat_statements.so \
326 ${libdir}/${BPN}/refint.so ${libdir}/${BPN}/seg.so \
327 ${libdir}/${BPN}/sslinfo.so \
328 ${libdir}/${BPN}/tablefunc.so \
329 ${libdir}/${BPN}/test_parser.so ${libdir}/${BPN}/timetravel.so \
330 ${libdir}/${BPN}/tsearch2.so ${libdir}/${BPN}/uuid-ossp.so \
331 ${libdir}/${BPN}/pgxml.so ${libdir}/${BPN}/passwordcheck.so \
332 ${libdir}/${BPN}/pg_upgrade_support.so ${libdir}/${BPN}/.so \
333 ${libdir}/${BPN}/unaccent.so \
334"
335FILES_${PN}-contrib-dbg = " \
336 ${libdir}/${BPN}/.debug/_int.so ${libdir}/${BPN}/.debug/adminpack.so \
337 ${libdir}/${BPN}/.debug/autoinc.so ${libdir}/${BPN}/.debug/auto_explain.so \
338 ${libdir}/${BPN}/.debug/auth_delay.so ${libdir}/${BPN}/.debug/btree_gin.so \
339 ${libdir}/${BPN}/.debug/btree_gist.so ${libdir}/${BPN}/.debug/.so \
340 ${libdir}/${BPN}/.debug/chkpass.so ${libdir}/${BPN}/.debug/citext.so \
341 ${libdir}/${BPN}/.debug/cube.so ${libdir}/${BPN}/.debug/dblink.so \
342 ${libdir}/${BPN}/.debug/dict_int.so ${libdir}/${BPN}/.debug/dict_xsyn.so \
343 ${libdir}/${BPN}/.debug/dummy_seclabel.so \
344 ${libdir}/${BPN}/.debug/earthdistance.so \
345 ${libdir}/${BPN}/.debug/file_fdw.so ${libdir}/${BPN}/.debug/fuzzystrmatch.so \
346 ${libdir}/${BPN}/.debug/hstore.so ${libdir}/${BPN}/.debug/insert_username.so \
347 ${libdir}/${BPN}/.debug/isn.so ${libdir}/${BPN}/.debug/lo.so \
348 ${libdir}/${BPN}/.debug/ltree.so ${libdir}/${BPN}/.debug/moddatetime.so \
349 ${libdir}/${BPN}/.debug/pageinspect.so \
350 ${libdir}/${BPN}/.debug/pg_buffercache.so \
351 ${libdir}/${BPN}/.debug/pg_freespacemap.so \
352 ${libdir}/${BPN}/.debug/pg_trgm.so \
353 ${libdir}/${BPN}/.debug/pgcrypto.so ${libdir}/${BPN}/.debug/pgrowlocks.so \
354 ${libdir}/${BPN}/.debug/pgstattuple.so \
355 ${libdir}/${BPN}/.debug/pg_stat_statements.so \
356 ${libdir}/${BPN}/.debug/refint.so ${libdir}/${BPN}/.debug/seg.so \
357 ${libdir}/${BPN}/.debug/sslinfo.so \
358 ${libdir}/${BPN}/.debug/tablefunc.so \
359 ${libdir}/${BPN}/.debug/test_parser.so ${libdir}/${BPN}/.debug/timetravel.so \
360 ${libdir}/${BPN}/.debug/tsearch2.so ${libdir}/${BPN}/.debug/uuid-ossp.so \
361 ${libdir}/${BPN}/.debug/pgxml.so ${libdir}/${BPN}/.debug/passwordcheck.so \
362 ${libdir}/${BPN}/.debug/pg_upgrade_support.so \
363 ${libdir}/${BPN}/.debug/unaccent.so \
364"
365DESCRIPTION_${PN}-contrib = "The postgresql-contrib package contains \
366 contributed packages that are included in the PostgreSQL distribution."
367
368FILES_${PN}-pltcl = "${libdir}/${BPN}/pltcl.so ${bindir}/pltcl_delmod \
369 ${binddir}/pltcl_listmod ${bindir}/pltcl_loadmod \
370 ${datadir}/${BPN}/unknown.pltcl"
371FILES_${PN}-pltcl-dbg = "${libdir}/${BPN}/.debug/pltcl.so"
372SUMMARY_${PN}-pltcl = "The Tcl procedural language for PostgreSQL"
373DESCRIPTION_${PN}-pltcl = "PostgreSQL is an advanced Object-Relational \
374 database management system. The postgresql-pltcl package contains the PL/Tcl \
375 procedural language for the backend."
376
377FILES_${PN}-plperl = "${libdir}/${BPN}/plperl.so"
378FILES_${PN}-plperl-dbg = "${libdir}/${BPN}/.debug/plperl.so"
379SUMMARY_${PN}-plperl = "The Perl procedural language for PostgreSQL"
380DESCRIPTION_${PN}-plperl = "PostgreSQL is an advanced Object-Relational \
381 database management system. The postgresql-plperl package contains the \
382 PL/Perl procedural language for the backend."
383
384# In version 8, it will be plpython.so
385# In version 9, it might be plpython{2,3}.so depending on python2 or 3
386FILES_${PN}-plpython = "${libdir}/${BPN}/plpython*.so"
387FILES_${PN}-plpython-dbg = "${libdir}/${BPN}/.debug/plpython*.so"
388SUMMARY_${PN}-plpython = "The Python procedural language for PostgreSQL"
389DESCRIPTION_${PN}-plpython = "PostgreSQL is an advanced Object-Relational \
390 database management system. The postgresql-plpython package contains \
391 the PL/Python procedural language for the backend."