[QBS] RFC pkgconfig support

Alberto Mardegan mardy at users.sourceforge.net
Tue Aug 21 17:08:22 CEST 2012

On 08/21/2012 04:53 PM, Ruslan Nigmatullin wrote:
>> 1) Changing the value of a variable defined in the .pc:
>>   pkg-config --define-variable=prefix=/opt ...
>> 2) Getting the name of a variable defined in the .pc file:
>>   pkg-config --variable=plugindir mylibrary.pc
>> at least the first one is something that you'd need to pass to
>> PkgConfigProbe in addition to "name".
> What is usecase of this commands? Can you provide me some examples, please, to understand the idea?

Sure. The second one is generally used to define a filesystem path which
can be useful when building other applications; for instance, if I write
an application which supports plugins, I could decide that at startup I
scan the /usr/lib/myapp/ directory and load all plugins from there. If I
want other people to be able to write plugins for my application, I'll
write a pkg-config file which defines where the plugins should be
installed -- so that plugin writers don't need to hardcode the
"/usr/lib/myapp" path, but can query it at build time.

See, for a concrete example, the dbus-1.pc file:

This tells people writing dbus services where they should be installed.

The first one is used a bit more rarely, but it's also important
installation of files in a prefix other than /usr; compare the output of
these two commands:

$ pkg-config --cflags dbus-1
-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include

$ pkg-config --define-variable=prefix=/opt --cflags dbus-1
-I/opt/include/dbus-1.0 -I/opt/lib/dbus-1.0/include


http://blog.mardy.it <- geek in un lingua international!

More information about the Qbs mailing list