[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.60 and 1.61

version 1.60, 2011/06/12 17:11:01 version 1.61, 2011/06/12 17:13:17
Line 55 
Line 55 
 $variables->{pc_sysrootdir} //= $ENV{PKG_CONFIG_SYSROOT_DIR};  $variables->{pc_sysrootdir} //= $ENV{PKG_CONFIG_SYSROOT_DIR};
 # The default '/' is implied.  # The default '/' is implied.
   
 my $D;  defined $ENV{PKG_CONFIG_DEBUG_SPEW} ? $mode{debug} = 1 : $mode{debug} = 0;
 defined $ENV{PKG_CONFIG_DEBUG_SPEW} ? $D = 1 : $D = 0;  
   
 if ($logfile) {  if ($logfile) {
         open my $L, ">>" , $logfile or die;          open my $L, ">>" , $logfile or die;
Line 73 
Line 72 
 # without having to go back and reload the files from disk.  # without having to go back and reload the files from disk.
   
 Getopt::Long::Configure('no_ignore_case');  Getopt::Long::Configure('no_ignore_case');
 GetOptions(     'debug' => \$D,  GetOptions(     'debug' => \$mode{debug},
                 'help' => \&help, #does not return                  'help' => \&help, #does not return
                 'usage' => \&help, #does not return                  'usage' => \&help, #does not return
                 'list-all' => \$mode{list},                  'list-all' => \$mode{list},
Line 107 
Line 106 
   
 # Initial value of printerr depends on the options...  # Initial value of printerr depends on the options...
 if (!defined $mode{printerr}) {  if (!defined $mode{printerr}) {
         if (defined $mode{libs} || defined $mode{cflags}          if (defined $mode{libs}
             || defined $mode{version} || defined $mode{list}) {              or defined $mode{cflags}
               or defined $mode{version}
               or defined $mode{list}) {
                 $mode{printerr} = 1;                  $mode{printerr} = 1;
         } else {          } else {
                 $mode{printerr} = 0;                  $mode{printerr} = 0;
         }          }
 }  }
   
 print STDERR "\n", beautify_list($0, @ARGV), "\n" if $D;  pr_debug("\n" . beautify_list($0, @ARGV));
   
 my $rc = 0;  my $rc = 0;
   
Line 251 
Line 252 
                                         handle_config($dep, undef, undef, $list);                                          handle_config($dep, undef, undef, $list);
                                 }                                  }
                         }                          }
                         print STDERR "package $p ", lc($property), " ",                          pr_debug("package $p " . lc($property) . " " . join(',', @$deps));
                             join(',', @$deps), "\n" if $D;  
                 }                  }
         };          };
   
Line 270 
Line 270 
         if ($allow_uninstalled && $p !~ m/\-uninstalled$/) {          if ($allow_uninstalled && $p !~ m/\-uninstalled$/) {
                 foreach my $d (@PKGPATH) {                  foreach my $d (@PKGPATH) {
                         my $f = "$d/$p-uninstalled.pc";                          my $f = "$d/$p-uninstalled.pc";
                         print STDERR "pathresolve($p) looking in $f\n" if $D;                          pr_debug("pathresolve($p) looking in $f");
                         if (-f $f) {                          if (-f $f) {
                                 $found_uninstalled = 1;                                  $found_uninstalled = 1;
                                 return $f;                                  return $f;
Line 280 
Line 280 
   
         foreach my $d (@PKGPATH) {          foreach my $d (@PKGPATH) {
                 my $f = "$d/$p.pc";                  my $f = "$d/$p.pc";
                 print STDERR "pathresolve($p) looking in $f\n" if $D;                  pr_debug("pathresolve($p) looking in $f");
                 return $f if -f $f;                  return $f if -f $f;
         }          }
         return undef;          return undef;
Line 297 
Line 297 
         if (!$@) {          if (!$@) {
                 return validate_config($f, $cfg);                  return validate_config($f, $cfg);
         } else {          } else {
                 print STDERR $@, "\n" if $D;                  pr_debug($@);
         }          }
         return undef;          return undef;
 }  }
Line 306 
Line 306 
 {  {
         my $name = shift;          my $name = shift;
   
         print STDERR "processing $name\n" if $D;          pr_debug("processing $name");
   
         if (exists $configs{$name}) {          if (exists $configs{$name}) {
                 return $configs{$name};                  return $configs{$name};
Line 323 
Line 323 
   
         # Check if we're dealing with an empty file, but don't error out just          # Check if we're dealing with an empty file, but don't error out just
         # yet, we'll do that when we realize there's no Name field.          # yet, we'll do that when we realize there's no Name field.
         if ((stat($f)->size == 0) && $mode{printerr}) {          if (stat($f)->size == 0) {
                 my $p = $f;                  my $p = $f;
                 $p =~ s/(^.*\/)(.*?)$/$2/g;                  $p =~ s/(^.*\/)(.*?)$/$2/g;
                 print STDERR "Package file '$p' appears to be empty\n";                  pr_error("Package file '$p' appears to be empty");
         }          }
   
         foreach (@required_elems) {          foreach (@required_elems) {
                 my $e = $cfg->get_property($_, $variables);                  my $e = $cfg->get_property($_, $variables);
                 if (!defined $e) {                  if (!defined $e) {
                         $f =~ s/(^.*\/)(.*?)\.pc$/$2/g;                          $f =~ s/(^.*\/)(.*?)\.pc$/$2/g;
                         if ($mode{printerr}) {                          pr_error("Package '$f' has no $_: field");
                                 print STDERR "Package '$f' has no $_: field\n";  
                         }  
                         return undef;                          return undef;
                 }                  }
         }          }
Line 362 
Line 360 
         if (defined $f) {          if (defined $f) {
                 return get_config($f);                  return get_config($f);
         }          }
         if ($mode{printerr}) {          pr_error("Package $p was not found in the pkg-config search path");
             print STDERR  
                 "Package $p was not found in the pkg-config search path\n";  
         }  
         return undef;          return undef;
 }  }
   
Line 583 
Line 579 
         # accepted are (in order): a(lpha) < b(eta) < rc < ' '.          # accepted are (in order): a(lpha) < b(eta) < rc < ' '.
         # suffix[0] is the 'alpha' part, suffix[1] is the '1' part in 'alpha1'.          # suffix[0] is the 'alpha' part, suffix[1] is the '1' part in 'alpha1'.
         if ($a =~ s/(rc|beta|b|alpha|a)(\d+)$//) {          if ($a =~ s/(rc|beta|b|alpha|a)(\d+)$//) {
                 print STDERR "valid suffix $1$2 found in $a$1$2.\n" if $D;                  pr_debug("valid suffix $1$2 found in $a$1$2.");
                 $suffix_a[0] = $1;                  $suffix_a[0] = $1;
                 $suffix_a[1] = $2;                  $suffix_a[1] = $2;
         }          }
   
         if ($b =~ s/(rc|beta|b|alpha|a)(\d+)$//) {          if ($b =~ s/(rc|beta|b|alpha|a)(\d+)$//) {
                 print STDERR "valid suffix $1$2 found in $b$1$2.\n" if $D;                  pr_debug("valid suffix $1$2 found in $b$1$2.");
                 $suffix_b[0] = $1;                  $suffix_b[0] = $1;
                 $suffix_b[1] = $2;                  $suffix_b[1] = $2;
         }          }
Line 624 
Line 620 
   
                                         # rc beats beta beats alpha                                          # rc beats beta beats alpha
                                         if (&$first_char($suffix_a[0]) lt &$first_char($suffix_b[0])) {                                          if (&$first_char($suffix_a[0]) lt &$first_char($suffix_b[0])) {
                                                 print STDERR "$full_a (installed) < $full_b (wanted)\n" if $D;                                                  pr_debug("$full_a (installed) < $full_b (wanted)");
                                                 return -1;                                                  return -1;
                                         } else {                                          } else {
                                                 print STDERR "$full_a (installed) > $full_b (wanted)\n" if $D;                                                  pr_debug("$full_a (installed) > $full_b (wanted)");
                                                 return 1;                                                  return 1;
                                         }                                          }
   
Line 636 
Line 632 
                                         # thereby beating the other.                                          # thereby beating the other.
                                         # e.g.: 1.02 > 1.02b1                                          # e.g.: 1.02 > 1.02b1
                                         if (@suffix_a) { # a is older                                          if (@suffix_a) { # a is older
                                                 print STDERR "$full_a (installed) < $full_b (wanted)\n" if $D;                                                  pr_debug("$full_a (installed) < $full_b (wanted)");
                                                 return 1;                                                  return 1;
                                         }                                          }
   
                                         if (@suffix_b) { # b is older                                          if (@suffix_b) { # b is older
                                                 print STDERR "$full_a (installed) > $full_b (wanted)\n" if $D;                                                  pr_debug("$full_a (installed) > $full_b (wanted)");
                                                 return -1;                                                  return -1;
                                         }                                          }
                                 }                                  }
Line 681 
Line 677 
         # can't possibly match if we can't find the version string          # can't possibly match if we can't find the version string
         return 0 if $inst eq '';          return 0 if $inst eq '';
   
         print "comparing $want (wanted) to $inst (installed)\n" if $D;          pr_debug("comparing $want (wanted) to $inst (installed)");
         my $value = compare($inst, $want);          my $value = compare($inst, $want);
         if    ($op eq '>=') { return $value >= 0; }          if    ($op eq '>=') { return $value >= 0; }
         elsif ($op eq '=')  { return $value == 0; }          elsif ($op eq '=')  { return $value == 0; }
Line 732 
Line 728 
                 } elsif (defined($mode{printrequiresprivate})) {                  } elsif (defined($mode{printrequiresprivate})) {
                         $value = $cfg->get_property('Requires.private', $variables);                          $value = $cfg->get_property('Requires.private', $variables);
                 } else {                  } else {
                         print STDERR "Unknown mode for print_requires.\n" if $D;                          pr_debug("Unknown mode for print_requires.");
                         return 1;                          return 1;
                 }                  }
   
Line 748 
Line 744 
 sub beautify_list  sub beautify_list
 {  {
         return join(' ', map {"[$_]"} @_);          return join(' ', map {"[$_]"} @_);
   }
   
   sub pr_debug
   {
           my $str = shift;
           print STDERR $str . "\n" if $mode{debug};
   }
   
   sub pr_error
   {
           my $str = shift;
           print STDERR $str . "\n" if $mode{printerr};
 }  }

Legend:
Removed from v.1.60  
changed lines
  Added in v.1.61