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:
parent
dee002155b
commit
3baa500c5e
14
meson.build
14
meson.build
@ -40,6 +40,8 @@ wayland_protos = dependency('wayland-protocols', version: '>=1.14')
|
||||
xkbcommon = dependency('xkbcommon')
|
||||
cairo = dependency('cairo')
|
||||
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
|
||||
bash_comp = dependency('bash-completion', required: false)
|
||||
fish_comp = dependency('fish', required: false)
|
||||
libpam = cc.find_library('pam', required: get_option('pam'))
|
||||
crypt = cc.find_library('crypt', required: not libpam.found())
|
||||
math = cc.find_library('m')
|
||||
@ -196,7 +198,11 @@ if get_option('bash-completions')
|
||||
bash_files = files(
|
||||
'completions/bash/swaylock',
|
||||
)
|
||||
bash_install_dir = datadir + '/bash-completion/completions'
|
||||
if bash_comp.found()
|
||||
bash_install_dir = bash_comp.get_pkgconfig_variable('completionsdir')
|
||||
else
|
||||
bash_install_dir = datadir + '/bash-completion/completions'
|
||||
endif
|
||||
|
||||
install_data(bash_files, install_dir: bash_install_dir)
|
||||
endif
|
||||
@ -205,7 +211,11 @@ if get_option('fish-completions')
|
||||
fish_files = files(
|
||||
'completions/fish/swaylock.fish',
|
||||
)
|
||||
fish_install_dir = datadir + '/fish/completions'
|
||||
if fish_comp.found()
|
||||
fish_install_dir = fish_comp.get_pkgconfig_variable('completionsdir')
|
||||
else
|
||||
fish_install_dir = datadir + '/fish/completions'
|
||||
endif
|
||||
|
||||
install_data(fish_files, install_dir: fish_install_dir)
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user