Skip to content

Commit

Permalink
completion: use pkg-config to get install location for bash/fish
Browse files Browse the repository at this point in the history
Both shells provide pkg-config files which declare their designated
completionsdir. Use this as the primary source of truth.
  • Loading branch information
eli-schwartz authored and ddevault committed Jan 22, 2020
1 parent dee0021 commit 3baa500
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand All @@ -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

0 comments on commit 3baa500

Please sign in to comment.