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
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     Copyright
75             A copyright attestation statement.  (optional; literal; pkgconf
76             extension)
77
78     Libs    Required linking flags for this package.  Libraries this package
79             depends on for linking against it, which are not described as de‐
80             pendencies should be specified here.  (optional; fragment list)
81
82     Libs.private
83             Required linking flags for this package that are only required
84             when linking statically.  Libraries this package depends on for
85             linking against it statically, which are not described as depen‐
86             dencies should be specified here.  (optional; fragment list)
87
88     License
89             The asserted SPDX license tag that should be applied to the given
90             package.  (optional; literal; pkgconf extension)
91
92     Maintainer
93             The preferred contact for the maintainer.  This should be in the
94             format of a name followed by an e-mail address or website.  (op‐
95             tional; literal; pkgconf extension)
96
97     Requires
98             Required dependencies that must be met for the package to be us‐
99             able.  All dependencies must be satisfied or the pkg-config im‐
100             plementation must not use the package.  (optional; dependency
101             list)
102
103     Requires.private
104             Required dependencies that must be met for the package to be us‐
105             able for static linking.  All dependencies must be satisfied or
106             the pkg-config implementation must not use the package for static
107             linking.  (optional; dependency list)
108
109     Conflicts
110             Dependencies that must not be met for the package to be usable.
111             If any package in the proposed dependency solution match any de‐
112             pendency in the Conflicts list, the package being considered is
113             not usable.  (optional; dependency list)
114
115     Provides
116             Dependencies that may be provided by an alternate package.  If a
117             package cannot be found, the entire package collection is scanned
118             for providers which can match the requested dependency.  (op‐
119             tional; dependency list; pkgconf extension)
120
121   EXTENSIONS
122     Features that have been marked as a pkgconf extension are only guaranteed
123     to work with the pkgconf implementation of pkg-config.  Other implementa‐
124     tions may or may not support the extensions.
125
126     Accordingly, it is suggested that .pc files which absolutely depend on
127     these extensions declare a requirement on the pkgconf virtual.
128

EXAMPLES

130     An example .pc file:
131
132     # This is a comment
133     prefix=/home/kaniini/pkg   # this defines a variable
134     exec_prefix=${prefix}      # defining another variable with a substitution
135     libdir=${exec_prefix}/lib
136     includedir=${prefix}/include
137
138     Name: libfoo                                  # human-readable name
139     Description: an example library called libfoo # human-readable description
140     Copyright: Copyright (c) 2022 pkgconf project authors
141     License: Apache-2.0
142     Maintainer: the pkgconf project <http://www.pkgconf.org>
143     Version: 1.0
144     URL: http://www.pkgconf.org
145     Requires: libbar > 2.0.0
146     Conflicts: libbaz <= 3.0.0
147     Libs: -L${libdir} -lfoo
148     Libs.private: -lm
149     Cflags: -I${includedir}/libfoo
150

SEE ALSO

152     pkgconf(1), pkg.m4(7)
153
154BSD                            December 15, 2017                           BSD
Impressum