05137ca53be8205bd97323543d4c166e3b05207a
[gentoo.git] / gnome-base / gdm / gdm-3.32.0.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 GNOME2_LA_PUNT="yes"
6 GNOME2_EAUTORECONF="yes"
7
8 inherit eutils gnome2 pam readme.gentoo-r1 systemd udev user
9
10 DESCRIPTION="GNOME Display Manager for managing graphical display servers and user logins"
11 HOMEPAGE="https://wiki.gnome.org/Projects/GDM"
12
13 SRC_URI="${SRC_URI}
14         branding? ( https://www.mail-archive.com/tango-artists@lists.freedesktop.org/msg00043/tango-gentoo-v1.1.tar.gz )
15 "
16
17 LICENSE="
18         GPL-2+
19         branding? ( CC-BY-SA-4.0 )
20 "
21
22 SLOT="0"
23
24 IUSE="accessibility audit bluetooth-sound branding elogind fprint +introspection ipv6 plymouth selinux smartcard systemd tcpd test wayland xinerama"
25 RESTRICT="!test? ( test )"
26 REQUIRED_USE="^^ ( elogind systemd )"
27
28 KEYWORDS="~alpha amd64 ~arm ~arm64 ~ppc ~ppc64 x86"
29
30 # NOTE: x11-base/xorg-server dep is for X_SERVER_PATH etc, bug #295686
31 # nspr used by smartcard extension
32 # dconf, dbus and g-s-d are needed at install time for dconf update
33 # We need either systemd or >=openrc-0.12 to restart gdm properly, bug #463784
34 COMMON_DEPEND="
35         app-text/iso-codes
36         >=dev-libs/glib-2.44:2
37         dev-libs/libgudev
38         >=x11-libs/gtk+-2.91.1:3
39         >=gnome-base/dconf-0.20
40         >=gnome-base/gnome-settings-daemon-3.1.4
41         gnome-base/gsettings-desktop-schemas
42         >=media-libs/fontconfig-2.5.0:1.0
43         >=media-libs/libcanberra-0.4[gtk3]
44         sys-apps/dbus
45         >=sys-apps/accountsservice-0.6.35
46
47         x11-base/xorg-server
48         x11-libs/libXau
49         x11-libs/libX11
50         x11-libs/libXdmcp
51         x11-libs/libXext
52         x11-libs/libxcb
53         >=x11-misc/xdg-utils-1.0.2-r3
54
55         sys-libs/pam
56         elogind? ( >=sys-auth/elogind-239.3[pam] )
57         systemd? ( >=sys-apps/systemd-186:0=[pam] )
58
59         sys-auth/pambase[elogind?,systemd?]
60
61         audit? ( sys-process/audit )
62         introspection? ( >=dev-libs/gobject-introspection-0.9.12:= )
63         plymouth? ( sys-boot/plymouth )
64         selinux? ( sys-libs/libselinux )
65         tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
66         xinerama? ( x11-libs/libXinerama )
67 "
68 # XXX: These deps are from session and desktop files in data/ directory
69 # fprintd is used via dbus by gdm-fingerprint-extension
70 # gnome-session-3.6 needed to avoid freezing with orca
71 RDEPEND="${COMMON_DEPEND}
72         >=gnome-base/gnome-session-3.6
73         >=gnome-base/gnome-shell-3.1.90
74         x11-apps/xhost
75
76         accessibility? (
77                 >=app-accessibility/orca-3.10
78                 gnome-extra/mousetweaks )
79         fprint? (
80                 sys-auth/fprintd
81                 sys-auth/pam_fprint )
82
83         !gnome-extra/fast-user-switch-applet
84 "
85 DEPEND="${COMMON_DEPEND}
86         app-text/docbook-xml-dtd:4.1.2
87         dev-util/gdbus-codegen
88         dev-util/glib-utils
89         dev-util/itstool
90         >=sys-devel/gettext-0.19.8
91         virtual/pkgconfig
92         x11-base/xorg-proto
93         test? ( >=dev-libs/check-0.9.4 )
94         app-text/yelp-tools
95 " # yelp-tools needed for eautoreconf to not lose help docs (m4_ifdeffed YELP_HELP_INIT call and setup)
96
97 DOC_CONTENTS="
98         To make GDM start at boot with systemd, run:\n
99         # systemctl enable gdm.service\n
100         \n
101         To make GDM start at boot with OpenRC, edit /etc/conf.d to have
102         DISPLAYMANAGER=\"gdm\" and enable the xdm service:\n
103         # rc-update add xdm
104         \n
105         For passwordless login to unlock your keyring, you need to install
106         sys-auth/pambase with USE=gnome-keyring and set an empty password
107         on your keyring. Use app-crypt/seahorse for that.\n
108         \n
109         You may need to install app-crypt/coolkey and sys-auth/pam_pkcs11
110         for smartcard support
111 "
112
113 pkg_setup() {
114         enewgroup gdm
115         enewgroup video # Just in case it hasn't been created yet
116         enewuser gdm -1 -1 /var/lib/gdm gdm,video
117
118         # For compatibility with certain versions of nvidia-drivers, etc., need to
119         # ensure that gdm user is in the video group
120         if ! egetent group video | grep -q gdm; then
121                 # FIXME XXX: is this at all portable, ldap-safe, etc.?
122                 # XXX: egetent does not have a 1-argument form, so we can't use it to
123                 # get the list of gdm's groups
124                 local g=$(groups gdm)
125                 elog "Adding user gdm to video group"
126                 usermod -G video,${g// /,} gdm || die "Adding user gdm to video group failed"
127         fi
128 }
129
130 src_prepare() {
131         # ssh-agent handling must be done at xinitrc.d, bug #220603
132         eapply "${FILESDIR}/${PN}-2.32.0-xinitrc-ssh-agent.patch"
133
134         # Gentoo does not have a fingerprint-auth pam stack
135         eapply "${FILESDIR}/${PN}-3.8.4-fingerprint-auth.patch"
136
137         # Support pam_elogind.so in gdm-launch-environment.pam
138         eapply "${FILESDIR}/pam-elogind.patch"
139
140         # Wait 10 seconds for a DRM master with systemd. Workaround for gdm not waiting for CanGraphical=yes property on the seat. Bug #613222
141         eapply "${FILESDIR}/gdm-CanGraphical-wait.patch" # needs eautoreconf
142
143         # Show logo when branding is enabled
144         use branding && eapply "${FILESDIR}/${PN}-3.30.3-logo.patch"
145
146         gnome2_src_prepare
147 }
148
149 src_configure() {
150         # PAM is the only auth scheme supported
151         # even though configure lists shadow and crypt
152         # they don't have any corresponding code.
153         # --with-at-spi-registryd-directory= needs to be passed explicitly because
154         # of https://bugzilla.gnome.org/show_bug.cgi?id=607643#c4
155         # Xevie is obsolete, bug #482304
156
157         # --with-initial-vt=7 conflicts with plymouth, bug #453392
158         # gdm-3.30 now reaps (stops) the login screen when the login VT isn't active, which
159         # saves on memory. However this means if we don't start on VT1, gdm doesn't start up
160         # before user manually goes to VT7. Thus as-is we can not keep gdm away from VT1,
161         # so lets try always having it in VT1 and see if that is an issue for people before
162         # hacking up workarounds for the initial start case.
163         # ! use plymouth && myconf="${myconf} --with-initial-vt=7"
164         local myconf=(
165                 --enable-gdm-xsession
166                 --enable-user-display-server
167                 --with-run-dir=/run/gdm
168                 --localstatedir="${EPREFIX}"/var
169                 --disable-static
170                 --with-xdmcp=yes
171                 --enable-authentication-scheme=pam
172                 --with-default-pam-config=exherbo
173                 --with-pam-mod-dir=$(getpam_mod_dir)
174                 --with-udevdir=$(get_udevdir)
175                 --with-at-spi-registryd-directory="${EPREFIX}"/usr/libexec
176                 --without-xevie
177                 $(use_enable systemd systemd-journal)
178                 --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
179                 $(use_with audit libaudit)
180                 $(use_enable ipv6)
181                 $(use_with plymouth)
182                 $(use_with selinux)
183                 $(use_with tcpd tcp-wrappers)
184                 $(use_enable wayland wayland-support)
185                 $(use_with xinerama)
186         )
187
188         if use elogind; then
189                 myconf+=(
190                         --with-initial-vt=7 # TODO: Revisit together with startDM.sh and other xinit talks; also ignores plymouth possibility
191                         SYSTEMD_CFLAGS=`pkg-config --cflags "libelogind" 2>/dev/null`
192                         SYSTEMD_LIBS=`pkg-config --libs "libelogind" 2>/dev/null`
193                 )
194         fi
195
196         gnome2_src_configure "${myconf[@]}"
197 }
198
199 src_install() {
200         gnome2_src_install
201
202         if ! use accessibility ; then
203                 rm "${ED}"/usr/share/gdm/greeter/autostart/orca-autostart.desktop || die
204         fi
205
206         exeinto /etc/X11/xinit/xinitrc.d
207         newexe "${FILESDIR}/49-keychain-r1" 49-keychain
208         newexe "${FILESDIR}/50-ssh-agent-r1" 50-ssh-agent
209
210         # gdm user's home directory
211         keepdir /var/lib/gdm
212         fowners gdm:gdm /var/lib/gdm
213
214         if ! use bluetooth-sound ; then
215                 # Workaround https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/10
216                 # bug #679526
217                 insinto /var/lib/gdm/.config/pulse
218                 doins "${FILESDIR}"/default.pa
219         fi
220
221         # install XDG_DATA_DIRS gdm changes
222         echo 'XDG_DATA_DIRS="/usr/share/gdm"' > 99xdg-gdm
223         doenvd 99xdg-gdm
224
225         use branding && newicon "${WORKDIR}/tango-gentoo-v1.1/scalable/gentoo.svg" gentoo-gdm.svg
226
227         readme.gentoo_create_doc
228 }
229
230 pkg_postinst() {
231         gnome2_pkg_postinst
232         local d ret
233
234         # bug #669146; gdm may crash if /var/lib/gdm subdirs are not owned by gdm:gdm
235         ret=0
236         ebegin "Fixing "${EROOT}"var/lib/gdm ownership"
237         chown --no-dereference gdm:gdm "${EROOT}var/lib/gdm" || ret=1
238         for d in "${EROOT}var/lib/gdm/"{.cache,.color,.config,.dbus,.local}; do
239                 [[ ! -e "${d}" ]] || chown --no-dereference -R gdm:gdm "${d}" || ret=1
240         done
241         eend ${ret}
242
243         systemd_reenable gdm.service
244         readme.gentoo_print_elog
245 }