Extensions to .pc files

Brad Hards bradh at frogmouth.net
Sat Jun 6 21:20:42 PDT 2009


Hi,

I'd like to ask for an opinion on the best way to manage extensions to the 
normal contents of a .pc file.

Conceptually, I'd like to be able to get back a path to a particular 
configuration / script file, which I'm going to (optionally) add to my 
command line to make the compiler do something different.

[The example here is dehydra, which is a static analysis tool from mozilla 
that works with gcc and javascript files to provide compile-time checks. So 
if a library provides a set of checks as "libfoo-check.js", I'd like 
pkg-config to be able to tell me if there is such a set of checks, and where 
they can be found.]

I considered using the --variable command line option, but it seemed somehow 
inconsistent to use it for this. Setting variables also uses a different 
syntax, which isn't ideal:
Libs: -lfoo
Cflags: -I${includedir}
dehydra_script={prefix}/share/libfoo-dehydra-check.js
dehydra_insert_after=useless

The other possibility I considered (actually considered first, before I 
realised I could use the --variable approach) was to extend pkg-config to use 
a X.foo_extension syntax:
Libs: -lfoo
Cflags: -I${includedir}
X.dehydra_script: {prefix}/share/libfoo-dehydra-check.js
X.dehydra_insert_after: useless

then we could use 
$ pkg-config --x=dehydra_script foo
/usr/local/share/libfoo-dehydra-check.js

Thoughts or suggestions?

Brad


More information about the pkg-config mailing list