1
1
mirror of https://github.com/swaywm/sway synced 2024-12-03 17:38:27 +01:00

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.
This commit is contained in:
Eli Schwartz 2020-01-21 23:03:58 -05:00 committed by Simon Ser
parent fe558cf627
commit 03e8ce7b20

@ -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',
)
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',
)
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