lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | # Inherit this class in recipes to enable building their introspection files |
| 2 | |
| 3 | # python3native is inherited to prevent introspection tools being run with |
| 4 | # host's python 3 (they need to be run with native python 3) |
| 5 | # |
| 6 | # This also sets up autoconf-based recipes to build introspection data (or not), |
| 7 | # depending on distro and machine features (see gobject-introspection-data class). |
| 8 | inherit python3native gobject-introspection-data |
| 9 | |
| 10 | # meson: default option name to enable/disable introspection. This matches most |
| 11 | # project's configuration. In doubts - check meson_options.txt in project's |
| 12 | # source path. |
| 13 | GIR_MESON_OPTION ?= 'introspection' |
| 14 | GIR_MESON_ENABLE_FLAG ?= 'true' |
| 15 | GIR_MESON_DISABLE_FLAG ?= 'false' |
| 16 | |
| 17 | # Auto enable/disable based on GI_DATA_ENABLED |
| 18 | EXTRA_OECONF_prepend_class-target = "${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection', '--disable-introspection', d)} " |
| 19 | EXTRA_OEMESON_prepend_class-target = "-D${GIR_MESON_OPTION}=${@bb.utils.contains('GI_DATA_ENABLED', 'True', '${GIR_MESON_ENABLE_FLAG}', '${GIR_MESON_DISABLE_FLAG}', d)} " |
| 20 | |
| 21 | # When building native recipes, disable introspection, as it is not necessary, |
| 22 | # pulls in additional dependencies, and makes build times longer |
| 23 | EXTRA_OECONF_prepend_class-native = "--disable-introspection " |
| 24 | EXTRA_OECONF_prepend_class-nativesdk = "--disable-introspection " |
| 25 | EXTRA_OEMESON_prepend_class-native = "-D${GIR_MESON_OPTION}=${GIR_MESON_DISABLE_FLAG} " |
| 26 | EXTRA_OEMESON_prepend_class-nativesdk = "-D${GIR_MESON_OPTION}=${GIR_MESON_DISABLE_FLAG} " |
| 27 | |
| 28 | # Generating introspection data depends on a combination of native and target |
| 29 | # introspection tools, and qemu to run the target tools. |
| 30 | DEPENDS_append_class-target = " gobject-introspection gobject-introspection-native qemu-native prelink-native" |
| 31 | |
| 32 | # Even though introspection is disabled on -native, gobject-introspection package is still |
| 33 | # needed for m4 macros. |
| 34 | DEPENDS_append_class-native = " gobject-introspection-native" |
| 35 | DEPENDS_append_class-nativesdk = " gobject-introspection-native" |
| 36 | |
| 37 | # This is used by introspection tools to find .gir includes |
| 38 | export XDG_DATA_DIRS = "${STAGING_DATADIR}:${STAGING_LIBDIR}" |
| 39 | |
| 40 | do_configure_prepend_class-target () { |
| 41 | # introspection.m4 pre-packaged with upstream tarballs does not yet |
| 42 | # have our fixes |
| 43 | mkdir -p ${S}/m4 |
| 44 | cp ${STAGING_DIR_TARGET}/${datadir}/aclocal/introspection.m4 ${S}/m4 |
| 45 | } |
| 46 | |
| 47 | # .typelib files are needed at runtime and so they go to the main package (so |
| 48 | # they'll be together with libraries they support). |
| 49 | FILES_${PN}_append = " ${libdir}/girepository-*/*.typelib" |
| 50 | |
| 51 | # .gir files go to dev package, as they're needed for developing (but not for |
| 52 | # running) things that depends on introspection. |
| 53 | FILES_${PN}-dev_append = " ${datadir}/gir-*/*.gir ${libdir}/gir-*/*.gir" |