| PC(5) | File Formats Manual | PC(5) |
file.pc —
pkg-config file format
pkg-config files provide a useful mechanism for storing various
information about libraries and packages on a given system. Information
stored by .pc files include compiler and linker
flags necessary to use a given library, as well as any other relevant
metadata.
These .pc files are processed by a utility
called pkg-config, of which
pkgconf is an implementation.
The .pc file follows a format inspired by
RFC822. Comments are prefixed by a pound sign, hash sign or octothorpe (#),
and variable assignment is similar to POSIX shell. Properties are defined
using RFC822-style stanzas.
Variable definitions start with an alphanumeric string, followed by an equal sign, and then the value the variable should contain.
Variable references are always written as "${variable}". It is possible to escape literal "${" as "$${".
Properties are set using RFC822-style stanzas which consist of a keyword, followed by a colon (:) and then the value the property should be set to. Variable substitution is always performed regardless of property type.
There are three types of property:
package-list = *WSP *( package-spec *( package-sep ) ) package-sep = WSP / "," package-spec = package-key [ ver-op package-version ] ver-op = "<" / "<=" / "=" / "!=" / ">=" / ">"
Features that have been marked as a pkgconf extension are only guaranteed to work with the pkgconf implementation of pkg-config. Other implementations may or may not support the extensions.
Accordingly, it is suggested that .pc
files which absolutely depend on these extensions declare a requirement on
the pkgconf virtual.
An example .pc file:
# This is a comment
prefix=/home/kaniini/pkg # this defines a variable
exec_prefix=${prefix} # defining another variable with a substitution
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libfoo # human-readable name
Description: an example library called libfoo # human-readable description
Version: 1.0
URL: http://www.pkgconf.org
Requires: libbar > 2.0.0
Conflicts: libbaz <= 3.0.0
Libs: -L${libdir} -lfoo
Libs.private: -lm
Cflags: -I${includedir}/libfoo
| December 15, 2017 | Debian |