Files
desktop/sddm/sddm.spec
2026-02-14 15:14:29 +08:00

265 lines
10 KiB
RPMSpec

# SPDX-FileCopyrightText: (C) 2025 Institute of Software, Chinese Academy of Sciences (ISCAS)
# SPDX-FileCopyrightText: (C) 2025 openRuyi Project Contributors
# SPDX-FileContributor: jingyupu <pujingyu@iscas.ac.cn>
#
# SPDX-License-Identifier: MulanPSL-2.0
# Build only against Qt 6; Qt 5 support is dropped.
%global qt6 1
%global qtver 6
%global _pam_vendordir %{_sysconfdir}/pam.d
# The .spec file name has to match the first Name:
Name: sddm
Version: 0.21.0
Release: %autorelease
Summary: QML-based display manager (Qt%{qtver})
License: GPL-2.0-or-later
Group: System/GUI/KDE
URL: https://github.com/sddm/sddm
#!RemoteAsset
Source: https://github.com/sddm/sddm/archive/v%{version}/sddm-%{version}.tar.gz
Source1: X11-displaymanagers-sddm
# Distro configs
Source10: 00-general.conf
Source11: 10-theme.conf
# Use kwin_wayland for DisplayServer=wayland.
# Adapted from git:https://invent.kde.org/plasma/plasma-workspace/-/blob/Plasma/5.27/sddm-wayland-session/plasma-wayland.conf
Source12: 11-kwin_wayland.conf
# PAM configuration
Source20: sddm.pam
Source21: sddm-autologin.pam
Source22: sddm-greeter.pam
# Patch0-100: PATCH-FIX-UPSTREAM
Patch0: 0001-CMake-Raise-required-version-to-3.5.patch
# https://github.com/sddm/sddm/pull/1779
Patch50: 0001-Redesign-login-shell-use-in-session-scripts.patch
# Part of https://github.com/sddm/sddm/pull/1896
Patch51: 0001-Fix-terminal-clearing.patch
# https://github.com/sddm/sddm/pull/1904
Patch52: 0001-Use-xrdb-to-set-Xcursor.theme.patch
# https://github.com/sddm/sddm/pull/1969
Patch53: 0001-Remove-unused-Display-m_relogin-variable.patch
Patch54: 0002-Set-Display-m_started-early.patch
Patch55: 0003-Load-autologin-configuration-in-Display-Display.patch
Patch56: 0004-Reset-daemonApp-first-in-the-Display-constructor.patch
Patch57: 0005-If-autologin-is-used-avoid-starting-a-display-server.patch
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: pam-devel
BuildRequires: pkgconfig
# Autodetect UID_MIN and UID_MAX from /etc/login.defs
BuildRequires: shadow
BuildRequires: python3-docutils
BuildRequires: cmake(Qt6Core)
BuildRequires: cmake(Qt6DBus)
BuildRequires: cmake(Qt6Gui)
BuildRequires: cmake(Qt6LinguistTools)
BuildRequires: cmake(Qt6Network)
BuildRequires: cmake(Qt6Quick)
BuildRequires: cmake(Qt6QuickTest)
BuildRequires: cmake(Qt6Test)
BuildRequires: qt6-linguist
BuildRequires: systemd-rpm-macros
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(xcb-xkb)
%systemd_requires
BuildRequires: update-alternatives
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
Requires: sddm-greeter-qt%{qtver} = %{version}
Provides: sddm = %{version}
Provides: user(sddm)
Provides: group(sddm)
Conflicts: sddm
%description
SDDM is a display manager for X11 and Wayland. It uses technologies like
QtQuick, which gives the designer the ability to create animated user
interfaces.
%package -n sddm-greeter-qt%{qtver}
Summary: SDDM Greeter for Qt%{qtver} themes
Requires: sddm = %{version}
%description -n sddm-greeter-qt%{qtver}
This package provides the SDDM frontend for themes using Qt %qtver.
%package branding-openruyi
Summary: openruyi branding for SDDM (Qt%{qtver})
BuildArch: noarch
Requires: %{name} = %{version}
Requires: sddm-theme-openruyi
# See 11-kwin_wayland.conf
Conflicts: %{name}-branding
Provides: %{name}-branding = %{version}
%description branding-openruyi
This package provides the openruyi branding for SDDM.
%prep
%autosetup -p1 -n sddm-%{version}
%build
LOGIN_DEFS_PATH="%{_sysconfdir}/login.defs"
[ -e "$LOGIN_DEFS_PATH" ] || LOGIN_DEFS_PATH="%{_distconfdir}/login.defs"
# SDDM_INITIAL_VT does not work for X: https://github.com/sddm/sddm/issues/1650
%cmake \
-DBUILD_WITH_QT6:BOOL=%{qt6} \
-DCMAKE_INSTALL_LIBEXECDIR="%{_libexecdir}/sddm" \
-DSESSION_COMMAND="%{_sysconfdir}/sddm/scripts/Xsession" \
-DBUILD_MAN_PAGES=ON \
-DSTATE_DIR="%{_localstatedir}/lib/sddm" \
-DDBUS_CONFIG_DIR=%{_datadir}/dbus-1/system.d \
-DRUNTIME_DIR="/run/sddm" \
-DPID_FILE="/run/sddm.pid" \
-DLOGIN_DEFS_PATH:path="${LOGIN_DEFS_PATH}" \
-DINSTALL_PAM_CONFIGURATION:BOOL=OFF \
%cmake_build
%install
%cmake_install
pushd %{buildroot}%{_datadir}/dbus-1/system.d
mv org.freedesktop.DisplayManager.conf sddm_org.freedesktop.DisplayManager.conf
popd
install -Dm 0644 %{SOURCE1} %{buildroot}%{_prefix}/lib/X11/displaymanagers/sddm
install -Dm 0644 %{SOURCE10} %{buildroot}%{_prefix}/lib/sddm/sddm.conf.d/00-general.conf
# Adjust paths to X session scripts in 00-general.conf
install -Dm 0644 %{SOURCE11} %{buildroot}%{_prefix}/lib/sddm/sddm.conf.d/10-theme.conf
install -Dm 0644 %{SOURCE12} %{buildroot}%{_prefix}/lib/sddm/sddm.conf.d/11-kwin_wayland.conf
# Install PAM config
pam_dest="%{?_pam_vendordir}%{!?_pam_vendordir:%{_sysconfdir}/pam.d}"
install -Dm 0644 %{SOURCE20} %{buildroot}${pam_dest}/sddm
install -Dm 0644 %{SOURCE21} %{buildroot}${pam_dest}/sddm-autologin
install -Dm 0644 %{SOURCE22} %{buildroot}${pam_dest}/sddm-greeter
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/default-displaymanager
ln -s %{_sysconfdir}/alternatives/default-displaymanager %{buildroot}%{_prefix}/lib/X11/displaymanagers/default-displaymanager
install -d %{buildroot}%{_rundir}/sddm
install -d %{buildroot}%{_localstatedir}/lib/sddm
install -d %{buildroot}%{_sysconfdir}/sddm.conf.d
install -d %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcsddm
# Drop sysusers snippet; we create user/group manually in %pre
rm -f %{buildroot}%{_sysusersdir}/sddm.conf
%fdupes %{buildroot}%{_datadir}/sddm
%check
%ctest
%pre
# Create sddm group/user without relying on sysuser2shadow
if ! getent group sddm >/dev/null; then
groupadd -r sddm
fi
if ! getent passwd sddm >/dev/null; then
useradd -r -g sddm -d %{_localstatedir}/lib/sddm -s /sbin/nologin -c "Simple Desktop Display Manager" sddm
fi
%{?service_add_pre:%service_add_pre sddm.service}
%{?!service_add_pre:%{?systemd_pre:%systemd_pre sddm.service}}
# Prepare for migration to /usr/etc; save any old .rpmsave
for i in pam.d/sddm pam.d/sddm-autologin pam.d/sddm-greeter ; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||:
done
# Previous versions owned /etc/sddm.conf, on upgrade it will be moved to .rpmsave if it was changed
# on disk. To keep the user configuration intact, it has to be moved back in posttrans.
# This also works for switching between sddm variants in one transaction.
# However, if both /etc/sddm.conf and /etc/sddm.conf.rpmsave exist already, there are special cases:
# 1. /etc/sddm.conf was not changed on disk. It will be deleted instead of renamed to .rpmsave.
# The posttrans script would rename the *old* .rpmsave file, restoring some ancient config.
# 2. /etc/sddm.conf was changed. The old .rpmsave file will be overwritten.
# Avoid this by moving any preexisting .rpmsave to .rpmsave.old. There is no rename back though,
# to prevent that every upgrade of the package renames it back and forth...
if [ -f %{_sysconfdir}/sddm.conf.rpmsave ]; then
mv -v %{_sysconfdir}/sddm.conf.rpmsave %{_sysconfdir}/sddm.conf.rpmsave.old
fi
%post
%{?service_add_post:%service_add_post sddm.service}
%{?!service_add_post:%{?systemd_post:%systemd_post sddm.service}}
%{_bindir}/systemd-tmpfiles --create %{_tmpfilesdir}/sddm.conf
%{_sbindir}/update-alternatives --install %{_prefix}/lib/X11/displaymanagers/default-displaymanager \
default-displaymanager %{_prefix}/lib/X11/displaymanagers/sddm 25
%posttrans
# Migration to /usr/lib/pam.d/, restore just created .rpmsave
for i in pam.d/sddm pam.d/sddm-autologin pam.d/sddm-greeter; do
[ -f %{_sysconfdir}/${i}.rpmsave ] && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} || :
done
# See the pre script above
if [ -f %{_sysconfdir}/sddm.conf.rpmsave ] && ! [ -f %{_sysconfdir}/sddm.conf ]; then
mv %{_sysconfdir}/sddm.conf.rpmsave %{_sysconfdir}/sddm.conf
fi
%preun
%{?service_del_preun:%service_del_preun sddm.service}
%{?!service_del_preun:%{?systemd_preun:%systemd_preun sddm.service}}
%postun
# Don't restart on upgrades (boo#1161826)
%{?service_del_postun_without_restart:%service_del_postun_without_restart sddm.service}
%{?!service_del_postun_without_restart:%{?systemd_postun_with_restart:%systemd_postun_with_restart sddm.service}}
[ -f %{_prefix}/lib/X11/displaymanagers/sddm ] || %{_sbindir}/update-alternatives \
--remove default-displaymanager %{_prefix}/lib/X11/displaymanagers/sddm
%files
%license LICENSE*
%doc README*
%dir %{_sysconfdir}/sddm.conf.d/
%{_pam_vendordir}/sddm
%{_pam_vendordir}/sddm-autologin
%{_pam_vendordir}/sddm-greeter
%{_datadir}/dbus-1/system.d/sddm_org.freedesktop.DisplayManager.conf
%dir %{_prefix}/lib/X11/displaymanagers/
%{_prefix}/lib/X11/displaymanagers/sddm
%{_prefix}/lib/X11/displaymanagers/default-displaymanager
%ghost %{_sysconfdir}/alternatives/default-displaymanager
%{_bindir}/sddm
%{_sbindir}/rcsddm
%dir %{_datadir}/sddm/
%dir %{_prefix}/lib/sddm/
%dir %{_prefix}/lib/sddm/sddm.conf.d/
%{_prefix}/lib/sddm/sddm.conf.d/00-general.conf
%dir %{_libexecdir}/sddm
%{_libexecdir}/sddm/sddm-helper
%{_libexecdir}/sddm/sddm-helper-start-wayland
%{_libexecdir}/sddm/sddm-helper-start-x11user
%{_datadir}/sddm/faces/
%{_datadir}/sddm/flags/
%{_datadir}/sddm/scripts/
%{_datadir}/sddm/themes/
%ghost %attr(711,root,root) %dir %{_rundir}/sddm
%ghost %attr(750,sddm,sddm) %dir %{_localstatedir}/lib/sddm
%{_mandir}/man*/sddm*%{ext_man}
%{_unitdir}/sddm.service
%{_tmpfilesdir}/sddm.conf
%files -n sddm-greeter-qt%{qtver}
%{_bindir}/sddm-greeter-qt%{qtver}
%{_libdir}/qt%{qtver}/qml/
%{_datadir}/sddm/translations-qt%{qtver}/
# The Plasma 6 branding is supplied by plasma6-workspace
%files branding-openruyi
%license LICENSE*
%doc README*
%{_prefix}/lib/sddm/sddm.conf.d/10-theme.conf
%{_prefix}/lib/sddm/sddm.conf.d/11-kwin_wayland.conf
%changelog