blob: 454624caaa2346d027dcc700f998a2a74d71dd53 [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 \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050034"
35
36LEAD_SONAME = "libpq.so"
37
38# LDFLAGS for shared libraries
39export LDFLAGS_SL = "${LDFLAGS}"
40
41inherit autotools pkgconfig perlnative pythonnative useradd update-rc.d systemd
42
Patrick Williamsddad1a12017-02-23 20:36:32 -060043CFLAGS += "-I${STAGING_INCDIR}/${PYTHON_DIR}"
44
Patrick Williamsb48b7b42016-08-17 15:04:38 -050045SYSTEMD_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() {
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
126 sed -i -e "/^perl_privlibexp/s:${LIBPNA}:${STAGING_LIBDIR}:g" \
127 ${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} \
162 -s /bin/bash -c 'PostgreSQL Server' -u ${usernum} postgres"
163GROUPADD_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
189 install -m 644 ${WORKDIR}/${BPN}-bashprofile ${D}${localstatedir}/lib/${BPN}/.bash_profile
190 chown -R postgres:postgres ${D}${localstatedir}/lib/${BPN}
191 # multiple server config directory
192 install -d -m 700 ${D}${sysconfdir}/default/${BPN}
193
194 if [ "${@d.getVar('enable_pam', True)}" = "pam" ]; then
195 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"
207
208PACKAGES =+ "${PN}-client ${PN}-server-dev ${PN}-timezone \
209 libecpg-compat-dbg libecpg-compat libecpg-compat-dev \
210 libecpg-dbg libecpg libecpg-dev libecpg-staticdev libecpg-doc \
211 libpq-dbg libpq libpq-dev libpq-staticdev \
212 libpgtypes-dbg libpgtypes libpgtypes-staticdev libpgtypes-dev \
213 ${PN}-contrib ${PN}-contrib-dbg \
214"
215
216FILES_${PN} += "${sysconfdir}/init.d/${BPN}-server \
217 ${localstatedir}/lib/${BPN}/data ${localstatedir}/lib/${BPN}/backups \
218 ${localstatedir}/lib/${BPN}/.bash_profile ${sysconfdir}/default/${BPN} \
219 ${libdir}/${BPN}/dict_snowball.so ${libdir}/${BPN}/plpgsql.so \
220 ${libdir}/${BPN}/euc2004_sjis2004.so \
221 ${libdir}/${BPN}/libpqwalreceiver.so \
222 ${libdir}/${BPN}/*_and_*.so \
223 ${@'${sysconfdir}/pam.d/postgresql' \
224 if 'pam' == d.getVar('enable_pam', True) \
225 else ''} \
226"
227
228FILES_${PN}-dbg += " ${libdir}/${BPN}/.debug/dict_snowball.so \
229 ${libdir}/${BPN}/.debug/plpgsql.so \
230 ${libdir}/${BPN}/.debug/euc2004_sjis2004.so \
231 ${libdir}/${BPN}/.debug/libpqwalreceiver.so \
232 ${libdir}/${BPN}/.debug/*_and_*.so \
233"
234
235FILES_${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}"
272FILES_libecpg-dbg = "${libdir}/.debug/libecpg*"
273FILES_libecpg-dev = "${libdir}/libecpg*${SOLIBSDEV} \
274 ${libdir}/libpgtypes*${SOLIBSDEV} \
275 ${includedir}/ecpg*.h ${includedir}/${BPN}/ecpg*.h \
276 ${includedir}/pgtypes*.h ${includedir}/${BPN}/informix \
277 ${includedir}/sql3types.h ${includedir}/sqlca.h \
278"
279FILES_libecpg-doc = "${mandir}/man1/ecpg.*"
280FILES_libecpg-staticdev = "${libdir}/libecpg*.a"
281SECTION_libecpg-staticdev = "devel"
282RDEPENDS_libecpg-staticdev = "libecpg-dev (= ${EXTENDPKGV})"
283
284FILES_libpq = "${libdir}/libpq*${SOLIBS}"
285FILES_libpq-dbg = "${libdir}/.debug/libpq* ${libdir}/${BPN}/pgxs/src/test/regress/.debug/*"
286FILES_libpq-dev = "${libdir}/libpq*${SOLIBSDEV} \
287 ${includedir} \
288"
289FILES_libpq-staticdev = "${libdir}/libpq*.a ${libdir}/libpgport.a"
290SECTION_libpq-staticdev = "devel"
291RDEPENDS_libpq-staticdev = "libpq-dev (= ${EXTENDPKGV})"
292
293FILES_libecpg-compat = "${libdir}/libecpg_compat*${SOLIBS}"
294FILES_libecpg-compat-dbg = "${libdir}/.debug/libecpg_compat*"
295FILES_libecpg-compat-dev = "${libdir}/libecpg_compat*${SOLIBS}"
296FILES_libpgtypes = "${libdir}/libpgtypes*${SOLIBS}"
297FILES_libpgtypes-dbg = "${libdir}/.debug/libpgtypes*"
298FILES_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"
329FILES_${PN}-contrib-dbg = " \
330 ${libdir}/${BPN}/.debug/_int.so ${libdir}/${BPN}/.debug/adminpack.so \
331 ${libdir}/${BPN}/.debug/autoinc.so ${libdir}/${BPN}/.debug/auto_explain.so \
332 ${libdir}/${BPN}/.debug/auth_delay.so ${libdir}/${BPN}/.debug/btree_gin.so \
333 ${libdir}/${BPN}/.debug/btree_gist.so ${libdir}/${BPN}/.debug/.so \
334 ${libdir}/${BPN}/.debug/chkpass.so ${libdir}/${BPN}/.debug/citext.so \
335 ${libdir}/${BPN}/.debug/cube.so ${libdir}/${BPN}/.debug/dblink.so \
336 ${libdir}/${BPN}/.debug/dict_int.so ${libdir}/${BPN}/.debug/dict_xsyn.so \
337 ${libdir}/${BPN}/.debug/dummy_seclabel.so \
338 ${libdir}/${BPN}/.debug/earthdistance.so \
339 ${libdir}/${BPN}/.debug/file_fdw.so ${libdir}/${BPN}/.debug/fuzzystrmatch.so \
340 ${libdir}/${BPN}/.debug/hstore.so ${libdir}/${BPN}/.debug/insert_username.so \
341 ${libdir}/${BPN}/.debug/isn.so ${libdir}/${BPN}/.debug/lo.so \
342 ${libdir}/${BPN}/.debug/ltree.so ${libdir}/${BPN}/.debug/moddatetime.so \
343 ${libdir}/${BPN}/.debug/pageinspect.so \
344 ${libdir}/${BPN}/.debug/pg_buffercache.so \
345 ${libdir}/${BPN}/.debug/pg_freespacemap.so \
346 ${libdir}/${BPN}/.debug/pg_trgm.so \
347 ${libdir}/${BPN}/.debug/pgcrypto.so ${libdir}/${BPN}/.debug/pgrowlocks.so \
348 ${libdir}/${BPN}/.debug/pgstattuple.so \
349 ${libdir}/${BPN}/.debug/pg_stat_statements.so \
350 ${libdir}/${BPN}/.debug/refint.so ${libdir}/${BPN}/.debug/seg.so \
351 ${libdir}/${BPN}/.debug/sslinfo.so \
352 ${libdir}/${BPN}/.debug/tablefunc.so \
353 ${libdir}/${BPN}/.debug/test_parser.so ${libdir}/${BPN}/.debug/timetravel.so \
354 ${libdir}/${BPN}/.debug/tsearch2.so ${libdir}/${BPN}/.debug/uuid-ossp.so \
355 ${libdir}/${BPN}/.debug/pgxml.so ${libdir}/${BPN}/.debug/passwordcheck.so \
356 ${libdir}/${BPN}/.debug/pg_upgrade_support.so \
357 ${libdir}/${BPN}/.debug/unaccent.so \
358"
359DESCRIPTION_${PN}-contrib = "The postgresql-contrib package contains \
360 contributed packages that are included in the PostgreSQL distribution."
361
362FILES_${PN}-pltcl = "${libdir}/${BPN}/pltcl.so ${bindir}/pltcl_delmod \
363 ${binddir}/pltcl_listmod ${bindir}/pltcl_loadmod \
364 ${datadir}/${BPN}/unknown.pltcl"
365FILES_${PN}-pltcl-dbg = "${libdir}/${BPN}/.debug/pltcl.so"
366SUMMARY_${PN}-pltcl = "The Tcl procedural language for PostgreSQL"
367DESCRIPTION_${PN}-pltcl = "PostgreSQL is an advanced Object-Relational \
368 database management system. The postgresql-pltcl package contains the PL/Tcl \
369 procedural language for the backend."
370
371FILES_${PN}-plperl = "${libdir}/${BPN}/plperl.so"
372FILES_${PN}-plperl-dbg = "${libdir}/${BPN}/.debug/plperl.so"
373SUMMARY_${PN}-plperl = "The Perl procedural language for PostgreSQL"
374DESCRIPTION_${PN}-plperl = "PostgreSQL is an advanced Object-Relational \
375 database management system. The postgresql-plperl package contains the \
376 PL/Perl procedural language for the backend."
377
378# In version 8, it will be plpython.so
379# In version 9, it might be plpython{2,3}.so depending on python2 or 3
380FILES_${PN}-plpython = "${libdir}/${BPN}/plpython*.so"
381FILES_${PN}-plpython-dbg = "${libdir}/${BPN}/.debug/plpython*.so"
382SUMMARY_${PN}-plpython = "The Python procedural language for PostgreSQL"
383DESCRIPTION_${PN}-plpython = "PostgreSQL is an advanced Object-Relational \
384 database management system. The postgresql-plpython package contains \
385 the PL/Python procedural language for the backend."