diff options
Diffstat (limited to 'meta/classes-recipe/manpages.bbclass')
-rw-r--r-- | meta/classes-recipe/manpages.bbclass | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/meta/classes-recipe/manpages.bbclass b/meta/classes-recipe/manpages.bbclass new file mode 100644 index 0000000000..693fb53671 --- /dev/null +++ b/meta/classes-recipe/manpages.bbclass | |||
@@ -0,0 +1,51 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | # Inherit this class to enable or disable building and installation of manpages | ||
8 | # depending on whether 'api-documentation' is in DISTRO_FEATURES. Such building | ||
9 | # tends to pull in the entire XML stack and other tools, so it's not enabled | ||
10 | # by default. | ||
11 | PACKAGECONFIG:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'manpages', '', d)}" | ||
12 | |||
13 | inherit qemu | ||
14 | |||
15 | # usually manual files are packaged to ${PN}-doc except man-pages | ||
16 | MAN_PKG ?= "${PN}-doc" | ||
17 | |||
18 | # only add man-db to RDEPENDS when manual files are built and installed | ||
19 | RDEPENDS:${MAN_PKG} += "${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'man-db', '', d)}" | ||
20 | |||
21 | pkg_postinst:${MAN_PKG}:append () { | ||
22 | # only update manual page index caches when manual files are built and installed | ||
23 | if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then | ||
24 | if test -n "$D"; then | ||
25 | if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true', 'false', d)}; then | ||
26 | sed "s:\(\s\)/:\1$D/:g" $D${sysconfdir}/man_db.conf | ${@qemu_run_binary(d, '$D', '${bindir}/mandb')} -C - -u -q $D${mandir} | ||
27 | chown -R root:root $D${mandir} | ||
28 | |||
29 | mkdir -p $D${localstatedir}/cache/man | ||
30 | cd $D${mandir} | ||
31 | find . -name index.db | while read index; do | ||
32 | mkdir -p $D${localstatedir}/cache/man/$(dirname ${index}) | ||
33 | mv ${index} $D${localstatedir}/cache/man/${index} | ||
34 | chown man:man $D${localstatedir}/cache/man/${index} | ||
35 | done | ||
36 | cd - | ||
37 | else | ||
38 | $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX} | ||
39 | fi | ||
40 | else | ||
41 | mandb -q | ||
42 | fi | ||
43 | fi | ||
44 | } | ||
45 | |||
46 | pkg_postrm:${MAN_PKG}:append () { | ||
47 | # only update manual page index caches when manual files are built and installed | ||
48 | if ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'true', 'false', d)}; then | ||
49 | mandb -q | ||
50 | fi | ||
51 | } | ||