blob: 3bf71f02e9f2efd0a5089052332ac273a25a50c7 [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 \
28 file://postgresql-bashprofile \
29 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 Bishop6e60e8b2018-02-01 10:27:11 -050040inherit autotools pkgconfig perlnative pythonnative useradd update-rc.d systemd gettext
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
109do_configure() {
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500110 # do_configure
111 autotools_do_configure
112
113 # do_configure_append
114 # workaround perl package related bugs
115 sed -i -e "s:-L/usr/local/lib:-L=/usr/local/lib:g" \
116 ${B}/src/Makefile.global
117 LIBPNA="\${STAGING_LIBDIR_NATIVE}/perl-native"
118 LIBNA="\${STAGING_LIBDIR_NATIVE}"
119 BLIBNA="\${STAGING_BASE_LIBDIR_NATIVE}"
120 sed -i -e "/^perl_archlibexp/s:${LIBPNA}:${STAGING_LIBDIR}:g" \
121 ${B}/src/Makefile.global
122 sed -i -e "/^perl_privlibexp/s:${LIBPNA}:${STAGING_LIBDIR}:g" \
123 ${B}/src/Makefile.global
124 # remove the rpath, replace with correct lib path
125 sed -i \
126 -e "/^perl_embed_ldflags/s:-Wl,-rpath,${LIBNA}::g" \
127 -e "/^perl_embed_ldflags/s:-Wl,-rpath,${BLIBNA}::g" \
128 -e "/^perl_embed_ldflags/s:-Wl,-rpath-link,${LIBNA}::g" \
129 -e "/^perl_embed_ldflags/s:-Wl,-rpath-link,${BLIBNA}::g" \
130 -e "/^perl_embed_ldflags/s:${LIBPNA}:${STAGING_LIBDIR}:g" \
131 -e "/^perl_embed_ldflags/s:${LIBNA}:${STAGING_LIBDIR}:g" \
132 -e "/^perl_embed_ldflags/s:${BLIBNA}:${STAGING_BASELIBDIR}:g" \
133 -e "/^TCLSH/s:=.*:= ${bindir}/tclsh:g" \
134 ${B}/src/Makefile.global
135
136 if ${@bb.utils.contains('PACKAGECONFIG', 'perl', 'true', 'false', d)}; then
137 # workaround perl package's libperl.so problem
138 # we are using perlnative so this perl should have same version
139 perl_version=`perl -v 2>/dev/null | \
140 sed -n 's/This is perl.*v[a-z ]*\([0-9]\.[0-9][0-9.]*\).*$/\1/p'`
141 if [ ! -h "${STAGING_LIBDIR}/perl/$perl_version/CORE/libperl.so" -a \
142 ! -h "${STAGING_LIBDIR}/libperl.so" ]; then
143 ln -sf ../../../libperl.so.5 \
144 ${STAGING_LIBDIR}/perl/$perl_version/CORE/libperl.so
145 fi
146 fi
147}
148
149do_compile_append() {
150 oe_runmake -C contrib all
151}
152
153# server needs to configure user and group
154usernum = "28"
155groupnum = "28"
156USERADD_PACKAGES = "${PN}"
157USERADD_PARAM_${PN} = "-M -g postgres -o -r -d ${localstatedir}/lib/${BPN} \
158 -s /bin/bash -c 'PostgreSQL Server' -u ${usernum} postgres"
159GROUPADD_PARAM_${PN} = "-g ${groupnum} -o -r postgres"
160
161INITSCRIPT_PACKAGES = "${PN}"
162INITSCRIPT_NAME = "${BPN}-server"
163INITSCRIPT_PARAMS = "start 64 . stop 36 0 1 2 3 4 5 6 ."
164
165do_install_append() {
166 # install contrib
167 oe_runmake DESTDIR=${D} -C contrib install
168 # install tutorial
169 install -d -m 0755 ${D}${libdir}/${BPN}/tutorial
170 install ${B}/src/tutorial/* ${D}${libdir}/${BPN}/tutorial
171
172 # install COPYRIGHT README HISTORY
173 install -d -m 0755 ${D}${docdir}/${BPN}
Patrick Williamsddad1a12017-02-23 20:36:32 -0600174 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 -0500175 [ -f $i ] && install $i ${D}${docdir}/${BPN}
176 done
177
178 # install dirs and server init
179 install -d ${D}${sysconfdir}/init.d
180 install -m 0755 ${WORKDIR}/${BPN}.init ${D}${sysconfdir}/init.d/${BPN}-server
181 sed -i -e "s/^PGVERSION=.*$/PGVERSION=${PV}/g" ${D}${sysconfdir}/init.d/${BPN}-server
182 install -m 0755 ${WORKDIR}/${BPN}-setup ${D}${bindir}/${BPN}-setup
183 install -d -m 700 ${D}${localstatedir}/lib/${BPN}/data
184 install -d -m 700 ${D}${localstatedir}/lib/${BPN}/backups
185 install -m 644 ${WORKDIR}/${BPN}-bashprofile ${D}${localstatedir}/lib/${BPN}/.bash_profile
186 chown -R postgres:postgres ${D}${localstatedir}/lib/${BPN}
187 # multiple server config directory
188 install -d -m 700 ${D}${sysconfdir}/default/${BPN}
189
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500190 if [ "${@d.getVar('enable_pam')}" = "pam" ]; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500191 install -d ${D}${sysconfdir}/pam.d
192 install -m 644 ${WORKDIR}/postgresql.pam ${D}${sysconfdir}/pam.d/postgresql
193 fi
194
195 # Install systemd unit files
196 install -d ${D}${systemd_unitdir}/system
197 install -m 0644 ${WORKDIR}/postgresql.service ${D}${systemd_unitdir}/system
198 sed -i -e 's,@BINDIR@,${bindir},g' \
199 ${D}${systemd_unitdir}/system/postgresql.service
200}
201
202SSTATE_SCAN_FILES += "Makefile.global"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800203SSTATE_SCAN_FILES_remove = "*_config"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500204
205PACKAGES =+ "${PN}-client ${PN}-server-dev ${PN}-timezone \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800206 libecpg-compat libecpg-compat-dev \
207 libecpg libecpg-dev libecpg-staticdev libecpg-doc \
208 libpq libpq-dev libpq-staticdev \
209 libpgtypes libpgtypes-staticdev libpgtypes-dev \
210 ${PN}-contrib \
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500211"
212
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800213RPROVIDES_${PN}-dbg += "libecpg-compat-dbg \
214 libecpg-dbg \
215 libpq-dbg \
216 libpgtypes-dbg \
217 ${PN}-contrib-dbg \
218 ${PN}-pltcl-dbg \
219 ${PN}-plpython-dbg \
220 ${PN}-plperl-dbg \
221 "
222
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500223FILES_${PN} += "${sysconfdir}/init.d/${BPN}-server \
224 ${localstatedir}/lib/${BPN}/data ${localstatedir}/lib/${BPN}/backups \
225 ${localstatedir}/lib/${BPN}/.bash_profile ${sysconfdir}/default/${BPN} \
226 ${libdir}/${BPN}/dict_snowball.so ${libdir}/${BPN}/plpgsql.so \
227 ${libdir}/${BPN}/euc2004_sjis2004.so \
228 ${libdir}/${BPN}/libpqwalreceiver.so \
229 ${libdir}/${BPN}/*_and_*.so \
230 ${@'${sysconfdir}/pam.d/postgresql' \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500231 if 'pam' == d.getVar('enable_pam') \
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500232 else ''} \
233"
234
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500235FILES_${PN}-client = "${bindir}/clusterdb \
236 ${bindir}/createdb \
237 ${bindir}/createlang \
238 ${bindir}/createuser \
239 ${bindir}/dropdb \
240 ${bindir}/droplang \
241 ${bindir}/dropuser \
242 ${bindir}/pg_dump \
243 ${bindir}/pg_dumpall \
244 ${bindir}/pg_restore \
245 ${bindir}/psql \
246 ${bindir}/reindexdb \
247 ${bindir}/vacuumdb \
248 ${bindir}/vacuumlo \
249 ${datadir}/${BPN}/psqlrc.sample \
250"
251FILES_${PN}-client-doc = "${mandir}/man1/clusterdb.* \
252 ${mandir}/man1/createdb.* ${mandir}/man1/createlang.* \
253 ${mandir}/man1/createuser.* ${mandir}/man1/dropdb.* \
254 ${mandir}/man1/droplang.* ${mandir}/man1/dropuser.* \
255 ${mandir}/man1/pg_dump.* ${mandir}/man1/pg_dumpall.* \
256 ${mandir}/man1/pg_restore.* ${mandir}/man1/psql.* \
257 ${mandir}/man1/reindexdb.* ${mandir}/man1/vacuumdb.* \
258 ${mandir}/man7/* \
259"
260FILES_${PN}-doc += "${docdir}/${BPN}/html ${libdir}/${BPN}/tutorial/ \
261 ${mandir}/man1/initdb.* ${mandir}/man1/pg_controldata.* \
262 ${mandir}/man1/pg_ctl.* ${mandir}/man1/pg_resetxlog.* \
263 ${mandir}/man1/postgres.* ${mandir}/man1/postmaster.* \
264"
265FILES_${PN}-timezone = "${datadir}/${BPN}/timezone \
266 ${datadir}/${BPN}/timezonesets \
267"
268RDEPENDS_${PN} += "${PN}-timezone"
269FILES_${PN}-server-dev = "${includedir}/${BPN}/server"
270
271FILES_libecpg = "${libdir}/libecpg*${SOLIBS}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500272FILES_libecpg-dev = "${libdir}/libecpg*${SOLIBSDEV} \
273 ${libdir}/libpgtypes*${SOLIBSDEV} \
274 ${includedir}/ecpg*.h ${includedir}/${BPN}/ecpg*.h \
275 ${includedir}/pgtypes*.h ${includedir}/${BPN}/informix \
276 ${includedir}/sql3types.h ${includedir}/sqlca.h \
277"
278FILES_libecpg-doc = "${mandir}/man1/ecpg.*"
279FILES_libecpg-staticdev = "${libdir}/libecpg*.a"
280SECTION_libecpg-staticdev = "devel"
281RDEPENDS_libecpg-staticdev = "libecpg-dev (= ${EXTENDPKGV})"
282
283FILES_libpq = "${libdir}/libpq*${SOLIBS}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500284FILES_libpq-dev = "${libdir}/libpq*${SOLIBSDEV} \
285 ${includedir} \
286"
287FILES_libpq-staticdev = "${libdir}/libpq*.a ${libdir}/libpgport.a"
288SECTION_libpq-staticdev = "devel"
289RDEPENDS_libpq-staticdev = "libpq-dev (= ${EXTENDPKGV})"
290
291FILES_libecpg-compat = "${libdir}/libecpg_compat*${SOLIBS}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500292FILES_libecpg-compat-dev = "${libdir}/libecpg_compat*${SOLIBS}"
293FILES_libpgtypes = "${libdir}/libpgtypes*${SOLIBS}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500294FILES_libpgtypes-staticdev = "${libdir}/libpgtypes*.a"
295FILES_libpgtypes-dev = "${libdir}/libpgtypes*${SOLIBS} ${includedir}/pgtypes*.h"
296
297FILES_${PN}-contrib = " ${bindir}/oid2name ${bindir}/pg_standby \
298 ${bindir}/pgbench ${bindir}/vacuumlo \
299 ${S}/contrib/spi/*.example \
300 ${libdir}/${BPN}/_int.so ${libdir}/${BPN}/adminpack.so \
301 ${libdir}/${BPN}/autoinc.so ${libdir}/${BPN}/auto_explain.so \
302 ${libdir}/${BPN}/auth_delay.so ${libdir}/${BPN}/btree_gin.so \
303 ${libdir}/${BPN}/btree_gist.so ${libdir}/${BPN}/.so \
304 ${libdir}/${BPN}/chkpass.so ${libdir}/${BPN}/citext.so \
305 ${libdir}/${BPN}/cube.so ${libdir}/${BPN}/dblink.so \
306 ${libdir}/${BPN}/dict_int.so ${libdir}/${BPN}/dict_xsyn.so \
307 ${libdir}/${BPN}/dummy_seclabel.so ${libdir}/${BPN}/earthdistance.so \
308 ${libdir}/${BPN}/file_fdw.so ${libdir}/${BPN}/fuzzystrmatch.so \
309 ${libdir}/${BPN}/hstore.so ${libdir}/${BPN}/insert_username.so \
310 ${libdir}/${BPN}/isn.so ${libdir}/${BPN}/lo.so \
311 ${libdir}/${BPN}/ltree.so ${libdir}/${BPN}/moddatetime.so \
312 ${libdir}/${BPN}/pageinspect.so ${libdir}/${BPN}/pg_buffercache.so \
313 ${libdir}/${BPN}/pg_freespacemap.so ${libdir}/${BPN}/pg_trgm.so \
314 ${libdir}/${BPN}/pgcrypto.so ${libdir}/${BPN}/pgrowlocks.so \
315 ${libdir}/${BPN}/pgstattuple.so ${libdir}/${BPN}/pg_stat_statements.so \
316 ${libdir}/${BPN}/refint.so ${libdir}/${BPN}/seg.so \
317 ${libdir}/${BPN}/sslinfo.so \
318 ${libdir}/${BPN}/tablefunc.so \
319 ${libdir}/${BPN}/test_parser.so ${libdir}/${BPN}/timetravel.so \
320 ${libdir}/${BPN}/tsearch2.so ${libdir}/${BPN}/uuid-ossp.so \
321 ${libdir}/${BPN}/pgxml.so ${libdir}/${BPN}/passwordcheck.so \
322 ${libdir}/${BPN}/pg_upgrade_support.so ${libdir}/${BPN}/.so \
323 ${libdir}/${BPN}/unaccent.so \
324"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500325DESCRIPTION_${PN}-contrib = "The postgresql-contrib package contains \
326 contributed packages that are included in the PostgreSQL distribution."
327
328FILES_${PN}-pltcl = "${libdir}/${BPN}/pltcl.so ${bindir}/pltcl_delmod \
329 ${binddir}/pltcl_listmod ${bindir}/pltcl_loadmod \
330 ${datadir}/${BPN}/unknown.pltcl"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500331SUMMARY_${PN}-pltcl = "The Tcl procedural language for PostgreSQL"
332DESCRIPTION_${PN}-pltcl = "PostgreSQL is an advanced Object-Relational \
333 database management system. The postgresql-pltcl package contains the PL/Tcl \
334 procedural language for the backend."
335
336FILES_${PN}-plperl = "${libdir}/${BPN}/plperl.so"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500337SUMMARY_${PN}-plperl = "The Perl procedural language for PostgreSQL"
338DESCRIPTION_${PN}-plperl = "PostgreSQL is an advanced Object-Relational \
339 database management system. The postgresql-plperl package contains the \
340 PL/Perl procedural language for the backend."
341
342# In version 8, it will be plpython.so
343# In version 9, it might be plpython{2,3}.so depending on python2 or 3
344FILES_${PN}-plpython = "${libdir}/${BPN}/plpython*.so"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500345SUMMARY_${PN}-plpython = "The Python procedural language for PostgreSQL"
346DESCRIPTION_${PN}-plpython = "PostgreSQL is an advanced Object-Relational \
347 database management system. The postgresql-plpython package contains \
348 the PL/Python procedural language for the backend."