From 8867ab9a223aaa22d844d6d7977e57b491a68c86 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 2 Jun 2022 10:13:55 +0100 Subject: [PATCH] meson: omit bash completion, with custom prefix In order for bash completions to work, they must be installed in the respective folder. Often that folder is writable only by root. In order words, using a command line the following now is successful, providing indicative warning message. meson builddir --prefix `pwd`/inst ... meson.build:140: WARNING: User provided prefix '.../inst' differs from bash-completion one '/usr'. Disabling completion. Reported-by: Pekka Paalanen Signed-off-by: Emil Velikov --- meson.build | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index f80f401..0ce413e 100644 --- a/meson.build +++ b/meson.build @@ -132,12 +132,22 @@ else endif dep_bash = dependency('bash-completion', required : false) +bashcompletiondir = '' if dep_bash.found() - bashcompletiondir = dep_bash.get_pkgconfig_variable('completionsdir') + prefixdir = get_option('prefix') + bash_prefix = dep_bash.get_pkgconfig_variable('prefix') + if prefixdir != bash_prefix + warning('User provided prefix \'@0@\' differs from bash-completion one \'@1@\'. ' + .format(prefixdir, bash_prefix) + 'Disabling completion.') + else + bashcompletiondir = dep_bash.get_pkgconfig_variable('completionsdir') + endif else bashcompletiondir = join_paths(get_option('datadir'), 'bash-completion/completions') endif -install_data('shell-completion/bash/wflinfo', install_dir : bashcompletiondir) +if bashcompletiondir != '' + install_data('shell-completion/bash/wflinfo', install_dir : bashcompletiondir) +endif zshcompletiondir = join_paths(get_option('datadir'), 'zsh/site-functions') install_data('shell-completion/zsh/_wflinfo', install_dir : zshcompletiondir) -- 2.11.4.GIT