Re: pkg-config and share/

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Mon, 25 Jul 2022 08:15:35 UTC
On Sun, Jul 24, 2022 at 02:36:14PM +0200, Andrea Pappacoda wrote:
> Hi everyone! First time on the FreeBSD mailing lists, I hope this is not in the wrong section :)
> 
> I'd like to ask/discuss about FreeBSD's pkg-config behaviour. [As far as I understand][1], on FreeBSD pkgconf looks for .pc files in the /usr/lib and /usr/libdata directories, but completely ignores /usr/share. Why is that? Where should arch-independent packages install their .pc files?
> 
> I came here after a short discussion on a [GitHub issue][2], and I recommend looking at that thread too because it gives a lot of information about what the issue with not looking in share/ is, but in short it creates interoperability problems with OSs wanting to use that directory for cross-build purposes.
> 
> Could somebody please help me understand why things work this way here, and if this unusual pkg-config behaviour could be improved?
> 
> Thanks!
> 
> [1]: https://cgit.freebsd.org/ports/tree/devel/pkgconf/Makefile#n23
> 
> [2]: https://github.com/marzer/tomlplusplus/pull/165


Hello,

pkgconf does not look into /usr/lib but only /usr/libdata, tradionnaly on
freebsd libdata has been used to store things used by the tool chain somehow but
not being an actual library: gcc's configuration data at the time, ldscripts at
the time, both empty now.

man hier(4) will provide you the information.

When pkg-config came out, (before my time) the .pc files were naturally added to
libdata which is where most people hacking on freebsd would have expected it.

So when we switched to pkgconf we preserved that.

Note that the ports tree on freebsd does not need patching as it automatically
moves the .pc files from the "linux" location to libdata.

I do hope that this answers your question!

Best regards,
Bapt