Skip to contentSkip to conversation

libportal: add explicit PACKAGECONFIG for gtk4 support

PATCH New Ross Burton 1 participant 5 messages May 13

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/5 libportal: add explicit PACKAGECONFIG for gtk4 support

Instead of using the presence of the opengl DISTRO_FEATURE to control whether the GTK 4 integration is built, add a PACKAGECONFIG for it.

---
 meta/recipes-gnome/libportal/libportal_0.9.1.bb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta/recipes-gnome/libportal/libportal_0.9.1.bb +4 -1
index 9713f70dbb1..f4924355f93 100644
@@ -14,6 +14,9 @@ GIDOCGEN_MESON_OPTION = 'docs'
 
 ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
 
-DEPENDS += "glib-2.0 glib-2.0-native gtk+3 ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'gtk4', '', d)}"
+DEPENDS += "glib-2.0 glib-2.0-native gtk+3"
+
+PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'gtk4', '', d)}"
+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"
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 2/5 libportal: split out GTK libraries into sub-packages

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.

---
 meta/recipes-gnome/libportal/libportal_0.9.1.bb | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
meta/recipes-gnome/libportal/libportal_0.9.1.bb +12 -4
index f4924355f93..59252e2a67b 100644
@@ -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"
Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 3/5 gcr: remove obsolete DEPENDS

In reply to Ross Burton

libxslt-native was added back in 2017 to gcr-3.2.0 as a needed dependency when building with gobject-introspection[1], but this no longer appears to be the case.

gnupg-native was added in 2020[1] but we now pass the correct paths to Meson so this is no longer needed.

[1] oe-core 58922a43f93 ("gcr: add missing dependency on xsltproc if introspection is enabled")
[2] oe-core afa5ec0dee8 ("gcr: depends on gnupg-native")

---
 meta/recipes-gnome/gcr/gcr_4.4.0.1.bb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-gnome/gcr/gcr_4.4.0.1.bb +1 -2
index f3288c8d36e..1f4d2f48001 100644
@@ -8,8 +8,7 @@ BUGTRACKER = "https://gitlab.gnome.org/GNOME/gcr/issues"
 LICENSE = "LGPL-2.0-only"
 LIC_FILES_CHKSUM = "file://COPYING;md5=55ca817ccb7d5b5b66355690e9abc605"
 
-DEPENDS = "p11-kit glib-2.0 libgcrypt gnupg-native \
-           ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'libxslt-native', '', d)}"
+DEPENDS = "p11-kit glib-2.0 libgcrypt"
 
 CFLAGS += "-D_GNU_SOURCE"
 
Signature · 1 line
2.43.0
#3 lore raw

PATCH v2 4/5 gcr: remove obsolete packaging

In reply to Ross Burton

Previously the package contained UI libraries but they were removed in the 4.0.0 release:

- gcr4 will no longer ship UI libraries, i.e. gcr-gtk3 or gcr-gtk4.

Remove a large amount of packaging metadata that is no longer needed, and add an optional and disabled PACKAGECONFIG for the viewer tool which is packaged separately from the libraries.

---
 meta/recipes-gnome/gcr/gcr_4.4.0.1.bb | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
meta/recipes-gnome/gcr/gcr_4.4.0.1.bb +4 -12
index 1f4d2f48001..fa769759c14 100644
@@ -13,31 +13,23 @@ DEPENDS = "p11-kit glib-2.0 libgcrypt"
 CFLAGS += "-D_GNU_SOURCE"
 
 GTKDOC_MESON_OPTION = "gtk_doc"
-inherit gnomebase gtk-icon-cache gi-docgen features_check vala gobject-introspection gettext mime mime-xdg
+inherit gnomebase gi-docgen vala gobject-introspection lib_package
 UPSTREAM_CHECK_REGEX = "gcr-(?P<pver>\d+\.\d+\.(?!9\d+)\d+(\.\d+)?)"
 
-REQUIRED_DISTRO_FEATURES = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'opengl', '', d)}"
-
 SRC_URI[archive.sha256sum] = "0c3c341e49f9f4f2532a4884509804190a0c2663e6120360bb298c5d174a8098"
 
 PACKAGECONFIG ??= " \
 	${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
-	${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'gtk', '', d)} \
-	${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'gtk', '', d)} \
 	${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'vapi', '', d)} \
 "
-PACKAGECONFIG[gtk] = "-Dgtk4=true,-Dgtk4=false,gtk4"
 PACKAGECONFIG[ssh_agent] = "-Dssh_agent=true,-Dssh_agent=false,libsecret,openssh"
 #'Use systemd socket activation for server programs'
 PACKAGECONFIG[systemd] = "-Dsystemd=enabled,-Dsystemd=disabled,systemd"
 PACKAGECONFIG[vapi] = "-Dvapi=true,-Dvapi=false,"
+# A tool to view certificates
+PACKAGECONFIG[viewer] = "-Dgtk4=true,-Dgtk4=false,gtk4"
 
-FILES:${PN} += " \
-    ${datadir}/dbus-1 \
-    ${datadir}/gcr-4 \
-    ${systemd_user_unitdir}/gcr-ssh-agent.socket \
-    ${systemd_user_unitdir}/gcr-ssh-agent.service \
-"
+FILES:${PN} += "${systemd_user_unitdir}/gcr-ssh-agent.*"
 
 # http://errors.yoctoproject.org/Errors/Details/20229/
 ARM_INSTRUCTION_SET:armv4 = "arm"
Signature · 1 line
2.43.0
#4 lore raw

PATCH v2 5/5 gcr: package the ssh-agent into a separate package

In reply to Ross Burton

The agent is a separate component to the library, so package it into a new package.

The systemd dependency is only relevant to the ssh-agent, so don't enable it by default as we don't enable the agent either.

---
 meta/recipes-gnome/gcr/gcr_4.4.0.1.bb | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
meta/recipes-gnome/gcr/gcr_4.4.0.1.bb +6 -7
index fa769759c14..493c8c2a0d0 100644
@@ -18,18 +18,17 @@ UPSTREAM_CHECK_REGEX = "gcr-(?P<pver>\d+\.\d+\.(?!9\d+)\d+(\.\d+)?)"
 
 SRC_URI[archive.sha256sum] = "0c3c341e49f9f4f2532a4884509804190a0c2663e6120360bb298c5d174a8098"
 
-PACKAGECONFIG ??= " \
-	${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
-	${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'vapi', '', d)} \
-"
-PACKAGECONFIG[ssh_agent] = "-Dssh_agent=true,-Dssh_agent=false,libsecret,openssh"
-#'Use systemd socket activation for server programs'
+PACKAGECONFIG ??= "${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'vapi', '', d)}"
+PACKAGECONFIG[ssh_agent] = "-Dssh_agent=true,-Dssh_agent=false,libsecret"
+# Socket activation for the ssh-agent
 PACKAGECONFIG[systemd] = "-Dsystemd=enabled,-Dsystemd=disabled,systemd"
 PACKAGECONFIG[vapi] = "-Dvapi=true,-Dvapi=false,"
 # A tool to view certificates
 PACKAGECONFIG[viewer] = "-Dgtk4=true,-Dgtk4=false,gtk4"
 
-FILES:${PN} += "${systemd_user_unitdir}/gcr-ssh-agent.*"
+PACKAGE_BEFORE_PN += "${PN}-ssh-agent"
+FILES:${PN}-ssh-agent = "${libexecdir}/gcr-ssh-agent ${systemd_user_unitdir}/gcr-ssh-agent.*"
+RDEPENDS:${PN}-ssh-agent += "openssh"
 
 # http://errors.yoctoproject.org/Errors/Details/20229/
 ARM_INSTRUCTION_SET:armv4 = "arm"
Signature · 1 line
2.43.0