blob: 85f19170b9bc0599d937d154deb40edaa6c0f44d [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"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080022DEPENDS = "libnsl2 zlib readline tzcode-native"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050023
24ARM_INSTRUCTION_SET = "arm"
25
26SRC_URI = "http://ftp.postgresql.org/pub/source/v${PV}/${BP}.tar.bz2 \
27 file://postgresql.init \
Andrew Geissler1548c072019-02-22 16:03:50 -060028 file://postgresql-profile \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050029 file://postgresql.pam \
30 file://postgresql-setup \
31 file://postgresql.service \
32 file://0001-Use-pkg-config-for-libxml2-detection.patch \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050033"
34
35LEAD_SONAME = "libpq.so"
36
37# LDFLAGS for shared libraries
38export LDFLAGS_SL = "${LDFLAGS}"
39
Brad Bishop19323692019-04-05 15:28:33 -040040inherit autotools pkgconfig perlnative pythonnative useradd update-rc.d systemd gettext cpan-base
Patrick Williamsb48b7b42016-08-17 15:04:38 -050041
Brad Bishop6e60e8b2018-02-01 10:27:11 -050042CFLAGS += "-I${STAGING_INCDIR}/${PYTHON_DIR} -I${STAGING_INCDIR}/tcl8.6"
Patrick Williamsddad1a12017-02-23 20:36:32 -060043
Patrick Williamsb48b7b42016-08-17 15:04:38 -050044SYSTEMD_SERVICE_${PN} = "postgresql.service"
45SYSTEMD_AUTO_ENABLE_${PN} = "disable"
46
47DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}"
48pkg_postinst_${PN} () {
49 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then
50 if [ -n "$D" ]; then
51 OPTS="--root=$D"
52 fi
53 systemctl $OPTS mask postgresql-server.service
54 fi
55}
56
Brad Bishop6e60e8b2018-02-01 10:27:11 -050057enable_pam = "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050058PACKAGECONFIG ??= "${enable_pam} openssl python uuid libxml tcl nls libxml perl"
59PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam,"
60PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl,"
61PACKAGECONFIG[python] = "--with-python,--without-python,python,python"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080062PACKAGECONFIG[uuid] = "--with-uuid=e2fs,--without-uuid,util-linux,"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050063PACKAGECONFIG[tcl] = "--with-tcl --with-tclconfig=${STAGING_BINDIR_CROSS},--without-tcl,tcl tcl-native,"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050064PACKAGECONFIG[nls] = "--enable-nls,--disable-nls,,"
65PACKAGECONFIG[libxml] = "--with-libxml,--without-libxml,libxml2,libxml2"
66PACKAGECONFIG[perl] = "--with-perl,--without-perl,perl,perl"
67
68EXTRA_OECONF += "--enable-thread-safety --disable-rpath \
69 --datadir=${datadir}/${BPN} \
70 --sysconfdir=${sysconfdir}/${BPN} \
71"
72EXTRA_OECONF_sh4 += "--disable-spinlocks"
73EXTRA_OECONF_aarch64 += "--disable-spinlocks"
74
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080075PACKAGES_DYNAMIC += "^${PN}-plperl \
76 ^${PN}-pltcl \
77 ^${PN}-plpython \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050078"
79
80python populate_packages_prepend() {
81
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080082 def fill_more(name):
Patrick Williamsb48b7b42016-08-17 15:04:38 -050083 if name is None or name.strip() == "":
84 return
85
86 fpack=d.getVar('PACKAGES', False) or ""
87 fpack="${PN}-" + name + " " + fpack
Patrick Williamsb48b7b42016-08-17 15:04:38 -050088 d.setVar('PACKAGES', fpack)
89
Brad Bishop6e60e8b2018-02-01 10:27:11 -050090 conf=(d.getVar('PACKAGECONFIG') or "").split()
Patrick Williamsb48b7b42016-08-17 15:04:38 -050091 pack=d.getVar('PACKAGES', False) or ""
92 bb.debug(1, "PACKAGECONFIG=%s" % conf)
93 bb.debug(1, "PACKAGES1=%s" % pack )
94
95 if "perl" in conf :
96 fill_more("plperl")
97
98 if "tcl" in conf:
99 fill_more("pltcl")
100
101 if "python" in conf:
102 fill_more("plpython")
103
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500104 pack=d.getVar('PACKAGES') or ""
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500105 bb.debug(1, "PACKAGES2=%s" % pack)
106
107}
108
Brad Bishop19323692019-04-05 15:28:33 -0400109# This will make native perl use target settings (for include dirs etc.)
110export PERLCONFIGTARGET = "${@is_target(d)}"
111export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}"
112
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500113do_configure() {
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500114 # do_configure
115 autotools_do_configure
116
117 # do_configure_append
118 # workaround perl package related bugs
119 sed -i -e "s:-L/usr/local/lib:-L=/usr/local/lib:g" \
120 ${B}/src/Makefile.global
121 LIBPNA="\${STAGING_LIBDIR_NATIVE}/perl-native"
122 LIBNA="\${STAGING_LIBDIR_NATIVE}"
123 BLIBNA="\${STAGING_BASE_LIBDIR_NATIVE}"
124 sed -i -e "/^perl_archlibexp/s:${LIBPNA}:${STAGING_LIBDIR}:g" \
125 ${B}/src/Makefile.global
Brad Bishop19323692019-04-05 15:28:33 -0400126 sed -i -e "/^perl_privlibexp/s:${libdir}:${STAGING_LIBDIR}:g" \
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500127 ${B}/src/Makefile.global
128 # remove the rpath, replace with correct lib path
129 sed -i \
130 -e "/^perl_embed_ldflags/s:-Wl,-rpath,${LIBNA}::g" \
131 -e "/^perl_embed_ldflags/s:-Wl,-rpath,${BLIBNA}::g" \
132 -e "/^perl_embed_ldflags/s:-Wl,-rpath-link,${LIBNA}::g" \
133 -e "/^perl_embed_ldflags/s:-Wl,-rpath-link,${BLIBNA}::g" \
134 -e "/^perl_embed_ldflags/s:${LIBPNA}:${STAGING_LIBDIR}:g" \
135 -e "/^perl_embed_ldflags/s:${LIBNA}:${STAGING_LIBDIR}:g" \
136 -e "/^perl_embed_ldflags/s:${BLIBNA}:${STAGING_BASELIBDIR}:g" \
137 -e "/^TCLSH/s:=.*:= ${bindir}/tclsh:g" \
138 ${B}/src/Makefile.global
139
140 if ${@bb.utils.contains('PACKAGECONFIG', 'perl', 'true', 'false', d)}; then
141 # workaround perl package's libperl.so problem
142 # we are using perlnative so this perl should have same version
143 perl_version=`perl -v 2>/dev/null | \
144 sed -n 's/This is perl.*v[a-z ]*\([0-9]\.[0-9][0-9.]*\).*$/\1/p'`
145 if [ ! -h "${STAGING_LIBDIR}/perl/$perl_version/CORE/libperl.so" -a \
146 ! -h "${STAGING_LIBDIR}/libperl.so" ]; then
147 ln -sf ../../../libperl.so.5 \
148 ${STAGING_LIBDIR}/perl/$perl_version/CORE/libperl.so
149 fi
150 fi
151}
152
153do_compile_append() {
154 oe_runmake -C contrib all
155}
156
157# server needs to configure user and group
158usernum = "28"
159groupnum = "28"
160USERADD_PACKAGES = "${PN}"
161USERADD_PARAM_${PN} = "-M -g postgres -o -r -d ${localstatedir}/lib/${BPN} \
Andrew Geissler1548c072019-02-22 16:03:50 -0600162 -s /bin/sh -c 'PostgreSQL Server' -u ${usernum} postgres"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500163GROUPADD_PARAM_${PN} = "-g ${groupnum} -o -r postgres"
164
165INITSCRIPT_PACKAGES = "${PN}"
166INITSCRIPT_NAME = "${BPN}-server"
167INITSCRIPT_PARAMS = "start 64 . stop 36 0 1 2 3 4 5 6 ."
168
169do_install_append() {
170 # install contrib
171 oe_runmake DESTDIR=${D} -C contrib install
172 # install tutorial
173 install -d -m 0755 ${D}${libdir}/${BPN}/tutorial
174 install ${B}/src/tutorial/* ${D}${libdir}/${BPN}/tutorial
175
176 # install COPYRIGHT README HISTORY
177 install -d -m 0755 ${D}${docdir}/${BPN}
Patrick Williamsddad1a12017-02-23 20:36:32 -0600178 for i in ${B}/COPYRIGHT ${B}/README ${B}/HISTORY ${B}/doc/KNOWN_BUGS ${B}/doc/MISSING_FEATURES ${B}/doc/README* ${B}/doc/bug.template; do
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500179 [ -f $i ] && install $i ${D}${docdir}/${BPN}
180 done
181
182 # install dirs and server init
183 install -d ${D}${sysconfdir}/init.d
184 install -m 0755 ${WORKDIR}/${BPN}.init ${D}${sysconfdir}/init.d/${BPN}-server
185 sed -i -e "s/^PGVERSION=.*$/PGVERSION=${PV}/g" ${D}${sysconfdir}/init.d/${BPN}-server
186 install -m 0755 ${WORKDIR}/${BPN}-setup ${D}${bindir}/${BPN}-setup
187 install -d -m 700 ${D}${localstatedir}/lib/${BPN}/data
188 install -d -m 700 ${D}${localstatedir}/lib/${BPN}/backups
Andrew Geissler1548c072019-02-22 16:03:50 -0600189 install -m 644 ${WORKDIR}/${BPN}-profile ${D}${localstatedir}/lib/${BPN}/.profile
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500190 chown -R postgres:postgres ${D}${localstatedir}/lib/${BPN}
191 # multiple server config directory
192 install -d -m 700 ${D}${sysconfdir}/default/${BPN}
193
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500194 if [ "${@d.getVar('enable_pam')}" = "pam" ]; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500195 install -d ${D}${sysconfdir}/pam.d
196 install -m 644 ${WORKDIR}/postgresql.pam ${D}${sysconfdir}/pam.d/postgresql
197 fi
198
199 # Install systemd unit files
200 install -d ${D}${systemd_unitdir}/system
201 install -m 0644 ${WORKDIR}/postgresql.service ${D}${systemd_unitdir}/system
202 sed -i -e 's,@BINDIR@,${bindir},g' \
203 ${D}${systemd_unitdir}/system/postgresql.service
204}
205
206SSTATE_SCAN_FILES += "Makefile.global"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800207SSTATE_SCAN_FILES_remove = "*_config"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500208
209PACKAGES =+ "${PN}-client ${PN}-server-dev ${PN}-timezone \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800210 libecpg-compat libecpg-compat-dev \
211 libecpg libecpg-dev libecpg-staticdev libecpg-doc \
212 libpq libpq-dev libpq-staticdev \
213 libpgtypes libpgtypes-staticdev libpgtypes-dev \
214 ${PN}-contrib \
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500215"
216
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800217RPROVIDES_${PN}-dbg += "libecpg-compat-dbg \
218 libecpg-dbg \
219 libpq-dbg \
220 libpgtypes-dbg \
221 ${PN}-contrib-dbg \
222 ${PN}-pltcl-dbg \
223 ${PN}-plpython-dbg \
224 ${PN}-plperl-dbg \
225 "
226
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500227FILES_${PN} += "${sysconfdir}/init.d/${BPN}-server \
228 ${localstatedir}/lib/${BPN}/data ${localstatedir}/lib/${BPN}/backups \
Andrew Geissler1548c072019-02-22 16:03:50 -0600229 ${localstatedir}/lib/${BPN}/.profile ${sysconfdir}/default/${BPN} \
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500230 ${libdir}/${BPN}/dict_snowball.so ${libdir}/${BPN}/plpgsql.so \
231 ${libdir}/${BPN}/euc2004_sjis2004.so \
232 ${libdir}/${BPN}/libpqwalreceiver.so \
233 ${libdir}/${BPN}/*_and_*.so \
234 ${@'${sysconfdir}/pam.d/postgresql' \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500235 if 'pam' == d.getVar('enable_pam') \
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500236 else ''} \
237"
238
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500239FILES_${PN}-client = "${bindir}/clusterdb \
240 ${bindir}/createdb \
241 ${bindir}/createlang \
242 ${bindir}/createuser \
243 ${bindir}/dropdb \
244 ${bindir}/droplang \
245 ${bindir}/dropuser \
246 ${bindir}/pg_dump \
247 ${bindir}/pg_dumpall \
248 ${bindir}/pg_restore \
249 ${bindir}/psql \
250 ${bindir}/reindexdb \
251 ${bindir}/vacuumdb \
252 ${bindir}/vacuumlo \
253 ${datadir}/${BPN}/psqlrc.sample \
254"
255FILES_${PN}-client-doc = "${mandir}/man1/clusterdb.* \
256 ${mandir}/man1/createdb.* ${mandir}/man1/createlang.* \
257 ${mandir}/man1/createuser.* ${mandir}/man1/dropdb.* \
258 ${mandir}/man1/droplang.* ${mandir}/man1/dropuser.* \
259 ${mandir}/man1/pg_dump.* ${mandir}/man1/pg_dumpall.* \
260 ${mandir}/man1/pg_restore.* ${mandir}/man1/psql.* \
261 ${mandir}/man1/reindexdb.* ${mandir}/man1/vacuumdb.* \
262 ${mandir}/man7/* \
263"
264FILES_${PN}-doc += "${docdir}/${BPN}/html ${libdir}/${BPN}/tutorial/ \
265 ${mandir}/man1/initdb.* ${mandir}/man1/pg_controldata.* \
266 ${mandir}/man1/pg_ctl.* ${mandir}/man1/pg_resetxlog.* \
267 ${mandir}/man1/postgres.* ${mandir}/man1/postmaster.* \
268"
269FILES_${PN}-timezone = "${datadir}/${BPN}/timezone \
270 ${datadir}/${BPN}/timezonesets \
271"
272RDEPENDS_${PN} += "${PN}-timezone"
273FILES_${PN}-server-dev = "${includedir}/${BPN}/server"
274
275FILES_libecpg = "${libdir}/libecpg*${SOLIBS}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500276FILES_libecpg-dev = "${libdir}/libecpg*${SOLIBSDEV} \
277 ${libdir}/libpgtypes*${SOLIBSDEV} \
278 ${includedir}/ecpg*.h ${includedir}/${BPN}/ecpg*.h \
279 ${includedir}/pgtypes*.h ${includedir}/${BPN}/informix \
280 ${includedir}/sql3types.h ${includedir}/sqlca.h \
281"
282FILES_libecpg-doc = "${mandir}/man1/ecpg.*"
283FILES_libecpg-staticdev = "${libdir}/libecpg*.a"
284SECTION_libecpg-staticdev = "devel"
285RDEPENDS_libecpg-staticdev = "libecpg-dev (= ${EXTENDPKGV})"
286
287FILES_libpq = "${libdir}/libpq*${SOLIBS}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500288FILES_libpq-dev = "${libdir}/libpq*${SOLIBSDEV} \
289 ${includedir} \
290"
291FILES_libpq-staticdev = "${libdir}/libpq*.a ${libdir}/libpgport.a"
292SECTION_libpq-staticdev = "devel"
293RDEPENDS_libpq-staticdev = "libpq-dev (= ${EXTENDPKGV})"
294
295FILES_libecpg-compat = "${libdir}/libecpg_compat*${SOLIBS}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500296FILES_libecpg-compat-dev = "${libdir}/libecpg_compat*${SOLIBS}"
297FILES_libpgtypes = "${libdir}/libpgtypes*${SOLIBS}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500298FILES_libpgtypes-staticdev = "${libdir}/libpgtypes*.a"
299FILES_libpgtypes-dev = "${libdir}/libpgtypes*${SOLIBS} ${includedir}/pgtypes*.h"
300
301FILES_${PN}-contrib = " ${bindir}/oid2name ${bindir}/pg_standby \
302 ${bindir}/pgbench ${bindir}/vacuumlo \
303 ${S}/contrib/spi/*.example \
304 ${libdir}/${BPN}/_int.so ${libdir}/${BPN}/adminpack.so \
305 ${libdir}/${BPN}/autoinc.so ${libdir}/${BPN}/auto_explain.so \
306 ${libdir}/${BPN}/auth_delay.so ${libdir}/${BPN}/btree_gin.so \
307 ${libdir}/${BPN}/btree_gist.so ${libdir}/${BPN}/.so \
308 ${libdir}/${BPN}/chkpass.so ${libdir}/${BPN}/citext.so \
309 ${libdir}/${BPN}/cube.so ${libdir}/${BPN}/dblink.so \
310 ${libdir}/${BPN}/dict_int.so ${libdir}/${BPN}/dict_xsyn.so \
311 ${libdir}/${BPN}/dummy_seclabel.so ${libdir}/${BPN}/earthdistance.so \
312 ${libdir}/${BPN}/file_fdw.so ${libdir}/${BPN}/fuzzystrmatch.so \
313 ${libdir}/${BPN}/hstore.so ${libdir}/${BPN}/insert_username.so \
314 ${libdir}/${BPN}/isn.so ${libdir}/${BPN}/lo.so \
315 ${libdir}/${BPN}/ltree.so ${libdir}/${BPN}/moddatetime.so \
316 ${libdir}/${BPN}/pageinspect.so ${libdir}/${BPN}/pg_buffercache.so \
317 ${libdir}/${BPN}/pg_freespacemap.so ${libdir}/${BPN}/pg_trgm.so \
318 ${libdir}/${BPN}/pgcrypto.so ${libdir}/${BPN}/pgrowlocks.so \
319 ${libdir}/${BPN}/pgstattuple.so ${libdir}/${BPN}/pg_stat_statements.so \
320 ${libdir}/${BPN}/refint.so ${libdir}/${BPN}/seg.so \
321 ${libdir}/${BPN}/sslinfo.so \
322 ${libdir}/${BPN}/tablefunc.so \
323 ${libdir}/${BPN}/test_parser.so ${libdir}/${BPN}/timetravel.so \
324 ${libdir}/${BPN}/tsearch2.so ${libdir}/${BPN}/uuid-ossp.so \
325 ${libdir}/${BPN}/pgxml.so ${libdir}/${BPN}/passwordcheck.so \
326 ${libdir}/${BPN}/pg_upgrade_support.so ${libdir}/${BPN}/.so \
327 ${libdir}/${BPN}/unaccent.so \
328"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500329DESCRIPTION_${PN}-contrib = "The postgresql-contrib package contains \
330 contributed packages that are included in the PostgreSQL distribution."
331
332FILES_${PN}-pltcl = "${libdir}/${BPN}/pltcl.so ${bindir}/pltcl_delmod \
333 ${binddir}/pltcl_listmod ${bindir}/pltcl_loadmod \
334 ${datadir}/${BPN}/unknown.pltcl"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500335SUMMARY_${PN}-pltcl = "The Tcl procedural language for PostgreSQL"
336DESCRIPTION_${PN}-pltcl = "PostgreSQL is an advanced Object-Relational \
337 database management system. The postgresql-pltcl package contains the PL/Tcl \
338 procedural language for the backend."
339
340FILES_${PN}-plperl = "${libdir}/${BPN}/plperl.so"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500341SUMMARY_${PN}-plperl = "The Perl procedural language for PostgreSQL"
342DESCRIPTION_${PN}-plperl = "PostgreSQL is an advanced Object-Relational \
343 database management system. The postgresql-plperl package contains the \
344 PL/Perl procedural language for the backend."
345
346# In version 8, it will be plpython.so
347# In version 9, it might be plpython{2,3}.so depending on python2 or 3
348FILES_${PN}-plpython = "${libdir}/${BPN}/plpython*.so"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500349SUMMARY_${PN}-plpython = "The Python procedural language for PostgreSQL"
350DESCRIPTION_${PN}-plpython = "PostgreSQL is an advanced Object-Relational \
351 database management system. The postgresql-plpython package contains \
352 the PL/Python procedural language for the backend."