Source: playerctl
Version: 0.6.1-1
Severity: serious
Tags: patch upstream
Justification: fails to build from source
Control: block 909846 by -1
playerctl has this pattern in configure.ac:
AC_PATH_PROG([GDBUS_CODEGEN], [`$PKG_CONFIG --variable=gdbus_codegen
gio-2.0`])
This doesn't work with recent versions of GLib, in which the pkg-config
call produces an absolute path. AC_PATH_PROG only accepts a basename for
its second argument.
There is some debate over whether the recommended way to check for tools
like these is to search the PATH:
AC_PATH_PROG([GDBUS_CODEGEN], [gdbus-codegen])
or to ask pkg-config:
PKG_CHECK_VAR([GDBUS_CODEGEN], [gio-2.0], [gdbus_codegen])
but combining AC_PATH_PROG with pkg-config certainly doesn't seem to be
what's intended. Either of those macro invocations would allow the location
to be overridden with "./configure GDBUS_CODEGEN=..." if required.
I have confirmed that the attached patch makes playerctl build
successfully in sbuild.
smcv
From: Simon McVittie <[email protected]>
Date: Thu, 4 Oct 2018 21:08:27 +0100
Subject: build: Use PKG_CHECK_VAR to check for gdbus-codegen
Recent versions of GLib define $gdbus_codegen to the absolute path to
gdbus-codegen, but AC_PATH_PROG doesn't work for an absolute path as
its second argument, causing configure to fail.
There's actually no need to use AC_PATH_PROG here, because
we don't need an absolute path to gdbus-codegen: if it's just a
basename that AC_PATH_PROG could find in the PATH, then the Makefile
can also find it in the PATH.
Using PKG_CHECK_VAR (from pkg-config 0.28+) preserves the ability for
a user to specify the path to a gdbus-codegen tool as a configure
argument, defaulting to the value of $gdbus_codegen from gio-2.0.pc.
---
configure.ac | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 21679fa..9a137c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,10 +21,8 @@ AC_PROG_INSTALL
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.38])
PKG_CHECK_MODULES([GIO], [gio-unix-2.0])
-AC_PATH_PROG([GDBUS_CODEGEN], [`$PKG_CONFIG --variable=gdbus_codegen gio-2.0`])
-if test -z "$GDBUS_CODEGEN"; then
- AC_MSG_ERROR([*** gdbus-codegen is required to build playerctl])
-fi
+PKG_CHECK_VAR([GDBUS_CODEGEN], [gio-2.0], [gdbus_codegen], [],
+ [AC_MSG_ERROR([*** gdbus-codegen is required to build playerctl])])
# Checks for typedefs, structures, and compiler characteristics
AC_PROG_CC_STDC