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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-10-14 14:39:45 +02:00
committed by Daan De Meyer
parent a2890ce3e0
commit c3f32b941b
+19 -18
View File
@@ -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