Produce a specification for .pc files #148
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: ariadne/pkgconf#148
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
If
pkgconf
andpkg-config
are both going to be potentially used by different people (for example, on different distros) to compile the same source code (another FOSS project), they’re both going to be consuming the same.pc
files.Currently there isn’t a comprehensive specification of the syntax or semantics of a
.pc
file. In order to avoid incompatibilities between the two implementations, there probably should be. Ideally it would be reviewed by both thepkgconf
andpkg-config
authors, and include some thoughts about forwards compatibility so thatpkgconf
could have scope to improve/extend the.pc
format in future without breaking users who are usingpkg-config
.Someone has written a specification up, which would be a good starting point (assuming they are OK with derivations of it — it’s CC-BY 3.0): https://dev.gentoo.org/~mgorny/pkg-config-spec.html
We have thought about formally specifying the .pc format a few times. mgorny was involved in pkgconf at an early stage, and that's where that spec came from.
We had some talks with the pkg-config maintainer about it a while back, but it didn't really develop into anything.
We do not need to have a specification in order to improve the .pc format as we intend to do.
A package which requires pkgconf extensions today can simply declare it's dependency on the pkgconf virtual like:
It may be interesting to add an
extension:
namespace for specific extensions, for example:In our view, this is the most realistic way forward... a specification that codifies legacy pkg-config behaviour is entirely antithetical to what we are trying to accomplish with this project.
To expand on this, I believe a specification is basically impossible.
pkgconf and pkg-config implement many things in entirely different ways, such as cross-compiling support.
For example:
With pkgconf, it is possible to have a single binary and define many sysroots and have everything just work with a wrapper script.
With pkg-config, it is possible to have a single binary and define many sysroots and making everything work requires adding cross-compilation details to the .pc files as well as a wrapper script. As a result cross-toolchains build their own copy of pkg-config that is configured relative to the sysroot.
Both interpretations could be considered valid, which should the spec choose?
There are other corner cases between the implementations that are intentional (because pkgconf comes from years of frustration with using pkg-config for embedded development) and a specification requiring the freedesktop.org pkg-config behaviour be correct is basically a specification we would be extremely unlikely to implement (because we do not want to break our own tools in the same way that pkg-config is broken for embedded development).
With all of that said I am keeping this open because there is value in specifying what pkgconf accepts.
The problem really comes down to using a spec to improve interoperability: it just seems so unlikely to me that I don’t want to spend time on it. If anything, the best outcome would be that pkg-config corrects some of the design defects in its implementation but like I said seems unlikely.
I would be open to specifying a subset of what pkgconf accepts as part of a POSIX or similar standard however.
Basically, the problem I want to avoid is: people writing
.pc
files which behave differently underpkgconf
andpkg-config
, without knowing that they should also make those.pc
files explicitly depend onpkgconf
(orpkg-config
). I want to avoid the situation where my project builds (or can be built against, if it’s a library exporting a.pc
file) absolutely fine on one system; but then fails or builds incorrectly on another system which is usingpkg-config
instead ofpkgconf
(or vice-versa). This could be avoided by having a specification of whatpkgconf
accepts, as long as that also points out wherepkgconf
’s behaviour differs frompkg-config
.Secondarily, I want to avoid people cargo-culting
.pc
files from other projects and not really understanding what the keys in the.pc
file mean. That can also be solved by a specification of whatpkgconf
accepts.Yeah, that's a huge problem, especially the cargo-culting.
I agree some solid documentation of the format is good, and I think the gating approach I described earlier can solve the pkg-config vs. pkgconf concern.
I will see what I can do :)
Great, thanks. I’m happy to proofread things if that will help.
@kaniini For what it's worth, it has been requested that at least a man page that documents what a pc file looks like and what the directives do be included in pkgconf.
See downstream RH bug: https://bugzilla.redhat.com/show_bug.cgi?id=1416434
I think that a manpage describing the format should be a separate manpage. Thoughts?
@kaniini Absolutely, I agree.
What should we call the manpage? I believe it should be in section 4, but not 100% sure on the name.
pkg-config
? Orpc
, but that's too short to me.I’ve left some proofreading comments on the commit itself. Thanks for doing this.