diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2020-01-21 23:03:58 -0500 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-01-22 18:05:29 +0100 |
commit | 03e8ce7b203d38278fa35482fb2f6cd198bbebf7 (patch) | |
tree | f87993f58c0a05dc585450d7afb205da1ca07897 | |
parent | fe558cf627787d00aea6c6b93d03750e0fdd081e (diff) | |
download | sway-03e8ce7b203d38278fa35482fb2f6cd198bbebf7.tar.xz |
completion: use pkg-config to get install location for bash/fish
Both shells provide pkg-config files which declare their designated
completionsdir. Use this as the primary source of truth.
-rw-r--r-- | meson.build | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/meson.build b/meson.build index 6efff3ed..ca0c791f 100644 --- a/meson.build +++ b/meson.build @@ -54,6 +54,8 @@ libinput = dependency('libinput', version: '>=1.6.0') systemd = dependency('libsystemd', version: '>=239', required: false) elogind = dependency('libelogind', version: '>=239', required: false) xcb = dependency('xcb', required: get_option('xwayland')) +bash_comp = dependency('bash-completion', required: false) +fish_comp = dependency('fish', required: false) math = cc.find_library('m') rt = cc.find_library('rt') @@ -260,7 +262,11 @@ if get_option('bash-completions') 'completions/bash/swaybar', 'completions/bash/swaymsg', ) - bash_install_dir = join_paths(datadir, 'bash-completion', 'completions') + if bash_comp.found() + bash_install_dir = bash_comp.get_pkgconfig_variable('completionsdir') + else + bash_install_dir = join_paths(datadir, 'bash-completion', 'completions') + endif install_data(bash_files, install_dir: bash_install_dir) endif @@ -271,7 +277,11 @@ if get_option('fish-completions') 'completions/fish/swaymsg.fish', 'completions/fish/swaynag.fish', ) - fish_install_dir = join_paths(datadir, 'fish', 'completions') + if fish_comp.found() + fish_install_dir = fish_comp.get_pkgconfig_variable('completionsdir') + else + fish_install_dir = join_paths(datadir, 'fish', 'completions') + endif install_data(fish_files, install_dir: fish_install_dir) endif |