Add D-Bus and systemd service files

This commit is contained in:
Aleksei Bavshin 2020-04-10 01:48:41 -07:00 committed by GitHub
parent ccc8a31568
commit ea98281d0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 1 deletions

View file

@ -0,0 +1,8 @@
[Unit]
Description=Portal service (wlroots implementation)
[Service]
Type=dbus
BusName=org.freedesktop.impl.portal.desktop.wlr
ExecStart=@libexecdir@/xdg-desktop-portal-wlr
Restart=on-failure

View file

@ -3,7 +3,7 @@ project(
'c', 'c',
version: '0.0.0', version: '0.0.0',
license: 'MIT', license: 'MIT',
meson_version: '>=0.46.0', meson_version: '>=0.47.0',
default_options: [ default_options: [
'c_std=c11', 'c_std=c11',
'warning_level=2', 'warning_level=2',
@ -60,6 +60,35 @@ executable(
], ],
include_directories: [inc], include_directories: [inc],
install: true, install: true,
install_dir: get_option('libexecdir'),
)
conf_data = configuration_data()
conf_data.set('libexecdir',
join_paths(get_option('prefix'), get_option('libexecdir')))
conf_data.set('systemd_service', '')
systemd = dependency('systemd', required: get_option('systemd'))
if systemd.found()
systemd_service_file = 'xdg-desktop-portal-wlr.service'
user_unit_dir = systemd.get_pkgconfig_variable('systemduserunitdir',
define_variable: ['prefix', get_option('prefix')])
conf_data.set('systemd_service', 'SystemdService=' + systemd_service_file)
configure_file(
configuration: conf_data,
input: 'contrib/systemd/' + systemd_service_file + '.in',
output: '@BASENAME@',
install_dir: user_unit_dir,
)
endif
configure_file(
configuration: conf_data,
input: 'org.freedesktop.impl.portal.desktop.wlr.service.in',
output: '@BASENAME@',
install_dir: join_paths(get_option('datadir'), 'dbus-1', 'services'),
) )
install_data( install_data(

1
meson_options.txt Normal file
View file

@ -0,0 +1 @@
option('systemd', type: 'feature', value: 'auto', description: 'Install systemd user service unit')

View file

@ -0,0 +1,4 @@
[D-BUS Service]
Name=org.freedesktop.impl.portal.desktop.wlr
Exec=@libexecdir@/xdg-desktop-portal-wlr
@systemd_service@