File gdm.spec of Package gdm

#
# spec file for package gdm
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#


%define systemdsystemunitdir %(pkg-config --variable=systemdsystemunitdir systemd)

# FIXME: need to check what should be done to enable this (at least adapt the pam files). See bnc#699999
%define enable_split_authentication 0

Name:           gdm
Version:        3.36.3
Release:        0
Summary:        The GNOME Display Manager
License:        GPL-2.0-or-later
Group:          System/GUI/GNOME
URL:            https://gitlab.gnome.org/GNOME/gdm
Source0:        %{name}-%{version}.tar.xz

Source1:        gdm.pamd
Source2:        gdm-autologin.pamd
Source3:        gdm-launch-environment.pamd
Source4:        gdm-fingerprint.pamd
Source5:        gdm-smartcard.pamd
# Use reserveVT.conf to make autologin user session not to select tty1
Source6:        reserveVT.conf
Source98:       README.gdm-obsolete-xdm
Source99:       gdm-rpmlintrc

BuildRequires:  check-devel
# needed for directory ownership
BuildRequires:  dconf
BuildRequires:  fdupes
BuildRequires:  gnome-session-core
BuildRequires:  intltool
BuildRequires:  itstool
BuildRequires:  libtool
BuildRequires:  libxml2-tools
BuildRequires:  pam-devel
BuildRequires:  pkgconfig
BuildRequires:  pwdutils
BuildRequires:  tcpd-devel
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-server
BuildRequires:  xorg-x11-server-extra
BuildRequires:  yelp-tools
BuildRequires:  pkgconfig(accountsservice) >= 0.6.35
BuildRequires:  pkgconfig(gio-2.0) >= 2.36.0
BuildRequires:  pkgconfig(gio-unix-2.0) >= 2.36.0
BuildRequires:  pkgconfig(glib-2.0) >= 2.36.0
BuildRequires:  pkgconfig(gobject-2.0) >= 2.36.0
BuildRequires:  pkgconfig(gobject-introspection-1.0) >= 0.9.12
BuildRequires:  pkgconfig(gthread-2.0)
BuildRequires:  pkgconfig(gtk+-3.0) >= 2.91.1
BuildRequires:  pkgconfig(iso-codes)
BuildRequires:  pkgconfig(libcanberra-gtk3) >= 0.4
BuildRequires:  pkgconfig(libkeyutils)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(ply-boot-client)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xau)
BuildRequires:  pkgconfig(xcb)
BuildRequires:  pkgconfig(xdmcp)
BuildRequires:  pkgconfig(xi)
BuildRequires:  pkgconfig(xinerama)
%ifnarch s390 s390x
BuildRequires:  pkgconfig(xorg-server)
%endif
BuildRequires:  pkgconfig(xrandr)
Requires:       %{name}-branding
Requires:       gnome-session-core
Requires:       gnome-settings-daemon
Requires:       gnome-shell
Requires:       %{_bindir}/dbus-run-session
Recommends:     gdmflexiserver
Requires(post): dconf
# accessibility
Recommends:     orca
# For groupadd, useradd, usermod
PreReq:         pwdutils
Recommends:     iso-codes
DocDir:         %{_defaultdocdir}

%description
The GNOME Display Manager is a system service that is responsible for
providing graphical log-ins and managing local and remote displays.

%package -n libgdm1
Summary:        Client Library for Communicating with GDM Greeter Server
Group:          System/Libraries
Recommends:     gdm

%description -n libgdm1
The GNOME Display Manager is a system service that is responsible for
providing graphical log-ins and managing local and remote displays.

%package -n typelib-1_0-Gdm-1_0
Summary:        Introspection bindings for gdm
Group:          System/Libraries

%description -n typelib-1_0-Gdm-1_0
The GNOME Display Manager is a system service that is responsible for
providing graphical log-ins and managing local and remote displays.

This package provides the GObject Introspection bindings for
communicating with the GDM greeter server.

%package devel
Summary:        Libraries for GDM -- Development Files
Group:          Development/Libraries/GNOME
Requires:       libgdm1 = %{version}
Requires:       typelib-1_0-Gdm-1_0 = %{version}

%description devel
The GNOME Display Manager is a system service that is responsible for
providing graphical log-ins and managing local and remote displays.

%package branding-upstream
Summary:        The GNOME Display Manager -- Upstream default configuration
Group:          System/GUI/GNOME
Requires:       %{name} = %{version}
Provides:       %{name}-branding = %{version}
Conflicts:      otherproviders(%{name}-branding)
Supplements:    packageand(%{name}:branding-upstream)
BuildArch:      noarch

%description branding-upstream
The GNOME Display Manager is a system service that is responsible for
providing graphical log-ins and managing local and remote displays.

This package provides the upstream default configuration for gdm.

%package -n gdmflexiserver
Summary:        Compatibility Wrapper for Display Managers
Group:          System/GUI/GNOME
Suggests:       gdm

%description -n gdmflexiserver
This tool interacts with the display manager to enable fast user
switching. This package contains a wrapper that selects the correct
flexiserver implementation, based on the running display manager.

%package -n gdm-obsolete-xdm
Summary:        Use gdm as the only displaymanager, no fallback
Group:          System/GUI/GNOME
Requires:       gdm
BuildArch:      noarch
Conflicts:      xdm
Conflicts:      xorg-x11-essentials

%description -n gdm-obsolete-xdm
Use gdm as the only displaymanager, no fallback like we normally
have in openSUSE. This package will uninstall xdm and
xorg-x11-essentials packages. Only for advanced users.


%lang_package

%prep
%autosetup -p1

%build
NOCONFIGURE=1 ./autogen.sh
%configure \
	--disable-static \
	--enable-documentation=yes \
	--libexecdir=%{_libexecdir}/gdm \
	--localstatedir=%{_localstatedir} \
	--with-at-spi-registryd-directory=%{_libexecdir}/at-spi \
	--with-check-accelerated-directory=%{_libexecdir} \
	--with-gnome-settings-daemon-directory=%{_libexecdir}/gnome-settings-daemon-3.0 \
	--with-pam-mod-dir=/%{_lib}/security \
	--enable-ipv6 \
	--enable-gdm-xsession \
	--with-plymouth \
	--enable-wayland-support \
	--enable-systemd-journal \
%if %{enable_split_authentication}
	--enable-split-authentication \
%else
	--disable-split-authentication \
%endif
	--with-initial-vt=7 \
	--with-run-dir=/run/gdm \
	--with-udevdir=%{_prefix}/lib/udev \
	%{nil}
%make_build

%install
%make_install

find %{buildroot} -name '*.la' -type f -delete -print
%fdupes %{buildroot}%{_datadir}/

## Install PAM files.
mkdir -p %{buildroot}%{_sysconfdir}/pam.d
# Generic pam config
cp %{SOURCE1} %{buildroot}%{_sysconfdir}/pam.d/gdm
# Pam config for autologin
cp %{SOURCE2} %{buildroot}%{_sysconfdir}/pam.d/gdm-autologin
# Pam config for the greeter session
cp %{SOURCE3} %{buildroot}%{_sysconfdir}/pam.d/gdm-launch-environment
%if %{enable_split_authentication}
# Pam config for fingerprint authentication
cp %{SOURCE4} %{buildroot}%{_sysconfdir}/pam.d/gdm-fingerprint
# Pam config for smartcard authentication
cp %{SOURCE5} %{buildroot}%{_sysconfdir}/pam.d/gdm-smartcard
%endif
# The default gdm pam configuration is the one to be used as pam-password too
%if %{enable_split_authentication}
rm %{buildroot}%{_sysconfdir}/pam.d/gdm-password
echo "We are not ready for this, we need to know what to put in gdm-fingerprint and gdm-smartcard pam config files."
false
%endif
ln -s gdm %{buildroot}/etc/pam.d/gdm-password
## Install other files
# Install PostLogin script.
mv $RPM_BUILD_ROOT%{_sysconfdir}/gdm/PostLogin/Default.sample $RPM_BUILD_ROOT%{_sysconfdir}/gdm/PostLogin/Default

# Install README.gdm-obsolete-xdm
install -D -m 644 %{SOURCE98} %{buildroot}%{_docdir}/%{name}/README.gdm-obsolete-xdm

# Install other files
mkdir -p %{buildroot}%{_localstatedir}/log/gdm
mkdir -p %{buildroot}/run/gdm
mkdir -p %{buildroot}%{_bindir}
ln -s ../sbin/gdm %{buildroot}%{_bindir}/gdm

mkdir -p %{buildroot}%{_libexecdir}/systemd/logind.conf.d
install -m 644 %{SOURCE6} %{buildroot}%{_libexecdir}/systemd/logind.conf.d/reserveVT.conf

%find_lang %{name} %{?no_lang_C}
%fdupes -s %{buildroot}%{_datadir}/help

%pre
/usr/sbin/groupadd -r gdm 2> /dev/null || :
/usr/sbin/useradd -r -g gdm -s /bin/false \
-c "Gnome Display Manager daemon" -d /var/lib/gdm gdm 2> /dev/null || :
/usr/sbin/usermod -g gdm -s /bin/false gdm 2> /dev/null

%pre -n gdm-obsolete-xdm
%service_add_pre gdm.service

%post -n gdm-obsolete-xdm
%service_add_post gdm.service

%posttrans
# Create dconf database for gdm, to lockdown the gdm session
dconf update

%preun -n gdm-obsolete-xdm
%service_del_preun gdm.service

%postun -n gdm-obsolete-xdm
export DISABLE_RESTART_ON_UPDATE=yes
%service_del_postun gdm.service

%post -n libgdm1 -p /sbin/ldconfig
%postun -n libgdm1 -p /sbin/ldconfig

%files
%license COPYING
%doc AUTHORS NEWS README.md
%doc %{_datadir}/help/C/%{name}/
%dir %config %{_sysconfdir}/gdm
%config %{_sysconfdir}/gdm/[IPXl]*
%{_sbindir}/gdm
%{_bindir}/gdm
%{_bindir}/gdm-screenshot
%dir %{_datadir}/dconf
%dir %{_datadir}/dconf/profile
%{_datadir}/dconf/profile/gdm
%{_datadir}/gdm/
%{_datadir}/gnome-session/sessions/gnome-login.session
%{_datadir}/glib-2.0/schemas/org.gnome.login-screen.gschema.xml
/%{_lib}/security/pam_gdm.so
%dir %{_libexecdir}/gdm
%{_libexecdir}/gdm/gdm-*
%ghost %attr(750,gdm,gdm) %dir %{_localstatedir}/lib/gdm
%ghost %attr(711,root,gdm) %dir %{_localstatedir}/log/gdm
%dir %{_localstatedir}/cache/gdm
%ghost %attr(711,root,gdm) %dir /run/gdm
%config %{_sysconfdir}/pam.d/gdm
%config %{_sysconfdir}/pam.d/gdm-autologin
%if %{enable_split_authentication}
%config %{_sysconfdir}/pam.d/gdm-fingerprint
%config %{_sysconfdir}/pam.d/gdm-smartcard
%endif
%config %{_sysconfdir}/pam.d/gdm-password
%config %{_sysconfdir}/pam.d/gdm-launch-environment
%config %{_sysconfdir}/dbus-1/system.d/gdm.conf
%config(noreplace) %{_libexecdir}/udev/rules.d/61-gdm.rules
%dir %{_libexecdir}/systemd/logind.conf.d
%{_libexecdir}/systemd/logind.conf.d/reserveVT.conf

%files -n libgdm1
%{_libdir}/libgdm.so.*

%files -n typelib-1_0-Gdm-1_0
%{_libdir}/girepository-1.0/Gdm-1.0.typelib

%files devel
%{_includedir}/gdm/
%{_libdir}/libgdm.so
%{_libdir}/pkgconfig/gdm.pc
%{_libdir}/pkgconfig/gdm-pam-extensions.pc
%{_datadir}/gir-1.0/Gdm-1.0.gir

%files branding-upstream
%config(noreplace) %{_sysconfdir}/gdm/custom.conf

%files -n gdmflexiserver
%{_bindir}/gdmflexiserver

%files -n gdm-obsolete-xdm
%doc %{_docdir}/%{name}/README.gdm-obsolete-xdm
%{_unitdir}/gdm.service

%files lang -f %{name}.lang

%changelog