diff --git a/meson.build b/meson.build index c67e7b6c30..6f37831536 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