1.\" Copyright (c) 2017 pkgconf authors (see AUTHORS). 2.\" 3.\" Permission to use, copy, modify, and/or distribute this software for any 4.\" purpose with or without fee is hereby granted, provided that the above 5.\" copyright notice and this permission notice appear in all copies. 6.\" 7.\" This software is provided 'as is' and without any warranty, express or 8.\" implied. In no event shall the authors be liable for any damages arising 9.\" from the use of this software. 10.Dd June 23, 2026 11.Dt PC 5 12.Os 13.Sh NAME 14.Nm file.pc 15.Nd pkg-config file format 16.Sh DESCRIPTION 17pkg-config files provide a useful mechanism for storing various information 18about libraries and packages on a given system. 19Information stored by 20.Nm .pc 21files include compiler and linker flags necessary to use a given library, as 22well as any other relevant metadata. 23.Pp 24These 25.Nm .pc 26files are processed by a utility called 27.Nm pkg-config , 28of which 29.Nm pkgconf 30is an implementation. 31.\" 32.Ss FILE SYNTAX 33The 34.Nm .pc 35file follows a format inspired by RFC822. 36Comments are prefixed by a pound sign, hash sign or octothorpe (#), and variable 37assignment is similar to POSIX shell. 38Properties are defined using RFC822-style stanzas. 39.\" 40.Ss VARIABLES 41.\" 42Variable definitions start with an alphanumeric string, followed by an equal sign, 43and then the value the variable should contain. 44.Pp 45Variable references are always written as "${variable}". 46It is possible to escape literal "${" as "$${". 47.\" 48.Ss PROPERTIES 49.\" 50Properties are set using RFC822-style stanzas which consist of a keyword, followed 51by a colon (:) and then the value the property should be set to. 52Variable substitution is always performed regardless of property type. 53.Pp 54There are three types of property: 55.\" 56.Bl -tag -width indent 57.\" 58.It Literal 59The property will be set to the text of the value. 60.\" 61.It Dependency List 62The property will be set to a list of dependencies parsed from the 63text. 64Dependency lists are defined by this ABNF syntax: 65.Bd -literal 66package-list = *WSP *( package-spec *( package-sep ) ) 67package-sep = WSP / "," 68.\" 69package-spec = package-key [ ver-op package-version ] 70ver-op = "<" / "<=" / "=" / "!=" / ">=" / ">" 71.Ed 72.\" 73.It Fragment List 74The property will be set to a list of fragments parsed from the text. 75The input text must be in a format that is suitable for passing to a POSIX 76shell without any shell expansions after variable substitution has been done. 77.Pp 78The text is tokenised using POSIX shell word-splitting rules: unquoted 79whitespace separates fragments, single and double quotes group text, and a 80backslash escapes the following character. 81A quote that is not itself escaped is consumed as a quoting delimiter and does 82not appear in the resulting fragment. 83To include a shell metacharacter \(em such as a quote, whitespace, a bracket, 84a brace, or a glob character \(em literally in a fragment, escape it with a 85backslash so that it survives tokenisation. 86.Pp 87For example, to make the toolchain receive the argument 88.Bd -literal -offset indent 89\-sFUNCS=["fnA","fnB"] 90.Ed 91escape the double quotes so they are not consumed as quoting: 92.Bd -literal -offset indent 93Libs: \-sFUNCS=[\e"fnA\e",\e"fnB\e"] 94.Ed 95.Pp 96On output, such metacharacters are re-escaped so that the original fragment is 97recovered when the consumer tokenises the output using the same shell 98word-splitting rules; see the note on output escaping in 99.Xr pkgconf 1 . 100.\" 101.El 102.Ss PROPERTY KEYWORDS 103.Bl -tag -width indent 104.\" 105.It Name 106The displayed name of the package. 107(mandatory; literal) 108.It Version 109The version of the package. 110(mandatory; literal) 111.It Description 112A description of the package. 113(mandatory; literal) 114.It URL 115A URL to a webpage for the package. 116This is used to recommend where newer versions of the package can be acquired. 117(mandatory; literal) 118.It Cflags 119Required compiler flags. 120These flags are always used, regardless of whether static compilation is requested. 121(optional; fragment list) 122.It Cflags.private 123Required compiler flags for static compilation only. 124(optional; fragment list; pkgconf extension; introduced in pkgconf 0.9.3) 125.It Cflags.shared 126Required compiler flags for shared compilation only. 127(optional; fragment list; pkgconf extension; introduced in pkgconf 3.0.0) 128.It Copyright 129A copyright attestation statement. 130(optional; literal; pkgconf extension; introduced in pkgconf 1.9.3) 131.It Libs 132Required linking flags for this package. 133Libraries this package depends on for linking against it, which are not 134described as dependencies should be specified here. 135(optional; fragment list) 136.It Libs.private 137Required linking flags for this package that are only required when linking 138statically. 139Libraries this package depends on for linking against it statically, which are 140not described as dependencies should be specified here. 141(optional; fragment list) 142.It Libs.shared 143Required linking flags for this package that are only required for dynamic 144linking. 145Libraries this package depends on for linking against it dynamically, which are 146not described as dependencies should be specified here. 147(optional; fragment list; pkgconf extension; introduced in pkgconf 3.0.0) 148.It Link.ABI 149A comma-separated list of tags describing the application binary interfaces a 150consumer must link this package against, such as 151.Sy c++ 152or 153.Sy fortran . 154Tags are case-insensitive and are normalized to lowercase. 155This allows a build system to select the appropriate linker driver and runtime 156when a package, or one of its dependencies, is implemented in a language whose 157ABI differs from C. 158The tag set is unioned across the dependency closure in the same manner as 159.Sy Libs : 160a package's own tags and those of its public 161.Sy Requires 162always apply, while 163.Sy Requires.private 164tags apply only when private dependencies are linked. 165Unlike a runtime library load, ABI compatibility of the exposed interface 166applies equally to shared and static linking. 167A package with no 168.Sy Link.ABI 169property is treated as 170.Sy c . 171(optional; pkgconf extension; introduced in pkgconf 3.0.0) 172.It License 173The asserted SPDX license tag that should be applied to the given package. 174One should try to determine the correct SPDX license tag for package 175from the SPDX License list. If a standard license name isn't available, use the 176LicenseRef-tag. For complex licensing details, utilize 177SPDX expression notation. 178It’s possible to assign multiple license tags in pc-file, which are 179then merged together with an 'AND' when rendering output. 180(optional; literal; pkgconf extension; introduced in pkgconf 1.9.0) 181.It License.file 182An absolute filesystem path to the installed file containing the full license 183text for this package. 184The path must refer to the license file as installed on the system, so that 185it corresponds to the exact version and configuration described by this 186.Sy .pc 187file; pkgconf variable references such as 188.Sy ${prefix} 189or 190.Sy ${datadir} , 191which expand to absolute paths, may be used. 192Relative paths are not supported. 193This must not be a URL: use 194.Sy Source 195to reference an upstream location. 196(optional; literal; pkgconf extension; introduced in pkgconf 3.0.0) 197.It Maintainer 198The preferred contact for the maintainer. This should be in the format of a 199name followed by an e-mail address or website. 200(optional; literal; pkgconf extension; introduced in pkgconf 1.9.3) 201.It Source 202The asserted SPDX downloadLocation tag that should be applied to the given package. 203Source should be URI contain tarball with exact version or Repository that contains 204tag with version same as mentioned in version tag. It can be also be URI with hash 205that is exact release point of the source. 206(optional; literal; pkgconf extension; introduced in pkgconf 3.0.0) 207.It Requires 208Required dependencies that must be met for the package to be usable. 209All dependencies must be satisfied or the pkg-config implementation must not use 210the package. 211(optional; dependency list) 212.It Requires.internal 213Required dependencies that must be met for the package to be usable for 214static linking. 215The main differences verses Requires.private are that CFLAGS will not be 216included and the solver will not consider the dependency when solving for 217CFLAGS only. 218(optional; dependency list; pkgconf extension; introduced in pkgconf 1.5.0) 219.It Requires.private 220Required dependencies that must be met for the package to be usable for header 221inclusion and static linking. 222All dependencies must be satisfied or the pkg-config implementation must not use 223the package for header inclusion and static linking. 224(optional; dependency list) 225.It Requires.shared 226Required dependencies that are only traversed when not in static mode. This allows 227a package to express dependencies that are only relevant when it is used as a 228shared library. 229(optional; dependency list; pkgconf extension; introduced in pkgconf 3.0.0) 230.It Conflicts 231Dependencies that must not be met for the package to be usable. 232If any package in the proposed dependency solution match any dependency in the 233Conflicts list, the package being considered is not usable. 234(optional; dependency list) 235.It Provides 236Dependencies that may be provided by an alternate package. 237If a package cannot be found, the entire package collection is scanned for 238providers which can match the requested dependency. 239(optional; dependency list; pkgconf extension; introduced in pkgconf 1.1.0) 240.El 241.Ss EXTENSIONS 242Features that have been marked as a pkgconf extension are only guaranteed to work 243with the pkgconf implementation of pkg-config. 244Other implementations may or may not support the extensions. 245.Pp 246Accordingly, it is suggested that 247.Nm .pc 248files which absolutely depend on these extensions declare a requirement on the 249pkgconf virtual. 250.Pp 251In addition it should be noted that the pkgconf virtual is versioned, and thus 252files which absolutely depend on these extensions can declare a requirement on 253the specific pkgconf version which introduced the extension. 254.Pp 255As an example: 256.Bd -literal 257Requires: pkgconf >= 3.0.0 258Libs.shared: ... 259.Ed 260.Sh EXAMPLES 261An example .pc file: 262.Bd -literal 263# This is a comment 264prefix=/home/kaniini/pkg # this defines a variable 265exec_prefix=${prefix} # defining another variable with a substitution 266libdir=${exec_prefix}/lib 267includedir=${prefix}/include 268 269Name: libfoo # human-readable name 270Description: an example library called libfoo # human-readable description 271Copyright: Copyright (c) 2022 pkgconf project authors 272License: Apache-2.0 273Maintainer: the pkgconf project <http://www.pkgconf.org> 274Version: 1.0 275URL: http://www.pkgconf.org 276Requires: libbar > 2.0.0 277Conflicts: libbaz <= 3.0.0 278Libs: -L${libdir} -lfoo 279Libs.private: -lm 280Cflags: -I${includedir}/libfoo 281.Ed 282.Sh SEE ALSO 283.Xr pkgconf 1 , 284.Xr pkg.m4 7 285