pkg-config and rpm relocations

Kevin Fox Kevin.Fox at
Wed Apr 21 16:54:11 PDT 2010

Since I didn't hear any objections to my proposed solution, I coded up a
patch real quick. See attached file. It is mostly a copy/paste from the
windows prefix relocation code already in pkg-config. I couldn't get to
pkg-config's git repo (stupid firewall) so I made the patch against
0.23. If you need me to fix anything, please let me know.

To use it, you do stuff like this in your .pc file:

Name: Simple test
Description: Dummy pkgconfig test package for testing pkgconfig
Version: 1.0.0
Libs: -L${libdir} -lsimple
Libs.private: -lm
Cflags: -I${includedir} -DSIMPLECONF=${sysconfdir}/simple.conf

If the file does not reside in /usr/lib/pkgconfig, but does live
under /XXX/lib/pkgconfig, relocroot becomes /XXX and relocprefix becomes
"". Otherwise, it leaves relocprefix and relocroot alone.


On Mon, 2010-04-05 at 23:47 -0700, Tollef Fog Heen wrote:
> ]] Dan Nicholson 
> (Kevin, not sure if you're subscribed or not, so Cc-ing you)
> | You can already do that today just by setting the variables in your
> | .pc file appropriately.
> | 
> | foo.pc:
> | relocatableprefix=
> | prefix=${relocatableprefix}/usr
> | exec_prefix=${prefix}
> | includedir=${prefix}/include
> | libdir=${exec_prefix}/lib
> | 
> | Cflags: -I${includedir}
> | Libs.private: -L${libdir} -lfoo
> | 
> | In fact, you can probably fake it today with most .pc files just by
> | using "pkg-config --define-variable=prefix=$relocatableprefix".
> I believe Kevin wants this to happen automatically, and you might
> reasonably want to relocate some, but not all of your libraries,
> something this approach does not support.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pkg-config-reloc.patch
Type: text/x-patch
Size: 2939 bytes
Desc: not available
URL: <>

More information about the pkg-config mailing list