Download raw body.
pkg-config relocatable .pc support
On Mon, 13 Jan 2025 14:17:54 +0100
Jeremie Courreges-Anglas <jca@wxcvbn.org> wrote:
> Thanks for the suggestion, but that doesn't work. At the call site
> we're within "package OpenBSD::PkgConfig;", so a bare dirname() would
> be looked up as OpenBSD::PkgConfig::dirname. Hence the fully
> qualified call used in the diff.
Sorry, I forgot that Perl modules have "package _;" lines.
The bare dirname() works only if I move the "use" after "package",
package OpenBSD::PkgConfig;
use File::Basename;
For example, src/usr.sbin/pkg_add/OpenBSD/Delete.pm has multiple
packages doing "use File::Basename;". In general, "use" goes after
"package" unless it is a lexical pragma like "use v5.36;".
If code calls "File::Basename::dirname" by the full name, then I would
expect it to "use File::Basename ();" to import the empty list.
The rest of your diff looks correct. While running it with the bare
dirname() and the moved "use", I confirm that --cflags and --libs
give the same output (or same error) for every package in --list-all
on my OpenBSD/amd64. I made a .pc with "prefix=${pcfiledir}/../.."
and it behaved the same on OpenBSD (with your diff) and Linux (where
pkg-config is pkgconf).
--gkoehler
pkg-config relocatable .pc support