Merge pull request #154 from Dudemanguy911/master

Add elogind support
This commit is contained in:
Drew DeVault 2017-09-22 13:26:02 -04:00 committed by GitHub
commit dc26f6a8f8
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 on systems without systemd)
* 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')