summaryrefslogtreecommitdiffstats
path: root/meta/classes/gtk-doc.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-10 14:35:29 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-12 15:27:17 +0100
commitfd1517e2b51a170f2427122c6b95396db251d827 (patch)
treedabfe3e631339c2fc99a9ee7febb0f9c128e325e /meta/classes/gtk-doc.bbclass
parent10317912ee319ccf7f83605d438b5cbf9663f296 (diff)
downloadpoky-fd1517e2b51a170f2427122c6b95396db251d827.tar.gz
classes: Update classes to match new bitbake class scope functionality
Move classes to classes-global or classes-recipe as appropriate to take advantage of new bitbake functionality to check class scope/usage. (From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/gtk-doc.bbclass')
-rw-r--r--meta/classes/gtk-doc.bbclass89
1 files changed, 0 insertions, 89 deletions
diff --git a/meta/classes/gtk-doc.bbclass b/meta/classes/gtk-doc.bbclass
deleted file mode 100644
index 68fa2cc745..0000000000
--- a/meta/classes/gtk-doc.bbclass
+++ /dev/null
@@ -1,89 +0,0 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7# Helper class to pull in the right gtk-doc dependencies and configure
8# gtk-doc to enable or disable documentation building (which requries the
9# use of usermode qemu).
10
11# This variable is set to True if api-documentation is in
12# DISTRO_FEATURES and qemu-usermode is in MACHINE_FEATURES, and False otherwise.
13#
14# It should be used in recipes to determine whether gtk-doc based documentation should be built,
15# so that qemu use can be avoided when necessary.
16GTKDOC_ENABLED:class-native = "False"
17GTKDOC_ENABLED ?= "${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', \
18 bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d), 'False', d)}"
19
20# meson: default option name to enable/disable gtk-doc. This matches most
21# project's configuration. In doubts - check meson_options.txt in project's
22# source path.
23GTKDOC_MESON_OPTION ?= 'docs'
24GTKDOC_MESON_ENABLE_FLAG ?= 'true'
25GTKDOC_MESON_DISABLE_FLAG ?= 'false'
26
27# Auto enable/disable based on GTKDOC_ENABLED
28EXTRA_OECONF:prepend:class-target = "${@bb.utils.contains('GTKDOC_ENABLED', 'True', '--enable-gtk-doc --enable-gtk-doc-html --disable-gtk-doc-pdf', \
29 '--disable-gtk-doc', d)} "
30EXTRA_OEMESON:prepend:class-target = "-D${GTKDOC_MESON_OPTION}=${@bb.utils.contains('GTKDOC_ENABLED', 'True', '${GTKDOC_MESON_ENABLE_FLAG}', '${GTKDOC_MESON_DISABLE_FLAG}', d)} "
31
32# When building native recipes, disable gtkdoc, as it is not necessary,
33# pulls in additional dependencies, and makes build times longer
34EXTRA_OECONF:prepend:class-native = "--disable-gtk-doc "
35EXTRA_OECONF:prepend:class-nativesdk = "--disable-gtk-doc "
36EXTRA_OEMESON:prepend:class-native = "-D${GTKDOC_MESON_OPTION}=${GTKDOC_MESON_DISABLE_FLAG} "
37EXTRA_OEMESON:prepend:class-nativesdk = "-D${GTKDOC_MESON_OPTION}=${GTKDOC_MESON_DISABLE_FLAG} "
38
39# Even though gtkdoc is disabled on -native, gtk-doc package is still
40# needed for m4 macros.
41DEPENDS:append = " gtk-doc-native"
42
43# The documentation directory, where the infrastructure will be copied.
44# gtkdocize has a default of "." so to handle out-of-tree builds set this to $S.
45GTKDOC_DOCDIR ?= "${S}"
46
47export STAGING_DIR_HOST
48
49inherit python3native pkgconfig qemu
50DEPENDS:append = "${@' qemu-native' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}"
51
52do_configure:prepend () {
53 # Need to use ||true as this is only needed if configure.ac both exists
54 # and uses GTK_DOC_CHECK.
55 gtkdocize --srcdir ${S} --docdir ${GTKDOC_DOCDIR} || true
56}
57
58do_compile:prepend:class-target () {
59 if [ ${GTKDOC_ENABLED} = True ]; then
60 # Write out a qemu wrapper that will be given to gtkdoc-scangobj so that it
61 # can run target helper binaries through that.
62 qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\\$GIR_EXTRA_LIBS_PATH','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
63 cat > ${B}/gtkdoc-qemuwrapper << EOF
64#!/bin/sh
65# Use a modules directory which doesn't exist so we don't load random things
66# which may then get deleted (or their dependencies) and potentially segfault
67export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy
68
69GIR_EXTRA_LIBS_PATH=\`find ${B} -name *.so -printf "%h\n"|sort|uniq| tr '\n' ':'\`\$GIR_EXTRA_LIBS_PATH
70GIR_EXTRA_LIBS_PATH=\`find ${B} -name .libs| tr '\n' ':'\`\$GIR_EXTRA_LIBS_PATH
71
72# meson sets this wrongly (only to libs in build-dir), qemu_wrapper_cmdline() and GIR_EXTRA_LIBS_PATH take care of it properly
73unset LD_LIBRARY_PATH
74
75if [ -d ".libs" ]; then
76 $qemu_binary ".libs/\$@"
77else
78 $qemu_binary "\$@"
79fi
80
81if [ \$? -ne 0 ]; then
82 echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the recipe should help."
83 echo "(typically like this: GIR_EXTRA_LIBS_PATH=\"$""{B}/something/.libs\" )"
84 exit 1
85fi
86EOF
87 chmod +x ${B}/gtkdoc-qemuwrapper
88 fi
89}