Page MenuHome GnuPG

gpgrt-config doesn't work well with PKG_CONFIG_LIBDIR="" and setting PKG_CONFIG_PATH
Closed, ResolvedPublic

Description

gpgrt-config runs emulating pkg-config.

pkg-config supports PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR environment variables.

Specifically, when PKG_CONFIG_LIBDIR is empty and PKG_CONFIG_PATH is defined, gpgrt-config should search *.pc files by PKG_CONFIG_PATH, ignoring --libdir option.

Related Objects

Event Timeline

gniibe created this task.

Here is a possible fix:

diff --git a/src/gpgrt-config.in b/src/gpgrt-config.in
index 6352384..3aaa243 100644
--- a/src/gpgrt-config.in
+++ b/src/gpgrt-config.in
@@ -470,7 +470,7 @@ while test $# -gt 0; do
     esac
 done
 
-if [ x"${PKG_CONFIG_LIBDIR:+set}" = xset -a -z "$PKG_CONFIG_LIBDIR" ]; then
+if env | grep '^PKG_CONFIG_LIBDIR=$' >/dev/null 2>&1; then
   # The variable set as empty, we use PKG_CONFIG_PATH in this case,
   # ignoring --libdir option
   if [ -z "$PKG_CONFIG_PATH"  ]; then

If we could assume Bash, we can use test with -v, but it's not portable.
Also, we can't use printenv, it's not POSIX command.

gniibe changed the task status from Open to Testing.Sep 10 2021, 3:00 AM
gniibe added a project: Restricted Project.

The fix works for me (using bash on openSUSE Tumbleweed).

gniibe removed a project: Restricted Project.Oct 24 2022, 4:47 AM