summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/gobject-introspection.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes-recipe/gobject-introspection.bbclass')
-rw-r--r--meta/classes-recipe/gobject-introspection.bbclass61
1 files changed, 61 insertions, 0 deletions
diff --git a/meta/classes-recipe/gobject-introspection.bbclass b/meta/classes-recipe/gobject-introspection.bbclass
new file mode 100644
index 0000000000..0c7b7d200a
--- /dev/null
+++ b/meta/classes-recipe/gobject-introspection.bbclass
@@ -0,0 +1,61 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7# Inherit this class in recipes to enable building their introspection files
8
9# python3native is inherited to prevent introspection tools being run with
10# host's python 3 (they need to be run with native python 3)
11#
12# This also sets up autoconf-based recipes to build introspection data (or not),
13# depending on distro and machine features (see gobject-introspection-data class).
14inherit python3native gobject-introspection-data
15
16# meson: default option name to enable/disable introspection. This matches most
17# project's configuration. In doubts - check meson_options.txt in project's
18# source path.
19GIR_MESON_OPTION ?= 'introspection'
20GIR_MESON_ENABLE_FLAG ?= 'true'
21GIR_MESON_DISABLE_FLAG ?= 'false'
22
23# Define g-i options such that they can be disabled completely when GIR_MESON_OPTION is empty
24GIRMESONTARGET = "-D${GIR_MESON_OPTION}=${@bb.utils.contains('GI_DATA_ENABLED', 'True', '${GIR_MESON_ENABLE_FLAG}', '${GIR_MESON_DISABLE_FLAG}', d)} "
25GIRMESONBUILD = "-D${GIR_MESON_OPTION}=${GIR_MESON_DISABLE_FLAG} "
26# Auto enable/disable based on GI_DATA_ENABLED
27EXTRA_OECONF:prepend:class-target = "${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection', '--disable-introspection', d)} "
28EXTRA_OEMESON:prepend:class-target = "${@['', '${GIRMESONTARGET}'][d.getVar('GIR_MESON_OPTION') != '']}"
29# When building native recipes, disable introspection, as it is not necessary,
30# pulls in additional dependencies, and makes build times longer
31EXTRA_OECONF:prepend:class-native = "--disable-introspection "
32EXTRA_OECONF:prepend:class-nativesdk = "--disable-introspection "
33EXTRA_OEMESON:prepend:class-native = "${@['', '${GIRMESONBUILD}'][d.getVar('GIR_MESON_OPTION') != '']}"
34EXTRA_OEMESON:prepend:class-nativesdk = "${@['', '${GIRMESONBUILD}'][d.getVar('GIR_MESON_OPTION') != '']}"
35
36# Generating introspection data depends on a combination of native and target
37# introspection tools, and qemu to run the target tools.
38DEPENDS:append:class-target = " gobject-introspection gobject-introspection-native qemu-native"
39
40# Even though introspection is disabled on -native, gobject-introspection package is still
41# needed for m4 macros.
42DEPENDS:append:class-native = " gobject-introspection-native"
43DEPENDS:append:class-nativesdk = " gobject-introspection-native"
44
45# This is used by introspection tools to find .gir includes
46export XDG_DATA_DIRS = "${STAGING_DATADIR}:${STAGING_LIBDIR}"
47
48do_configure:prepend:class-target () {
49 # introspection.m4 pre-packaged with upstream tarballs does not yet
50 # have our fixes
51 mkdir -p ${S}/m4
52 cp ${STAGING_DIR_TARGET}/${datadir}/aclocal/introspection.m4 ${S}/m4
53}
54
55# .typelib files are needed at runtime and so they go to the main package (so
56# they'll be together with libraries they support).
57FILES:${PN}:append = " ${libdir}/girepository-*/*.typelib"
58
59# .gir files go to dev package, as they're needed for developing (but not for
60# running) things that depends on introspection.
61FILES:${PN}-dev:append = " ${datadir}/gir-*/*.gir ${libdir}/gir-*/*.gir"