1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-25 21:57:32 +03:00

meson: add install tags for udev and hwdb

Allows building and installing them individually, like
other existing components
This commit is contained in:
Luca Boccassi 2025-01-09 21:37:26 +00:00 committed by Yu Watanabe
parent 96403d5121
commit 8442ac9c02
7 changed files with 50 additions and 17 deletions

View File

@ -135,6 +135,9 @@ $CC --version
meson --version meson --version
ninja --version ninja --version
# TODO: drop once minimum meson version is bumped to 0.62 or newer
find . -type f -name meson.build -exec sed -i 's/install_emptydir(\(.*\), install_tag : .*)/install_emptydir(\1)/g' '{}' '+'
for args in "${ARGS[@]}"; do for args in "${ARGS[@]}"; do
SECONDS=0 SECONDS=0

View File

@ -32,6 +32,8 @@ function info() {
} }
function run_meson() { function run_meson() {
# TODO: drop once minimum meson version is bumped to 0.62 or newer
find . -type f -name meson.build -exec sed -i 's/install_emptydir(\(.*\), install_tag : .*)/install_emptydir(\1)/g' '{}' '+'
if ! meson "$@"; then if ! meson "$@"; then
find . -type f -name meson-log.txt -exec cat '{}' + find . -type f -name meson-log.txt -exec cat '{}' +
return 1 return 1

View File

@ -45,17 +45,20 @@ if conf.get('ENABLE_HWDB') == 1
command : make_autosuspend_rules_py, command : make_autosuspend_rules_py,
capture : true, capture : true,
install : true, install : true,
install_dir: udevhwdbdir) install_dir: udevhwdbdir,
install_tag: 'hwdb')
install_data(hwdb_files_notest, install_data(hwdb_files_notest,
hwdb_files_test, hwdb_files_test,
install_dir : udevhwdbdir) install_dir : udevhwdbdir,
install_tag: 'hwdb')
if install_sysconfdir if install_sysconfdir
install_emptydir(sysconfdir / 'udev/hwdb.d') install_emptydir(sysconfdir / 'udev/hwdb.d', install_tag : 'hwdb')
meson.add_install_script(sh, '-c', meson.add_install_script(sh, '-c',
'test -n "$DESTDIR" || @0@/systemd-hwdb update'.format(bindir)) 'test -n "$DESTDIR" || @0@/systemd-hwdb update'.format(bindir),
install_tag: 'hwdb')
endif endif
if want_tests != 'false' if want_tests != 'false'

View File

@ -49,7 +49,8 @@ all_rules = []
foreach tuple : rules foreach tuple : rules
if tuple.length() == 1 or tuple[1] if tuple.length() == 1 or tuple[1]
install_data(tuple[0], install_data(tuple[0],
install_dir : udevrulesdir) install_dir : udevrulesdir,
install_tag : 'udev')
all_rules += tuple[0] all_rules += tuple[0]
endif endif
endforeach endforeach
@ -76,7 +77,8 @@ foreach tuple : rules_in
output: tuple[0], output: tuple[0],
command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
install : want, install : want,
install_dir : udevrulesdir) install_dir : udevrulesdir,
install_tag : 'udev')
if want if want
all_rules += rule all_rules += rule

View File

@ -8,5 +8,6 @@ executables += [
'sources' : files('hwdb.c'), 'sources' : files('hwdb.c'),
'link_with' : udev_link_with, 'link_with' : udev_link_with,
'install_rpath' : udev_rpath, 'install_rpath' : udev_rpath,
'install_tag' : 'hwdb',
}, },
] ]

View File

@ -132,6 +132,7 @@ udev_plugin_template = executable_template + {
'link_with' : udev_link_with, 'link_with' : udev_link_with,
'install_rpath' : udev_rpath, 'install_rpath' : udev_rpath,
'install_dir' : udevlibexecdir, 'install_dir' : udevlibexecdir,
'install_tag' : 'udev',
} }
udev_common_template = { udev_common_template = {
@ -155,6 +156,7 @@ executables += [
'link_with' : [libudevd_core], 'link_with' : [libudevd_core],
'dependencies' : udev_dependencies, 'dependencies' : udev_dependencies,
'install_rpath' : udev_rpath, 'install_rpath' : udev_rpath,
'install_tag' : 'udev',
}, },
udev_plugin_template + { udev_plugin_template + {
'name' : 'ata_id', 'name' : 'ata_id',
@ -254,13 +256,16 @@ executables += [
] ]
meson.add_install_script(sh, '-c', ln_s.format(bindir / 'udevadm', meson.add_install_script(sh, '-c', ln_s.format(bindir / 'udevadm',
libexecdir / 'systemd-udevd')) libexecdir / 'systemd-udevd'),
install_tag : 'udev')
if install_sysconfdir_samples if install_sysconfdir_samples
install_data('udev.conf', install_data('udev.conf',
install_dir : configfiledir / 'udev') install_dir : configfiledir / 'udev',
install_tag : 'udev')
install_data('iocost/iocost.conf', install_data('iocost/iocost.conf',
install_dir : configfiledir / 'udev') install_dir : configfiledir / 'udev',
install_tag : 'udev')
endif endif
udev_pc = custom_target( udev_pc = custom_target(
@ -273,5 +278,5 @@ udev_pc = custom_target(
install_dir : pkgconfigdatadir) install_dir : pkgconfigdatadir)
if install_sysconfdir if install_sysconfdir
install_emptydir(sysconfdir / 'udev/rules.d') install_emptydir(sysconfdir / 'udev/rules.d', install_tag : 'udev')
endif endif

View File

@ -102,6 +102,7 @@ units = [
{ {
'file' : 'initrd-udevadm-cleanup-db.service', 'file' : 'initrd-udevadm-cleanup-db.service',
'conditions' : ['ENABLE_INITRD'], 'conditions' : ['ENABLE_INITRD'],
'install_tag' : 'udev',
}, },
{ {
'file' : 'initrd-usr-fs.target', 'file' : 'initrd-usr-fs.target',
@ -365,6 +366,7 @@ units = [
'file' : 'systemd-hwdb-update.service.in', 'file' : 'systemd-hwdb-update.service.in',
'conditions' : ['ENABLE_HWDB'], 'conditions' : ['ENABLE_HWDB'],
'symlinks' : ['sysinit.target.wants/'], 'symlinks' : ['sysinit.target.wants/'],
'install_tag' : 'hwdb',
}, },
{ {
'file' : 'systemd-hybrid-sleep.service.in', 'file' : 'systemd-hybrid-sleep.service.in',
@ -718,27 +720,38 @@ units = [
'conditions' : ['ENABLE_TMPFILES'], 'conditions' : ['ENABLE_TMPFILES'],
'symlinks' : ['sysinit.target.wants/'], 'symlinks' : ['sysinit.target.wants/'],
}, },
{ 'file' : 'systemd-udev-load-credentials.service' }, {
{ 'file' : 'systemd-udev-settle.service' }, 'file' : 'systemd-udev-load-credentials.service',
'install_tag' : 'udev',
},
{
'file' : 'systemd-udev-settle.service',
'install_tag' : 'udev',
},
{ {
'file' : 'systemd-udev-trigger.service', 'file' : 'systemd-udev-trigger.service',
'symlinks' : ['sysinit.target.wants/'], 'symlinks' : ['sysinit.target.wants/'],
'install_tag' : 'udev',
}, },
{ {
'file' : 'systemd-udevd-control.socket', 'file' : 'systemd-udevd-control.socket',
'symlinks' : ['sockets.target.wants/'], 'symlinks' : ['sockets.target.wants/'],
'install_tag' : 'udev',
}, },
{ {
'file' : 'systemd-udevd-kernel.socket', 'file' : 'systemd-udevd-kernel.socket',
'symlinks' : ['sockets.target.wants/'], 'symlinks' : ['sockets.target.wants/'],
'install_tag' : 'udev',
}, },
{ {
'file' : 'systemd-udevd-varlink.socket', 'file' : 'systemd-udevd-varlink.socket',
'symlinks' : ['sockets.target.wants/'], 'symlinks' : ['sockets.target.wants/'],
'install_tag' : 'udev',
}, },
{ {
'file' : 'systemd-udevd.service.in', 'file' : 'systemd-udevd.service.in',
'symlinks' : ['sysinit.target.wants/'], 'symlinks' : ['sysinit.target.wants/'],
'install_tag' : 'udev',
}, },
{ {
'file' : 'systemd-update-done.service.in', 'file' : 'systemd-update-done.service.in',
@ -848,23 +861,27 @@ foreach unit : units
output : name, output : name,
command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
install : install, install : install,
install_dir : systemunitdir) install_dir : systemunitdir,
install_tag : unit.get('install_tag', ''))
elif install elif install
install_data(source, install_data(source,
install_dir : systemunitdir) install_dir : systemunitdir,
install_tag : unit.get('install_tag', ''))
endif endif
if install if install
foreach target : unit.get('symlinks', []) foreach target : unit.get('symlinks', [])
if target.endswith('/') if target.endswith('/')
install_emptydir(systemunitdir / target) install_emptydir(systemunitdir / target, install_tag : unit.get('install_tag', ''))
meson.add_install_script(sh, '-c', meson.add_install_script(sh, '-c',
ln_s.format(systemunitdir / name, ln_s.format(systemunitdir / name,
systemunitdir / target / name)) systemunitdir / target / name),
install_tag : unit.get('install_tag', ''))
else else
meson.add_install_script(sh, '-c', meson.add_install_script(sh, '-c',
ln_s.format(systemunitdir / name, ln_s.format(systemunitdir / name,
systemunitdir / target)) systemunitdir / target),
install_tag : unit.get('install_tag', ''))
endif endif
endforeach endforeach
endif endif