[perl-ExtUtils-PkgConfig] Empty cflags are valid cflags



commit 729f4fcf8a7d0cecd76f805b6d186a8d872193f1
Author: Petr Písař <ppisar redhat com>
Date:   Mon Jul 22 09:32:29 2013 +0200

    Empty cflags are valid cflags
    
    ExtUtils::PkgConfig->find() croaked on emptry cflags:
    
    $ pkg-config --cflags 'libffi >= 3.0.0'| hexdump -C
    00000000  0a                                                |.|
    00000001
    $ perl -MData::Dumper -MExtUtils::PkgConfig -e 'print Dumper(ExtUtils::PkgConfig->find(q{libffi}))'
    *** can't find cflags for "libffi"
    *** is it properly installed and available in PKG_CONFIG_PATH?
     at -e line 1.
    
    That's wrong. Empty cflags are valid cflags too.
    
    <https://rt.cpan.org/Public/Bug/Display.html?id=84026>
    
    Signed-off-by: Petr Písař <ppisar redhat com>

 Changes                   |    3 +++
 lib/ExtUtils/PkgConfig.pm |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/Changes b/Changes
index bbd6bcc..3847fe1 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for Perl extension ExtUtils::PkgConfig.
 
+x.xx  <date>
+    - Gracefully handle empty fields in pkg-config files.
+
 1.14  Sun Feb  3 17:51:54 PDT 2013
     - Skip tests for pkg-config binary with the '--max-version' switch on
       OpenBSD 5.2, due to a bug in OpenBSD's implemenation of 'pkg-config'
diff --git a/lib/ExtUtils/PkgConfig.pm b/lib/ExtUtils/PkgConfig.pm
index 075d8dc..0f68256 100644
--- a/lib/ExtUtils/PkgConfig.pm
+++ b/lib/ExtUtils/PkgConfig.pm
@@ -129,7 +129,7 @@ sub find {
                 $data{$what} =~ s/[\015\012]+$//;
                croak "*** can't find $what for \"$data{pkg}\"\n"
                    . "*** is it properly installed and available in PKG_CONFIG_PATH?\n"
-                       unless $data{$what};
+                       unless defined $data{$what};
        }
        return %data;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]