diff mbox series

[v2,2/5] libportal: split out GTK libraries into sub-packages

Message ID 20260513133557.2951262-2-ross.burton@arm.com
State Under Review
Headers show
Series [v2,1/5] libportal: add explicit PACKAGECONFIG for gtk4 support | expand

Commit Message

Ross Burton May 13, 2026, 1:35 p.m. UTC
We shouldn't package the bare libportal and the GTK3 and GTK4 libraries
into one package. Instead package the UI libraries into separate
packages, so that dependencies are contained.

Add PACKAGECONFIGs for the gtk3 and gtk3 libraries so that they can be
controlled individually. Keep the existing behaviour of enabling both
GTK 3 and 4 as various recipes use both, but this allows building
libportal without any GTK dependencies if required.

The PACKAGECONFIG logic is "fun": if either of wayland or x11 are
enabled then we can enable GTK+3 by default, and if either of those
_and_ opengl are enabled then we can also do GTK 4.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-gnome/libportal/libportal_0.9.1.bb | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-gnome/libportal/libportal_0.9.1.bb b/meta/recipes-gnome/libportal/libportal_0.9.1.bb
index f4924355f93..59252e2a67b 100644
--- a/meta/recipes-gnome/libportal/libportal_0.9.1.bb
+++ b/meta/recipes-gnome/libportal/libportal_0.9.1.bb
@@ -9,14 +9,22 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=3000208d539ec061b899bce1d9ce9404"
 SRC_URI = "git://github.com/flatpak/${BPN}.git;protocol=https;branch=main"
 SRCREV = "8f5dc8d192f6e31dafe69e35219e3b707bde71ce"
 
-inherit meson gi-docgen gobject-introspection vala features_check pkgconfig
+inherit meson gi-docgen gobject-introspection vala pkgconfig
 GIDOCGEN_MESON_OPTION = 'docs'
 
-ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
+DEPENDS += "glib-2.0 glib-2.0-native"
 
-DEPENDS += "glib-2.0 glib-2.0-native gtk+3"
+CAN_GTK = "${@bb.utils.contains_any('DISTRO_FEATURES', '${GTK3DISTROFEATURES}', '1', '0', d)}"
 
-PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'gtk4', '', d)}"
+PACKAGECONFIG ??= "${@oe.utils.vartrue('CAN_GTK', 'gtk3', '', d)} \
+                   ${@oe.utils.vartrue('CAN_GTK', '${@bb.utils.contains("DISTRO_FEATURES", "opengl", "gtk4", "", d)}', '', d)}"
+
+PACKAGECONFIG[gtk3] = "-Dbackend-gtk3=enabled,-Dbackend-gtk3=disabled,gtk+3"
 PACKAGECONFIG[gtk4] = "-Dbackend-gtk4=enabled,-Dbackend-gtk4=disabled,gtk4"
 
 EXTRA_OEMESON = "${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-Dvapi=true', '-Dvapi=false', d)} -Dbackend-qt5=disabled"
+
+PACKAGES =+ "${PN}-gtk3 ${PN}-gtk4"
+
+FILES:${PN}-gtk3 = "${libdir}/libportal-gtk3${SOLIBS} ${libdir}/girepository-1.0/*Gtk3-1.0.typelib"
+FILES:${PN}-gtk4 = "${libdir}/libportal-gtk4${SOLIBS} ${libdir}/girepository-1.0/*Gtk4-1.0.typelib"