diff options
author | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2019-02-04 20:18:12 +0000 |
---|---|---|
committer | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2019-02-04 20:18:12 +0000 |
commit | b510453dc598e25bb1def1b4881a24e59ecbf51a (patch) | |
tree | 9b31696014f56d12a3683080529fe18598263d65 /usr.bin/pkg-config | |
parent | 0591c3702b83e11cee76bf938d082af8cde0e7c6 (diff) |
add support for defining variables through the environment
this uses the PKG_CONFIG_$PACKAGE_$VARIABLE format as implemented in fd.o pkg-config 0.29.1;
bump our version accordingly.
Diffstat (limited to 'usr.bin/pkg-config')
-rw-r--r-- | usr.bin/pkg-config/pkg-config | 19 | ||||
-rw-r--r-- | usr.bin/pkg-config/pkg-config.1 | 4 |
2 files changed, 20 insertions, 3 deletions
diff --git a/usr.bin/pkg-config/pkg-config b/usr.bin/pkg-config/pkg-config index 9acc4a2eccd..6dfbd3224eb 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.91 2019/02/04 18:51:29 jasper Exp $ +# $OpenBSD: pkg-config,v 1.92 2019/02/04 20:18:11 jasper Exp $ # $CSK: pkgconfig.pl,v 1.39 2006/11/27 16:26:20 ckuethe Exp $ # Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org> @@ -46,7 +46,7 @@ my $allow_uninstalled = defined $ENV{PKG_CONFIG_DISABLE_UNINSTALLED} ? 0 : 1; my $found_uninstalled = 0; -my $version = '0.29.0'; # pretend to be this version of pkgconfig +my $version = '0.29.1'; # pretend to be this version of pkgconfig my %configs = (); setup_self(); @@ -289,6 +289,21 @@ sub handle_config my $get_props = sub { my $property = shift; + my $pkg; + + # See if there's anyting in the environment that we need to take into account. + ($pkg = $p) =~ s/(^.*\/)?(.*?)\.pc$/$2/g; + $pkg = uc($pkg); + + if (grep {/PKG_CONFIG_${pkg}.*/} keys %ENV) { + # Now that we know we have something to look for, do the inefficient + # iteration. + while (my ($k, $v) = each %ENV) { + if ($k =~ /^PKG_CONFIG_${pkg}_(\w+)/) { + $variables->{lc($1)} = $v; + } + } + } my $deps = $cfg->get_property($property, $variables); if (defined $deps) { diff --git a/usr.bin/pkg-config/pkg-config.1 b/usr.bin/pkg-config/pkg-config.1 index 03b8fcd5e27..8a808cdc731 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.32 2019/02/04 18:51:29 jasper Exp $ +.\" $OpenBSD: pkg-config.1,v 1.33 2019/02/04 20:18:11 jasper Exp $ .\" .\" Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org> .\" @@ -182,6 +182,8 @@ If set uses the specified value for .Em pc_top_builddir instead of $(top_builddir). +.It Ev PKG_CONFIG_$PACKAGE_$VARIABLE +Override the $VARIABLE in $PACKAGE with the given value. .El .Sh EXIT STATUS .Ex -std pkg-config |