From: Zbigniew Jędrzejewski-Szmek Date: Thu, 9 Oct 2025 12:53:22 +0000 (+0200) Subject: meson: stop probing for paths of programs in /usr/sbin X-Git-Tag: v259-rc1~335 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3f32b941b50dea7e319dcd43f311b4504a0980b;p=thirdparty%2Fsystemd.git meson: stop probing for paths of programs in /usr/sbin We dropped support for split-usr a while ago, which means that the programs will be in /usr/sbin, which actually may be the same as /usr/bin on merged-bin systems. So the whole checking is mostly pointless in the usual case. OTOH, on Nix the paths will be totally different and need to be set through the option anyway. So save time during builds by using the "fallback" path unless the option is specified. This avoid some busywork during the slow serial build phase. --- diff --git a/meson.build b/meson.build index c67e7b6c30d..6f378315367 100644 --- a/meson.build +++ b/meson.build @@ -629,33 +629,34 @@ stat = find_program('stat') ln_s = ln.full_path() + ' -frsT -- "${DESTDIR:-}@0@" "${DESTDIR:-}@1@"' -# If -Dxxx-path option is found, use that. Otherwise, check in $PATH, -# /usr/sbin, /sbin, and fall back to the default from middle column. -progs = [['quotaon', '/usr/sbin/quotaon' ], - ['quotacheck', '/usr/sbin/quotacheck' ], +# If -Dxxx-path option is found, use that. Otherwise, use the default from the +# middle column; a full path is used directly, a relative path is converted to +# /usr/bin/foo or /usr/sbin/foo, depending on whether split-bin is enabled. +progs = [['quotaon', 'quotaon' ], + ['quotacheck', 'quotacheck' ], ['kmod', '/usr/bin/kmod' ], - ['kexec', '/usr/sbin/kexec' ], - ['sulogin', '/usr/sbin/sulogin' ], - ['swapon', '/usr/sbin/swapon' ], - ['swapoff', '/usr/sbin/swapoff' ], - ['agetty', '/usr/sbin/agetty' ], + ['kexec', 'kexec' ], + ['sulogin', 'sulogin' ], + ['swapon', 'swapon' ], + ['swapoff', 'swapoff' ], + ['agetty', 'agetty' ], ['mount', '/usr/bin/mount', 'MOUNT_PATH'], ['umount', '/usr/bin/umount', 'UMOUNT_PATH'], ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'], ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'], - ['nologin', '/usr/sbin/nologin', ], + ['nologin', 'nologin', ], ] foreach prog : progs path = get_option(prog[0] + '-path') - if path != '' - message('Using @1@ for @0@'.format(prog[0], path)) - else - exe = find_program(prog[0], - '/usr/sbin/' + prog[0], - '/sbin/' + prog[0], - required: false) - path = exe.found() ? exe.full_path() : prog[1] + if path == '' + if prog[1].startswith('/') + path = prog[1] + else + path = '/usr' / (split_bin ? 'sbin' : 'bin') / prog[1] + endif endif + message('Using @1@ for @0@'.format(prog[0], path)) + name = prog.length() > 2 ? prog[2] : prog[0].to_upper() conf.set_quoted(name, path) endforeach