diff options
author | Alexander Kanavin <alexander.kanavin@linux.intel.com> | 2016-07-15 16:09:38 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-09 12:12:22 +0100 |
commit | 2167573f6885bd84f35a5e1ec00845264d130d72 (patch) | |
tree | abe5903e73cedcb40da9f9bb3da6d2eb4f679625 | |
parent | 5029d1fb1523e111df482c2a6f69ac9758310691 (diff) | |
download | poky-2167573f6885bd84f35a5e1ec00845264d130d72.tar.gz |
gtk-doc.bbclass: enable building gtk-doc based documentation
This is done similarly to gobject-introspection, but with much
less delicate hacking around the upstream way of working.
(From OE-Core rev: 1b5b429f63c323fcd46b7419a531689717a73b91)
Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/gtk-doc.bbclass | 72 |
1 files changed, 58 insertions, 14 deletions
diff --git a/meta/classes/gtk-doc.bbclass b/meta/classes/gtk-doc.bbclass index e32f98dcfc..d41c80bb0d 100644 --- a/meta/classes/gtk-doc.bbclass +++ b/meta/classes/gtk-doc.bbclass | |||
@@ -1,25 +1,69 @@ | |||
1 | # Helper class to pull in the right gtk-doc dependencies and disable | 1 | # Helper class to pull in the right gtk-doc dependencies and configure |
2 | # gtk-doc. | 2 | # gtk-doc to enable or disable documentation building (which requries the |
3 | # use of usermode qemu). | ||
4 | |||
5 | # This variable is set to True if api-documentation is in | ||
6 | # DISTRO_FEATURES and qemu-usermode is in MACHINE_FEATURES, and False otherwise. | ||
3 | # | 7 | # |
4 | # Long-term it would be great if this class could be toggled between | 8 | # It should be used in recipes to determine whether gtk-doc based documentation should be built, |
5 | # gtk-doc-stub-native and the real gtk-doc-native, which would enable | 9 | # so that qemu use can be avoided when necessary. |
6 | # re-generation of documentation. For now, we'll make do with this which | 10 | GTKDOC_ENABLED = "${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', \ |
7 | # packages up any existing documentation (so from tarball builds). | 11 | bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d), 'False', d)}" |
12 | |||
13 | EXTRA_OECONF_prepend_class-target = "${@bb.utils.contains('GTKDOC_ENABLED', 'True', '--enable-gtk-doc --enable-gtk-doc-html --disable-gtk-doc-pdf', \ | ||
14 | '--disable-gtk-doc', d)} " | ||
15 | |||
16 | # When building native recipes, disable gtkdoc, as it is not necessary, | ||
17 | # pulls in additional dependencies, and makes build times longer | ||
18 | EXTRA_OECONF_prepend_class-native = "--disable-gtk-doc " | ||
19 | EXTRA_OECONF_prepend_class-nativesdk = "--disable-gtk-doc " | ||
20 | |||
21 | DEPENDS_append_class-target = " gtk-doc-native qemu-native gtk-doc" | ||
22 | |||
23 | # Even though gtkdoc is disabled on -native, gtk-doc package is still | ||
24 | # needed for m4 macros. | ||
25 | DEPENDS_append_class-native = " gtk-doc-native" | ||
26 | DEPENDS_append_class-nativesdk = " gtk-doc-native" | ||
8 | 27 | ||
9 | # The documentation directory, where the infrastructure will be copied. | 28 | # The documentation directory, where the infrastructure will be copied. |
10 | # gtkdocize has a default of "." so to handle out-of-tree builds set this to $S. | 29 | # gtkdocize has a default of "." so to handle out-of-tree builds set this to $S. |
11 | GTKDOC_DOCDIR ?= "${S}" | 30 | GTKDOC_DOCDIR ?= "${S}" |
12 | 31 | ||
13 | DEPENDS_append = " gtk-doc-stub-native" | 32 | do_configure_prepend () { |
33 | ( cd ${S}; gtkdocize --docdir ${GTKDOC_DOCDIR} || true ) | ||
34 | } | ||
35 | |||
36 | inherit qemu | ||
14 | 37 | ||
15 | EXTRA_OECONF_append = "\ | 38 | export STAGING_DIR_HOST |
16 | --disable-gtk-doc \ | ||
17 | --disable-gtk-doc-html \ | ||
18 | --disable-gtk-doc-pdf \ | ||
19 | " | ||
20 | 39 | ||
21 | do_configure_prepend () { | 40 | do_compile_prepend_class-target () { |
22 | ( cd ${S}; gtkdocize --docdir ${GTKDOC_DOCDIR} ) | 41 | |
42 | # Write out a qemu wrapper that will be given to gtkdoc-scangobj so that it | ||
43 | # can run target helper binaries through that. | ||
44 | qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\$GIR_EXTRA_LIBS_PATH','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}" | ||
45 | cat > ${B}/gtkdoc-qemuwrapper << EOF | ||
46 | #!/bin/sh | ||
47 | # Use a modules directory which doesn't exist so we don't load random things | ||
48 | # which may then get deleted (or their dependencies) and potentially segfault | ||
49 | export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy | ||
50 | |||
51 | GIR_EXTRA_LIBS_PATH=\`find ${B} -name .libs| tr '\n' ':'\`\$GIR_EXTRA_LIBS_PATH | ||
52 | |||
53 | if test -d ".libs"; then | ||
54 | $qemu_binary ".libs/\$@" | ||
55 | else | ||
56 | $qemu_binary "\$@" | ||
57 | fi | ||
58 | |||
59 | if [ \$? -ne 0 ]; then | ||
60 | echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the recipe should help." | ||
61 | echo "(typically like this: GIR_EXTRA_LIBS_PATH=\"$""{B}/something/.libs\" )" | ||
62 | exit 1 | ||
63 | fi | ||
64 | EOF | ||
65 | chmod +x ${B}/gtkdoc-qemuwrapper | ||
23 | } | 66 | } |
24 | 67 | ||
68 | |||
25 | inherit pkgconfig | 69 | inherit pkgconfig |