xref: /openbmc/openbmc/poky/meta/classes-recipe/manpages.bbclass (revision fc113eade321128fc43b0b299e81ad07fc1edf3d)
192b42cb3SPatrick Williams#
292b42cb3SPatrick Williams# Copyright OpenEmbedded Contributors
392b42cb3SPatrick Williams#
492b42cb3SPatrick Williams# SPDX-License-Identifier: MIT
592b42cb3SPatrick Williams#
692b42cb3SPatrick Williams
792b42cb3SPatrick Williams# Inherit this class to enable or disable building and installation of manpages
892b42cb3SPatrick Williams# depending on whether 'api-documentation' is in DISTRO_FEATURES. Such building
992b42cb3SPatrick Williams# tends to pull in the entire XML stack and other tools, so it's not enabled
1092b42cb3SPatrick Williams# by default.
1192b42cb3SPatrick WilliamsPACKAGECONFIG:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'manpages', '', d)}"
1292b42cb3SPatrick Williams
1392b42cb3SPatrick Williamsinherit qemu
1492b42cb3SPatrick Williams
1592b42cb3SPatrick Williams# usually manual files are packaged to ${PN}-doc except man-pages
1692b42cb3SPatrick WilliamsMAN_PKG ?= "${PN}-doc"
1792b42cb3SPatrick Williams
1892b42cb3SPatrick Williams# only add man-db to RDEPENDS when manual files are built and installed
1992b42cb3SPatrick WilliamsRDEPENDS:${MAN_PKG} += "${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'man-db', '', d)}"
2092b42cb3SPatrick Williams
2192b42cb3SPatrick Williamspkg_postinst:${MAN_PKG}:append () {
2292b42cb3SPatrick Williams	# only update manual page index caches when manual files are built and installed
2392b42cb3SPatrick Williams	if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
2492b42cb3SPatrick Williams		if test -n "$D"; then
2592b42cb3SPatrick Williams			if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then
26*fc113eadSAndrew Geissler				$INTERCEPT_DIR/postinst_intercept update_mandb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} bindir=${bindir} sysconfdir=${sysconfdir} mandir=${mandir}
2792b42cb3SPatrick Williams			else
2892b42cb3SPatrick Williams				$INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
2992b42cb3SPatrick Williams			fi
3092b42cb3SPatrick Williams		else
3192b42cb3SPatrick Williams			mandb -q
3292b42cb3SPatrick Williams		fi
3392b42cb3SPatrick Williams	fi
3492b42cb3SPatrick Williams}
3592b42cb3SPatrick Williams
3692b42cb3SPatrick Williamspkg_postrm:${MAN_PKG}:append () {
3792b42cb3SPatrick Williams	# only update manual page index caches when manual files are built and installed
3892b42cb3SPatrick Williams	if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
3992b42cb3SPatrick Williams		mandb -q
4092b42cb3SPatrick Williams	fi
4192b42cb3SPatrick Williams}
42