Add option to use elogind

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
This commit is contained in:
Stephan Lachnit 2020-04-25 00:08:31 +02:00 committed by afayaz-feral
parent 1e8312f7e3
commit 953792b4a5
4 changed files with 23 additions and 4 deletions

View File

@ -36,8 +36,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include "common-logging.h" #include "common-logging.h"
#include "common-pidfds.h" #include "common-pidfds.h"
#ifdef USE_ELOGIND
#include <elogind/sd-bus.h>
#include <elogind/sd-daemon.h>
#else
#include <systemd/sd-bus.h> #include <systemd/sd-bus.h>
#include <systemd/sd-daemon.h> #include <systemd/sd-daemon.h>
#endif
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>

View File

@ -17,6 +17,7 @@ gamemoded_includes += config_h_dir
gamemoded = executable( gamemoded = executable(
'gamemoded', 'gamemoded',
sources: daemon_sources, sources: daemon_sources,
c_args: elogind_args,
dependencies: [ dependencies: [
link_daemon_common, link_daemon_common,
dep_threads, dep_threads,

View File

@ -79,9 +79,22 @@ path_libdir = join_paths(path_prefix, get_option('libdir'))
path_libexecdir = join_paths(path_prefix, get_option('libexecdir')) path_libexecdir = join_paths(path_prefix, get_option('libexecdir'))
path_sysconfdir = join_paths(path_prefix, get_option('sysconfdir')) path_sysconfdir = join_paths(path_prefix, get_option('sysconfdir'))
# Find systemd via pkgconfig # Find systemd / elogind via pkgconfig
with_systemd = get_option('with-systemd') with_systemd = get_option('with-systemd')
dep_systemd = dependency('libsystemd') with_elogind = get_option('with-elogind')
elogind_args = []
dep_systemd = []
if with_systemd == true
if with_elogind == true
error('you can\'t use systemd and elogind at the same time')
endif
dep_systemd = dependency('libsystemd')
elif with_elogind == true
elogind_args += ['-DUSE_ELOGIND']
dep_systemd = dependency('libelogind')
else
error('you need to use either sd-bus.h from systemd or elogind')
endif
# For the client, libdbus is used # For the client, libdbus is used
dep_dbus = dependency('dbus-1') dep_dbus = dependency('dbus-1')

View File

@ -1,12 +1,12 @@
option('with-systemd', type: 'boolean', description: 'Use systemd support (unit, etc)', value: 'true')
# limits.d # limits.d
option('with-pam-group', type: 'string', description: 'Install the limits.d configuration file to allow renicing as an unpriviledged user being part of the specified group') option('with-pam-group', type: 'string', description: 'Install the limits.d configuration file to allow renicing as an unpriviledged user being part of the specified group')
# systemd specific # systemd specific
option('with-systemd', type: 'boolean', description: 'Use systemd support (unit, etc)', value: true)
option('with-systemd-user-unit-dir', type: 'string', description: 'Explicitly set the systemd user unit directory') option('with-systemd-user-unit-dir', type: 'string', description: 'Explicitly set the systemd user unit directory')
# Not using systemd # Not using systemd
option('with-elogind', type: 'boolean', description: 'Use elogind\'s Dbus library', value: false)
option('with-dbus-service-dir', type: 'string', description: 'Explicitly set the D-BUS session directory') option('with-dbus-service-dir', type: 'string', description: 'Explicitly set the D-BUS session directory')
# lib dir in gamemoderun # lib dir in gamemoderun