summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2020-01-21 23:19:13 -0500
committerDrew DeVault <sir@cmpwn.com>2020-01-22 09:19:47 -0700
commit3baa500c5e51859e256645c712b3fa441d300ee2 (patch)
tree462c59f476d8ecd04d4dc0b47ae5a421788602a5
parentdee002155b919cb769f9c417e7e263443a181a9e (diff)
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.build14
1 files changed, 12 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 5c460bb..ce955f8 100644
--- a/meson.build
+++ b/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