From: George Koehler Subject: Re: pkg-config relocatable .pc support To: Jeremie Courreges-Anglas Cc: tech@openbsd.org Date: Sun, 12 Jan 2025 20:53:35 -0500 "use File::Basename;" imports "dirname" and a few other functions by default. You can call "dirname($name)" without the "File::Basename::" prefix, like src/usr.bin/pkg-config/pkg-config does with "basename". --gkoehler On Sun, 12 Jan 2025 14:57:34 +0100 Jeremie Courreges-Anglas wrote: > Index: OpenBSD/PkgConfig.pm > =================================================================== > RCS file: /cvs/src/usr.bin/pkg-config/OpenBSD/PkgConfig.pm,v > diff -u -p -r1.12 PkgConfig.pm > --- OpenBSD/PkgConfig.pm 11 Feb 2024 03:57:10 -0000 1.12 > +++ OpenBSD/PkgConfig.pm 25 Nov 2024 18:27:22 -0000 > @@ -15,6 +15,7 @@ > # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > > use v5.36; > +use File::Basename; > > > # interface to the *.pc file format of pkg-config. > @@ -106,6 +107,8 @@ sub read_fh($class, $fh, $name = '') > { > my $cfg = $class->new; > > + $cfg->add_variable('pcfiledir', File::Basename::dirname($name)); > + > while (<$fh>) { > chomp; > # continuation lines > @@ -145,6 +148,8 @@ sub read_file($class, $filename) > sub write_fh($self, $fh) > { > foreach my $variable (@{$self->{vlist}}) { > + # writing out pcfiledir makes no sense > + next if $variable eq 'pcfiledir'; > say $fh "$variable=", $self->{variables}{$variable}; > } > print $fh "\n\n";