summary refs log tree commit diff
diff options
context:
space:
mode:
authorTimothy Sample <samplet@ngyro.com>2021-11-19 23:19:40 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-11-21 09:08:51 -0500
commit404c7eedfe73673af8f590315fb85f5a725461b3 (patch)
treec941758c1557b772282050b2646308d74205cce2
parent72501a555eaad267dc68c88c5f22de1a1573e371 (diff)
downloadguix-404c7eedfe73673af8f590315fb85f5a725461b3.tar.gz
gnu: gnome-session: Restore elogind support.
* gnu/packages/patches/gnome-session-support-elogind.patch: New file.
* gnu/local.mk: Add it.
* gnu/packages/gnome.scm (gnome-session)[source]: Use it.
[arguments]: Add "-Delogind=true" to #:configure-flags; remove
phases that patch in old-style elogind support.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
-rw-r--r--gnu/packages/gnome.scm14
-rw-r--r--gnu/packages/patches/gnome-session-support-elogind.patch73
2 files changed, 75 insertions, 12 deletions
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index ebe718ab4a..63e9d4ac73 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -7252,6 +7252,7 @@ such as gzip tarballs.")
               (uri (string-append "mirror://gnome/sources/" name "/"
                                   (version-major version) "/"
                                   name "-" version ".tar.xz"))
+              (patches (search-patches "gnome-session-support-elogind.patch"))
               (sha256
                (base32
                 "02z0xr6sv9ibl7awbw9j4y05hf4jk1zgvsbbmh7n27hhjvsvc8pl"))))
@@ -7260,18 +7261,6 @@ such as gzip tarballs.")
        #:glib-or-gtk? #t
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'pre-configure
-           (lambda* (#:key outputs #:allow-other-keys)
-             ;; Use elogind instead of systemd.
-             (substitute* "meson.build"
-               (("libsystemd-login") "libelogind")
-               (("and libsystemd_daemon_dep.found.*") ","))
-             (substitute* "gnome-session/gsm-systemd.c"
-               (("#include <systemd/sd-login.h>")
-                "#include <elogind/sd-login.h>"))
-             ;; Remove uses of the systemd daemon.
-             (substitute* "gnome-session/gsm-autostart-app.c"
-               (("#ifdef HAVE_SYSTEMD") "#if 0"))))
          (add-after 'install 'wrap-gnome-session
            (lambda* (#:key inputs outputs #:allow-other-keys)
              ;; Make sure 'gnome-session' finds the 'gsettings' program.
@@ -7283,6 +7272,7 @@ such as gzip tarballs.")
        #:configure-flags
        '("-Ddocbook=false" ; FIXME: disabled because of docbook validation error
          "-Dman=false" ; FIXME: disabled because of docbook validation error
+         "-Delogind=true"
          "-Dsystemd=false"
          "-Dsystemd_session=disable"
          "-Dsystemd_journal=false")))
diff --git a/gnu/packages/patches/gnome-session-support-elogind.patch b/gnu/packages/patches/gnome-session-support-elogind.patch
new file mode 100644
index 0000000000..b52b4c6855
--- /dev/null
+++ b/gnu/packages/patches/gnome-session-support-elogind.patch
@@ -0,0 +1,73 @@
+This patch, borrowed from Gentoo, allows configuring gnome-sesssion with
+elogind support.
+
+https://gitweb.gentoo.org/repo/gentoo.git/plain/gnome-base/gnome-session/files/gnome-session-3.38.0-meson-Support-elogind.patch?id=5f7fe88af5f888aff58fa0c069c3fe07973c7cd2
+
+From 4454f2a63394b69fba2c900151165ad8b5742f31 Mon Sep 17 00:00:00 2001
+From: Mart Raudsepp <leio@gentoo.org>
+Date: Sun, 15 Mar 2020 14:34:39 +0200
+Subject: [PATCH] meson: Support elogind
+
+---
+ meson.build       | 12 +++++++++---
+ meson_options.txt |  1 +
+ 2 files changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index ef5132c6..7f68aaae 100644
+--- a/meson.build
++++ b/meson.build
+@@ -124,8 +124,10 @@ enable_systemd = get_option('systemd')
+ enable_systemd_session = get_option('systemd_session') != 'disable'
+ use_systemd_session = get_option('systemd_session') == 'default'
+ enable_systemd_journal = get_option('systemd_journal')
++enable_elogind = get_option('elogind')
+ enable_consolekit = get_option('consolekit')
+-if enable_systemd or enable_consolekit
++assert(not (enable_systemd and enable_elogind), 'Can not support systemd and elogind at once')
++if enable_systemd or enable_elogind or enable_consolekit
+   session_bin_deps += dependency('gio-unix-2.0', version: glib_req_version)
+ 
+   # Check for systemd
+@@ -152,6 +154,10 @@ if enable_systemd or enable_consolekit
+     endif
+ 
+     session_tracking = 'systemd'
++  elif enable_elogind
++    libelogind_dep = dependency('libelogind', version: '>= 239.4')
++    session_bin_deps += libelogind_dep
++    session_tracking = 'elogind'
+   endif
+ 
+   # Check for ConsoleKit
+@@ -161,7 +167,7 @@ if enable_systemd or enable_consolekit
+ 
+     session_bin_deps += dbus_glib_dep
+ 
+-    if enable_systemd
++    if enable_systemd or enable_elogind
+       session_tracking += ' (with fallback to ConsoleKit)'
+     else
+       session_tracking = 'ConsoleKit'
+@@ -171,7 +177,7 @@ endif
+ if enable_systemd_session
+   assert(enable_systemd, 'Systemd support must be enabled when using systemd session management')
+ endif
+-config_h.set('HAVE_SYSTEMD', enable_systemd)
++config_h.set('HAVE_SYSTEMD', enable_systemd or enable_elogind)
+ config_h.set('ENABLE_SYSTEMD_SESSION', enable_systemd_session)
+ config_h.set('ENABLE_SYSTEMD_JOURNAL', enable_systemd_journal)
+ config_h.set('HAVE_CONSOLEKIT', enable_consolekit)
+diff --git a/meson_options.txt b/meson_options.txt
+index 4c05dc6e..512d1528 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -1,4 +1,5 @@
+ option('deprecation_flags', type: 'boolean', value: false, description: 'use *_DISABLE_DEPRECATED flags')
++option('elogind', type: 'boolean', value: true, description: 'Use elogind')
+ option('session_selector', type: 'boolean', value: false, description: 'enable building a custom session selector dialog')
+ option('systemd', type: 'boolean', value: true, description: 'Use systemd')
+ option('systemd_session', type: 'combo', choices: ['disable', 'enable', 'default'], value: 'default', description: 'Whether to include systemd session support and use it by default')
+-- 
+2.26.2
+