From: Emil Velikov Date: Thu, 24 Oct 2024 12:46:47 +0000 (+0100) Subject: meson: disable automatic shell completion on prefix missmatch X-Git-Tag: v34~165 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cea524a659c350a3f78c5aca0167f868573c92de;p=thirdparty%2Fkmod.git meson: disable automatic shell completion on prefix missmatch Currently one can choose a prefix completely different from the one bash-completion and fish use, as per their pkg-config file. In such cases, flag a warning and disable it. People can always manually provide the completion directory/ies to re-enable. $ meson setup --prefix=/tmp/example build/ ... WARNING: User provided prefix '/tmp/example' differs from bash-completion one '/usr'. Disabling completion. ... WARNING: User provided prefix '/tmp/example' differs from fish one '/usr'. Disabling completion. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/209 Signed-off-by: Lucas De Marchi --- diff --git a/meson.build b/meson.build index 3a714609..17978338 100644 --- a/meson.build +++ b/meson.build @@ -240,7 +240,16 @@ foreach tuple : _completiondirs if completiondir == '' completion = dependency(pkg_dep, required : false) if completion.found() - completiondir = completion.get_variable(pkgconfig : 'completionsdir') + completion_prefix = completion.get_variable(pkgconfig : 'prefix') + if completion_prefix != prefixdir + warning('User provided prefix \'@0@\' differs from @1@ one \'@2@\'.' + .format(prefixdir, pkg_dep, completion_prefix)) + warning('Not installing completion. To re-enable, manually set @0@.' + .format(dir_option)) + completiondir = 'no' + else + completiondir = completion.get_variable(pkgconfig : 'completionsdir') + endif else completiondir = datadir / def_path endif