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

#
# spec file for package xdg-desktop-portal-phosh
#
# Copyright (c) 2025 SUSE LLC
#
# 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 submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           xdg-desktop-portal-phosh
Version:        0.49.0
Release:        0
Summary:        A backend implementation for xdg-desktop-portal
# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses
License:        LGPL-2.1-or-later
URL:            https://gitlab.gnome.org/guidog/xdg-desktop-portal-phosh
Source0:        %{name}-%{version}.tar.zst
Source1:        pfs-0.0.4.tar.zst
Source2:        vendor-pfs.tar.gz
Source3:        vendor-xdg-desktop-portal-phosh.tar.gz
Patch0:         0001-avoid-git-in-cargo.patch 
BuildRequires:  c_compiler
BuildRequires:  fontconfig
BuildRequires:  meson
BuildRequires:  pkgconfig
BuildRequires:  xdg-desktop-portal-gtk
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(gio-unix-2.0)
BuildRequires:  pkgconfig(glib-2.0) >= 2.44
BuildRequires:  pkgconfig(gnome-desktop-4)
BuildRequires:  pkgconfig(gsettings-desktop-schemas) >= 47.alpha
BuildRequires:  pkgconfig(gtk4) >= 4.0
BuildRequires:  pkgconfig(libadwaita-1)
BuildRequires:  pkgconfig(systemd)
BuildRequires:  pkgconfig(xdg-desktop-portal) >= 1.19.1
BuildRequires:  desktop-file-utils
BuildRequires:  cmake
BuildRequires:  rust
BuildRequires:  cargo
Requires:       xdg-desktop-portal

%description
A backend implementation for xdg-desktop-portal for the PHOSH
desktop environment.

%prep
%setup -q -a 0 -n %{name}-%{version}
%patch -P 0 -p1
cd subprojects
tar --use-compress-program=unzstd -xvf %{SOURCE1}
mv $(basename -s .tar.zst %{SOURCE1}) pfs
mkdir -p %{_tmppath}/pfs/
cd %{_tmppath}/pfs/
tar -xzvf %{SOURCE2}
mkdir -p %{_tmppath}/xdg-desktop-portal-phosh/
cd %{_tmppath}/xdg-desktop-portal-phosh/
tar -xzvf %{SOURCE3}

%build
mkdir -p `pwd`/aarch64-suse-linux/subprojects/pfs/cargo-home
cat >`pwd`/aarch64-suse-linux/subprojects/pfs/cargo-home/config.toml <<EOF
[source.crates-io]
replace-with = 'vendored-sources'
[source.vendored-sources]
directory = '%{_tmppath}/pfs/vendor'
EOF
mkdir -p `pwd`/aarch64-suse-linux/cargo
cat >`pwd`/aarch64-suse-linux/cargo/config.toml <<EOF
[source.crates-io]
replace-with = 'vendored-sources'
[source.vendored-sources]
directory = '%{_tmppath}/xdg-desktop-portal-phosh/vendor'
EOF
%meson -Dsystemd_user_unit_dir=%{_userunitdir} \
	%{nil}
%meson_build

%install
%meson_install

%pre -n %{name}
%service_add_pre xdg-desktop-portal-phrosh.service

%post -n %{name}
%service_add_post xdg-desktop-portal-phrosh.service
systemctl --user enable xdg-desktop-portal-phrosh.service

%preun -n %{name}
%service_del_preun xdg-desktop-portal-phrosh.service

%postun -n %{name}
%service_del_postun xdg-desktop-portal-phrosh.service

%files
%{_datadir}/applications/*
%{_datadir}/dbus-1/services/*
%{_datadir}/glib-2.0/schemas/*
%{_datadir}/xdg-desktop-portal/portals/*
%{_libexecdir}/*
%{_userunitdir}/*


%changelog

openSUSE Build Service is sponsored by