Add elogind support

Resolves SirCmpwn/wlroots#146
This commit is contained in:
dudemanguy 2017-09-22 12:02:55 -05:00
parent e5e6dab7fd
commit 175f89f4ff
6 changed files with 22 additions and 3 deletions

View File

@ -25,6 +25,7 @@ Install dependencies:
* udev * udev
* pixman * pixman
* systemd (optional, for logind support) * systemd (optional, for logind support)
* elogind (optional, for logind support)
* libcap (optional, for capability support) * libcap (optional, for capability support)
* asciidoc (optional, for man pages) * asciidoc (optional, for man pages)

View File

@ -28,9 +28,13 @@ if systemd.found()
backend_files += files('session/logind.c') backend_files += files('session/logind.c')
endif endif
if elogind.found()
backend_files += files('session/logind.c')
endif
lib_wlr_backend = static_library( lib_wlr_backend = static_library(
'wlr_backend', 'wlr_backend',
backend_files, backend_files,
include_directories: wlr_inc, include_directories: wlr_inc,
dependencies: [wayland_server, egl, gbm, libinput, systemd, wlr_protos], dependencies: [wayland_server, egl, gbm, libinput, systemd, elogind, wlr_protos],
) )

View File

@ -5,8 +5,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <systemd/sd-bus.h>
#include <systemd/sd-login.h>
#include <unistd.h> #include <unistd.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -15,6 +13,14 @@
#include <wlr/backend/session/interface.h> #include <wlr/backend/session/interface.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#ifdef HAS_SYSTEMD
#include <systemd/sd-bus.h>
#include <systemd/sd-login.h>
#elif HAS_ELOGIND
#include <elogind/sd-bus.h>
#include <elogind/sd-login.h>
#endif
enum { DRM_MAJOR = 226 }; enum { DRM_MAJOR = 226 };
const struct session_impl session_logind; const struct session_impl session_logind;

View File

@ -18,6 +18,8 @@ extern const struct session_impl session_direct;
static const struct session_impl *impls[] = { static const struct session_impl *impls[] = {
#ifdef HAS_SYSTEMD #ifdef HAS_SYSTEMD
&session_logind, &session_logind,
#elif HAS_ELOGIND
&session_logind,
#endif #endif
&session_direct, &session_direct,
NULL, NULL,

View File

@ -46,6 +46,7 @@ xcb = dependency('xcb')
xcb_composite = dependency('xcb-composite') xcb_composite = dependency('xcb-composite')
libcap = dependency('libcap', required: false) libcap = dependency('libcap', required: false)
systemd = dependency('libsystemd', required: false) systemd = dependency('libsystemd', required: false)
elogind = dependency('libelogind', required: false)
math = cc.find_library('m', required: false) math = cc.find_library('m', required: false)
if libcap.found() and get_option('enable_libcap') if libcap.found() and get_option('enable_libcap')
@ -56,6 +57,10 @@ if systemd.found() and get_option('enable_systemd')
add_project_arguments('-DHAS_SYSTEMD', language: 'c') add_project_arguments('-DHAS_SYSTEMD', language: 'c')
endif endif
if elogind.found() and get_option('enable_elogind')
add_project_arguments('-DHAS_ELOGIND', language: 'c')
endif
subdir('protocol') subdir('protocol')
subdir('backend') subdir('backend')
subdir('render') subdir('render')

View File

@ -1,2 +1,3 @@
option('enable_libcap', type: 'boolean', value: true, description: 'Enable support for capabilities') option('enable_libcap', type: 'boolean', value: true, description: 'Enable support for capabilities')
option('enable_systemd', type: 'boolean', value: true, description: 'Enable support for logind') option('enable_systemd', type: 'boolean', value: true, description: 'Enable support for logind')
option('enable_elogind', type: 'boolean', value: true, description: 'Enable support for logind')