[pacman-dev] [PATCH] Make bash-completion optional
Wouter Wijsman
wwijsman at live.nl
Thu May 7 18:45:05 UTC 2020
The bash completion files were the only reason pacman was not able to
build as a non-root user. This patch adds the option to not install
these files. This was needed for my use case, hopefully upstream someone
else has a use for it as well.
Signed-off-by: Wouter Wijsman <wwijsman at live.nl>
---
meson_options.txt | 3 +++
scripts/meson.build | 44 +++++++++++++++++++++++---------------------
2 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/meson_options.txt b/meson_options.txt
index 4d8cc300..2927cd15 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -51,6 +51,9 @@ option('gpgme', type : 'feature', value : 'auto',
option('i18n', type : 'boolean', value : true,
description : 'enable localization of pacman, libalpm and scripts')
+option('bash-completion', type : 'boolean', value : true,
+ description : 'install bash-completion files')
+
# tools
option('file-seccomp', type: 'feature', value: 'auto',
description: 'determine whether file is seccomp-enabled')
diff --git a/scripts/meson.build b/scripts/meson.build
index d2466523..12262e98 100644
--- a/scripts/meson.build
+++ b/scripts/meson.build
@@ -68,25 +68,27 @@ configure_file(
output : '@BASENAME@',
install_dir : join_paths(DATAROOTDIR, 'pkgconfig'))
-custom_target(
- 'bash_completion',
- command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
- input : 'completion/bash_completion.in',
- output : 'pacman',
- install : true,
- install_dir : BASHCOMPDIR)
-
-foreach symlink : ['pacman-key', 'makepkg']
- meson.add_install_script(MESON_MAKE_SYMLINK,
- 'pacman',
- join_paths(BASHCOMPDIR, symlink))
-endforeach
+if get_option('bash-completion')
+ custom_target(
+ 'bash_completion',
+ command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
+ input : 'completion/bash_completion.in',
+ output : 'pacman',
+ install : true,
+ install_dir : BASHCOMPDIR)
-zsh_completion_dir = join_paths(DATAROOTDIR, 'zsh/site-functions')
-custom_target(
- 'zsh_completion',
- command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
- input : 'completion/zsh_completion.in',
- output : '_pacman',
- install : true,
- install_dir : zsh_completion_dir)
+ foreach symlink : ['pacman-key', 'makepkg']
+ meson.add_install_script(MESON_MAKE_SYMLINK,
+ 'pacman',
+ join_paths(BASHCOMPDIR, symlink))
+ endforeach
+
+ zsh_completion_dir = join_paths(DATAROOTDIR, 'zsh/site-functions')
+ custom_target(
+ 'zsh_completion',
+ command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
+ input : 'completion/zsh_completion.in',
+ output : '_pacman',
+ install : true,
+ install_dir : zsh_completion_dir)
+endif
--
2.20.1
More information about the pacman-dev
mailing list