Skip to content

Commit

Permalink
Update meson installer
Browse files Browse the repository at this point in the history
- Add systemd unit, installed by default
- Don't install dbus service by default
  • Loading branch information
gasinvein committed Jul 6, 2021
1 parent d423453 commit 0bc6791
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions data/com.feralinteractive.GameMode.service.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[D-BUS Service]
Name=com.feralinteractive.GameMode
Exec=@bindir@/tunedmode
@DBUS_SYSTEMD_SERVICE@
12 changes: 12 additions & 0 deletions data/tunedmode.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=GameMode to Tuned wrapper service
Requires=dbus.service
Conflicts=gamemoded.service

[Service]
Type=dbus
BusName=com.feralinteractive.GameMode
ExecStart=@bindir@/tunedmode

[Install]
WantedBy=default.target
26 changes: 25 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ datadir = join_paths(get_option('prefix'), get_option('datadir'))
conf = configuration_data()
conf.set('bindir', bindir)

if get_option('systemd').enabled()
conf.set('DBUS_SYSTEMD_SERVICE', 'SystemdService=tunedmode.service')
else
conf.set('DBUS_SYSTEMD_SERVICE', '')
endif

systemd = dependency('systemd', required: get_option('systemd').enabled())
if get_option('systemd_user_unit_dir') != ''
user_unit_dir = get_option('systemd_user_unit_dir')
elif systemd.found()
user_unit_dir = systemd.get_pkgconfig_variable('systemd_user_unit_dir')
else
user_unit_dir = join_paths(get_option('prefix'), 'lib', 'systemd', 'user')
endif

python.install_sources('tunedmode.py', pure: true)

configure_file(
Expand All @@ -24,9 +39,18 @@ configure_file(
install_mode: 'rwxr-xr-x'
)

configure_file(
input: 'data/tunedmode.service.in',
output: 'tunedmode.service',
configuration: conf,
install: get_option('systemd').enabled(),
install_dir: user_unit_dir,
)

configure_file(
input: 'data/com.feralinteractive.GameMode.service.in',
output: 'com.feralinteractive.GameMode.service',
configuration: conf,
install_dir: join_paths(datadir, 'dbus-1', 'services')
install: get_option('dbus_activation').enabled(),
install_dir: join_paths(datadir, 'dbus-1', 'services'),
)
3 changes: 3 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
option('systemd', type : 'feature', value : 'enabled')
option('systemd_user_unit_dir', type : 'string')
option('dbus_activation', type : 'feature', value : 'disabled')

0 comments on commit 0bc6791

Please sign in to comment.