Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-misc/light-locker/, x11-misc/light-locker/files/
Date: Sat, 30 Mar 2019 09:59:59
Message-Id: 1553939901.c355d1d34e9c90ebdfb422fedde2f9f1aee1b1d6.asturm@gentoo
1 commit: c355d1d34e9c90ebdfb422fedde2f9f1aee1b1d6
2 Author: Guillaume Castagnino <casta <AT> xwing <DOT> info>
3 AuthorDate: Fri Mar 22 14:03:36 2019 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sat Mar 30 09:58:21 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c355d1d3
7
8 x11-misc/light-locker: add elogind support
9
10 This patch comes from the pull request
11 https://github.com/the-cavalry/light-locker/pull/117/files
12 and add elogind support. Without this patch, if xorg is compiled with
13 elogind support, the session cannot be restored after locking the screen
14 and result in a black screen.
15
16 Closes: https://bugs.gentoo.org/681300
17 Signed-off-by: Guillaume Castagnino <casta <AT> xwing.info>
18 Package-Manager: Portage-2.3.62, Repoman-2.3.12
19 Closes: https://github.com/gentoo/gentoo/pull/11460
20 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
21
22 .../files/light-locker-1.8.0-elogind.patch | 257 +++++++++++++++++++++
23 x11-misc/light-locker/light-locker-1.8.0-r1.ebuild | 74 ++++++
24 2 files changed, 331 insertions(+)
25
26 diff --git a/x11-misc/light-locker/files/light-locker-1.8.0-elogind.patch b/x11-misc/light-locker/files/light-locker-1.8.0-elogind.patch
27 new file mode 100644
28 index 00000000000..511e730f434
29 --- /dev/null
30 +++ b/x11-misc/light-locker/files/light-locker-1.8.0-elogind.patch
31 @@ -0,0 +1,257 @@
32 +diff --git a/README b/README
33 +index 330ec82..d16cc6b 100644
34 +--- a/README
35 ++++ b/README
36 +@@ -34,6 +34,7 @@ Most of these configurations will be enabled automatically when their dependenci
37 + Here is a list of the different dependencies and there configuration flags:
38 + --with-gtk2: This decides between the Gtk+-3.0 and Gtk+-2.0 dependency.
39 + --with-systemd: This adds the support for systemd logind. This option requires the development files to be installed.
40 ++ --with-elogind: This adds support for elogind, a standalone version of systemd's logind daemon. Requires the elogind development files be installed. This option cannot be enabled at the same time as the --with-systemd option above.
41 + --with-console-kit: This adds the support for ConsoleKit.
42 + --with-upower: This adds the support for UPower.
43 + --with-mit-ext: This enables the lock-after-screensaver feature. This options requires the X11 Screen Saver extension development files to be installed.
44 +diff --git a/configure.ac.in b/configure.ac.in
45 +index 929befd..8639583 100644
46 +--- a/configure.ac
47 ++++ b/configure.ac
48 +@@ -447,6 +447,42 @@ fi
49 + AC_SUBST(SYSTEMD_CFLAGS)
50 + AC_SUBST(SYSTEMD_LIBS)
51 +
52 ++dnl ---------------------------------------------------------------------------
53 ++dnl elogind
54 ++dnl ---------------------------------------------------------------------------
55 ++
56 ++AC_ARG_WITH(elogind,
57 ++ AS_HELP_STRING([--with-elogind],
58 ++ [Add elogind support]),
59 ++ [with_elogind=$withval], [with_elogind=auto])
60 ++
61 ++if test "x$with_systemd" = "xyes" && test "x$with_elogind" = "xyes"; then
62 ++ AC_MSG_ERROR([Conflicting options: --with-systemd and --with-elogind])
63 ++fi
64 ++
65 ++PKG_CHECK_MODULES(ELOGIND,
66 ++ [libelogind],
67 ++ [have_elogind=yes], [have_elogind=no])
68 ++
69 ++if test "x$with_elogind" = "xauto" ; then
70 ++ if test x$have_elogind = xno ; then
71 ++ use_elogind=no
72 ++ else
73 ++ use_elogind=yes
74 ++ fi
75 ++else
76 ++ use_elogind=$with_elogind
77 ++fi
78 ++
79 ++if test "x$use_elogind" = "xyes"; then
80 ++ if test "x$have_elogind" = "xno"; then
81 ++ AC_MSG_ERROR([Elogind support explicitly required, but elogind not found])
82 ++ fi
83 ++ AC_DEFINE(WITH_ELOGIND, 1, [elogind support])
84 ++fi
85 ++AC_SUBST(ELOGIND_CFLAGS)
86 ++AC_SUBST(ELOGIND_LIBS)
87 ++
88 + dnl ---------------------------------------------------------------------------
89 + dnl UPower
90 + dnl ---------------------------------------------------------------------------
91 +@@ -668,6 +704,7 @@ echo "
92 + systemd: ${use_systemd}
93 + ConsoleKit: ${use_console_kit}
94 + UPower: ${use_upower}
95 ++ elogind: ${use_elogind}
96 +
97 + Features:
98 + ---------
99 +diff --git a/src/Makefile.am b/src/Makefile.am
100 +index 0fa4ef9..7c6a46f 100644
101 +--- a/src/Makefile.am
102 ++++ b/src/Makefile.am
103 +@@ -90,7 +90,8 @@ light_locker_SOURCES = \
104 + light_locker_LDADD = \
105 + $(LIGHT_LOCKER_LIBS) \
106 + $(SAVER_LIBS) \
107 +- $(SYSTEMD_LIBS) \
108 ++ $(SYSTEMD_LIBS) \
109 ++ $(ELOGIND_LIBS) \
110 + $(NULL)
111 +
112 + light_locker_LDFLAGS = -export-dynamic
113 +diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c
114 +index cab6a9e..8928cbf 100644
115 +--- a/src/gs-listener-dbus.c
116 ++++ b/src/gs-listener-dbus.c
117 +@@ -47,6 +47,10 @@
118 + #include <systemd/sd-login.h>
119 + #endif
120 +
121 ++#ifdef WITH_ELOGIND
122 ++#include <elogind/systemd/sd-login.h>
123 ++#endif
124 ++
125 + #include "gs-listener-dbus.h"
126 + #include "gs-marshal.h"
127 + #include "gs-debug.h"
128 +@@ -82,7 +86,7 @@ struct GSListenerPrivate
129 + char *session_id;
130 + char *seat_path;
131 +
132 +-#ifdef WITH_SYSTEMD
133 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
134 + gboolean have_systemd;
135 + char *sd_session_id;
136 + int delay_fd;
137 +@@ -138,7 +142,7 @@ gs_listener_send_switch_greeter (GSListener *listener)
138 +
139 + gs_debug ("Send switch greeter");
140 +
141 +-#ifdef WITH_SYSTEMD
142 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
143 + /* Compare with 0. On failure this will return < 0.
144 + * In the later case we probably aren't using systemd.
145 + */
146 +@@ -179,7 +183,7 @@ gs_listener_send_lock_session (GSListener *listener)
147 +
148 + gs_debug ("Send lock session");
149 +
150 +-#ifdef WITH_SYSTEMD
151 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
152 + /* Compare with 0. On failure this will return < 0.
153 + * In the later case we probably aren't using systemd.
154 + */
155 +@@ -363,7 +367,7 @@ gs_listener_set_idle_hint (GSListener *listener, gboolean idle)
156 +
157 + gs_debug ("Send idle hint: %d", idle);
158 +
159 +-#ifdef WITH_SYSTEMD
160 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
161 + if (listener->priv->have_systemd) {
162 +
163 + if (listener->priv->system_connection == NULL) {
164 +@@ -436,7 +440,7 @@ gs_listener_set_idle_hint (GSListener *listener, gboolean idle)
165 + void
166 + gs_listener_delay_suspend (GSListener *listener)
167 + {
168 +-#ifdef WITH_SYSTEMD
169 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
170 + DBusMessage *message;
171 + DBusMessage *reply;
172 + DBusError error;
173 +@@ -509,7 +513,7 @@ gs_listener_delay_suspend (GSListener *listener)
174 + void
175 + gs_listener_resume_suspend (GSListener *listener)
176 + {
177 +-#ifdef WITH_SYSTEMD
178 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
179 + gs_debug ("Resume suspend: fd=%d", listener->priv->delay_fd);
180 +
181 + if (listener->priv->delay_fd >= 0) {
182 +@@ -1112,7 +1116,7 @@ _listener_message_path_is_our_session (GSListener *listener,
183 + return FALSE;
184 + }
185 +
186 +-#ifdef WITH_SYSTEMD
187 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
188 + static gboolean
189 + query_session_active (GSListener *listener)
190 + {
191 +@@ -1248,7 +1252,7 @@ query_lid_closed (GSListener *listener)
192 + #endif
193 + #endif
194 +
195 +-#if defined(WITH_SYSTEMD) || (defined(WITH_UPOWER) && defined(WITH_LOCK_ON_LID))
196 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND) || (defined(WITH_UPOWER) && defined(WITH_LOCK_ON_LID))
197 + static gboolean
198 + properties_changed_match (DBusMessage *message,
199 + const char *property)
200 +@@ -1343,7 +1347,7 @@ listener_dbus_handle_system_message (DBusConnection *connection,
201 + dbus_message_get_destination (message));
202 + #endif
203 +
204 +-#ifdef WITH_SYSTEMD
205 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
206 +
207 + if (listener->priv->have_systemd) {
208 +
209 +@@ -1963,7 +1967,7 @@ gs_listener_acquire (GSListener *listener,
210 + listener_dbus_system_filter_function,
211 + listener,
212 + NULL);
213 +-#ifdef WITH_SYSTEMD
214 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
215 + if (listener->priv->have_systemd) {
216 + dbus_bus_add_match (listener->priv->system_connection,
217 + "type='signal'"
218 +@@ -2075,7 +2079,7 @@ query_session_id (GSListener *listener)
219 +
220 + dbus_error_init (&error);
221 +
222 +-#ifdef WITH_SYSTEMD
223 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
224 + if (listener->priv->have_systemd) {
225 + dbus_uint32_t pid = getpid();
226 +
227 +@@ -2164,7 +2168,7 @@ query_session_id (GSListener *listener)
228 + #endif
229 + }
230 +
231 +-#ifdef WITH_SYSTEMD
232 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
233 + static char *
234 + query_sd_session_id (GSListener *listener)
235 + {
236 +@@ -2192,7 +2196,7 @@ init_session_id (GSListener *listener)
237 + listener->priv->session_id = query_session_id (listener);
238 + gs_debug ("Got session-id: %s", listener->priv->session_id);
239 +
240 +-#ifdef WITH_SYSTEMD
241 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
242 + g_free (listener->priv->sd_session_id);
243 + listener->priv->sd_session_id = query_sd_session_id (listener);
244 + gs_debug ("Got sd-session-id: %s", listener->priv->sd_session_id);
245 +@@ -2284,7 +2288,7 @@ gs_listener_init (GSListener *listener)
246 + {
247 + listener->priv = GS_LISTENER_GET_PRIVATE (listener);
248 +
249 +-#ifdef WITH_SYSTEMD
250 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
251 + /* check if logind is running */
252 + listener->priv->have_systemd = (access("/run/systemd/seats/", F_OK) >= 0);
253 + listener->priv->delay_fd = -1;
254 +@@ -2313,7 +2317,7 @@ gs_listener_finalize (GObject *object)
255 + g_free (listener->priv->session_id);
256 + g_free (listener->priv->seat_path);
257 +
258 +-#ifdef WITH_SYSTEMD
259 ++#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
260 + g_free (listener->priv->sd_session_id);
261 + #endif
262 +
263 +diff --git a/src/light-locker.c b/src/light-locker.c
264 +index 264b033..79de29a 100644
265 +--- a/src/light-locker.c
266 ++++ b/src/light-locker.c
267 +@@ -144,7 +144,8 @@ main (int argc,
268 + "gtk: %d\n"
269 + "systemd: %s\n"
270 + "ConsoleKit: %s\n"
271 +- "UPower: %s",
272 ++ "UPower: %s\n"
273 ++ "elogind: %s",
274 + GTK_MAJOR_VERSION,
275 + #ifdef WITH_SYSTEMD
276 + "yes",
277 +@@ -160,6 +161,11 @@ main (int argc,
278 + "yes"
279 + #else
280 + "no"
281 ++#endif
282 ++#ifdef WITH_ELOGIND
283 ++ "yes"
284 ++#else
285 ++ "no"
286 + #endif
287 + );
288 + gs_debug ("Features:\n"
289
290 diff --git a/x11-misc/light-locker/light-locker-1.8.0-r1.ebuild b/x11-misc/light-locker/light-locker-1.8.0-r1.ebuild
291 new file mode 100644
292 index 00000000000..eab1233af0c
293 --- /dev/null
294 +++ b/x11-misc/light-locker/light-locker-1.8.0-r1.ebuild
295 @@ -0,0 +1,74 @@
296 +# Copyright 1999-2019 Gentoo Authors
297 +# Distributed under the terms of the GNU General Public License v2
298 +
299 +EAPI=7
300 +
301 +inherit autotools gnome2-utils
302 +
303 +DESCRIPTION="A simple locker using lightdm"
304 +HOMEPAGE="https://github.com/the-cavalry/light-locker"
305 +SRC_URI="${HOMEPAGE}/releases/download/v${PV}/${P}.tar.bz2"
306 +
307 +LICENSE="GPL-2 LGPL-2"
308 +SLOT="0"
309 +KEYWORDS="~amd64 ~x86"
310 +IUSE="consolekit +dpms elogind gtk3 +screensaver systemd +upower"
311 +
312 +BDEPEND="dev-lang/perl
313 + dev-perl/XML-Parser
314 + dev-util/intltool
315 + sys-devel/gettext"
316 +DEPEND="dev-libs/dbus-glib
317 + dev-libs/glib
318 + sys-apps/dbus
319 + x11-libs/cairo
320 + x11-libs/libX11
321 + x11-libs/pango
322 + x11-libs/libXxf86vm
323 + consolekit? ( sys-auth/consolekit )
324 + dpms? ( x11-libs/libXext )
325 + elogind? ( sys-auth/elogind )
326 + !gtk3? ( x11-libs/gtk+:2 )
327 + gtk3? ( x11-libs/gtk+:3 )
328 + screensaver? ( x11-libs/libXScrnSaver )
329 + systemd? ( sys-apps/systemd )
330 + upower? ( sys-power/upower )"
331 +RDEPEND="${DEPEND}
332 + x11-misc/lightdm"
333 +
334 +REQUIRED_USE="?? ( consolekit elogind systemd )"
335 +
336 +DOCS=( AUTHORS HACKING NEWS README )
337 +
338 +PATCHES=(
339 + "${FILESDIR}/${PN}-${PV}-elogind.patch"
340 +)
341 +
342 +src_prepare() {
343 + default
344 + # remove xdt-autogen specific macro (just like upstream do) as we need to autoreconf
345 + sed -si -e "/XDT_I18N/d" configure.ac || die
346 + eautoreconf
347 +}
348 +
349 +src_configure() {
350 + local myeconfargs=(
351 + $(use_with consolekit console-kit)
352 + $(use_with dpms dpms-ext)
353 + $(use_with !gtk3 gtk2)
354 + $(use_with screensaver x)
355 + $(use_with screensaver mit-ext)
356 + $(use_with systemd)
357 + $(use_with elogind)
358 + $(use_with upower)
359 + )
360 + econf "${myeconfargs[@]}"
361 +}
362 +
363 +pkg_postinst() {
364 + gnome2_schemas_update
365 +}
366 +
367 +pkg_postrm() {
368 + gnome2_schemas_update
369 +}