File cosmic-greeter.spec of Package cosmic-greeter

#
# spec file for package cosmic-greeter
#
# 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/
#


%define         appname com.system76.CosmicGreeter
%if 0%{?suse_version} >= 1550
  %define _pam_confdir %{_pam_vendordir}
%else
  %define _pam_confdir %{_sysconfdir}/pam.d
%endif
Name:           cosmic-greeter
Version:        1.0.0~beta3+0
Release:        0
Summary:        COSMIC greeter for greetd
License:        GPL-3.0-only
URL:            https://github.com/pop-os/cosmic-greeter
Source0:        %{name}-%{version}.tar.zst
Source1:        vendor.tar.zst
Source2:        %{name}.service
Source3:        %{name}-daemon.service
Patch0:         fix-dbus-conf.patch
Patch1:         switch-to-greetd-user.patch
BuildRequires:  cargo-packaging
BuildRequires:  clang-devel
BuildRequires:  git-core
BuildRequires:  greetd
BuildRequires:  just
BuildRequires:  llvm-devel
BuildRequires:  pkgconfig
BuildRequires:  rust >= 1.80
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(libinput)
BuildRequires:  pkgconfig(libudev)
%if 0%{?suse_version} < 1600
BuildRequires:  pam-devel
%else
BuildRequires:  pkgconfig(pam)
%endif
BuildRequires:  pkgconfig(systemd)
BuildRequires:  pkgconfig(wayland-client)
BuildRequires:  pkgconfig(xkbcommon)
Recommends:     fprintd-pam
Recommends:     xinit
Requires:       bash
Requires:       cosmic-comp
Requires:       greetd >= 0.10
Requires:       mozilla-fira-fonts
%systemd_requires

%description
libcosmic greeter for greetd, which can be run inside cosmic-comp

%prep
%autosetup -p1 -a1

%build
just build-release

%install
just rootdir=%{buildroot} prefix=%{_prefix} install
install -d %{buildroot}%{_sharedstatedir}/%{name}
install -D -m 0644 %{name}.toml %{buildroot}%{_sysconfdir}/greetd/%{name}.toml
chmod 0644 %{buildroot}%{_datadir}/dbus-1/system.d/%{appname}.conf
chmod -x %{buildroot}%{_datadir}/dbus-1/system.d/%{appname}.conf
install -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}-daemon.service
rm -f %{buildroot}%{_sysusersdir}/%{name}.conf

# workaround for getting the right pam permissions
install -d %{buildroot}%{_pam_confdir}
ln -s %{_pam_confdir}/greetd %{buildroot}%{_pam_confdir}/%{name}

%pre
%service_add_pre %{name}.service %{name}-daemon.service

%post
%service_add_post %{name}.service %{name}-daemon.service
%tmpfiles_create %{_prefix}/lib/tmpfiles.d/%{name}.conf

%preun
%service_del_preun %{name}.service %{name}-daemon.service

%postun
%service_del_postun %{name}.service %{name}-daemon.service

%check
%{cargo_test}

%files
%license LICENSE
%doc README.md
%{_bindir}/%{name}
%{_bindir}/%{name}-daemon
%{_bindir}/%{name}-start
%config(noreplace) %{_sysconfdir}/greetd/%{name}.toml
%{_prefix}/lib/tmpfiles.d/%{name}.conf
%{_datadir}/dbus-1/system.d/%{appname}.conf
%{_sharedstatedir}/%{name}
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}-daemon.service
%{_pam_confdir}/%{name}

%changelog
openSUSE Build Service is sponsored by