From 79abb94656850d9e1dee50c8ff6a2900252f2c81 Mon Sep 17 00:00:00 2001 From: artoo Date: Wed, 30 Sep 2026 21:13:51 +0200 Subject: [PATCH] udev standalone --- meson.build | 16 +++++++++--- meson_options.txt | 3 +++ rules.d/meson.build | 2 +- shell-completion/bash/meson.build | 42 ------------------------------- shell-completion/zsh/meson.build | 36 -------------------------- src/core/meson.build | 14 ++--------- src/hwdb/meson.build | 2 +- src/libudev/meson.build | 9 ++++++- src/udev/meson.build | 8 +++--- src/udev/udevd.c | 2 +- test/meson.build | 2 +- units/meson.build | 4 --- 12 files changed, 33 insertions(+), 107 deletions(-) diff --git a/meson.build b/meson.build index 2db5138147..93ad855395 100644 --- a/meson.build +++ b/meson.build @@ -103,6 +103,7 @@ standalone_binaries = get_option('standalone-binaries').split(',') if standalone_binaries == [''] standalone_binaries = [] endif +have_standalone_udev = get_option('standalone-udev') conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs')) @@ -135,7 +136,7 @@ includedir = prefixdir / get_option('includedir') datadir = prefixdir / get_option('datadir') localstatedir = '/' / get_option('localstatedir') -libexecdir = prefixdir / 'lib/systemd' +libexecdir = bindir libexecdir_to_bin = '../../bin/' pkglibdir = libdir / 'systemd' @@ -2133,7 +2134,7 @@ module_additional_kwargs = { # 'src/core' embeds a built-in copy of some unit files, so the unit file list # from 'units' must be defined first. -subdir('units') + # systemd-analyze requires 'libcore' subdir('src/core') # systemd-networkd requires 'libsystemd_network' @@ -2745,6 +2746,13 @@ install_data('LICENSE.GPL2', install_subdir('LICENSES', install_dir : docdir) +if have_standalone_udev + install_data('LICENSE.GPL2', + 'LICENSE.LGPL2.1', + install_tag : 'udev', + install_dir : datadir / 'doc/udev') +endif + ##################################################################### # Ensure that changes to the docs/ directory do not break the @@ -2960,10 +2968,10 @@ udev_targets = [] foreach bin : udev_binaries udev_targets += executables_by_name.get(bin, []) endforeach -alias_target('udev', buildable_rules, udev_targets, udev_units) +alias_target('udev', buildable_rules, udev_targets) if conf.get('ENABLE_HWDB') == 1 - alias_target('hwdb', auto_suspend_rules, executables_by_name.get('systemd-hwdb'), hwdb_units) + alias_target('hwdb', auto_suspend_rules, executables_by_name.get('udev-hwdb')) endif alt_time_epoch = run_command('date', '-Is', '-u', '-d', f'@@time_epoch@', check : false) diff --git a/meson_options.txt b/meson_options.txt index 007780664e..9df71f918a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -580,3 +580,6 @@ option('default-mountfsd-trusted-directories', type : 'boolean', value: false, option('default-oci-registry', type : 'string', value : 'docker.io', description : 'Default OCI registry name') + +option('standalone-udev', type : 'boolean', value : false, + description : 'build standalone version of udev') diff --git a/rules.d/meson.build b/rules.d/meson.build index b47bc781de..f965edaec0 100644 --- a/rules.d/meson.build +++ b/rules.d/meson.build @@ -2,6 +2,7 @@ install_data( 'README', + install_tag : 'udev', install_dir : udevrulesdir) rules = [ @@ -70,7 +71,6 @@ rules_in = [ ['50-udev-default.rules'], ['60-persistent-storage.rules'], ['64-btrfs.rules'], - ['99-systemd.rules'], ['70-uaccess.rules', conf.get('ENABLE_LOGIND') == 1 and conf.get('HAVE_ACL') == 1], ['71-seat.rules', conf.get('ENABLE_LOGIND') == 1], diff --git a/shell-completion/bash/meson.build b/shell-completion/bash/meson.build index 1b8000e8a2..0181111975 100644 --- a/shell-completion/bash/meson.build +++ b/shell-completion/bash/meson.build @@ -20,49 +20,7 @@ custom_target( install_dir : bashcompletiondir) foreach item : [ - ['bootctl', ''], - ['busctl', ''], - ['coredumpctl', 'ENABLE_COREDUMP'], - ['homectl', 'ENABLE_HOMED'], - ['hostnamectl', 'ENABLE_HOSTNAMED'], - ['importctl', 'ENABLE_IMPORTD'], - ['journalctl', ''], - ['kernel-install', 'ENABLE_KERNEL_INSTALL'], - ['localectl', 'ENABLE_LOCALED'], - ['loginctl', 'ENABLE_LOGIND'], - ['machinectl', 'ENABLE_MACHINED'], - ['networkctl', 'ENABLE_NETWORKD'], - ['oomctl', 'ENABLE_OOMD'], - ['portablectl', 'ENABLE_PORTABLED'], - ['resolvectl', 'ENABLE_RESOLVE'], - ['run0', ''], - ['storagectl', ''], - ['systemd-analyze', ''], - ['systemd-cat', ''], - ['systemd-cgls', ''], - ['systemd-cgtop', ''], - ['systemd-confext', 'ENABLE_SYSEXT'], - ['systemd-creds', ''], - ['systemd-cryptenroll', 'HAVE_LIBCRYPTSETUP'], - ['systemd-delta', ''], - ['systemd-detect-virt', ''], - ['systemd-dissect', 'HAVE_BLKID'], - ['systemd-hwdb', 'ENABLE_HWDB'], - ['systemd-id128', ''], - ['systemd-nspawn', 'ENABLE_NSPAWN'], - ['systemd-path', ''], - ['systemd-resolve', 'ENABLE_RESOLVE'], - ['systemd-run', ''], - ['systemd-sysext', 'ENABLE_SYSEXT'], - ['systemd-sysinstall', 'ENABLE_SYSINSTALL'], - ['systemd-sysupdate', 'ENABLE_SYSUPDATE'], - ['systemd-vmspawn', 'ENABLE_VMSPAWN'], - ['systemd-vpick', ''], - ['timedatectl', 'ENABLE_TIMEDATED'], ['udevadm', ''], - ['updatectl', 'ENABLE_SYSUPDATED'], - ['userdbctl', 'ENABLE_USERDB'], - ['varlinkctl', ''], ] if item[1] == '' or conf.get(item[1]) == 1 diff --git a/shell-completion/zsh/meson.build b/shell-completion/zsh/meson.build index e8add29e82..5758d95479 100644 --- a/shell-completion/zsh/meson.build +++ b/shell-completion/zsh/meson.build @@ -15,43 +15,7 @@ custom_target( install_dir : zshcompletiondir) foreach item : [ - ['_bootctl', ''], - ['_busctl', ''], - ['_coredumpctl', 'ENABLE_COREDUMP'], - ['_hostnamectl', 'ENABLE_HOSTNAMED'], - ['_journalctl', ''], - ['_kernel-install', 'ENABLE_KERNEL_INSTALL'], - ['_localectl', 'ENABLE_LOCALED'], - ['_loginctl', 'ENABLE_LOGIND'], - ['_machinectl', 'ENABLE_MACHINED'], - ['_networkctl', 'ENABLE_NETWORKD'], - ['_oomctl', 'ENABLE_OOMD'], - ['_resolvectl', 'ENABLE_RESOLVE'], - ['_run0', ''], - ['_sd_bus_address', ''], - ['_sd_hosts_or_user_at_host', ''], - ['_sd_machines', 'ENABLE_MACHINED'], - ['_sd_outputmodes', ''], - ['_sd_unit_files', ''], - ['_storagectl', ''], - ['_systemd', ''], - ['_systemd-analyze', ''], - ['_systemd-cryptenroll', 'HAVE_LIBCRYPTSETUP'], - ['_systemd-delta', ''], - ['_systemd-hwdb', 'ENABLE_HWDB'], - ['_systemd-id128', ''], - ['_systemd-inhibit', 'ENABLE_LOGIND'], - ['_systemd-nspawn', ''], - ['_systemd-path', ''], - ['_systemd-run', ''], - ['_systemd-sysinstall', 'ENABLE_SYSINSTALL'], - ['_systemd-sysupdate', 'ENABLE_SYSUPDATE'], - ['_systemd-tmpfiles', 'ENABLE_TMPFILES'], - ['_timedatectl', 'ENABLE_TIMEDATED'], ['_udevadm', ''], - ['_updatectl', 'ENABLE_SYSUPDATED'], - ['_userdbctl', ''], - ['_varlinkctl', ''], ] if item[1] == '' or conf.get(item[1]) == 1 diff --git a/src/core/meson.build b/src/core/meson.build index e8d6563803..ccb720edf2 100644 --- a/src/core/meson.build +++ b/src/core/meson.build @@ -135,12 +135,6 @@ load_fragment_gperf_nulstr_c = custom_target( command : [awk, '-f', '@INPUT0@', '@INPUT1@'], capture : true) -generate_builtin_units = files('generate-builtin-units.py') -builtin_units_inc = custom_target( - input : [generate_builtin_units, embedded_units], - output : 'builtin-units.inc', - command : [python, generate_builtin_units, embedded_units], - capture : true) generate_bpf_delegate_configs = files('generate-bpf-delegate-configs.py') bpf_delegate_configs_inc = custom_target( @@ -162,8 +156,8 @@ bpf_delegate_xml = custom_target( capture : true) man_page_depends += bpf_delegate_xml -generated_sources += [load_fragment_gperf_c, load_fragment_gperf_nulstr_c, bpf_delegate_configs_inc, builtin_units_inc] -libcore_sources += [load_fragment_gperf_c, load_fragment_gperf_nulstr_c, bpf_delegate_configs_inc, builtin_units_inc] +generated_sources += [load_fragment_gperf_c, load_fragment_gperf_nulstr_c, bpf_delegate_configs_inc] +libcore_sources += [load_fragment_gperf_c, load_fragment_gperf_nulstr_c, bpf_delegate_configs_inc] libcore_build_dir = meson.current_build_dir() libcore_name = 'systemd-core-@0@'.format(shared_lib_tag) core_includes = [include_directories('.'), includes] @@ -334,10 +328,6 @@ if install_sysconfdir install_dir : sysconfdir / 'xdg/systemd') endif -assert(fs.parent(sbindir) / 'lib/systemd' == libexecdir) -install_symlink('init', - pointing_to : '../lib/systemd/systemd', - install_dir : sbindir) ############################################################ diff --git a/src/hwdb/meson.build b/src/hwdb/meson.build index cb1d3562bd..064b55192b 100644 --- a/src/hwdb/meson.build +++ b/src/hwdb/meson.build @@ -2,7 +2,7 @@ executables += [ executable_template + { - 'name' : 'systemd-hwdb', + 'name' : 'udev-hwdb', 'public' : true, 'conditions' : ['ENABLE_HWDB'], 'sources' : files('hwdb.c'), diff --git a/src/libudev/meson.build b/src/libudev/meson.build index 854628aed4..ffed0018e6 100644 --- a/src/libudev/meson.build +++ b/src/libudev/meson.build @@ -25,6 +25,13 @@ libudev_sym_path = libudev_dir_path / 'libudev.sym' install_headers('libudev.h') libudev_h_path = libudev_dir_path / 'libudev.h' +if have_standalone_udev + install_data( + libudev_h_path, + install_dir: includedir, + install_tag: 'libudev-devel') +endif + libudev_basic = static_library( 'udev-basic', libudev_sources, @@ -42,5 +49,5 @@ libudev_pc = custom_target( output : 'libudev.pc', command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : pkgconfiglibdir != 'no', - install_tag : 'devel', + install_tag : 'libudev-devel', install_dir : pkgconfiglibdir) diff --git a/src/udev/meson.build b/src/udev/meson.build index 15d140398b..a6032f57c4 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -244,9 +244,9 @@ executables += [ }, ] -install_symlink('systemd-udevd', - pointing_to : libexecdir_to_bin + 'udevadm', - install_dir : libexecdir, +install_symlink('udevd', + pointing_to : bindir / 'udevadm', + install_dir : bindir, install_tag : 'udev') if install_sysconfdir_samples @@ -263,7 +263,7 @@ udev_pc = custom_target( output : 'udev.pc', command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], install : pkgconfigdatadir != 'no', - install_tag : 'devel', + install_tag : 'udev-devel', install_dir : pkgconfigdatadir) if install_sysconfdir diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 593eee89b8..1e11406e92 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -67,7 +67,7 @@ int run_udevd(int argc, char *argv[]) { if (arg_daemonize) { pid_t pid; - log_info("Starting systemd-udevd version " GIT_VERSION); + log_info("Starting udevd version " GIT_VERSION); /* connect /dev/null to stdin, stdout, stderr */ if (log_get_max_level() < LOG_DEBUG) { diff --git a/test/meson.build b/test/meson.build index d58ff3a637..202295db40 100644 --- a/test/meson.build +++ b/test/meson.build @@ -40,7 +40,7 @@ endif ############################################################ if want_tests != 'false' and conf.get('ENABLE_HWDB') == 1 - exe = executables_by_name.get('systemd-hwdb') + exe = executables_by_name.get('udev-hwdb') test('hwdb-test', files('hwdb-test.sh'), suite : 'dist', diff --git a/units/meson.build b/units/meson.build index 9f8f8d0e41..bae7b105b4 100644 --- a/units/meson.build +++ b/units/meson.build @@ -1174,10 +1174,6 @@ foreach unit : units install_tag : unit.get('install_tag', '')) endif - if name in embedded_unit_names - # Embed either the processed output or the original file. - embedded_units += needs_jinja ? processed : source - endif if install foreach target : unit.get('symlinks', []) -- 2.55.0