- 
                Notifications
    You must be signed in to change notification settings 
- Fork 399
Description
The main page for this project suggests that other projects wanting to add third-party drop-ins should use:
"For packages using GNU autotools the installation can be handled for example like this in configure.ac:
PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], ,
bashcompdir="${sysconfdir}/bash_completion.d")
AC_SUBST(bashcompdir)
...accompanied by this in Makefile.am:
bashcompdir = @bashcompdir@
dist_bashcomp_DATA = # completion files go here
"
However, the nbdkit project did just that, and it causes 'make distcheck' to fail.  The problem is that even though bash-completion.pc contains:
prefix=/usr
completionsdir=${prefix}/share/bash-completion/completions
the result of the PKG_CHECK_VAR macro, which really is merely a call to:
bashcompdir=`$PKG_CONFIG --variable=completionsdir bash-completion 2>/dev/null
is always absolute ("/usr/share/bash-completion/completions", that is, ${prefix} was resolved before output) instead of --prefix-relative (as in a literal '${prefix}/share/bash-completion/completions'). Then when 'make distcheck' invokes './configure --prefix=/path/to/nonroot/_inst', it expects that 'make install' can be run as non-root with no files being installed outside of that jail, but that expectation is broken because the absolute name stored in bashcompdir is not prefix-relative, resulting in:
/usr/bin/install -c -m 644 ../../../bash/nbdkit '/usr/share/bash-completion/completions' /usr/bin/install: cannot remove '/usr/share/bash-completion/completions/nbdkit': Permission denied
It can be worked around by doing:
bashcompdir=$PKG_CONFIG --define-variable=prefix='${prefix}' \ --variable=completionsdir bash-completion 2>/dev/null
but I don't know if that is the right approach to take, especially since the PKG_CHECK_VAR() macro does not easily allow that type of rewrite. Are there any other best-practice ideas out there on working around this sort of issue?
The nbdkit thread can be found here: https://www.redhat.com/archives/libguestfs/2018-December/msg00103.html
See also https://git.dereferenced.org/pkgconf/pkgconf/issues/17