build: make completions respect install prefix

paths straight from pkgconfig will sometimes be outside of the users
build prefix, we should never try to install anything outside of that
directory.

filter the value obtained from pkgconfig and use some fallback if it
is not inside
This commit is contained in:
Dominique Martinet 2020-03-29 10:06:48 +02:00
parent 214e3030e1
commit ad66d0861d

View file

@ -264,6 +264,9 @@ if get_option('bash-completions')
) )
if bash_comp.found() if bash_comp.found()
bash_install_dir = bash_comp.get_pkgconfig_variable('completionsdir') bash_install_dir = bash_comp.get_pkgconfig_variable('completionsdir')
if not bash_install_dir.startswith(prefix)
bash_install_dir = join_paths(datadir, 'bash-completion', 'completions')
endif
else else
bash_install_dir = join_paths(datadir, 'bash-completion', 'completions') bash_install_dir = join_paths(datadir, 'bash-completion', 'completions')
endif endif
@ -279,6 +282,9 @@ if get_option('fish-completions')
) )
if fish_comp.found() if fish_comp.found()
fish_install_dir = fish_comp.get_pkgconfig_variable('completionsdir') fish_install_dir = fish_comp.get_pkgconfig_variable('completionsdir')
if not fish_install_dir.startswith(prefix)
fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d')
endif
else else
fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d') fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d')
endif endif