meson: use maps for udev program paths

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-07-27 17:48:53 +02:00
parent 68e101da7a
commit 0b5f1bd49e
2 changed files with 21 additions and 21 deletions

View File

@ -115,7 +115,7 @@ libudevd_core = static_library(
link_with : udev_link_with,
dependencies : [libblkid, libkmod])
udev_id_progs = [['ata_id/ata_id.c'],
udev_progs = [['ata_id/ata_id.c'],
['cdrom_id/cdrom_id.c'],
['fido_id/fido_id.c',
'fido_id/fido_id_desc.c',
@ -131,26 +131,24 @@ udev_id_progs = [['ata_id/ata_id.c'],
dmi_arches = ['x86', 'x86_64', 'aarch64', 'arm', 'ia64', 'mips']
if dmi_arches.contains(host_machine.cpu_family())
udev_id_progs += [['dmi_memory_id/dmi_memory_id.c']]
udev_progs += [['dmi_memory_id/dmi_memory_id.c']]
endif
foreach prog : udev_id_progs
udev_prog_paths = {}
foreach prog : udev_progs
name = prog[0].split('/')[0]
exe = executable(
name,
prog,
include_directories : includes,
dependencies : [versiondep],
dependencies : versiondep,
link_with : udev_link_with,
install_rpath : udev_rpath,
install : true,
install_dir : udevlibexecdir)
# TODO: let's use a dictionary instead as soon as we can depend on meson >= 0.47.
if name == 'dmi_memory_id'
dmi_memory_id_path = exe.full_path()
endif
udev_prog_paths += {name : exe.full_path()}
endforeach
if install_sysconfdir_samples

View File

@ -145,7 +145,9 @@ if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family())
test(name,
udev_dmi_memory_id_test,
args : [dmi_memory_id_path, source, source + '.txt'])
args : [udev_prog_paths['dmi_memory_id'],
source,
source + '.txt'])
endforeach
endif