Skip to content

build: Fix build_gir logic

Thomas Staudinger requested to merge Staudey/gtk:gtk-3-24 into gtk-3-24

As part of the switch from autotools to meson a change to "conditionally generate introspection" was backported from the main branch in 4b8cdeec

Since introspection is a boolean in gtk-3-24 this does however not work the same way as for the introspection feature in main. If the user sets introspection=false, but gir.found() is true, and meson.is_cross_build() is false, then the user choice is ignored by this check and build_gir evaluates to true. I don't think this was the intention, and it was surprising to me when trying to build gtk-3 for Solus.

A quick solution to this is simply ignoring the value of is_cross_build, as it will only overrule the value of introspection in the case where it doesn't make sense anyway (introspection set to false, no cross build). This is what this PR implements. See the tables below for a comparison of the behaviour before and after the change (see the fourth row for the difference). With this change the value of introspection is always respected where possible.

Before:

gir.found is_cross_build introspection build_gir
TRUE TRUE TRUE TRUE
TRUE TRUE FALSE FALSE
TRUE FALSE TRUE TRUE
TRUE FALSE FALSE TRUE
FALSE TRUE TRUE FALSE
FALSE TRUE FALSE FALSE
FALSE FALSE TRUE FALSE
FALSE FALSE FALSE FALSE

After:

gir.found is_cross_build introspection build_gir
TRUE TRUE TRUE TRUE
TRUE TRUE FALSE FALSE
TRUE FALSE TRUE TRUE
TRUE FALSE FALSE FALSE
FALSE TRUE TRUE FALSE
FALSE TRUE FALSE FALSE
FALSE FALSE TRUE FALSE
FALSE FALSE FALSE FALSE

The more involved, but probably more sensible solution, would be to turn introspection into a feature, as in the main branch.

P.S. Writing this at 06:30 before sleep while it's still fresh in my head, sorry in advance for any mistakes

Merge request reports