blob: 64b7d8c42226089371127bc6b6c506e45fb040d6 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001# 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 Williams213cb262021-08-07 19:21:33 -05005PACKAGECONFIG:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'manpages', '', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08006
7inherit qemu
8
9# usually manual files are packaged to ${PN}-doc except man-pages
10MAN_PKG ?= "${PN}-doc"
11
12# only add man-db to RDEPENDS when manual files are built and installed
Patrick Williams213cb262021-08-07 19:21:33 -050013RDEPENDS:${MAN_PKG} += "${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'man-db', '', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080014
Patrick Williams213cb262021-08-07 19:21:33 -050015pkg_postinst:append:${MAN_PKG} () {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080016 # 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
19 if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true','false', d)}; then
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 Geissler82c905d2020-04-13 13:39:40 -050021 chown -R root:root $D${mandir}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080022 mkdir -p $D${localstatedir}/cache/man
Andrew Geissler82c905d2020-04-13 13:39:40 -050023 cd $D${mandir}
24 find . -name index.db | while read index; do
25 mkdir -p $D${localstatedir}/cache/man/$(dirname ${index})
26 mv ${index} $D${localstatedir}/cache/man/${index}
27 chown man:man $D${localstatedir}/cache/man/${index}
28 done
29 cd -
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080030 else
31 $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
32 fi
33 else
34 mandb -q
35 fi
36 fi
37}
38
Patrick Williams213cb262021-08-07 19:21:33 -050039pkg_postrm:append:${MAN_PKG} () {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080040 # only update manual page index caches when manual files are built and installed
41 if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
42 mandb -q
43 fi
44}