File sddm.spec of Package sddm.openSUSE_Backports_SLE-12-SP1

#
# spec file for package sddm
#
# Copyright (c) 2015 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.13.0
Release:        0
Summary:        Lightweight 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}
# default.face.icon.png and root.face.icon.png were part of Patch7 (0002-Use-.face.icon-instead-of-default.face.icon-and-rena.patch), but used as sources since binary patches are not supported
Source3:        default.face.icon.png
Source4:        root.face.icon.png
# PATCH-FIX-OPENSUSE proper_pam.diff -- Use openSUSE pam config
Patch0:         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
Patch1:         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
Patch2:         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.
Patch3:         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
Patch4:         sddm-service-handle-plymouth.patch
# PATCH-FIX-OPENSUSE boo949903.patch -- Let sddm also default to plasma5 for last used session (boo#949903)
Patch5:         boo949903.patch
# PATCH-FIX-UPSTREAM 0001-Add-a-config-option-to-enable-avatars.patch -- Add EnableAvatars config option
Patch6:         0001-Add-a-config-option-to-enable-avatars.patch
# PATCH-FIX-UPSTREAM 0002-Use-.face.icon-instead-of-default.face.icon-and-rena.patch -- Use new face icons
Patch7:         0002-Use-.face.icon-instead-of-default.face.icon-and-rena.patch
# PATCH-FIX-UPSTREAM add-count-property-to-UserModel.patch -- Adds a new property so themes can use it
Patch8:         add-count-property-to-UserModel.patch
# PATCH-FIX-UPSTREAM specify-default-config-entries.patch -- Specify which config entries are a default and which come from the config file
Patch9:         specify-default-config-entries.patch
# PATCH-FIX-UPSTREAM add-threshold-to-disable-avatars.patch -- Add a config option/property to define a thershold above which avatars are disabled automatically
Patch10:        add-threshold-to-disable-avatars.patch
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  kf5-filesystem
BuildRequires:  libqt5-linguist-devel
BuildRequires:  pam-devel
BuildRequires:  pkg-config
BuildRequires:  python-docutils
# Autodetect UID_MIN and UID_MAX from /etc/login.defs
BuildRequires:  shadow
BuildRequires:  systemd-devel
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5DBus)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5Quick)
BuildRequires:  pkgconfig(Qt5Test)
BuildRequires:  pkgconfig(xcb-xkb)
Requires:       sddm-branding = %{version}
# Merged the -lang package back into the main package
Obsoletes:      %{name}-lang <= %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
SDDM is a modern display manager for X11 aiming to be fast, simple and beatiful.
It uses modern technologies like QtQuick, which in turn gives the designer the
ability to create smooth, animated user interfaces.

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

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

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

%description branding-upstream
SDDM is a modern display manager for X11 aiming to be fast, simple and beatiful.
It uses modern technologies like QtQuick, which in turn gives the designer the
ability to create smooth, 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
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
cp %{SOURCE3} data/faces/default.face.icon.png
cp %{SOURCE4} data/faces/root.face.icon.png

%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 branding-openSUSE
if [ $1 -ge 1 -a -f /etc/sddm.conf ]; then
    sed -i -e 's/^Current=maui$/Current=breeze/g' /etc/sddm.conf
fi

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

%files
%defattr(-,root,root)
%doc COPYING* 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
%{_sysconfdir}/pam.d/sddm*
%{_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 COPYING* README*

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

%changelog
openSUSE Build Service is sponsored by