manpages.bbclass 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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.
  5. PACKAGECONFIG_append_class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'manpages', '', d)}"
  6. inherit qemu
  7. # usually manual files are packaged to ${PN}-doc except man-pages
  8. MAN_PKG ?= "${PN}-doc"
  9. # only add man-db to RDEPENDS when manual files are built and installed
  10. RDEPENDS_${MAN_PKG} += "${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'man-db', '', d)}"
  11. pkg_postinst_append_${MAN_PKG} () {
  12. # only update manual page index caches when manual files are built and installed
  13. if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
  14. if test -n "$D"; then
  15. if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true','false', d)}; then
  16. sed "s:\(\s\)/:\1$D/:g" $D${sysconfdir}/man_db.conf | ${@qemu_run_binary(d, '$D', '${bindir}/mandb')} -C - -u -q $D${mandir}
  17. chown -R root:root $D${mandir}
  18. mkdir -p $D${localstatedir}/cache/man
  19. cd $D${mandir}
  20. find . -name index.db | while read index; do
  21. mkdir -p $D${localstatedir}/cache/man/$(dirname ${index})
  22. mv ${index} $D${localstatedir}/cache/man/${index}
  23. chown man:man $D${localstatedir}/cache/man/${index}
  24. done
  25. cd -
  26. else
  27. $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
  28. fi
  29. else
  30. mandb -q
  31. fi
  32. fi
  33. }
  34. pkg_postrm_append_${MAN_PKG} () {
  35. # only update manual page index caches when manual files are built and installed
  36. if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then
  37. mandb -q
  38. fi
  39. }