build: Install bash-completion relative to datadir

Since bash-completion 2.9, it was no longer possible to override
the completionsdir through prefix. [1] In 2.10, the overridability
was re-estabilished but this time through datadir variable. [2]

This should not really matter except for developers installing the project
into a custom prefix or distros using per-package prefixes like NixOS.

[1]: 81ba2c7e7d
[2]: https://github.com/scop/bash-completion/pull/344
This commit is contained in:
Jan Tojnar 2020-04-16 11:40:49 +02:00
parent de0ec87ba1
commit dd2ec3681e
No known key found for this signature in database
GPG key ID: 7FAB2A15F7A607A4

View file

@ -28,6 +28,7 @@ osxversion = curversion + 1
prefix = get_option('prefix') prefix = get_option('prefix')
datadir = join_paths(prefix, get_option('datadir'))
libexecdir = get_option('libexecdir') libexecdir = get_option('libexecdir')
helpers_install_dir = join_paths(libexecdir, 'gstreamer-1.0') helpers_install_dir = join_paths(libexecdir, 'gstreamer-1.0')
@ -97,7 +98,7 @@ if glib_checks.disabled() or (glib_checks.auto() and not gst_version_is_dev)
endif endif
cdata.set_quoted('GST_API_VERSION', apiversion) cdata.set_quoted('GST_API_VERSION', apiversion)
cdata.set_quoted('GST_DATADIR', join_paths(prefix, get_option('datadir'))) cdata.set_quoted('GST_DATADIR', datadir)
cdata.set_quoted('LOCALEDIR', join_paths(prefix, get_option('localedir'))) cdata.set_quoted('LOCALEDIR', join_paths(prefix, get_option('localedir')))
cdata.set_quoted('LIBDIR', join_paths(prefix, get_option('libdir'))) cdata.set_quoted('LIBDIR', join_paths(prefix, get_option('libdir')))
cdata.set_quoted('GST_API_VERSION', '1.0') cdata.set_quoted('GST_API_VERSION', '1.0')
@ -514,7 +515,8 @@ bash_helpers_dir = ''
bashcomp_found = false bashcomp_found = false
if bashcomp_dep.found() if bashcomp_dep.found()
bashcomp_found = true bashcomp_found = true
bash_completions_dir = bashcomp_dep.get_pkgconfig_variable('completionsdir', define_variable: ['prefix', '.']) bashcomp_dir_override = bashcomp_dep.version().version_compare('>= 2.10') ? ['datadir', datadir] : ['prefix', prefix]
bash_completions_dir = bashcomp_dep.get_pkgconfig_variable('completionsdir', define_variable: bashcomp_dir_override)
if bash_completions_dir == '' if bash_completions_dir == ''
msg = 'Found bash-completion but the .pc file did not set \'completionsdir\'.' msg = 'Found bash-completion but the .pc file did not set \'completionsdir\'.'
if bashcomp_option.enabled() if bashcomp_option.enabled()
@ -525,7 +527,7 @@ if bashcomp_dep.found()
bashcomp_found = false bashcomp_found = false
endif endif
bash_helpers_dir = bashcomp_dep.get_pkgconfig_variable('helpersdir', define_variable: ['prefix', '.']) bash_helpers_dir = bashcomp_dep.get_pkgconfig_variable('helpersdir', define_variable: bashcomp_dir_override)
if bash_helpers_dir == '' if bash_helpers_dir == ''
msg = 'Found bash-completion, but the .pc file did not set \'helpersdir\'.' msg = 'Found bash-completion, but the .pc file did not set \'helpersdir\'.'
if bashcomp_option.enabled() if bashcomp_option.enabled()