Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 1 | # Inherit this class to enable or disable building and installation of manpages |
| 2 | # depending on whether 'api-documentation' is in DISTRO_FEATURES. Such building |
| 3 | # tends to pull in the entire XML stack and other tools, so it's not enabled |
| 4 | # by default. |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 5 | PACKAGECONFIG:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'manpages', '', d)}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 6 | |
| 7 | inherit qemu |
| 8 | |
| 9 | # usually manual files are packaged to ${PN}-doc except man-pages |
| 10 | MAN_PKG ?= "${PN}-doc" |
| 11 | |
| 12 | # only add man-db to RDEPENDS when manual files are built and installed |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 13 | RDEPENDS:${MAN_PKG} += "${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'man-db', '', d)}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 14 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 15 | pkg_postinst:${MAN_PKG}:append () { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 16 | # only update manual page index caches when manual files are built and installed |
| 17 | if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then |
| 18 | if test -n "$D"; then |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 19 | if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 20 | sed "s:\(\s\)/:\1$D/:g" $D${sysconfdir}/man_db.conf | ${@qemu_run_binary(d, '$D', '${bindir}/mandb')} -C - -u -q $D${mandir} |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 21 | chown -R root:root $D${mandir} |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 22 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 23 | mkdir -p $D${localstatedir}/cache/man |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 24 | cd $D${mandir} |
| 25 | find . -name index.db | while read index; do |
| 26 | mkdir -p $D${localstatedir}/cache/man/$(dirname ${index}) |
| 27 | mv ${index} $D${localstatedir}/cache/man/${index} |
| 28 | chown man:man $D${localstatedir}/cache/man/${index} |
| 29 | done |
| 30 | cd - |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 31 | else |
| 32 | $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX} |
| 33 | fi |
| 34 | else |
| 35 | mandb -q |
| 36 | fi |
| 37 | fi |
| 38 | } |
| 39 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 40 | pkg_postrm:${MAN_PKG}:append () { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 41 | # only update manual page index caches when manual files are built and installed |
| 42 | if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then |
| 43 | mandb -q |
| 44 | fi |
| 45 | } |