From b17fcfae7a5b01d42d887380cb74386c00a6e6bd Mon Sep 17 00:00:00 2001 From: Sam James Date: Fri, 22 Sep 2023 17:53:37 +0100 Subject: [PATCH] sys-apps/xdg-desktop-portal: various fixes * Fix missing flatpak, bubblewrap dependencies. 1.18.0 makes these mandatory by way of dropping autotools support. Previous versions always required this in their meson build system, but we didn't use meson before. Include a variant of https://github.com/flatpak/xdg-desktop-portal/pull/1100 on top to make flatpak optional as well as bubblewrap (we need the latter optional because not all of our platforms support seccomp). * Fix dependency sorting. Only GNOME uses the 'in order of build system' rule, others usually do alphabetical. * Always install man pages per QA policy. Bug: https://bugs.gentoo.org/914510 Fixes: de9365facce0ed2d37216f8cd73c64d7ef2b2a64 Signed-off-by: Sam James --- profiles/arch/powerpc/ppc32/package.use.mask | 4 ++ ...w-linux-to-build-without-flatpak-ins.patch | 37 ++++++++++++ ...ow-linux-to-build-without-bubblewrap.patch | 33 +++++++++++ .../0003-Make-flatpak-bwrap-optional.patch | 57 +++++++++++++++++++ sys-apps/xdg-desktop-portal/metadata.xml | 4 ++ ...ld => xdg-desktop-portal-1.18.0-r1.ebuild} | 33 +++++++---- 6 files changed, 157 insertions(+), 11 deletions(-) create mode 100644 sys-apps/xdg-desktop-portal/files/0001-meson.build-allow-linux-to-build-without-flatpak-ins.patch create mode 100644 sys-apps/xdg-desktop-portal/files/0002-meson.build-allow-linux-to-build-without-bubblewrap.patch create mode 100644 sys-apps/xdg-desktop-portal/files/0003-Make-flatpak-bwrap-optional.patch rename sys-apps/xdg-desktop-portal/{xdg-desktop-portal-1.18.0.ebuild => xdg-desktop-portal-1.18.0-r1.ebuild} (77%) diff --git a/profiles/arch/powerpc/ppc32/package.use.mask b/profiles/arch/powerpc/ppc32/package.use.mask index 8ab7c49f60d6a..c238f69444278 100644 --- a/profiles/arch/powerpc/ppc32/package.use.mask +++ b/profiles/arch/powerpc/ppc32/package.use.mask @@ -1,6 +1,10 @@ # Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +# Sam James (2023-09-22) +# sys-apps/flatpak is not keyworded here +sys-apps/xdg-desktop-portal flatpak + # Matt Turner (2023-05-30) # sys-apps/dbus-broker is not keyworded app-accessibility/at-spi2-core dbus-broker diff --git a/sys-apps/xdg-desktop-portal/files/0001-meson.build-allow-linux-to-build-without-flatpak-ins.patch b/sys-apps/xdg-desktop-portal/files/0001-meson.build-allow-linux-to-build-without-flatpak-ins.patch new file mode 100644 index 0000000000000..9f758f7b5432d --- /dev/null +++ b/sys-apps/xdg-desktop-portal/files/0001-meson.build-allow-linux-to-build-without-flatpak-ins.patch @@ -0,0 +1,37 @@ +https://github.com/flatpak/xdg-desktop-portal/pull/1100 + +From b734c44545276141b785dd31ff9c0c78a7801baa Mon Sep 17 00:00:00 2001 +From: "Anna (navi) Figueiredo Gomes" +Date: Fri, 8 Sep 2023 22:07:06 +0200 +Subject: [PATCH 1/3] meson.build: allow linux to build without flatpak + installed + +the old automake scripts would allow for building without flatpak, as the +xml file would just not be copied (because it doesn't exist) so it +wouldn't be used to generate files. + +this allows similar behaviour by not requiring the flatpak dependency in +meson. + +Signed-off-by: Anna (navi) Figueiredo Gomes +--- + meson.build | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index 2254c0d..2366d9e 100644 +--- a/meson.build ++++ b/meson.build +@@ -21,8 +21,7 @@ endif + + flatpak_intf_dir = get_option('flatpak-interfaces-dir') + if flatpak_intf_dir == '' +- flatpak_required = host_machine.system() in ['linux'] +- flatpak_dep = dependency('flatpak', version: '>= 1.5.0', required : flatpak_required) ++ flatpak_dep = dependency('flatpak', version: '>= 1.5.0', required : false) + if flatpak_dep.found() + flatpak_intf_dir = flatpak_dep.get_variable(pkgconfig: 'interfaces_dir') + endif +-- +2.42.0 + diff --git a/sys-apps/xdg-desktop-portal/files/0002-meson.build-allow-linux-to-build-without-bubblewrap.patch b/sys-apps/xdg-desktop-portal/files/0002-meson.build-allow-linux-to-build-without-bubblewrap.patch new file mode 100644 index 0000000000000..ce10d326828f0 --- /dev/null +++ b/sys-apps/xdg-desktop-portal/files/0002-meson.build-allow-linux-to-build-without-bubblewrap.patch @@ -0,0 +1,33 @@ +https://github.com/flatpak/xdg-desktop-portal/pull/1100 + +From 8cf28b590ab23e94d6b80eaa6893ed51542d3dd8 Mon Sep 17 00:00:00 2001 +From: "Anna (navi) Figueiredo Gomes" +Date: Sat, 9 Sep 2023 01:20:36 +0200 +Subject: [PATCH 2/3] meson.build: allow linux to build without bubblewrap + +per the same logic as flatpak, there's no reason to force bwrap as a +dependency to build xdp under linux, as there is systems without bwrap +that would want to be able to build xdp + +Signed-off-by: Anna (navi) Figueiredo Gomes +--- + meson.build | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index 2366d9e..ad7faae 100644 +--- a/meson.build ++++ b/meson.build +@@ -112,8 +112,7 @@ libportal_dep = dependency('libportal', + pipewire_dep = dependency('libpipewire-0.3', version: '>= 0.2.90') + libsystemd_dep = dependency('libsystemd', required: get_option('systemd')) + +-bwrap_required = host_machine.system() in ['linux'] +-bwrap = find_program('bwrap', required: bwrap_required) ++bwrap = find_program('bwrap', required: false) + + have_libportal = libportal_dep.found() + if have_libportal +-- +2.42.0 + diff --git a/sys-apps/xdg-desktop-portal/files/0003-Make-flatpak-bwrap-optional.patch b/sys-apps/xdg-desktop-portal/files/0003-Make-flatpak-bwrap-optional.patch new file mode 100644 index 0000000000000..78b0b3e522a2b --- /dev/null +++ b/sys-apps/xdg-desktop-portal/files/0003-Make-flatpak-bwrap-optional.patch @@ -0,0 +1,57 @@ +From 5b4ad3e7a9828df2cd06d663d89800c346f5051f Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Fri, 22 Sep 2023 17:35:21 +0100 +Subject: [PATCH] Make flatpak, bwrap optional + +See https://github.com/flatpak/xdg-desktop-portal/pull/1100 + +Signed-off-by: Sam James +--- + meson.build | 4 ++-- + meson_options.txt | 8 ++++++++ + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index ad7faae..933eb54 100644 +--- a/meson.build ++++ b/meson.build +@@ -21,7 +21,7 @@ endif + + flatpak_intf_dir = get_option('flatpak-interfaces-dir') + if flatpak_intf_dir == '' +- flatpak_dep = dependency('flatpak', version: '>= 1.5.0', required : false) ++ flatpak_dep = dependency('flatpak', version: '>= 1.5.0', required : get_option('flatpak')) + if flatpak_dep.found() + flatpak_intf_dir = flatpak_dep.get_variable(pkgconfig: 'interfaces_dir') + endif +@@ -112,7 +112,7 @@ libportal_dep = dependency('libportal', + pipewire_dep = dependency('libpipewire-0.3', version: '>= 0.2.90') + libsystemd_dep = dependency('libsystemd', required: get_option('systemd')) + +-bwrap = find_program('bwrap', required: false) ++bwrap = find_program('bwrap', required: get_option('bwrap')) + + have_libportal = libportal_dep.found() + if have_libportal +diff --git a/meson_options.txt b/meson_options.txt +index edcbcd8..d1914ce 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -2,6 +2,14 @@ option('dbus-service-dir', + type: 'string', + value: '', + description: 'directory for dbus service files (default: PREFIX/share/dbus-1/services)') ++option('bwrap', ++ type: 'feature', ++ value: 'enabled', ++ description: 'Use bwrap (requires seccomp) for sandboxing for e.g. icon validation. Recommended.') ++option('flatpak', ++ type: 'feature', ++ value: 'enabled', ++ description: 'Enable flatpak integration') + option('flatpak-interfaces-dir', + type: 'string', + value: '', +-- +2.42.0 + diff --git a/sys-apps/xdg-desktop-portal/metadata.xml b/sys-apps/xdg-desktop-portal/metadata.xml index 004564dfa9893..0b034d09a0490 100644 --- a/sys-apps/xdg-desktop-portal/metadata.xml +++ b/sys-apps/xdg-desktop-portal/metadata.xml @@ -5,6 +5,10 @@ kde@gentoo.org Gentoo KDE Project + + Enable sys-apps/flatpak integration + Use sys-apps/bubblewrap (which requires seccomp) to sandbox some functionality like icon handling + flatpak/xdg-desktop-portal diff --git a/sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.18.0.ebuild b/sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.18.0-r1.ebuild similarity index 77% rename from sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.18.0.ebuild rename to sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.18.0-r1.ebuild index 0d2ad6cdbcd98..ebec9c9e36e24 100644 --- a/sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.18.0.ebuild +++ b/sys-apps/xdg-desktop-portal/xdg-desktop-portal-1.18.0-r1.ebuild @@ -14,23 +14,24 @@ SRC_URI="https://github.com/flatpak/${PN}/releases/download/${PV}/${P}.tar.xz" LICENSE="LGPL-2.1" SLOT="0" KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86" -IUSE="geolocation man systemd test" +IUSE="geolocation flatpak seccomp systemd test" RESTRICT="!test? ( test )" DEPEND=" >=dev-libs/glib-2.66:2 dev-libs/json-glib + dev-python/docutils + >=media-video/pipewire-0.3:= >=sys-fs/fuse-3.10.0:3[suid] x11-libs/gdk-pixbuf geolocation? ( >=app-misc/geoclue-2.5.3:2.0 ) - >=media-video/pipewire-0.3:= + flatpak? ( sys-apps/flatpak ) + seccomp? ( sys-apps/bubblewrap ) systemd? ( sys-apps/systemd ) - test? ( - dev-libs/libportal - ) - man? ( dev-python/docutils ) + test? ( dev-libs/libportal ) " -RDEPEND="${DEPEND} +RDEPEND=" + ${DEPEND} sys-apps/dbus " BDEPEND=" @@ -49,10 +50,15 @@ BDEPEND=" PATCHES=( # These tests require connections to pipewire, internet, /dev/fuse "${FILESDIR}/${P}-sandbox-disable-failing-tests.patch" + + # https://github.com/flatpak/xdg-desktop-portal/pull/1100 + "${FILESDIR}/0001-meson.build-allow-linux-to-build-without-flatpak-ins.patch" + "${FILESDIR}/0002-meson.build-allow-linux-to-build-without-bubblewrap.patch" + "${FILESDIR}/0003-Make-flatpak-bwrap-optional.patch" ) pkg_setup() { - use test && python_setup + use test && python-any-r1_pkg_setup } python_check_deps() { @@ -65,16 +71,21 @@ src_configure() { -Ddbus-service-dir="${EPREFIX}/usr/share/dbus-1/services" -Dflatpak-interfaces-dir="${EPREFIX}/usr/share/dbus-1/interfaces" -Dsystemd-user-unit-dir="$(systemd_get_userunitdir)" - $(meson_feature test libportal) # Only used for tests + $(meson_feature flatpak) + # Only used for tests + $(meson_feature test libportal) $(meson_feature geolocation geoclue) + $(meson_feature seccomp bwrap) $(meson_feature systemd) - -Ddocbook-docs=disabled # requires flatpak + # Requires flatpak + -Ddocbook-docs=disabled # -Dxmlto-flags= -Ddatarootdir="${EPREFIX}/usr/share" + -Dman-pages=enabled -Dinstalled-tests=false $(meson_feature test pytest) - $(meson_feature man man-pages) ) + meson_src_configure }