summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasper <jasper@openbsd.org>2011-03-14 08:35:08 +0000
committerjasper <jasper@openbsd.org>2011-03-14 08:35:08 +0000
commita1f315564a74fef51ddfca95c80ba543666cc03d (patch)
tree892ba08e2bae47b0267bf9ff3754d7ef6735516c
parentfixed a use-after-free bug introduced at 1.7 in pipex_mppe_output(). (diff)
downloadwireguard-openbsd-a1f315564a74fef51ddfca95c80ba543666cc03d.tar.xz
wireguard-openbsd-a1f315564a74fef51ddfca95c80ba543666cc03d.zip
- implement PKG_CONFIG_SYSROOT_DIR
- bump version to 0.23
-rw-r--r--usr.bin/pkg-config/pkg-config23
-rw-r--r--usr.bin/pkg-config/pkg-config.114
2 files changed, 31 insertions, 6 deletions
diff --git a/usr.bin/pkg-config/pkg-config b/usr.bin/pkg-config/pkg-config
index 551fd5efdce..b2945e43342 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.31 2011/03/10 19:15:55 jasper Exp $
+# $OpenBSD: pkg-config,v 1.32 2011/03/14 08:35:08 jasper Exp $
#$CSK: pkgconfig.pl,v 1.39 2006/11/27 16:26:20 ckuethe Exp $
# Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org>
@@ -39,7 +39,7 @@ my $allow_uninstalled =
defined $ENV{PKG_CONFIG_DISABLE_UNINSTALLED} ? 0 : 1;
my $found_uninstalled = 0;
-my $version = 0.22; # pretend to be this version of pkgconfig
+my $version = 0.23; # pretend to be this version of pkgconfig
my %configs = ();
my %mode = ();
@@ -53,6 +53,12 @@ my $D = 0; # debug flag
} else {
$variables->{pc_top_builddir} = '$(top_builddir)';
}
+
+ my $s = $ENV{PKG_CONFIG_SYSROOT_DIR};
+ if (defined $s) {
+ $variables->{pc_sysrootdir} = $s;
+ }
+ # The default '/' is implied.
}
$D = 1 if defined($ENV{PKG_CONFIG_DEBUG_SPEW});
@@ -407,7 +413,7 @@ sub do_cflags
my $l = $configs{$pkg}->get_property('Cflags', $variables);
push(@$cflags, @$l) if defined $l;
}
- return OpenBSD::PkgConfig->compress($cflags,
+ my $a = OpenBSD::PkgConfig->compress($cflags,
sub {
local $_ = shift;
if (($mode{cflags} & 1) && /^-I/ ||
@@ -417,7 +423,11 @@ sub do_cflags
return 0;
}
});
- return undef;
+ if (defined($a) && defined($variables->{pc_sysrootdir})){
+ $a =~ s/^-I/$&$variables->{pc_sysrootdir}/g;
+ }
+
+ return $a;
}
#if the lib option is set, pull out the linker flags
@@ -441,6 +451,11 @@ sub do_libs
return 0;
}
});
+
+ if (defined($variables->{pc_sysrootdir})){
+ $a =~ s/^-[lL]/$&$variables->{pc_sysrootdir}/g;
+ }
+
if ($mode{libs} & 1) {
my $b = OpenBSD::PkgConfig->rcompress($libs,
sub { shift =~ m/^-l/; });
diff --git a/usr.bin/pkg-config/pkg-config.1 b/usr.bin/pkg-config/pkg-config.1
index 5c0cf4ab32f..1a9180eef94 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.17 2011/03/10 19:13:14 jasper Exp $
+.\" $OpenBSD: pkg-config.1,v 1.18 2011/03/14 08:35:08 jasper Exp $
.\"
.\" Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: March 10 2011 $
+.Dd $Mdocdate: March 14 2011 $
.Dt PKG-CONFIG 1
.Os
.Sh NAME
@@ -154,6 +154,16 @@ will write the passed arguments.
This can be used to specify a colon-separated list of paths to search for
package files.
If given, this list of paths is prepended to the standard search path.
+.It Ev PKG_CONFIG_SYSROOT_DIR
+This modifies
+.Fl I
+and
+.Fl L
+to use the target sysroot directory.
+Thus -I/usr/local/include will become -I/target/usr/local/include when
+PKG_CONFIG_SYSROOT_DIR is set to /target, which is useful when crosscompiling
+packages that use
+.Nm .
.It Ev PKG_CONFIG_TOP_BUILD_DIR
If set
.Nm