Skip to content

Commit

Permalink
meson.build: Allow skipping the systemd service
Browse files Browse the repository at this point in the history
  • Loading branch information
konradybcio committed Apr 9, 2024
1 parent 22e9076 commit e6b5997
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
32 changes: 20 additions & 12 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,32 @@ project('qrtr',
])

prefix = get_option('prefix')
systemd = dependency('systemd')

systemd_system_unit_dir = get_option('systemd-unit-prefix')
if systemd_system_unit_dir == ''
systemd_system_unit_dir = systemd.get_variable(
pkgconfig : 'systemdsystemunitdir',
install_systemd_unit = get_option('systemd-service')
systemd = dependency('systemd', required : install_systemd_unit)
if systemd.found()
systemd_system_unit_dir = get_option('systemd-unit-prefix')
if systemd_system_unit_dir == ''
systemd_system_unit_dir = systemd.get_variable(
pkgconfig : 'systemdsystemunitdir',
pkgconfig_define: ['prefix', prefix])
else
message('Could not resolve systemd dependencies, skipping unit file')
install_systemd_unit = false
endif
endif

inc = include_directories('include')
subdir('lib')
subdir('include')
subdir('src')

systemd_unit_conf = configuration_data()
systemd_unit_conf.set('prefix', prefix)
configure_file(
input : 'qrtr-ns.service.in',
output : 'qrtr-ns.service',
configuration : systemd_unit_conf,
install_dir : systemd_system_unit_dir)
if systemd.found()
systemd_unit_conf = configuration_data()
systemd_unit_conf.set('prefix', prefix)
configure_file(
input : 'qrtr-ns.service.in',
output : 'qrtr-ns.service',
configuration : systemd_unit_conf,
install_dir : systemd_system_unit_dir)
endif
6 changes: 6 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ option('systemd-unit-prefix',
type: 'string',
description: 'Directory for systemd system unit files'
)

option('systemd-service',
type: 'feature',
value: 'auto',
description: 'Whether or not the systemd service should be built'
)

0 comments on commit e6b5997

Please sign in to comment.