Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 22d5d82

Browse files
committedFeb 21, 2024··
meson.build: fix paths to knot-dns libs if exec_prefix != prefix
Man, this is complicated. But I hope that this one will really be reliable, with `sh` and `wc` being present in basically every POSIX env.
1 parent 979cdc1 commit 22d5d82

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed
 

‎NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Knot Resolver 6.0.7 (2024-0m-dd)
44
Bugfixes
55
--------
66
- fix listening by interface name containing dashes (#900, !1500)
7+
- fix paths to knot-dns libs if exec_prefix != prefix (!1503)
78

89

910
Knot Resolver 6.0.6 (2024-02-13)

‎meson.build

+14-4
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,6 @@ conf_data.set_quoted('LIBDIR', lib_dir)
194194
conf_data.set_quoted('ROOTHINTS', root_hints)
195195
conf_data.set_quoted('LIBEXT', libext)
196196
conf_data.set_quoted('OPERATING_SYSTEM', host_machine.system())
197-
conf_data.set_quoted('libzscanner_SONAME',
198-
libzscanner.get_pkgconfig_variable('libdir') / libzscanner.get_pkgconfig_variable('soname'))
199-
conf_data.set_quoted('libknot_SONAME',
200-
libknot.get_pkgconfig_variable('libdir') / libknot.get_pkgconfig_variable('soname'))
201197
conf_data.set('ENABLE_LIBSYSTEMD', libsystemd.found().to_int())
202198
conf_data.set('ENABLE_SENDMMSG', sendmmsg.to_int())
203199
conf_data.set('ENABLE_XDP', xdp.to_int())
@@ -211,6 +207,20 @@ else
211207
conf_data.set('DBG_ASSERTION_FORK', '(5 * 60 * 1000) /* five minutes */')
212208
endif
213209

210+
# Getting *runtime* path to knot-dns libs is surprisingly difficult.
211+
# Partially it's because meson isn't meant for general-purpose programming.
212+
foreach libname, lib: { 'libknot': libknot, 'libzscanner': libzscanner }
213+
l = lib.get_pkgconfig_variable('libdir')
214+
p = lib.get_pkgconfig_variable('prefix')
215+
ep = lib.get_pkgconfig_variable('exec_prefix')
216+
if ep != p
217+
p_len = run_command('sh', '-c', 'echo "' + p + '" | wc -c', check: true).stdout().to_int()
218+
assert(l.startswith(p))
219+
l = ep / l.substring(p_len)
220+
endif
221+
conf_data.set_quoted(libname + '_SONAME', l / lib.get_pkgconfig_variable('soname'))
222+
endforeach
223+
214224
kresconfig = configure_file(
215225
output: 'kresconfig.h',
216226
configuration: conf_data,

0 commit comments

Comments
 (0)
Please sign in to comment.