meson: use template to declare udev plugins

This commit is contained in:
Yu Watanabe 2023-06-26 05:01:03 +09:00
parent 12b4cffdae
commit adedcd39a8
2 changed files with 52 additions and 35 deletions

View file

@ -116,6 +116,13 @@ libudevd_core = static_library(
userspace],
build_by_default : false)
udev_plugin_template = executable_template + {
'public' : true,
'link_with' : udev_link_with,
'install_rpath' : udev_rpath,
'install_dir' : udevlibexecdir,
}
executables += [
executable_template + {
'name' : 'udevadm',
@ -131,41 +138,50 @@ executables += [
],
'install_rpath' : udev_rpath,
},
udev_plugin_template + {
'name' : 'ata_id',
'sources' : files('ata_id/ata_id.c'),
},
udev_plugin_template + {
'name' : 'cdrom_id',
'sources' : files('cdrom_id/cdrom_id.c'),
},
udev_plugin_template + {
'name' : 'dmi_memory_id',
'conditions' : ['HAVE_DMI'],
'sources' : files('dmi_memory_id/dmi_memory_id.c'),
},
udev_plugin_template + {
'name' : 'fido_id',
'sources' : files(
'fido_id/fido_id.c',
'fido_id/fido_id_desc.c',
),
},
udev_plugin_template + {
'name' : 'iocost',
'sources' : files('iocost/iocost.c'),
},
udev_plugin_template + {
'name' : 'mtd_probe',
'sources' : files(
'mtd_probe/mtd_probe.c',
'mtd_probe/probe_smartmedia.c',
),
},
udev_plugin_template + {
'name' : 'scsi_id',
'sources' : files(
'scsi_id/scsi_id.c',
'scsi_id/scsi_serial.c',
),
},
udev_plugin_template + {
'name' : 'v4l_id',
'sources' : files('v4l_id/v4l_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'],
['iocost/iocost.c'],
['scsi_id/scsi_id.c',
'scsi_id/scsi_serial.c'],
['v4l_id/v4l_id.c'],
['mtd_probe/mtd_probe.c',
'mtd_probe/probe_smartmedia.c']]
if conf.get('HAVE_DMI') == 1
udev_progs += [['dmi_memory_id/dmi_memory_id.c']]
endif
udev_prog_paths = {}
foreach prog : udev_progs
name = fs.stem(prog[0])
exe = executable(
name,
prog,
include_directories : includes,
dependencies : [userspace],
link_with : udev_link_with,
install_rpath : udev_rpath,
install : true,
install_dir : udevlibexecdir)
udev_prog_paths += {name : exe}
public_programs += exe
endforeach
meson.add_install_script(meson_make_symlink,
bindir / 'udevadm',
libexecdir / 'systemd-udevd')

View file

@ -258,6 +258,7 @@ endif
if want_tests != 'false' and conf.get('HAVE_DMI') == 1
udev_dmi_memory_id_test = find_program('udev-dmi-memory-id-test.sh')
exe = executables_by_name.get('dmi_memory_id')
if git.found() and fs.is_dir(project_source_root / '.git')
out = run_command(
@ -276,10 +277,10 @@ if want_tests != 'false' and conf.get('HAVE_DMI') == 1
test('dmidecode_' + fs.stem(p),
udev_dmi_memory_id_test,
suite : 'dist',
args : [udev_prog_paths['dmi_memory_id'].full_path(),
args : [exe.full_path(),
source,
source + '.txt'],
depends : udev_prog_paths['dmi_memory_id'])
depends : exe)
endforeach
endif