[BACK]Return to pkg-config CVS log [TXT][DIR] Up to [local] / src / usr.bin / pkg-config

Diff for /src/usr.bin/pkg-config/pkg-config between version 1.92 and 1.93

version 1.92, 2019/02/04 20:18:11 version 1.93, 2019/12/08 14:22:14
Line 165 
Line 165 
   
 # Return the next module from @ARGV, if it turns out to be a comma separated  # Return the next module from @ARGV, if it turns out to be a comma separated
 # module list, take the first one and put the rest back to the front.  # module list, take the first one and put the rest back to the front.
 sub get_next_module {  sub get_next_module
   {
         my $module = shift @ARGV;          my $module = shift @ARGV;
         my $m;          my $m;
         if ($module =~ m/,/) {          if ($module =~ m/,/) {
Line 288 
Line 289 
         }          }
   
         my $get_props = sub {          my $get_props = sub {
                 my $property = shift;              my $property = shift;
                 my $pkg;              my $pkg;
   
                 # See if there's anyting in the environment that we need to take into account.              # See if there's anything in the environment that we need to
                 ($pkg = $p) =~ s/(^.*\/)?(.*?)\.pc$/$2/g;              # take into account.
                 $pkg = uc($pkg);              ($pkg = $p) =~ s/(^.*\/)?(.*?)\.pc$/$2/g;
               $pkg = uc($pkg);
   
                 if (grep {/PKG_CONFIG_${pkg}.*/} keys %ENV) {              if (grep {/PKG_CONFIG_${pkg}.*/} keys %ENV) {
                         # Now that we know we have something to look for, do the inefficient                      # Now that we know we have something to look for, do
                         # iteration.                      # the inefficient iteration.
                         while (my ($k, $v) = each %ENV) {                      while (my ($k, $v) = each %ENV) {
                                 if ($k =~ /^PKG_CONFIG_${pkg}_(\w+)/) {                              if ($k =~ /^PKG_CONFIG_${pkg}_(\w+)/) {
                                         $variables->{lc($1)} = $v;                                      $variables->{lc($1)} = $v;
                                 }                              }
                         }                      }
                 }              }
   
                 my $deps = $cfg->get_property($property, $variables);              my $deps = $cfg->get_property($property, $variables);
                 if (defined $deps) {              return unless defined $deps;
                         for my $dep (@$deps) {              for my $dep (@$deps) {
                                 if ($dep =~ m/^(.*?)\s*([<=>]+)\s*([\d\.]+|[\d\.]+[\w]*[\d]+)$/) {                      if ($dep =~ m/^(.*?)\s*([<=>]+)\s*([\d\.]+|[\d\.]+[\w]*[\d]+)$/) {
                                         handle_config($1, $2, $3, $list);                              handle_config($1, $2, $3, $list);
                                 } else {                      } else {
                                         handle_config($dep, undef, undef, $list);                              handle_config($dep, undef, undef, $list);
                                 }                      }
                         }              }
                         say_debug("package $p " . lc($property) . " " . join(',', @$deps));              say_debug("package $p " . lc($property) . " " . join(',', @$deps));
                 }  
         };          };
   
         if (defined $mode{cflags}          if (defined $mode{cflags}
Line 328 
Line 329 
         unless (defined $mode{validate}) {          unless (defined $mode{validate}) {
                 &$get_props("Requires");                  &$get_props("Requires");
         }          }
   
 }  }
   
 # look for the .pc file in each of the PKGPATH elements. Return the path or  # look for the .pc file in each of the PKGPATH elements. Return the path or
Line 338 
Line 338 
         my ($p) = @_;          my ($p) = @_;
   
         if ($allow_uninstalled && $p !~ m/\-uninstalled$/) {          if ($allow_uninstalled && $p !~ m/\-uninstalled$/) {
                 foreach my $d (@PKGPATH) {                  for my $d (@PKGPATH) {
                         my $f = "$d/$p-uninstalled.pc";                          my $f = "$d/$p-uninstalled.pc";
                         say_debug("pathresolve($p) looking in $f");                          say_debug("pathresolve($p) looking in $f");
                         if (-f $f) {                          if (-f $f) {
Line 348 
Line 348 
                 }                  }
         }          }
   
         foreach my $d (@PKGPATH) {          for my $d (@PKGPATH) {
                 my $f = "$d/$p.pc";                  my $f = "$d/$p.pc";
                 say_debug("pathresolve($p) looking in $f");                  say_debug("pathresolve($p) looking in $f");
                 return $f if -f $f;                  return $f if -f $f;
Line 397 
Line 397 
                 say_error("Package file '$f' appears to be empty");                  say_error("Package file '$f' appears to be empty");
         }          }
   
         foreach (@required_elems) {          for my $p (@required_elems) {
                 my $e = $cfg->get_property($_, $variables);                  my $e = $cfg->get_property($p, $variables);
                 if (!defined $e) {                  if (!defined $e) {
                         $f =~ s/(^.*\/)?(.*?)\.pc$/$2/g;                          $f =~ s/(^.*\/)?(.*?)\.pc$/$2/g;
                         say_error("Package '$f' has no $_: field");                          say_error("Package '$f' has no $p: field");
                         return undef;                          return undef;
                 }                  }
         }          }
Line 494 
Line 494 
   
         my $cflags = [];          my $cflags = [];
   
         foreach my $pkg (@$list) {          for my $pkg (@$list) {
                 my $l = $configs{$pkg}->get_property('Cflags', $variables);                  my $l = $configs{$pkg}->get_property('Cflags', $variables);
                 foreach (@$l) {                  for my $path (@$l) {
                         unless ($_ =~ /-I\/usr\/include\/*$/) {                          unless ($path =~ /-I\/usr\/include\/*$/) {
                                 push(@$cflags, $_);                                  push(@$cflags, $path);
                         }                          }
                 }                  }
         }          }
Line 530 
Line 530 
         # order, not in search order. Ordering matters for static linking:          # order, not in search order. Ordering matters for static linking:
         # Start with Libs (first our own, then dependencies), and append          # Start with Libs (first our own, then dependencies), and append
         # Libs.private (same order as for Libs).          # Libs.private (same order as for Libs).
         foreach my $pkg (@$list) {          for my $pkg (@$list) {
                 my $l = $configs{$pkg}->get_property('Libs', $variables);                  my $l = $configs{$pkg}->get_property('Libs', $variables);
                 foreach (@$l) {                  for my $path (@$l) {
                         unless ($_ =~ /-L\/usr\/lib\/*$/) {                          unless ($path =~ /-L\/usr\/lib\/*$/) {
                                 push(@$libs, $_);                                  push(@$libs, $path);
                         }                          }
                 }                  }
                 if ($mode{static}) {                  if ($mode{static}) {
                         my $lp = $configs{$pkg}->get_property('Libs.private', $variables);                          my $lp = $configs{$pkg}->get_property('Libs.private', $variables);
                         foreach (@$lp) {                          for my $path (@$lp) {
                                 unless ($_ =~ /-L\/usr\/lib\/*/) {                                  unless ($path =~ /-L\/usr\/lib\/*/) {
                                         push(@$libs, $_);                                          push(@$libs, $path);
                                 }                                  }
                         }                          }
                 }                  }
Line 550 
Line 550 
         # Get the linker path directives (-L) and store it in $a.          # Get the linker path directives (-L) and store it in $a.
         # $b will be the actual libraries.          # $b will be the actual libraries.
         my $a = OpenBSD::PkgConfig->compress($libs,          my $a = OpenBSD::PkgConfig->compress($libs,
                 sub {              sub {
                         local $_ = shift;                  local $_ = shift;
                         if (($mode{libs} & 2) && /^-L/ ||                  if (($mode{libs} & 2) && /^-L/ ||
                             ($mode{libs} & 4) && !/^-[lL]/) {                      ($mode{libs} & 4) && !/^-[lL]/) {
                             return 1;                      return 1;
                         } else {                  } else {
                             return 0;                      return 0;
                         }                  }
                 });              });
   
         if (defined($variables->{pc_sysrootdir})){          if (defined($variables->{pc_sysrootdir})){
                 $a =~ s/[\w]?-[lL]/$&$variables->{pc_sysrootdir}/g;                  $a =~ s/[\w]?-[lL]/$&$variables->{pc_sysrootdir}/g;
Line 566 
Line 566 
   
         if ($mode{libs} & 1) {          if ($mode{libs} & 1) {
                 my $b = OpenBSD::PkgConfig->rcompress($libs,                  my $b = OpenBSD::PkgConfig->rcompress($libs,
                             sub { shift =~ m/^-l/; });                      sub { shift =~ m/^-l/; });
                 return ($a, $b);                  return ($a, $b);
         } else {          } else {
                 return $a;                  return $a;
Line 579 
Line 579 
         my ($p, $x, $y, @files, $fname, $name);          my ($p, $x, $y, @files, $fname, $name);
         my $error = 0;          my $error = 0;
   
         foreach my $p (@PKGPATH) {          for my $p (@PKGPATH) {
                 push(@files, <$p/*.pc>);                  push(@files, <$p/*.pc>);
         }          }
   
         # Scan the lengths of the package names so I can make a format          # Scan the lengths of the package names so I can make a format
         # string to line the list up just like the real pkgconfig does.          # string to line the list up just like the real pkgconfig does.
         $x = 0;          $x = 0;
         foreach my $f (@files) {          for my $f (@files) {
                 $fname = basename($f, '.pc');                  $fname = basename($f, '.pc');
                 $y = length $fname;                  $y = length $fname;
                 $x = (($y > $x) ? $y : $x);                  $x = (($y > $x) ? $y : $x);
         }          }
         $x *= -1;          $x *= -1;
   
         foreach my $f (@files) {          for my $f (@files) {
                 my $cfg = get_config($f);                  my $cfg = get_config($f);
                 if (!defined $cfg) {                  if (!defined $cfg) {
                         say_warning("Problem reading file $f");                          say_warning("Problem reading file $f");
Line 841 
Line 841 
                 }                  }
   
                 if (defined($value)) {                  if (defined($value)) {
                         print "$_\n" foreach (@$value);                          print "$_\n" for @$value;
                         return undef;                          return undef;
                 }                  }
         }          }
Line 882 
Line 882 
                 delete($mode{estdout});                  delete($mode{estdout});
         }          }
   
         print STDERR $str . "\n";          print STDERR $str, "\n";
 }  }

Legend:
Removed from v.1.92  
changed lines
  Added in v.1.93