1*a3cefe7fSPierre Pronchery.\" Copyright (c) 2017 pkgconf authors (see AUTHORS). 2*a3cefe7fSPierre Pronchery.\" 3*a3cefe7fSPierre Pronchery.\" Permission to use, copy, modify, and/or distribute this software for any 4*a3cefe7fSPierre Pronchery.\" purpose with or without fee is hereby granted, provided that the above 5*a3cefe7fSPierre Pronchery.\" copyright notice and this permission notice appear in all copies. 6*a3cefe7fSPierre Pronchery.\" 7*a3cefe7fSPierre Pronchery.\" This software is provided 'as is' and without any warranty, express or 8*a3cefe7fSPierre Pronchery.\" implied. In no event shall the authors be liable for any damages arising 9*a3cefe7fSPierre Pronchery.\" from the use of this software. 10*a3cefe7fSPierre Pronchery.Dd December 15, 2017 11*a3cefe7fSPierre Pronchery.Dt PC 5 12*a3cefe7fSPierre Pronchery.Os 13*a3cefe7fSPierre Pronchery.Sh NAME 14*a3cefe7fSPierre Pronchery.Nm file.pc 15*a3cefe7fSPierre Pronchery.Nd pkg-config file format 16*a3cefe7fSPierre Pronchery.Sh DESCRIPTION 17*a3cefe7fSPierre Proncherypkg-config files provide a useful mechanism for storing various information 18*a3cefe7fSPierre Proncheryabout libraries and packages on a given system. 19*a3cefe7fSPierre ProncheryInformation stored by 20*a3cefe7fSPierre Pronchery.Nm .pc 21*a3cefe7fSPierre Proncheryfiles include compiler and linker flags necessary to use a given library, as 22*a3cefe7fSPierre Proncherywell as any other relevant metadata. 23*a3cefe7fSPierre Pronchery.Pp 24*a3cefe7fSPierre ProncheryThese 25*a3cefe7fSPierre Pronchery.Nm .pc 26*a3cefe7fSPierre Proncheryfiles are processed by a utility called 27*a3cefe7fSPierre Pronchery.Nm pkg-config , 28*a3cefe7fSPierre Proncheryof which 29*a3cefe7fSPierre Pronchery.Nm pkgconf 30*a3cefe7fSPierre Proncheryis an implementation. 31*a3cefe7fSPierre Pronchery.\" 32*a3cefe7fSPierre Pronchery.Ss FILE SYNTAX 33*a3cefe7fSPierre ProncheryThe 34*a3cefe7fSPierre Pronchery.Nm .pc 35*a3cefe7fSPierre Proncheryfile follows a format inspired by RFC822. 36*a3cefe7fSPierre ProncheryComments are prefixed by a pound sign, hash sign or octothorpe (#), and variable 37*a3cefe7fSPierre Proncheryassignment is similar to POSIX shell. 38*a3cefe7fSPierre ProncheryProperties are defined using RFC822-style stanzas. 39*a3cefe7fSPierre Pronchery.\" 40*a3cefe7fSPierre Pronchery.Ss VARIABLES 41*a3cefe7fSPierre Pronchery.\" 42*a3cefe7fSPierre ProncheryVariable definitions start with an alphanumeric string, followed by an equal sign, 43*a3cefe7fSPierre Proncheryand then the value the variable should contain. 44*a3cefe7fSPierre Pronchery.Pp 45*a3cefe7fSPierre ProncheryVariable references are always written as "${variable}". 46*a3cefe7fSPierre ProncheryIt is possible to escape literal "${" as "$${". 47*a3cefe7fSPierre Pronchery.\" 48*a3cefe7fSPierre Pronchery.Ss PROPERTIES 49*a3cefe7fSPierre Pronchery.\" 50*a3cefe7fSPierre ProncheryProperties are set using RFC822-style stanzas which consist of a keyword, followed 51*a3cefe7fSPierre Proncheryby a colon (:) and then the value the property should be set to. 52*a3cefe7fSPierre ProncheryVariable substitution is always performed regardless of property type. 53*a3cefe7fSPierre Pronchery.Pp 54*a3cefe7fSPierre ProncheryThere are three types of property: 55*a3cefe7fSPierre Pronchery.\" 56*a3cefe7fSPierre Pronchery.Bl -tag -width indent 57*a3cefe7fSPierre Pronchery.\" 58*a3cefe7fSPierre Pronchery.It Literal 59*a3cefe7fSPierre ProncheryThe property will be set to the text of the value. 60*a3cefe7fSPierre Pronchery.\" 61*a3cefe7fSPierre Pronchery.It Dependency List 62*a3cefe7fSPierre ProncheryThe property will be set to a list of dependencies parsed from the 63*a3cefe7fSPierre Proncherytext. 64*a3cefe7fSPierre ProncheryDependency lists are defined by this ABNF syntax: 65*a3cefe7fSPierre Pronchery.Bd -literal 66*a3cefe7fSPierre Proncherypackage-list = *WSP *( package-spec *( package-sep ) ) 67*a3cefe7fSPierre Proncherypackage-sep = WSP / "," 68*a3cefe7fSPierre Pronchery.\" 69*a3cefe7fSPierre Proncherypackage-spec = package-key [ ver-op package-version ] 70*a3cefe7fSPierre Proncheryver-op = "<" / "<=" / "=" / "!=" / ">=" / ">" 71*a3cefe7fSPierre Pronchery.Ed 72*a3cefe7fSPierre Pronchery.\" 73*a3cefe7fSPierre Pronchery.It Fragment List 74*a3cefe7fSPierre ProncheryThe property will be set to a list of fragments parsed from the text. 75*a3cefe7fSPierre ProncheryThe input text must be in a format that is suitable for passing to a POSIX 76*a3cefe7fSPierre Proncheryshell without any shell expansions after variable substitution has been done. 77*a3cefe7fSPierre Pronchery.\" 78*a3cefe7fSPierre Pronchery.El 79*a3cefe7fSPierre Pronchery.Ss PROPERTY KEYWORDS 80*a3cefe7fSPierre Pronchery.Bl -tag -width indent 81*a3cefe7fSPierre Pronchery.\" 82*a3cefe7fSPierre Pronchery.It Name 83*a3cefe7fSPierre ProncheryThe displayed name of the package. 84*a3cefe7fSPierre Pronchery(mandatory; literal) 85*a3cefe7fSPierre Pronchery.It Version 86*a3cefe7fSPierre ProncheryThe version of the package. 87*a3cefe7fSPierre Pronchery(mandatory; literal) 88*a3cefe7fSPierre Pronchery.It Description 89*a3cefe7fSPierre ProncheryA description of the package. 90*a3cefe7fSPierre Pronchery(mandatory; literal) 91*a3cefe7fSPierre Pronchery.It URL 92*a3cefe7fSPierre ProncheryA URL to a webpage for the package. 93*a3cefe7fSPierre ProncheryThis is used to recommend where newer versions of the package can be acquired. 94*a3cefe7fSPierre Pronchery(mandatory; literal) 95*a3cefe7fSPierre Pronchery.It Cflags 96*a3cefe7fSPierre ProncheryRequired compiler flags. 97*a3cefe7fSPierre ProncheryThese flags are always used, regardless of whether static compilation is requested. 98*a3cefe7fSPierre Pronchery(optional; fragment list) 99*a3cefe7fSPierre Pronchery.It Cflags.private 100*a3cefe7fSPierre ProncheryRequired compiler flags for static compilation. 101*a3cefe7fSPierre Pronchery(optional; fragment list; pkgconf extension) 102*a3cefe7fSPierre Pronchery.It Copyright 103*a3cefe7fSPierre ProncheryA copyright attestation statement. 104*a3cefe7fSPierre Pronchery(optional; literal; pkgconf extension) 105*a3cefe7fSPierre Pronchery.It Libs 106*a3cefe7fSPierre ProncheryRequired linking flags for this package. 107*a3cefe7fSPierre ProncheryLibraries this package depends on for linking against it, which are not 108*a3cefe7fSPierre Proncherydescribed as dependencies should be specified here. 109*a3cefe7fSPierre Pronchery(optional; fragment list) 110*a3cefe7fSPierre Pronchery.It Libs.private 111*a3cefe7fSPierre ProncheryRequired linking flags for this package that are only required when linking 112*a3cefe7fSPierre Proncherystatically. 113*a3cefe7fSPierre ProncheryLibraries this package depends on for linking against it statically, which are 114*a3cefe7fSPierre Proncherynot described as dependencies should be specified here. 115*a3cefe7fSPierre Pronchery(optional; fragment list) 116*a3cefe7fSPierre Pronchery.It License 117*a3cefe7fSPierre ProncheryThe asserted SPDX license tag that should be applied to the given package. 118*a3cefe7fSPierre Pronchery(optional; literal; pkgconf extension) 119*a3cefe7fSPierre Pronchery.It Maintainer 120*a3cefe7fSPierre ProncheryThe preferred contact for the maintainer. This should be in the format of a 121*a3cefe7fSPierre Proncheryname followed by an e-mail address or website. 122*a3cefe7fSPierre Pronchery(optional; literal; pkgconf extension) 123*a3cefe7fSPierre Pronchery.It Requires 124*a3cefe7fSPierre ProncheryRequired dependencies that must be met for the package to be usable. 125*a3cefe7fSPierre ProncheryAll dependencies must be satisfied or the pkg-config implementation must not use 126*a3cefe7fSPierre Proncherythe package. 127*a3cefe7fSPierre Pronchery(optional; dependency list) 128*a3cefe7fSPierre Pronchery.It Requires.private 129*a3cefe7fSPierre ProncheryRequired dependencies that must be met for the package to be usable for header 130*a3cefe7fSPierre Proncheryinclusion and static linking. 131*a3cefe7fSPierre ProncheryAll dependencies must be satisfied or the pkg-config implementation must not use 132*a3cefe7fSPierre Proncherythe package for header inclusion and static linking. 133*a3cefe7fSPierre Pronchery(optional; dependency list) 134*a3cefe7fSPierre Pronchery.It Conflicts 135*a3cefe7fSPierre ProncheryDependencies that must not be met for the package to be usable. 136*a3cefe7fSPierre ProncheryIf any package in the proposed dependency solution match any dependency in the 137*a3cefe7fSPierre ProncheryConflicts list, the package being considered is not usable. 138*a3cefe7fSPierre Pronchery(optional; dependency list) 139*a3cefe7fSPierre Pronchery.It Provides 140*a3cefe7fSPierre ProncheryDependencies that may be provided by an alternate package. 141*a3cefe7fSPierre ProncheryIf a package cannot be found, the entire package collection is scanned for 142*a3cefe7fSPierre Proncheryproviders which can match the requested dependency. 143*a3cefe7fSPierre Pronchery(optional; dependency list; pkgconf extension) 144*a3cefe7fSPierre Pronchery.El 145*a3cefe7fSPierre Pronchery.Ss EXTENSIONS 146*a3cefe7fSPierre ProncheryFeatures that have been marked as a pkgconf extension are only guaranteed to work 147*a3cefe7fSPierre Proncherywith the pkgconf implementation of pkg-config. 148*a3cefe7fSPierre ProncheryOther implementations may or may not support the extensions. 149*a3cefe7fSPierre Pronchery.Pp 150*a3cefe7fSPierre ProncheryAccordingly, it is suggested that 151*a3cefe7fSPierre Pronchery.Nm .pc 152*a3cefe7fSPierre Proncheryfiles which absolutely depend on these extensions declare a requirement on the 153*a3cefe7fSPierre Proncherypkgconf virtual. 154*a3cefe7fSPierre Pronchery.Sh EXAMPLES 155*a3cefe7fSPierre ProncheryAn example .pc file: 156*a3cefe7fSPierre Pronchery.Bd -literal 157*a3cefe7fSPierre Pronchery# This is a comment 158*a3cefe7fSPierre Proncheryprefix=/home/kaniini/pkg # this defines a variable 159*a3cefe7fSPierre Proncheryexec_prefix=${prefix} # defining another variable with a substitution 160*a3cefe7fSPierre Proncherylibdir=${exec_prefix}/lib 161*a3cefe7fSPierre Proncheryincludedir=${prefix}/include 162*a3cefe7fSPierre Pronchery 163*a3cefe7fSPierre ProncheryName: libfoo # human-readable name 164*a3cefe7fSPierre ProncheryDescription: an example library called libfoo # human-readable description 165*a3cefe7fSPierre ProncheryCopyright: Copyright (c) 2022 pkgconf project authors 166*a3cefe7fSPierre ProncheryLicense: Apache-2.0 167*a3cefe7fSPierre ProncheryMaintainer: the pkgconf project <http://www.pkgconf.org> 168*a3cefe7fSPierre ProncheryVersion: 1.0 169*a3cefe7fSPierre ProncheryURL: http://www.pkgconf.org 170*a3cefe7fSPierre ProncheryRequires: libbar > 2.0.0 171*a3cefe7fSPierre ProncheryConflicts: libbaz <= 3.0.0 172*a3cefe7fSPierre ProncheryLibs: -L${libdir} -lfoo 173*a3cefe7fSPierre ProncheryLibs.private: -lm 174*a3cefe7fSPierre ProncheryCflags: -I${includedir}/libfoo 175*a3cefe7fSPierre Pronchery.Ed 176*a3cefe7fSPierre Pronchery.Sh SEE ALSO 177*a3cefe7fSPierre Pronchery.Xr pkgconf 1 , 178*a3cefe7fSPierre Pronchery.Xr pkg.m4 7 179