1PC(5)                       BSD File Formats Manual                      PC(5)
2

NAME

4     file.pc — pkg-config file format
5

DESCRIPTION

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       The property will be set to the text of the value.
36
37     Dependency List
38                   The property will be set to a list of dependencies parsed
39                   from the text.  Dependency lists are defined by this ABNF
40                   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
49                   the text.  The input text must be in a format that is suit‐
50                   able for passing to a POSIX shell without any shell expan‐
51                   sions after variable substitution has been done.
52
53   PROPERTY KEYWORDS
54     Name          The displayed name of the package.  (mandatory; literal)
55
56     Version       The version of the package.  (mandatory; literal)
57
58     Description   A description of the package.  (mandatory; literal)
59
60     URL           A URL to a webpage for the package.  This is used to recom‐
61                   mend where newer versions of the package can be acquired.
62                   (mandatory; literal)
63
64     Cflags        Required compiler flags.  These flags are always used,
65                   regardless of whether static compilation is requested.
66                   (optional; fragment list)
67
68     Cflags.private
69                   Required compiler flags for static compilation.  (optional;
70                   fragment list; pkgconf extension)
71
72     Libs          Required linking flags for this package.  Libraries this
73                   package depends on for linking against it, which are not
74                   described as dependencies should be specified here.
75                   (optional; fragment list)
76
77     Libs.private  Required linking flags for this package that are only
78                   required when linking statically.  Libraries this package
79                   depends on for linking against it statically, which are not
80                   described as dependencies should be specified here.
81                   (optional; fragment list)
82
83     Requires      Required dependencies that must be met for the package to
84                   be usable.  All dependencies must be satisfied or the pkg-
85                   config implementation must not use the package.  (optional;
86                   dependency list)
87
88     Requires.private
89                   Required dependencies that must be met for the package to
90                   be usable for static linking.  All dependencies must be
91                   satisfied or the pkg-config implementation must not use the
92                   package for static linking.  (optional; dependency list)
93
94     Conflicts     Dependencies that must not be met for the package to be
95                   usable.  If any package in the proposed dependency solution
96                   match any dependency in the Conflicts list, the package
97                   being considered is not usable.  (optional; dependency
98                   list)
99
100     Provides      Dependencies that may be provided by an alternate package.
101                   If a package cannot be found, the entire package collection
102                   is scanned for providers which can match the requested
103                   dependency.  (optional; dependency list; pkgconf extension)
104
105   EXTENSIONS
106     Features that have been marked as a pkgconf extension are only guaranteed
107     to work with the pkgconf implementation of pkg-config.  Other implementa‐
108     tions may or may not support the extensions.
109
110     Accordingly, it is suggested that .pc files which absolutely depend on
111     these extensions declare a requirement on the pkgconf virtual.
112

EXAMPLES

114     An example .pc file:
115
116     # This is a comment
117     prefix=/home/kaniini/pkg   # this defines a variable
118     exec_prefix=${prefix}      # defining another variable with a substitution
119     libdir=${exec_prefix}/lib
120     includedir=${prefix}/include
121
122     Name: libfoo                                  # human-readable name
123     Description: an example library called libfoo # human-readable description
124     Version: 1.0
125     URL: http://www.pkgconf.org
126     Requires: libbar > 2.0.0
127     Conflicts: libbaz <= 3.0.0
128     Libs: -L${libdir} -lfoo
129     Libs.private: -lm
130     Cflags: -I${includedir}/libfoo
131

SEE ALSO

133     pkgconf(1), pkg.m4(7)
134
135BSD                            December 15, 2017                           BSD
Impressum