public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libportal/, profiles/features/big-endian/
@ 2024-08-06  0:20 Eli Schwartz
  0 siblings, 0 replies; only message in thread
From: Eli Schwartz @ 2024-08-06  0:20 UTC (permalink / raw
  To: gentoo-commits

commit:     7455e8235d08ddf8a5660cb9c3102650e6dbec92
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Thu Jun 20 00:44:43 2024 +0000
Commit:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
CommitDate: Tue Aug  6 00:18:30 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7455e823

dev-libs/libportal: prevent automagically building against gtk[X,wayland]

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 <AT> gmail.com>
Signed-off-by: Eli Schwartz <eschwartz <AT> gentoo.org>

 dev-libs/libportal/libportal-0.7.1-r1.ebuild  | 113 ++++++++++++++++++++++++++
 profiles/features/big-endian/package.use.mask |   1 +
 2 files changed, 114 insertions(+)

diff --git a/dev-libs/libportal/libportal-0.7.1-r1.ebuild b/dev-libs/libportal/libportal-0.7.1-r1.ebuild
new file mode 100644
index 000000000000..ee06945d14a1
--- /dev/null
+++ b/dev-libs/libportal/libportal-0.7.1-r1.ebuild
@@ -0,0 +1,113 @@
+# Copyright 2022-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+inherit flag-o-matic meson python-any-r1 vala virtualx
+
+DESCRIPTION="Flatpak portal library"
+HOMEPAGE="https://github.com/flatpak/libportal"
+SRC_URI="https://github.com/flatpak/libportal/releases/download/${PV}/${P}.tar.xz"
+
+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 wayland X"
+RESTRICT="!test? ( test )"
+REQUIRED_USE="
+	gtk-doc? ( introspection )
+	vala? ( introspection )
+"
+
+RDEPEND="
+	>=dev-libs/glib-2.58:2
+	introspection? ( dev-libs/gobject-introspection:= )
+	gtk? (
+		>=x11-libs/gtk+-3.24.41-r1:3[X?,wayland?]
+		>=gui-libs/gtk-4.12.5-r2:4[X?,wayland?]
+	)
+	qt5? (
+		dev-qt/qtcore:=
+		dev-qt/qtgui:=
+		dev-qt/qtx11extras:=
+		dev-qt/qtwidgets:=
+	)
+"
+DEPEND="${RDEPEND}
+	qt5? (
+		test? ( dev-qt/qttest:= )
+	)
+"
+BDEPEND="
+	dev-util/glib-utils
+	virtual/pkgconfig
+	gtk-doc? ( dev-util/gi-docgen )
+	qt5? (
+		test? ( dev-qt/linguist-tools )
+	)
+	test? (
+		${PYTHON_DEPS}
+		$(python_gen_any_dep '
+			dev-python/pytest[${PYTHON_USEDEP}]
+			dev-python/dbus-python[${PYTHON_USEDEP}]
+			dev-python/python-dbusmock[${PYTHON_USEDEP}]
+		')
+	)
+	vala? ( $(vala_depend) )
+"
+
+python_check_deps() {
+	python_has_version \
+		"dev-python/pytest[${PYTHON_USEDEP}]" \
+		"dev-python/dbus-python[${PYTHON_USEDEP}]" \
+		"dev-python/python-dbusmock[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+	if use test; then
+		python-any-r1_pkg_setup
+	fi
+}
+
+src_prepare() {
+	default
+	vala_setup
+}
+
+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)
+		$(meson_feature qt5 backend-qt5)
+		-Dportal-tests=false
+		$(meson_use introspection)
+		$(meson_use vala vapi)
+		$(meson_use gtk-doc docs)
+		$(meson_use test tests)
+	)
+	meson_src_configure
+}
+
+src_test() {
+	# Tests only exist for Qt5
+	if use qt5; then
+		virtx meson_src_test
+	else
+		# run meson_src_test to notice if tests are added
+		meson_src_test
+	fi
+}
+
+src_install() {
+	meson_src_install
+
+	if use gtk-doc; then
+		mkdir -p "${ED}"/usr/share/gtk-doc/html/ || die
+		mv "${ED}"/usr/share/doc/${PN}-1 "${ED}"/usr/share/gtk-doc/html/ || die
+	fi
+}

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)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-08-06  0:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-06  0:20 [gentoo-commits] repo/gentoo:master commit in: dev-libs/libportal/, profiles/features/big-endian/ Eli Schwartz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox