summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/pkg-config/OpenBSD/PkgConfig.pm25
1 files changed, 19 insertions, 6 deletions
diff --git a/usr.bin/pkg-config/OpenBSD/PkgConfig.pm b/usr.bin/pkg-config/OpenBSD/PkgConfig.pm
index 6b4791335e9..3a7f7efbffe 100644
--- a/usr.bin/pkg-config/OpenBSD/PkgConfig.pm
+++ b/usr.bin/pkg-config/OpenBSD/PkgConfig.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PkgConfig.pm,v 1.6 2015/10/26 18:08:44 jasper Exp $
+# $OpenBSD: PkgConfig.pm,v 1.7 2018/05/18 17:01:57 espie Exp $
#
# Copyright (c) 2006 Marc Espie <espie@openbsd.org>
#
@@ -24,11 +24,24 @@ package OpenBSD::PkgConfig;
my $parse = {
Requires => sub {
- [split qr{
- (?<![<=>]) # not preceded by <=>
- [,\s]+ # delimiter
- (?![<=>]) # not followed by <=>
- }x, shift ] }
+ my @l = split(/[,\s]+/, shift);
+ my @r = ();
+ while (@l > 0) {
+ my $n = shift @l;
+ if ($n =~ m/[<=>]+$/) {
+ if (@l > 0) {
+ $n .= shift @l;
+ }
+ }
+ if ($n =~ m/^[<=>]+/) {
+ if (@r > 0) {
+ $n = (pop @r).$n;
+ }
+ }
+ push(@r, $n);
+ }
+ return \@r;
+ },
};