diff mbox series

[RFC] vala.bbclass: enable vapi build if class is inherited

Message ID 20231107100149.1048627-1-f_l_k@t-online.de
State New
Headers show
Series [RFC] vala.bbclass: enable vapi build if class is inherited | expand

Commit Message

Markus Volk Nov. 7, 2023, 10:01 a.m. UTC
Try to enable vapi build automatically if GI_DATA_ENABLED = True.
Do it basically the same way it is done for gi

Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 meta/classes-recipe/vala.bbclass              | 23 +++++++++++++++++++
 .../libdazzle/libdazzle_3.44.0.bb             |  1 +
 .../appstream/appstream_0.16.3.bb             |  2 --
 3 files changed, 24 insertions(+), 2 deletions(-)

Comments

Alexander Kanavin Nov. 7, 2023, 10:06 a.m. UTC | #1
There is quite a bit more recipes in core that inherit vala. Shouldn't
they be as well tweaked to rely on the class doing the right thing?

[ak@fedora poky]$ grep -ir vala meta*|grep inher
meta/recipes-support/libical/libical_3.0.16.bb:inherit cmake pkgconfig
gobject-introspection vala github-releases
meta/recipes-support/libproxy/libproxy_0.5.3.bb:inherit meson
pkgconfig gobject-introspection vala gi-docgen
meta/recipes-support/appstream/appstream_0.16.3.bb:inherit meson
gobject-introspection gettext gtk-doc pkgconfig vala
meta/recipes-gnome/libdazzle/libdazzle_3.44.0.bb:inherit gnomebase
upstream-version-is-even vala features_check gobject-introspection
meta/recipes-gnome/librsvg/librsvg_2.56.3.bb:inherit cargo_common
gnomebase pixbufcache gobject-introspection rust vala gi-docgen
cargo-update-recipe-crates
meta/recipes-gnome/gcr/gcr_4.1.0.bb:inherit gnomebase gtk-icon-cache
gi-docgen features_check vala gobject-introspection gettext mime
mime-xdg
meta/recipes-gnome/libhandy/libhandy_1.8.2.bb:inherit meson
gobject-introspection vala gettext gi-docgen features_check pkgconfig
meta/recipes-gnome/libadwaita/libadwaita_1.4.0.bb:inherit gnomebase
gobject-introspection gi-docgen vala features_check
meta/recipes-gnome/libportal/libportal_0.7.1.bb:inherit meson
gi-docgen gobject-introspection vala features_check pkgconfig
meta/recipes-gnome/libsecret/libsecret_0.21.1.bb:inherit gnomebase
gi-docgen vala gobject-introspection manpages

Alex

On Tue, 7 Nov 2023 at 11:01, Markus Volk <f_l_k@t-online.de> wrote:
>
> Try to enable vapi build automatically if GI_DATA_ENABLED = True.
> Do it basically the same way it is done for gi
>
> Signed-off-by: Markus Volk <f_l_k@t-online.de>
> ---
>  meta/classes-recipe/vala.bbclass              | 23 +++++++++++++++++++
>  .../libdazzle/libdazzle_3.44.0.bb             |  1 +
>  .../appstream/appstream_0.16.3.bb             |  2 --
>  3 files changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes-recipe/vala.bbclass b/meta/classes-recipe/vala.bbclass
> index 460ddb36f0..45c3993c54 100644
> --- a/meta/classes-recipe/vala.bbclass
> +++ b/meta/classes-recipe/vala.bbclass
> @@ -16,6 +16,29 @@ export STAGING_DATADIR
>  # Upstream Vala >= 0.11 looks in XDG_DATA_DIRS for .vapi files
>  export XDG_DATA_DIRS = "${STAGING_DATADIR}:${STAGING_LIBDIR}"
>
> +VALA_ENABLED:class-native = "False"
> +VALA_ENABLED ?= "${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'True', 'False', d)}"
> +
> +# meson: default option name to enable/disable vala. This matches most
> +# project's configuration. In doubts - check meson_options.txt in project's
> +# source path.
> +VALA_MESON_OPTION ?= 'vapi'
> +VALA_MESON_ENABLE_FLAG ?= 'true'
> +VALA_MESON_DISABLE_FLAG ?= 'false'
> +
> +# Define vala options such that they can be disabled completely when VALA_MESON_OPTION is empty
> +VALAMESONTARGET = "-D${VALA_MESON_OPTION}=${@bb.utils.contains('VALA_ENABLED', 'True', '${VALA_MESON_ENABLE_FLAG}', '${VALA_MESON_DISABLE_FLAG}', d)} "
> +VALAMESONBUILD = "-D${VALA_MESON_OPTION}=${VALA_MESON_DISABLE_FLAG} "
> +
> +EXTRA_OECONF:prepend:class-target = "${@bb.utils.contains('VALA_ENABLED', 'True', '--enable-vala', '--disable-vala', d)} "
> +EXTRA_OEMESON:prepend:class-target = "${@['', '${VALAMESONTARGET}'][d.getVar('VALA_MESON_OPTION') != '']} "
> +# When building native recipes, disable vala, as it is not necessary,
> +# pulls in additional dependencies, and makes build times longer
> +EXTRA_OECONF:prepend:class-native = "--disable-vala "
> +EXTRA_OEMESON:prepend:class-native = "${@['', '${VALAMESONBUILD}'][d.getVar('VALA_MESON_OPTION') != '']}"
> +EXTRA_OECONF:prepend:class-nativesdk = "--disable-vala "
> +EXTRA_OEMESON:prepend:class-nativesdk = "${@['', '${VALAMESONBUILD}'][d.getVar('VALA_MESON_OPTION') != '']}"
> +
>  # Package additional files
>  FILES:${PN}-dev += "\
>      ${datadir}/vala/vapi/*.vapi \
> diff --git a/meta/recipes-gnome/libdazzle/libdazzle_3.44.0.bb b/meta/recipes-gnome/libdazzle/libdazzle_3.44.0.bb
> index 49ebc818b0..e561bfa22a 100644
> --- a/meta/recipes-gnome/libdazzle/libdazzle_3.44.0.bb
> +++ b/meta/recipes-gnome/libdazzle/libdazzle_3.44.0.bb
> @@ -15,5 +15,6 @@ DEPENDS = "glib-2.0-native glib-2.0 gtk+3"
>  SRC_URI[archive.sha256sum] = "3cd3e45eb6e2680cb05d52e1e80dd8f9d59d4765212f0e28f78e6c1783d18eae"
>
>  GIR_MESON_OPTION = 'with_introspection'
> +VALA_MESON_OPTION = "with_vapi"
>
>  ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
> diff --git a/meta/recipes-support/appstream/appstream_0.16.3.bb b/meta/recipes-support/appstream/appstream_0.16.3.bb
> index bde679e256..dafeff2555 100644
> --- a/meta/recipes-support/appstream/appstream_0.16.3.bb
> +++ b/meta/recipes-support/appstream/appstream_0.16.3.bb
> @@ -40,6 +40,4 @@ PACKAGECONFIG[stemming] = "-Dstemming=true,-Dstemming=false,libstemmer"
>
>  FILES:${PN} += "${datadir}"
>
> -EXTRA_OEMESON += "${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-Dvapi=true', '-Dvapi=false', d)}"
> -
>  BBCLASSEXTEND = "native"
> --
> 2.42.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#190261): https://lists.openembedded.org/g/openembedded-core/message/190261
> Mute This Topic: https://lists.openembedded.org/mt/102439967/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Markus Volk Nov. 7, 2023, 10:18 a.m. UTC | #2
On Tue, Nov 7 2023 at 11:06:26 AM +01:00:00, Alexander Kanavin 
<alex.kanavin@gmail.com> wrote:
> There is quite a bit more recipes in core that inherit vala. Shouldn't
> they be as well tweaked to rely on the class doing the right thing?

yes, and I build almost all of them regulary. On a first look it seems 
like they already do the right thing. I encountered some breakage in 
meta-openembedded and one issue in meta-virtualization so far. I'll 
send RFC patches for that and I'll also do more testing with oe-core
Markus Volk Nov. 7, 2023, 11:52 a.m. UTC | #3
On Tue, Nov 7 2023 at 11:18:15 AM +01:00:00, Markus Volk 
<f_l_k@t-online.de> wrote:
> Shouldn't
> they be as well tweaked to rely on the class doing the right thing?

functionwise its been ok but I've found some additional things to 
cleanup, so I'll send a v2.
diff mbox series

Patch

diff --git a/meta/classes-recipe/vala.bbclass b/meta/classes-recipe/vala.bbclass
index 460ddb36f0..45c3993c54 100644
--- a/meta/classes-recipe/vala.bbclass
+++ b/meta/classes-recipe/vala.bbclass
@@ -16,6 +16,29 @@  export STAGING_DATADIR
 # Upstream Vala >= 0.11 looks in XDG_DATA_DIRS for .vapi files
 export XDG_DATA_DIRS = "${STAGING_DATADIR}:${STAGING_LIBDIR}"
 
+VALA_ENABLED:class-native = "False"
+VALA_ENABLED ?= "${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'True', 'False', d)}"
+
+# meson: default option name to enable/disable vala. This matches most
+# project's configuration. In doubts - check meson_options.txt in project's
+# source path.
+VALA_MESON_OPTION ?= 'vapi'
+VALA_MESON_ENABLE_FLAG ?= 'true'
+VALA_MESON_DISABLE_FLAG ?= 'false'
+
+# Define vala options such that they can be disabled completely when VALA_MESON_OPTION is empty
+VALAMESONTARGET = "-D${VALA_MESON_OPTION}=${@bb.utils.contains('VALA_ENABLED', 'True', '${VALA_MESON_ENABLE_FLAG}', '${VALA_MESON_DISABLE_FLAG}', d)} "
+VALAMESONBUILD = "-D${VALA_MESON_OPTION}=${VALA_MESON_DISABLE_FLAG} "
+
+EXTRA_OECONF:prepend:class-target = "${@bb.utils.contains('VALA_ENABLED', 'True', '--enable-vala', '--disable-vala', d)} "
+EXTRA_OEMESON:prepend:class-target = "${@['', '${VALAMESONTARGET}'][d.getVar('VALA_MESON_OPTION') != '']} "
+# When building native recipes, disable vala, as it is not necessary,
+# pulls in additional dependencies, and makes build times longer
+EXTRA_OECONF:prepend:class-native = "--disable-vala "
+EXTRA_OEMESON:prepend:class-native = "${@['', '${VALAMESONBUILD}'][d.getVar('VALA_MESON_OPTION') != '']}"
+EXTRA_OECONF:prepend:class-nativesdk = "--disable-vala "
+EXTRA_OEMESON:prepend:class-nativesdk = "${@['', '${VALAMESONBUILD}'][d.getVar('VALA_MESON_OPTION') != '']}"
+
 # Package additional files
 FILES:${PN}-dev += "\
     ${datadir}/vala/vapi/*.vapi \
diff --git a/meta/recipes-gnome/libdazzle/libdazzle_3.44.0.bb b/meta/recipes-gnome/libdazzle/libdazzle_3.44.0.bb
index 49ebc818b0..e561bfa22a 100644
--- a/meta/recipes-gnome/libdazzle/libdazzle_3.44.0.bb
+++ b/meta/recipes-gnome/libdazzle/libdazzle_3.44.0.bb
@@ -15,5 +15,6 @@  DEPENDS = "glib-2.0-native glib-2.0 gtk+3"
 SRC_URI[archive.sha256sum] = "3cd3e45eb6e2680cb05d52e1e80dd8f9d59d4765212f0e28f78e6c1783d18eae"
 
 GIR_MESON_OPTION = 'with_introspection'
+VALA_MESON_OPTION = "with_vapi"
 
 ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
diff --git a/meta/recipes-support/appstream/appstream_0.16.3.bb b/meta/recipes-support/appstream/appstream_0.16.3.bb
index bde679e256..dafeff2555 100644
--- a/meta/recipes-support/appstream/appstream_0.16.3.bb
+++ b/meta/recipes-support/appstream/appstream_0.16.3.bb
@@ -40,6 +40,4 @@  PACKAGECONFIG[stemming] = "-Dstemming=true,-Dstemming=false,libstemmer"
 
 FILES:${PN} += "${datadir}"
 
-EXTRA_OEMESON += "${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-Dvapi=true', '-Dvapi=false', d)}"
-
 BBCLASSEXTEND = "native"