Skip to content

Commit 41ee397

Browse files
committed
build: optionally install systemd service
If using a systemd based distro, it is useful to have the service file installed so that it properly integrates with the service manager. Certain distros are carrying around patches that accomplish this.
1 parent 2a06a34 commit 41ee397

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

.builds/alpine.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ sources:
1313
tasks:
1414
- setup: |
1515
cd mako
16-
meson build/ -Dauto_features=enabled -Dsd-bus-provider=libelogind
16+
meson build/ -Dauto_features=enabled -Dsd-bus-provider=libelogind -Dsystemd=disabled
1717
- build: |
1818
cd mako
1919
ninja -C build/

.builds/freebsd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ sources:
1515
tasks:
1616
- setup: |
1717
cd mako
18-
meson build/ -Dauto_features=enabled -Dsd-bus-provider=basu
18+
meson build/ -Dauto_features=enabled -Dsd-bus-provider=basu -Dsystemd=disabled
1919
- build: |
2020
cd mako
2121
ninja -C build/

fr.emersion.mako.service.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[D-BUS Service]
22
Name=org.freedesktop.Notifications
33
Exec=@bindir@/mako
4+
@systemd_service@

meson.build

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,20 @@ executable(
108108

109109
conf_data = configuration_data()
110110
conf_data.set('bindir', get_option('prefix') / get_option('bindir'))
111+
conf_data.set('systemd_service', '')
112+
113+
systemd = dependency('systemd', required: get_option('systemd'))
114+
if systemd.found()
115+
service_file = 'mako.service'
116+
user_unit_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir',
117+
pkgconfig_define: ['prefix', get_option('prefix')])
118+
conf_data.set('systemd_service', 'SystemdService=' + service_file)
119+
120+
install_data(
121+
'contrib' / 'systemd' / service_file,
122+
install_dir: user_unit_dir
123+
)
124+
endif
111125

112126
configure_file(
113127
configuration: conf_data,

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ option('man-pages', type: 'feature', value: 'auto', description: 'Generate and i
44
option('fish-completions', type: 'boolean', value: false, description: 'Install fish completions')
55
option('zsh-completions', type: 'boolean', value: false, description: 'Install zsh completions')
66
option('bash-completions', type: 'boolean', value: false, description: 'Install bash completions')
7+
option('systemd', type: 'feature', value: 'auto', description: 'Install systemd user service unit')

0 commit comments

Comments
 (0)