summaryrefslogtreecommitdiff
path: root/usr.bin/pkg-config
diff options
context:
space:
mode:
authorChris Kuethe <ckuethe@cvs.openbsd.org>2006-11-28 01:36:18 +0000
committerChris Kuethe <ckuethe@cvs.openbsd.org>2006-11-28 01:36:18 +0000
commit6de44620796db542e00d3b0f762e2cd1f289c9e0 (patch)
tree2bc1c78089af164cf261b74be68a92a41ad02606 /usr.bin/pkg-config
parent2ee3b93fbb879808a78ed3bdb057aae5268db438 (diff)
Allow "pkg-config --modversion" to work. Reported by naddy@
Diffstat (limited to 'usr.bin/pkg-config')
-rw-r--r--usr.bin/pkg-config/pkg-config15
-rw-r--r--usr.bin/pkg-config/pkg-config.17
2 files changed, 17 insertions, 5 deletions
diff --git a/usr.bin/pkg-config/pkg-config b/usr.bin/pkg-config/pkg-config
index 6a3673fc982..6e3a6818d25 100644
--- a/usr.bin/pkg-config/pkg-config
+++ b/usr.bin/pkg-config/pkg-config
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $OpenBSD: pkg-config,v 1.5 2006/11/27 23:57:51 ckuethe Exp $
+# $OpenBSD: pkg-config,v 1.6 2006/11/28 01:36:17 ckuethe Exp $
#$CSK: pkgconfig.pl,v 1.39 2006/11/27 16:26:20 ckuethe Exp $
# Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org>
@@ -76,13 +76,20 @@ GetOptions( 'debug' => \$D,
'static' => sub { $mode{'static'} = 1},
'uninstalled' => sub { $mode{'uninstalled'} = 1},
'atleast-version=s' => \$mode{'atleast-version'},
- 'modversion=s' => \$mode{'modversion'},
+ 'modversion:s' => \$mode{'modversion'},
'variable=s' => \$mode{'variable'}
);
print STDERR "\n[" . join('] [', $0, @ARGV) . "]\n" if $D;
self_version($mode{'minvers'}) if $mode{'minvers'}; #does not return
-do_modversion($mode{'modversion'}) if $mode{'modversion'}; #does not return
+if (defined $mode{'modversion'}) {
+ if ($mode{'modversion'}) {
+ do_modversion($mode{'modversion'}) ; #does not return
+ } else {
+ print $version . "\n";
+ exit 0;
+ }
+}
$p = join(' ', @ARGV);
$p =~ s/\s+/ /g;
@@ -222,6 +229,8 @@ sub do_modversion
my ($p, undef) = @_;
my ($f);
+ print "\$p ='$p'\n";
+
exit 1 unless $f = pathresolve($p);
exit 1 unless $f = slurp($f);
diff --git a/usr.bin/pkg-config/pkg-config.1 b/usr.bin/pkg-config/pkg-config.1
index 23c51b13bbc..f171acbe50a 100644
--- a/usr.bin/pkg-config/pkg-config.1
+++ b/usr.bin/pkg-config/pkg-config.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pkg-config.1,v 1.2 2006/11/28 01:20:44 ckuethe Exp $
+.\" $OpenBSD: pkg-config.1,v 1.3 2006/11/28 01:36:17 ckuethe Exp $
.\"
.\" Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org>
.\"
@@ -109,7 +109,10 @@ Return the compiler and/or linker flags required for static linking.
.It Fl -atleast-version Ar version
Exit with error if the specified package is not new enough
.It Fl -modversion
-Fetch package version
+Fetch package version.
+If no package is given,
+.Nm
+returns its own version.
.It Fl -variable Ar name
Fetch the value of the named variable.
.El