Skip to content

Commit 6c38116

Browse files
committed
build: allow building systemd unit files without systemd dependency
If systemd-unit-prefix is passed, there is no need for the systemd build dependency. Allows building in postmarketOS, where the build environment can't install systemd.
1 parent 408ca1e commit 6c38116

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

meson.build

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ prefix = get_option('prefix')
1313
zstd_dep = dependency('libzstd')
1414
add_project_arguments('-DHAVE_ZSTD', language : 'c')
1515

16-
# Not required to build the executable, only to install unit file
16+
# Not required to build the executable,
17+
# only to automatically retrieve the install dir for unit files
1718
systemd = dependency('systemd', required : false)
18-
if systemd.found()
19-
systemd_system_unit_dir = get_option('systemd-unit-prefix')
20-
if systemd_system_unit_dir == ''
21-
systemd_system_unit_dir = systemd.get_variable(
22-
pkgconfig : 'systemdsystemunitdir',
23-
pkgconfig_define: ['prefix', prefix])
24-
endif
19+
if get_option('systemd-unit-prefix') != ''
20+
systemd_system_unit_dir = get_option('systemd-unit-prefix')
21+
elif systemd.found()
22+
systemd_system_unit_dir = systemd.get_variable(
23+
pkgconfig : 'systemdsystemunitdir',
24+
pkgconfig_define: ['prefix', prefix])
2525
endif
2626

2727
qrtr_dep = dependency('qrtr')
@@ -34,7 +34,7 @@ executable('tqftpserv',
3434
dependencies : [qrtr_dep, zstd_dep],
3535
install : true)
3636

37-
if systemd.found()
37+
if systemd_system_unit_dir != ''
3838
systemd_unit_conf = configuration_data()
3939
systemd_unit_conf.set('prefix', prefix)
4040
configure_file(

0 commit comments

Comments
 (0)