pkg-config patches
I uploaded a few patches to the pkg-config bugzilla recently, which will hopefully make their way into the next release.
The first is related to bug 3097, which has to do with the broken dependent library elimination code added to 0.17.
The patch adds a Requires.private
field to .pc
files that contains a
list of required packages like Requires
currently does, which has the
following properties:
- When verifying that a particular package name is available with
"
pkg-config --exists
", dependencies in bothRequires
andRequires.private
are checked. - When running "
pkg-config --cflags
", flags from dependencies inRequires
are included. - When running "
pkg-config --libs
", flags from dependencies inRequires
are included. - When running "
pkg-config --static --libs
", flags from dependencies in bothRequires
andRequires.private
are included.
The purpose of this is to list dependencies that are not exposed in the API of the library in question while not making users of the library link directly to those dependencies. This means that private dependencies can be upgraded to new incompatible versions without breaking applications that only depend on them indirectly.
This is intended for cases like Cairo,
which links to libpng
, but doesn't expose any of the libpng
API
itself. It is not intended for dependencies like gtk+
depending on
pango
. Of course, this header will cause the .pc
file to be
incompatible with pkg-config
versions prior to 0.16, because those
versions don't tolerate unknown fields.
The other changes are related to the associated autoconf macros:
- Add a
PKG_CHECK_EXISTS()
macro. This would be similar toPKG_CHECK_MODULES()
, except that no variables would be set or substitutes -- it would simply run theACTION-IF-FOUND
orACTION-IF-NOT-FOUND
arguments. It is basically a less heavy weight macro for cases where you just want to see if a set of modules is available (bug 3530). - Get rid of the caching behaviour in
PKG_CHECK_MODULES()
. Since 0.16, this macro has cached the result of the check based on the variable prefix passed as the first argument. Since pkg-config is quite fast andconfigure
doesn't store its cache between runs by default, this doesn't result in any noticable speed improvement and causes build problems forconfigure
scripts that callPKG_CHECK_MODULES
multiple times with the same variable name prefix but different package lists (e.g. Eye of Gnome). It seems simplest to just remove the caching, resulting in a simpler and more reliable macro (bug 3550, patch not yet uploaded).
With these changes, hopefully 0.18 will fix up the last few small incompatibilities in the recent releases.
Comments:
Alastair McKinstry -
Hi, these changes look interesting and useful: I'm fixing up packages in Debian at the moment that have unnecessary dependencies. Any idea when pkg-config 0.18 might be released?
Regards Alastair McKinstry
James Henstridge -
I'm not sure. I haven't spoken with Tollef much recently (I'd guess he's hard at work on breezy).