manpages.bbclass 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #
  2. # Copyright OpenEmbedded Contributors
  3. #
  4. # SPDX-License-Identifier: MIT
  5. #
  6. # Inherit this class to enable or disable building and installation of manpages
  7. # depending on whether 'api-documentation' is in DISTRO_FEATURES. Such building
  8. # tends to pull in the entire XML stack and other tools, so it's not enabled
  9. # by default.
  10. PACKAGECONFIG:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'manpages', '', d)}"
  11. inherit qemu
  12. # usually manual files are packaged to ${PN}-doc except man-pages
  13. MAN_PKG ?= "${PN}-doc"
  14. # only add man-db to RDEPENDS when manual files are built and installed
  15. RDEPENDS:${MAN_PKG} += "${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'man-db', '', d)}"
  16. pkg_postinst:${MAN_PKG}:append () {
  17. # only update manual page index caches when manual files are built and installed
  18. if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
  19. if test -n "$D"; then
  20. if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then
  21. $INTERCEPT_DIR/postinst_intercept update_mandb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} bindir=${bindir} sysconfdir=${sysconfdir} mandir=${mandir}
  22. else
  23. $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
  24. fi
  25. else
  26. mandb -q
  27. fi
  28. fi
  29. }
  30. pkg_postrm:${MAN_PKG}:append () {
  31. # only update manual page index caches when manual files are built and installed
  32. if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
  33. mandb -q
  34. fi
  35. }