Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | # Inherit this class in recipes to enable building their introspection files |
| 2 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 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), |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 7 | # depending on distro and machine features (see gobject-introspection-data class). |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 8 | inherit python3native gobject-introspection-data |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 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 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame^] | 17 | # Define g-i options such that they can be disabled completely when GIR_MESON_OPTION is empty |
| 18 | GIRMESONTARGET = "-D${GIR_MESON_OPTION}=${@bb.utils.contains('GI_DATA_ENABLED', 'True', '${GIR_MESON_ENABLE_FLAG}', '${GIR_MESON_DISABLE_FLAG}', d)} " |
| 19 | GIRMESONBUILD = "-D${GIR_MESON_OPTION}=${GIR_MESON_DISABLE_FLAG} " |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 20 | # Auto enable/disable based on GI_DATA_ENABLED |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 21 | EXTRA_OECONF:prepend:class-target = "${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection', '--disable-introspection', d)} " |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame^] | 22 | EXTRA_OEMESON:prepend:class-target = "${@['', '${GIRMESONTARGET}'][d.getVar('GIR_MESON_OPTION') != '']}" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 23 | # When building native recipes, disable introspection, as it is not necessary, |
| 24 | # pulls in additional dependencies, and makes build times longer |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 25 | EXTRA_OECONF:prepend:class-native = "--disable-introspection " |
| 26 | EXTRA_OECONF:prepend:class-nativesdk = "--disable-introspection " |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame^] | 27 | EXTRA_OEMESON:prepend:class-native = "${@['', '${GIRMESONBUILD}'][d.getVar('GIR_MESON_OPTION') != '']}" |
| 28 | EXTRA_OEMESON:prepend:class-nativesdk = "${@['', '${GIRMESONBUILD}'][d.getVar('GIR_MESON_OPTION') != '']}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 29 | |
| 30 | # Generating introspection data depends on a combination of native and target |
| 31 | # introspection tools, and qemu to run the target tools. |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 32 | DEPENDS:append:class-target = " gobject-introspection gobject-introspection-native qemu-native prelink-native" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 33 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 34 | # Even though introspection is disabled on -native, gobject-introspection package is still |
| 35 | # needed for m4 macros. |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 36 | DEPENDS:append:class-native = " gobject-introspection-native" |
| 37 | DEPENDS:append:class-nativesdk = " gobject-introspection-native" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 38 | |
| 39 | # This is used by introspection tools to find .gir includes |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 40 | export XDG_DATA_DIRS = "${STAGING_DATADIR}:${STAGING_LIBDIR}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 41 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 42 | do_configure:prepend:class-target () { |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 43 | # introspection.m4 pre-packaged with upstream tarballs does not yet |
| 44 | # have our fixes |
| 45 | mkdir -p ${S}/m4 |
| 46 | cp ${STAGING_DIR_TARGET}/${datadir}/aclocal/introspection.m4 ${S}/m4 |
| 47 | } |
| 48 | |
| 49 | # .typelib files are needed at runtime and so they go to the main package (so |
| 50 | # they'll be together with libraries they support). |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 51 | FILES:${PN}:append = " ${libdir}/girepository-*/*.typelib" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 52 | |
| 53 | # .gir files go to dev package, as they're needed for developing (but not for |
| 54 | # running) things that depends on introspection. |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 55 | FILES:${PN}-dev:append = " ${datadir}/gir-*/*.gir ${libdir}/gir-*/*.gir" |