1PC(5) BSD File Formats Manual PC(5)
2
4 file.pc — pkg-config file format
5
7 pkg-config files provide a useful mechanism for storing various informa‐
8 tion about libraries and packages on a given system. Information stored
9 by .pc files include compiler and linker flags necessary to use a given
10 library, as well as any other relevant metadata.
11
12 These .pc files are processed by a utility called pkg-config, of which
13 pkgconf is an implementation.
14
15 FILE SYNTAX
16 The .pc file follows a format inspired by RFC822. Comments are prefixed
17 by a pound sign, hash sign or octothorpe (#), and variable assignment is
18 similar to POSIX shell. Properties are defined using RFC822-style stan‐
19 zas.
20
21 VARIABLES
22 Variable definitions start with an alphanumeric string, followed by an
23 equal sign, and then the value the variable should contain.
24
25 Variable references are always written as "${variable}". It is possible
26 to escape literal "${" as "$${".
27
28 PROPERTIES
29 Properties are set using RFC822-style stanzas which consist of a keyword,
30 followed by a colon (:) and then the value the property should be set to.
31 Variable substitution is always performed regardless of property type.
32
33 There are three types of property:
34
35 Literal
36 The property will be set to the text of the value.
37
38 Dependency List
39 The property will be set to a list of dependencies parsed from
40 the text. Dependency lists are defined by this ABNF syntax:
41
42 package-list = *WSP *( package-spec *( package-sep ) )
43 package-sep = WSP / ","
44 package-spec = package-key [ ver-op package-version ]
45 ver-op = "<" / "<=" / "=" / "!=" / ">=" / ">"
46
47 Fragment List
48 The property will be set to a list of fragments parsed from the
49 text. The input text must be in a format that is suitable for
50 passing to a POSIX shell without any shell expansions after vari‐
51 able substitution has been done.
52
53 PROPERTY KEYWORDS
54 Name The displayed name of the package. (mandatory; literal)
55
56 Version
57 The version of the package. (mandatory; literal)
58
59 Description
60 A description of the package. (mandatory; literal)
61
62 URL A URL to a webpage for the package. This is used to recommend
63 where newer versions of the package can be acquired. (mandatory;
64 literal)
65
66 Cflags Required compiler flags. These flags are always used, regardless
67 of whether static compilation is requested. (optional; fragment
68 list)
69
70 Cflags.private
71 Required compiler flags for static compilation. (optional; frag‐
72 ment list; pkgconf extension)
73
74 Libs Required linking flags for this package. Libraries this package
75 depends on for linking against it, which are not described as
76 dependencies should be specified here. (optional; fragment list)
77
78 Libs.private
79 Required linking flags for this package that are only required
80 when linking statically. Libraries this package depends on for
81 linking against it statically, which are not described as depen‐
82 dencies should be specified here. (optional; fragment list)
83
84 Requires
85 Required dependencies that must be met for the package to be
86 usable. All dependencies must be satisfied or the pkg-config
87 implementation must not use the package. (optional; dependency
88 list)
89
90 Requires.private
91 Required dependencies that must be met for the package to be
92 usable for static linking. All dependencies must be satisfied or
93 the pkg-config implementation must not use the package for static
94 linking. (optional; dependency list)
95
96 Conflicts
97 Dependencies that must not be met for the package to be usable.
98 If any package in the proposed dependency solution match any
99 dependency in the Conflicts list, the package being considered is
100 not usable. (optional; dependency list)
101
102 Provides
103 Dependencies that may be provided by an alternate package. If a
104 package cannot be found, the entire package collection is scanned
105 for providers which can match the requested dependency.
106 (optional; dependency list; pkgconf extension)
107
108 EXTENSIONS
109 Features that have been marked as a pkgconf extension are only guaranteed
110 to work with the pkgconf implementation of pkg-config. Other implementa‐
111 tions may or may not support the extensions.
112
113 Accordingly, it is suggested that .pc files which absolutely depend on
114 these extensions declare a requirement on the pkgconf virtual.
115
117 An example .pc file:
118
119 # This is a comment
120 prefix=/home/kaniini/pkg # this defines a variable
121 exec_prefix=${prefix} # defining another variable with a substitution
122 libdir=${exec_prefix}/lib
123 includedir=${prefix}/include
124
125 Name: libfoo # human-readable name
126 Description: an example library called libfoo # human-readable description
127 Version: 1.0
128 URL: http://www.pkgconf.org
129 Requires: libbar > 2.0.0
130 Conflicts: libbaz <= 3.0.0
131 Libs: -L${libdir} -lfoo
132 Libs.private: -lm
133 Cflags: -I${includedir}/libfoo
134
136 pkgconf(1), pkg.m4(7)
137
138BSD December 15, 2017 BSD