public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Eli Schwartz <eschwartz93@gmail.com>
To: gentoo-dev@lists.gentoo.org
Cc: gnome@gentoo.org, xfce@gentoo.org, binhost@gentoo.org
Subject: [gentoo-dev] [PATCH 5/5] dev-libs/libportal: prevent automagically building against gtk[X,wayland]
Date: Sun, 23 Jun 2024 13:35:51 -0400	[thread overview]
Message-ID: <20240623173646.3368935-6-eschwartz93@gmail.com> (raw)
In-Reply-To: <20240623173646.3368935-1-eschwartz93@gmail.com>

e.g. the upstream code checks whether GDK_WINDOWING_WAYLAND is defined
by the gtk headers, and if so will compile against the wayland symbols
it provides. This means that libportal built on a system with
gtk+[-wayland] will be compatible with anything, but when built on a
system with gtk+[wayland], requires that at runtime.

This cannot be expressed with USE flags.

We could bind tightly to whether gtk was built with wayland (and X), and
in the process, arbitrarily restrict libportal[-wayland] to only build
and install on a system with gtk+[-wayland].

But we recently added a hack to gtk itself which allows hiding the
automagic macros entirely. Inject this via append-cflags if the USE
flags aren't set, to simulate building on a system with more minimal gtk
packages.

Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
---
 ...rtal-0.7.1.ebuild => libportal-0.7.1-r1.ebuild} | 14 +++++++++-----
 profiles/features/big-endian/package.use.mask      |  1 +
 2 files changed, 10 insertions(+), 5 deletions(-)
 copy dev-libs/libportal/{libportal-0.7.1.ebuild => libportal-0.7.1-r1.ebuild} (83%)

diff --git a/dev-libs/libportal/libportal-0.7.1.ebuild b/dev-libs/libportal/libportal-0.7.1-r1.ebuild
similarity index 83%
copy from dev-libs/libportal/libportal-0.7.1.ebuild
copy to dev-libs/libportal/libportal-0.7.1-r1.ebuild
index 38a05311150b..af3e04a1f256 100644
--- a/dev-libs/libportal/libportal-0.7.1.ebuild
+++ b/dev-libs/libportal/libportal-0.7.1-r1.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 PYTHON_COMPAT=( python3_{10..12} )
-inherit meson python-any-r1 vala virtualx
+inherit flag-o-matic meson python-any-r1 vala virtualx
 
 DESCRIPTION="Flatpak portal library"
 HOMEPAGE="https://github.com/flatpak/libportal"
@@ -12,8 +12,8 @@ SRC_URI="https://github.com/flatpak/libportal/releases/download/${PV}/${P}.tar.x
 
 LICENSE="LGPL-3"
 SLOT="0/1-1-1-1" # soname of libportal{,-gtk3,-gtk4,-qt5}.so
-KEYWORDS="~alpha amd64 ~arm arm64 ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc x86"
-IUSE="gtk gtk-doc +introspection qt5 test +vala"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
+IUSE="gtk gtk-doc +introspection qt5 test +vala wayland X"
 RESTRICT="!test? ( test )"
 REQUIRED_USE="
 	gtk-doc? ( introspection )
@@ -24,8 +24,8 @@ RDEPEND="
 	>=dev-libs/glib-2.58:2
 	introspection? ( dev-libs/gobject-introspection:= )
 	gtk? (
-		x11-libs/gtk+:3
-		gui-libs/gtk:4
+		x11-libs/gtk+:3[X?,wayland?]
+		gui-libs/gtk:4[X?,wayland?]
 	)
 	qt5? (
 		dev-qt/qtcore:=
@@ -76,6 +76,10 @@ src_prepare() {
 }
 
 src_configure() {
+	# defang automagic dependencies
+	use wayland || append-cflags -DGENTOO_GTK_HIDE_WAYLAND
+	use X || append-cflags -DGENTOO_GTK_HIDE_X11
+
 	local emesonargs=(
 		$(meson_feature gtk backend-gtk3)
 		$(meson_feature gtk backend-gtk4)
diff --git a/profiles/features/big-endian/package.use.mask b/profiles/features/big-endian/package.use.mask
index 71906122232a..bbde951452d2 100644
--- a/profiles/features/big-endian/package.use.mask
+++ b/profiles/features/big-endian/package.use.mask
@@ -45,6 +45,7 @@ gui-libs/gtk wayland
 gnome-base/gnome-control-center wayland
 sys-apps/xdg-desktop-portal-gnome wayland
 net-libs/webkit-gtk:6 wayland
+dev-libs/libportal wayland
 
 # matoro <matoro_gentoo@matoro.tk> (2023-04-10)
 # media-libs/libldac casualties (#80238)
-- 
2.44.2



  parent reply	other threads:[~2024-06-23 17:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-23 17:35 [gentoo-dev] [PATCH 0/5] Fixing automagic dependencies on gtk[wayland,X], Eli Schwartz
2024-06-23 17:35 ` [gentoo-dev] [PATCH 1/5] gui-libs/gtk: add a "poison" macro support to disable X/wayland Eli Schwartz
2024-06-24  9:08   ` Florian Schmaus
2024-06-26  9:03   ` Sam James
2024-06-27  4:52     ` Eli Schwartz
2024-06-27  4:58       ` Sam James
2024-07-03 11:16         ` Mart Raudsepp
2024-07-03 17:26           ` Eli Schwartz
2024-06-23 17:35 ` [gentoo-dev] [PATCH 2/5] net-libs/gtk-vnc: prevent automagically building against gtk[X,wayland] Eli Schwartz
2024-06-23 17:35 ` [gentoo-dev] [PATCH 3/5] x11-libs/wxGTK: " Eli Schwartz
2024-06-23 17:35 ` [gentoo-dev] [PATCH 4/5] xfce-base/libxfce4ui: prevent automagically building against gtk[wayland] Eli Schwartz
2024-06-23 17:35 ` Eli Schwartz [this message]
2024-06-23 18:33 ` [gentoo-dev] [PATCH 0/5] Fixing automagic dependencies on gtk[wayland,X], James Le Cuirot
2024-06-26  9:02 ` Sam James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240623173646.3368935-6-eschwartz93@gmail.com \
    --to=eschwartz93@gmail.com \
    --cc=binhost@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=gnome@gentoo.org \
    --cc=xfce@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox