File sddm.spec of Package sddm

#
# spec file for package sddm
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%{!?_rundir: %global _rundir /run}
%{!?_unitdir: %global _unitdir /usr/lib/systemd/system}

Name:           sddm
Version:        0.14.0
Release:        0
Summary:        QML-based display manager
License:        GPL-2.0+
Group:          System/GUI/KDE
Url:            https://github.com/sddm/sddm
Source:         https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.xz
Source1:        %{name}.conf
Source2:        X11-displaymanagers-%{name}
# PATCH-FIX-UPSTREAM 0001-Revert-Rename-XDisplay-and-WaylandDisplay-config-sec.patch -- Revert to 0.13.0 config syntax
Patch0:         0001-Revert-Rename-XDisplay-and-WaylandDisplay-config-sec.patch
# PATCH-FIX-OPENSUSE proper_pam.diff -- Use openSUSE pam config
Patch1:         proper_pam.diff
# PATCH-FIX-OPENSUSE create_pid_file.patch -- openSUSE's generic display-manager service doesn't know what to do without a pid file. drop the patch as soon as that sick dinosaur is killed
Patch2:         create_pid_file.patch
# PATCH-FIX-OPENSUSE sddm-relaxed-auth.diff -- Insert XAUTHLOCALHOSTNAME into users enviroment, so the session handles hostname changes with a single X instance/run
# related patches: libxcb/bug-262309_xcb-xauthlocalhostname.diff, xauth/xauth-tolerant-hostname-changes.diff, kdebase4-workspace/kdm-relaxed-auth.diff
Patch3:         sddm-relaxed-auth.diff
# PATCH-FIX-OPENSUSE sysconfig-support.patch -- Support DISPLAYMANAGER_AUTOLOGIN entry from /etc/sysconfig/displaymanager, the value overwrites
# any entry in sddm.conf/[Autologin]/User. Patch also defaults to plasma5.desktop as default autologin session. This is controlled only by sddm.conf file.
Patch4:         sysconfig-support.patch
# PATCH-FIX-OPENSUSE sddm-service-handle-plymouth.patch -- sddm has some rudimentary support for plymouth handling, which only works with plymouth-quit.service
# (the servce is not enabled on openSUSE). For users of sddm.service, we need to issue plymouth quit command by hand in this case
Patch5:         sddm-service-handle-plymouth.patch
# PATCH-FIX-UPSTREAM 0001-Make-the-default-cursor-themed.patch -- Make the default cursor themed
Patch7:         0001-Make-the-default-cursor-themed.patch
# PATCH-FIX-OPENSUSE 0001-Systemd-service-unit-Use-tty7-by-default.patch -- Use tty7 by default in the systemd service unit
Patch8:         0001-Systemd-service-unit-Use-tty7-by-default.patch
# PATCH-FIX-UPSTREAM 0001-Also-theme-the-default-cursor-for-the-root-window.patch
Patch9:         0001-Also-theme-the-default-cursor-for-the-root-window.patch
# Bugfixes from upstream develop branch
Patch10:        0001-Fix-display-of-user-avatars.-684.patch
Patch11:        0002-Add-a-config-option-to-enable-high-DPI-scaling-701.patch
Patch12:        0003-elarun-Update-date-and-time.patch
Patch13:        0004-Support-Non-Latin-characters-in-theme-settings-708.patch
Patch14:        0005-Cleanup-dangling-pointer-in-SocketServer-725.patch
Patch15:        0001-Also-set-QT_IM_MODULE-in-non-testing-mode.patch
# PATCH-FIX-UPSTREAM 
Patch16:        0001-Parse-desktop-file-sections.patch
Patch17:        0002-Ignore-session-desktop-files-with-the-Hidden-propert.patch
# PATCH-FIX-OPENSUSE
Patch18:        0003-Leave-duplicate-symlinks-out-of-the-SessionModel.patch
# PATCH-FIX-UPSTREAM
Patch19:        0001-Do-not-truncate-XAUTHORITY-file-on-login.patch
BuildRequires:  cmake
BuildRequires:  extra-cmake-modules >= 1.4.0
BuildRequires:  fdupes
BuildRequires:  kf5-filesystem
BuildRequires:  libqt5-linguist-devel
BuildRequires:  pam-devel
BuildRequires:  pkg-config
%if 0%{?sle_version} && !0%{?is_opensuse}
BuildRequires:  python-docutils
%else
BuildRequires:  python3-docutils
%endif
# Autodetect UID_MIN and UID_MAX from /etc/login.defs
BuildRequires:  shadow
BuildRequires:  pkgconfig(Qt5Core) >= 5.6.0
BuildRequires:  pkgconfig(Qt5DBus)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5Quick)
BuildRequires:  pkgconfig(Qt5Test)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(systemd)
BuildRequires:  pkgconfig(xcb-xkb)
Requires:       sddm-branding = %{version}
# Merged the -lang package back into the main package
Provides:       %{name}-lang = %{version}
Obsoletes:      %{name}-lang < %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
SDDM is a display manager for X11. It uses technologies like QtQuick,
which in turn gives the designer the ability to create animated user
interfaces.

%package branding-openSUSE
Summary:        openSUSE branding for SDDM, a QML-based display manager
Group:          System/GUI/KDE
PreReq:         sddm
Requires:       sddm-theme-openSUSE
Supplements:    packageand(plasma5-workspace:branding-openSUSE)
Provides:       sddm-branding = %{version}
Conflicts:      otherproviders(sddm-branding)

%description branding-openSUSE
SDDM is a display manager for X11. It uses technologies like QtQuick,
which in turn gives the designer the ability to create animated user
interfaces.
This package provides the openSUSE branding for SDDM.

%package branding-upstream
Summary:        Upstream branding for SDDM, a QML-based display manager
Group:          System/GUI/KDE
Supplements:    packageand(plasma5-workspace:branding-upstream)
Provides:       sddm-branding = %{version}
Conflicts:      otherproviders(sddm-branding)

%description branding-upstream
SDDM is a display manager for X11. It uses technologies like QtQuick,
which in turn gives the designer the ability to create animated user
interfaces.
This package provides upstream branding for SDDM.

%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1

%build
%cmake \
      -DCMAKE_BUILD_TYPE=Release \
      -DMINIMUM_VT=7 \
      -DCMAKE_INSTALL_LIBEXECDIR=%{_libexecdir}/%{name} \
      -DIMPORTS_INSTALL_DIR="%{_libdir}/qt5/qml" \
      -DSESSION_COMMAND="/etc/X11/xdm/Xsession" \
      -DBUILD_MAN_PAGES=ON \
      -DSTATE_DIR="/var/lib/sddm" \
      -DRUNTIME_DIR="/run/sddm" \
      -DPID_FILE="/run/sddm.pid"
  %make_jobs

%install
  %kf5_makeinstall -C build

  pushd %{buildroot}%{_sysconfdir}/dbus-1/system.d
  mv org.freedesktop.DisplayManager.conf sddm_org.freedesktop.DisplayManager.conf
  popd

  install -Dm 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}.conf
  install -Dm 0644 %{SOURCE2} %{buildroot}%{_libexecdir}/X11/displaymanagers/%{name}
  install -d %{buildroot}%{_rundir}/sddm
  install -d %{buildroot}%{_localstatedir}/lib/sddm

  %fdupes -s %{buildroot}%{_datadir}/sddm

%pre
/usr/sbin/groupadd -r sddm 2> /dev/null || :
/usr/sbin/useradd -r -g sddm -s /bin/false -c "SDDM daemon" \
    -d /var/lib/sddm sddm 2> /dev/null || :

%post
if [ $1 -eq 2 -a -f /etc/sddm.conf ]; then
    sed -i -e 's/^Current=maui$/Current=/g' /etc/sddm.conf
fi

%post branding-openSUSE
if [ $1 -ge 1 -a -f /etc/sddm.conf ]; then
    # Upgrade from previous theme name
    sed -i -e 's/^Current=breeze$/Current=breeze-openSUSE/g' /etc/sddm.conf
    sed -i -e 's/^Current=maui$/Current=breeze-openSUSE/g' /etc/sddm.conf
fi
sed -i -e 's/^Current=$/Current=breeze-openSUSE/g' /etc/sddm.conf

%postun branding-openSUSE
if [ $1 -eq 0 -a -f /etc/sddm.conf ]; then
   sed -i -e 's/^Current=breeze-openSUSE$/Current=/g' /etc/sddm.conf
fi

%files
%defattr(-,root,root)
%doc LICENSE* README*
%config(noreplace) %{_sysconfdir}/%{name}.conf
%config %{_sysconfdir}/pam.d/sddm
%config %{_sysconfdir}/pam.d/sddm-autologin
%config %{_sysconfdir}/pam.d/sddm-greeter
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/sddm_org.freedesktop.DisplayManager.conf
%{_libexecdir}/sddm/
%dir %{_libexecdir}/X11/displaymanagers/
%{_libexecdir}/X11/displaymanagers/%{name}
%{_bindir}/sddm
%{_bindir}/sddm-greeter
%{_libdir}/qt5/qml/
%dir %{_datadir}/sddm/
%{_datadir}/sddm/faces/
%{_datadir}/sddm/flags/
%{_datadir}/sddm/scripts/
%{_datadir}/sddm/themes/
%{_datadir}/sddm/translations/
%{_mandir}/man*/sddm*.*
%ghost %attr(711,sddm,sddm) %dir %{_rundir}/sddm
%attr(750,sddm,sddm) %dir %{_localstatedir}/lib/sddm
%{_unitdir}/sddm.service

%files branding-openSUSE
%defattr(-,root,root)
%doc LICENSE* README*

%files branding-upstream
%defattr(-,root,root)
%doc LICENSE* README*

%changelog
openSUSE Build Service is sponsored by