1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
From 1f0f87bbcacaed80c02178bf74b87612578840cd Mon Sep 17 00:00:00 2001
From: Swagtoy <me@ow.swag.toys>
Date: Fri, 20 Mar 2026 19:43:57 -0400
Subject: [PATCH] Make systemd optional
Starting from gnome session 49 onwards, systemd was integrated via a
leader, ctl, and a service file. This is fine; however, this was also
intentionally designed to allow for other leaders/ctl/tools to be
injected (such as the efforts with gnome-session-openrc).
Despite this, systemd still remains a required dependency and you
cannot install gnome-session without it. Now, systemd is specified as
an meson option. It intentionally isn't a fallback if systemd isn't
found (like `required: false`) to ensure that non-systemd systems will
still error out, or in interesting cases where multiple binaries will
get built and could have both elogind and systemd stashed
somewhere. In either case, I don't think it's inappropriate to make it
an option, since it completely changes the way gnome-session builds
and functions too.
If on, things will function as they would before this commit,
otherwise, it will toggle on elogind as a fallback so things still
function, disable the systemd leader, stop installing the unit files,
and tools. This ultimately opens the doors for things like
gnome-session-openrc 'to work,' by allowing for a custom leader,
tools, etc.
Signed-off-by: Swagtoy <me@ow.swag.toys>
Signed-off-by: Emi <reedy.sailors.8t@icloud.com>
---
data/meson.build | 47 +++++++++++++++++++++------------------
gnome-session/meson.build | 2 ++
meson.build | 9 ++++++--
meson_options.txt | 1 +
tools/meson.build | 5 ++++-
5 files changed, 39 insertions(+), 25 deletions(-)
diff --git a/data/meson.build b/data/meson.build
index 3e5401a0..7db0497c 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -16,11 +16,12 @@ i18n.merge_file(
)
# Next, let's install the necessary systemd scaffolding
-
-install_data(
- 'gnome.session.conf',
- install_dir: systemd_userunitdir / 'gnome-session@gnome.target.d',
-)
+if get_option('systemd')
+ install_data(
+ 'gnome.session.conf',
+ install_dir: systemd_userunitdir / 'gnome-session@gnome.target.d',
+ )
+endif
systemd_service = [
'gnome-session-manager@.service',
@@ -33,7 +34,7 @@ foreach service: systemd_service
configure_file(
input: service + '.in',
output: service,
- install: true,
+ install: get_option('systemd'),
install_dir: systemd_userunitdir,
configuration: {
'libexecdir': session_libexecdir,
@@ -54,25 +55,27 @@ systemd_target = [
'gnome-session-x11-services-ready.target',
]
-install_data(
- systemd_target,
- install_dir: systemd_userunitdir
-)
+if get_option('systemd')
+ install_data(
+ systemd_target,
+ install_dir: systemd_userunitdir
+ )
-# Install resource limits that are applied to GNOME-launched apps
+ # Install resource limits that are applied to GNOME-launched apps
-install_data(
- 'app-override.scope.conf',
- rename: 'override.conf',
- install_dir : join_paths(systemd_userunitdir, 'app-gnome-.scope.d')
-)
+ install_data(
+ 'app-override.scope.conf',
+ rename: 'override.conf',
+ install_dir : join_paths(systemd_userunitdir, 'app-gnome-.scope.d')
+ )
-# FIXME: https://github.com/systemd/systemd/issues/37104
-install_data(
- 'app-override.scope.conf',
- rename: 'override.conf',
- install_dir : join_paths(systemd_userunitdir, 'app-flatpak-.scope.d')
-)
+ # FIXME: https://github.com/systemd/systemd/issues/37104
+ install_data(
+ 'app-override.scope.conf',
+ rename: 'override.conf',
+ install_dir : join_paths(systemd_userunitdir, 'app-flatpak-.scope.d')
+ )
+endif
# Install some other misc. configuration files
diff --git a/gnome-session/meson.build b/gnome-session/meson.build
index 67774960..c975fba1 100644
--- a/gnome-session/meson.build
+++ b/gnome-session/meson.build
@@ -19,10 +19,12 @@ executable(
install_dir: session_bindir
)
+# If you are not using systemd, you must supply your own leader
sources = files(
'gsm-util.c',
'leader-systemd.c',
)
+sources = get_option('systemd') ? sources : disabler()
executable(
meson.project_name() + '-init-worker',
diff --git a/meson.build b/meson.build
index 2b9d524c..dbab0821 100644
--- a/meson.build
+++ b/meson.build
@@ -86,17 +86,21 @@ session_deps = [
dependency('gnome-desktop-4'),
]
-libsystemd_dep = dependency('libsystemd', version: '>= 209', required: true)
+libsystemd_dep = dependency('libsystemd', version: '>= 209', required: get_option('systemd'), disabler: true)
config_h.set('SYSTEMD_STRICT_ENV',
libsystemd_dep.version().version_compare('< 248'))
+if not libsystemd_dep.found()
+ libsystemd_dep = dependency('libelogind', version: '>=209', required: true)
+endif
+
session_bin_deps = session_deps + [
libsystemd_dep,
dependency('gio-unix-2.0', version: glib_req_version),
]
systemd_userunitdir = get_option('systemduserunitdir')
-if systemd_userunitdir == ''
+if systemd_userunitdir == '' and libsystemd_dep.name() != 'libelogind'
systemd_dep = dependency('systemd', version: '>= 242', required: true)
systemd_userunitdir = systemd_dep.get_variable(pkgconfig: 'systemduserunitdir',
pkgconfig_define: ['prefix', session_prefix])
@@ -130,6 +134,7 @@ summary_options = {
'Use *_DISABLE_DEPRECATED': get_option('deprecation_flags'),
'Build Docbook': get_option('docbook'),
'Build manpages': get_option('man'),
+ 'Systemd Integration': get_option('systemd'),
'Systemd Units Directory': systemd_userunitdir,
}
diff --git a/meson_options.txt b/meson_options.txt
index e1d1afae..bca3e40d 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('systemd', type: 'boolean', value: true, description: 'Systemd integration, leader, etc.')
option('systemduserunitdir', type: 'string', description: 'Directory for systemd user service files')
option('docbook', type: 'boolean', value: true, description: 'build documentation')
option('man', type: 'boolean', value: true, description: 'build documentation (requires xmlto)')
diff --git a/tools/meson.build b/tools/meson.build
index c453093e..fb09020d 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -1,10 +1,13 @@
programs = [
# name, deps, install_dir
- ['gnome-session-ctl', session_bin_deps, session_libexecdir],
['gnome-session-inhibit', session_deps, session_bindir],
['gnome-session-quit', session_deps, session_bindir],
]
+if get_option('systemd')
+ programs += [['gnome-session-ctl', session_bin_deps, session_libexecdir]]
+endif
+
foreach program: programs
executable(
program[0],
--
2.53.0
|