gobject-introspection: auto-enable/-disable gobject-introspection for meson
PATCH v2 2/2 gobject-introspection: auto-enable/-disable gobject-introspection for meson
---
V1 -> V2: Introduce GIR_MESON_OPTION as suggested by Alexander Kanavin
meta/classes/gobject-introspection.bbclass | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
meta/classes/gobject-introspection.bbclass +13 -1
@@ -6,14 +6,26 @@ # This also sets up autoconf-based recipes to build introspection data (or not), # depending on distro and machine features (see gobject-introspection-data class). inherit python3native gobject-introspection-data + +# meson: default option name to enable/disable introspection. This matches most +# project's configuration. In doubts - check meson_options.txt in project's +# source path. +GIR_MESON_OPTION ?= 'introspection' + +# Auto enable/disable based on GI_DATA_ENABLED EXTRA_OECONF_prepend_class-target = "${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection', '--disable-introspection', d)} " +EXTRA_OEMESON_prepend_class-target = "-D${GIR_MESON_OPTION}=${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'true', 'false', d)} " # When building native recipes, disable introspection, as it is not necessary, # pulls in additional dependencies, and makes build times longer EXTRA_OECONF_prepend_class-native = "--disable-introspection " EXTRA_OECONF_prepend_class-nativesdk = "--disable-introspection " +EXTRA_OEMESON_prepend_class-native = "-D${GIR_MESON_OPTION}=False " +EXTRA_OEMESON_prepend_class-nativesdk = "-D${GIR_MESON_OPTION}=False " -UNKNOWN_CONFIGURE_WHITELIST_append = " --enable-introspection --disable-introspection" +# Avoid triggering configure QA +UNKNOWN_CONFIGURE_WHITELIST_append = " ${@["", "--enable-introspection --disable-introspection"][(bb.data.inherits_class('autotools', d))]}" +UNKNOWN_CONFIGURE_WHITELIST_append = " ${@["", "${GIR_MESON_OPTION}"][(bb.data.inherits_class('meson', d))]}" # Generating introspection data depends on a combination of native and target # introspection tools, and qemu to run the target tools.
Signature · 1 line
2.20.1
meta/classes/gobject-introspection.bbclass line 17
Quoted 3 lines · Andreas Müller
meta/classes/gobject-introspection.bbclass +2
-0+# Auto enable/disable based on GI_DATA_ENABLED EXTRA_OECONF_prepend_class-target = "${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection', '--disable-introspection', d)} " +EXTRA_OEMESON_prepend_class-target = "-D${GIR_MESON_OPTION}=${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'true', 'false', d)} "
Thanks, may I also ask that you go over the recipes in oe-core that inherit meson, and tweak them to use this option? (there is not a lot, and some don't use g-i at all).
meta/classes/gobject-introspection.bbclass line 28
Quoted 11 lines
# When building native recipes, disable introspection, as it is not necessary,
# pulls in additional dependencies, and makes build times longer EXTRA_OECONF_prepend_class-native = "--disable-introspection " EXTRA_OECONF_prepend_class-nativesdk = "--disable-introspection "meta/classes/gobject-introspection.bbclass +5
-1+EXTRA_OEMESON_prepend_class-native = "-D${GIR_MESON_OPTION}=False " +EXTRA_OEMESON_prepend_class-nativesdk = "-D${GIR_MESON_OPTION}=False " -UNKNOWN_CONFIGURE_WHITELIST_append = " --enable-introspection --disable-introspection" +# Avoid triggering configure QA +UNKNOWN_CONFIGURE_WHITELIST_append = " ${@["", "--enable-introspection --disable-introspection"][(bb.data.inherits_class('autotools', d))]}" +UNKNOWN_CONFIGURE_WHITELIST_append = " ${@["", "${GIR_MESON_OPTION}"][(bb.data.inherits_class('meson', d))]}"
I honestly don't remember why the whitelisting was considered a good idea, but I think it would be better to drop it altogether? That way there will be no silent regressions (when upstream decides to rename the option, for example, which does happen).
Alex
Quoted 3 lines · Alexander Kanavin
Thanks, may I also ask that you go over the recipes in oe-core that inherit meson, and tweak them to use this option? (there is not a lot, and some don't use g-i at all).
The exact list is:
at-spi2-core
libsoup-2.4
gdk-pixbuf
libmodulemd
atk
pango
libdazzle
json-glib
clutter-gtk-1.0.inc
Alex
Quoted 19 lines · Alexander Kanavin
Quoted 3 lines · Alexander Kanavin
Thanks, may I also ask that you go over the recipes in oe-core that inherit meson, and tweak them to use this option? (there is not a lot, and some don't use g-i at all).
The exact list is:
at-spi2-core
libsoup-2.4
gdk-pixbuf
libmodulemd
atk
pango
libdazzle
json-glib
clutter-gtk-1.0.inc
Quoted 1 line
Alex
Thanks :)
I cannot promise when but will take care because I consider it an enhancement.
Problem is that I am sitting on growing loads of meta-gnome patches and they need review for this either.
As collector of DEs I'd love to see gnome again - that should have been next step in [1]
[1] https://github.com/schnitzeltony/meta-openembedded/tree/work-2019-03
Andreas
Quoted 19 lines · Alexander Kanavin
Quoted 3 lines · Alexander Kanavin
Thanks, may I also ask that you go over the recipes in oe-core that inherit meson, and tweak them to use this option? (there is not a lot, and some don't use g-i at all).
The exact list is:
at-spi2-core
libsoup-2.4
gdk-pixbuf
libmodulemd
atk
pango
libdazzle
json-glib
clutter-gtk-1.0.inc
Quoted 1 line
Alex
Some intermediate info:
* adjusted gobject-introspection.bbclass to make flags (true/false or yes/no ...) overridable and removed configure option whitelisting
* changed the recipes above
* update glib-networking to get gnutls option back
With test builds I get:
* gstreamer1.0-plugins-good complains for unrecognised 'enable-introspection' and 'disable-introspection'. This is odd for two reasons: Both options enable/disable? gstreamer1.0-plugins-good complains but has introspection.m4 what is the problem?
* Some recipes in meta-gnome complain for unrecognised options now
To be continued...
Andreas
On Wed, 3 Apr 2019 at 12:55, Andreas Müller <[email protected]> wrote:
t builds I get:
Quoted 4 lines
* gstreamer1.0-plugins-good complains for unrecognised 'enable-introspection' and 'disable-introspection'. This is odd for two reasons: Both options enable/disable? gstreamer1.0-plugins-good complains but has introspection.m4 what is the problem?
It seems as though gst-plugins-good does not support introspection, and never did! So you can simply add the option whitelisting to that recipe specifically.
Alex
Quoted 9 lines · Alexander Kanavin
meta/classes/gobject-introspection.bbclass line 17
Quoted 3 lines · Andreas Müller
meta/classes/gobject-introspection.bbclass +2
-0+# Auto enable/disable based on GI_DATA_ENABLED EXTRA_OECONF_prepend_class-target = "${@bb.utils.contains('GI_DATA_ENABLED', 'True', '--enable-introspection', '--disable-introspection', d)} " +EXTRA_OEMESON_prepend_class-target = "-D${GIR_MESON_OPTION}=${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'true', 'false', d)} "Thanks, may I also ask that you go over the recipes in oe-core that inherit meson, and tweak them to use this option? (there is not a lot, and some don't use g-i at all).
OK will do - but I'll wait a bit just in case somebody finds reasons not to apply this patch.
Quoted 8 lines
Quoted 8 lines
# When building native recipes, disable introspection, as it is not necessary,
# pulls in additional dependencies, and makes build times longer EXTRA_OECONF_prepend_class-native = "--disable-introspection " EXTRA_OECONF_prepend_class-nativesdk = "--disable-introspection "meta/classes/gobject-introspection.bbclass +2
-0+EXTRA_OEMESON_prepend_class-native = "-D${GIR_MESON_OPTION}=False " +EXTRA_OEMESON_prepend_class-nativesdk = "-D${GIR_MESON_OPTION}=False "
Quoted 10 lines
meta/classes/gobject-introspection.bbclass line 28
Quoted 4 lines
meta/classes/gobject-introspection.bbclass +3
-1-UNKNOWN_CONFIGURE_WHITELIST_append = " --enable-introspection --disable-introspection" +# Avoid triggering configure QA +UNKNOWN_CONFIGURE_WHITELIST_append = " ${@["", "--enable-introspection --disable-introspection"][(bb.data.inherits_class('autotools', d))]}" +UNKNOWN_CONFIGURE_WHITELIST_append = " ${@["", "${GIR_MESON_OPTION}"][(bb.data.inherits_class('meson', d))]}"I honestly don't remember why the whitelisting was considered a good idea, but I think it would be better to drop it altogether? That way there will be no silent regressions (when upstream decides to rename the option, for example, which does happen).
Whitelisting would make sense for for projects where gir is mandatory and cannot be disabled by configuration - are there any?
And
Quoted 7 lines · Andreas Müller
Quoted 5 lines
I honestly don't remember why the whitelisting was considered a good idea, but I think it would be better to drop it altogether? That way there will be no silent regressions (when upstream decides to rename the option, for example, which does happen).
Whitelisting would make sense for for projects where gir is mandatory and cannot be disabled by configuration - are there any?
For autotools, basically no, as they all use the same m4 macro file which allows disabling.
For meson or other build systems the answer is also no, because in this case we would have to patch the upstream code to either make gir generation optional (and then 'inherit gobject-introspection'), or disable it altogether (and then don't inherit g-i at all). The reason is that introspection data generation is done through running a target binary, which requires a functional qemu usermode, and for some target MACHINEs qemu won't work (e.g. mips-n32, some flavours of powerpc etc
- g-i class determines that and does the right thing to disable introspection automatically). Here's an example of such patching:
(newer versions of libmodulemd made g-i optional, and so the current oe-core recipe and its patches reflects that).
Alex
Quoted 14 lines · Alexander Kanavin
Quoted 7 lines · Andreas Müller
Quoted 5 lines
I honestly don't remember why the whitelisting was considered a good idea, but I think it would be better to drop it altogether? That way there will be no silent regressions (when upstream decides to rename the option, for example, which does happen).
Whitelisting would make sense for for projects where gir is mandatory and cannot be disabled by configuration - are there any?
For autotools, basically no, as they all use the same m4 macro file which allows disabling.
Quoted 9 lines
For meson or other build systems the answer is also no, because in this case we would have to patch the upstream code to either make gir generation optional (and then 'inherit gobject-introspection'), or disable it altogether (and then don't inherit g-i at all). The reason is that introspection data generation is done through running a target binary, which requires a functional qemu usermode, and for some target MACHINEs qemu won't work (e.g. mips-n32, some flavours of powerpc etc
- g-i class determines that and does the right thing to disable introspection automatically).
What about musl? Am not sure that my information is still valid:
Broken qemu or not?
Quoted 7 lines
Here's an example of such patching:
(newer versions of libmodulemd made g-i optional, and so the current oe-core recipe and its patches reflects that).
I will prepare follow ups:
* remove whitelisting (see what we get)
* adapt recipes in oe-core
Seems all this is too late for warrier (that was my target - am again too late - maybe next time :).
So I think I'll continue with gnome-de for warrier first (with oe-core as is). Maybe I get patches landed before doors are shut for meta-gnome...
Will come back then
Andreas
Quoted 2 lines · Andreas Müller
What about musl? Am not sure that my information is still valid:
Broken qemu or not?
musl is fine with qemu.
Alex
Quoted 7 lines · Alexander Kanavin
Quoted 2 lines · Andreas Müller
What about musl? Am not sure that my information is still valid:
Broken qemu or not?musl is fine with qemu.
Just saw glib-networking failing for 'gnutils' option -> yes this option is not available.
The very first I have to do is fixing fallout by unrecognised meson options - hurray it seems to work - damn it causes more extra efforts :(
Andreas