From: Yu Watanabe Date: Sun, 25 Jun 2023 20:01:03 +0000 (+0900) Subject: meson: use template to declare udev plugins X-Git-Tag: v255-rc1~832^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=adedcd39a8a49360875258fbca559b4467d68884;p=thirdparty%2Fsystemd.git meson: use template to declare udev plugins --- diff --git a/src/udev/meson.build b/src/udev/meson.build index 2c100959412..bc5c859845f 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -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') diff --git a/test/meson.build b/test/meson.build index d57736e739d..99f50828a3c 100644 --- a/test/meson.build +++ b/test/meson.build @@ -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