File xdg-desktop-portal.spec of Package xdg-desktop-portal

#
# spec file for package xdg-desktop-portal
#
# Copyright (c) 2025 Andreas Vögele <andreas@andreasvoegele.com>
# Copyright (c) 2025 Fedora Project
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please send bugfixes or comments to the author.
#


%bcond docs 0

%global flatpak_version 1.5.0
%global geoclue_version 2.5.2
%global glib_version 2.72
%global low_memory_monitor_version 2.0
%global pipewire_version 0.2.90

%if 0%{?suse_version} > 0
%global _pkgdocdir %{_defaultdocdir}/%{name}
%endif

Name:    xdg-desktop-portal
Version: 1.20.3
Release: 0
Summary: Portal frontend service to flatpak

# doc/website is CC0-1.0 but it is not included in rpm
License: LGPL-2.1-or-later
URL:     https://github.com/flatpak/xdg-desktop-portal/
Source0: https://github.com/flatpak/xdg-desktop-portal/releases/download/%{version}/%{name}-%{version}.tar.xz
Patch0:  src-Allow-screen-recording.patch

BuildRequires: gcc
BuildRequires: gettext
BuildRequires: meson
BuildRequires: systemd-rpm-macros
BuildRequires: pkgconfig(flatpak) >= %{flatpak_version}
BuildRequires: pkgconfig(fuse3)
BuildRequires: pkgconfig(gdk-pixbuf-2.0)
BuildRequires: pkgconfig(gio-unix-2.0) >= %{glib_version}
BuildRequires: pkgconfig(gstreamer-pbutils-1.0)
BuildRequires: pkgconfig(json-glib-1.0)
BuildRequires: pkgconfig(libgeoclue-2.0) >= %{geoclue_version}
BuildRequires: pkgconfig(libpipewire-0.3) >= %{pipewire_version}
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(umockdev-1.0)
BuildRequires: python3-dbusmock
%if 0%{?suse_version} > 0
BuildRequires: python3-gobject
%else
BuildRequires: python3-gobject-base
%endif
BuildRequires: python3-pytest
%if %{undefined rhel}
BuildRequires: python3-pytest-xdist
%endif
%if %{with docs}
BuildRequires: python3-furo
BuildRequires: python3-sphinx-copybutton
BuildRequires: python3-sphinxext-opengraph
BuildRequires: /usr/bin/sphinx-build
%endif
%if 0%{?suse_version} > 0
BuildRequires: gstreamer
BuildRequires: gstreamer-plugins-good
%else
BuildRequires: gstreamer1
BuildRequires: gstreamer1-plugins-good
%endif
# for man-pages
BuildRequires: python3-docutils

%if 0%{?suse_version} > 0
Recommends:    pipewire >= %{pipewire_version}
%else
Requires:      dbus
Requires:      geoclue2 >= %{geoclue_version}
Requires:      glib2%{?_isa} >= %{glib_version}
Recommends:    pipewire >= %{pipewire_version}
Requires:      pipewire-libs%{?_isa} >= %{pipewire_version}
%endif
# Required for the document portal.
Requires:      fuse3
# Required for the GMemoryMonitor GIO API
Recommends:    low-memory-monitor >= %{low_memory_monitor_version}

%if 0%{?suse_version} > 0
Conflicts: xdg-desktop-portal-lang
%endif

# https://github.com/containers/composefs/pull/229#issuecomment-1838735764
%if 0%{?rhel} >= 10
ExcludeArch:    %{ix86}
%endif

%description
xdg-desktop-portal works by exposing a series of D-Bus interfaces known as
portals under a well-known name (org.freedesktop.portal.Desktop) and object
path (/org/freedesktop/portal/desktop). The portal interfaces include APIs for
file access, opening URIs, printing and others.

%package  devel
Summary:  Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
The pkg-config file for %{name}.


%prep
%autosetup -p1


%build
%meson %{!?with_docs:-Ddocumentation=disabled}
%meson_build


%install
%meson_install
install -dm 755 %{buildroot}/%{_pkgdocdir}
install -pm 644 README.md %{buildroot}/%{_pkgdocdir}
# This directory is used by implementations such as xdg-desktop-portal-gtk.
install -dm 755 %{buildroot}/%{_datadir}/xdg-desktop-portal/portals

%find_lang %{name}


%check


%post
%systemd_user_post xdg-desktop-portal.service
%systemd_user_post xdg-document-portal.service
%systemd_user_post xdg-permission-store.service


%preun
%systemd_user_preun xdg-desktop-portal.service
%systemd_user_preun xdg-document-portal.service
%systemd_user_preun xdg-permission-store.service


%files -f %{name}.lang
%doc %{_pkgdocdir}
%license COPYING
%{_datadir}/dbus-1/interfaces/org.freedesktop.host.portal.Registry.xml
%{_datadir}/dbus-1/interfaces/org.freedesktop.portal.*.xml
%{_datadir}/dbus-1/interfaces/org.freedesktop.impl.portal.*.xml
%{_datadir}/dbus-1/services/org.freedesktop.portal.Desktop.service
%{_datadir}/dbus-1/services/org.freedesktop.portal.Documents.service
%{_datadir}/dbus-1/services/org.freedesktop.impl.portal.PermissionStore.service
%dir %{_datadir}/xdg-desktop-portal/
%dir %{_datadir}/xdg-desktop-portal/portals
%{_libexecdir}/xdg-desktop-portal
%{_libexecdir}/xdg-desktop-portal-rewrite-launchers
%{_libexecdir}/xdg-desktop-portal-validate-icon
%{_libexecdir}/xdg-desktop-portal-validate-sound
%{_libexecdir}/xdg-document-portal
%{_libexecdir}/xdg-permission-store
%{_mandir}/man5/portals.conf.5*
%{_userunitdir}/xdg-desktop-portal.service
%{_userunitdir}/xdg-desktop-portal-rewrite-launchers.service
%{_userunitdir}/xdg-document-portal.service
%{_userunitdir}/xdg-permission-store.service

%files devel
%{_datadir}/pkgconfig/xdg-desktop-portal.pc


%changelog
openSUSE Build Service is sponsored by