Search all dirs in @INC for Clownfish headers

Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/706e3068
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/706e3068
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/706e3068

Branch: refs/heads/master
Commit: 706e3068b9e015818a8b40996e18429f5e0e037e
Parents: 78ed168
Author: Nick Wellnhofer <[email protected]>
Authored: Fri Aug 1 13:47:46 2014 +0200
Committer: Nick Wellnhofer <[email protected]>
Committed: Tue Aug 5 11:56:02 2014 +0200

----------------------------------------------------------------------
 compiler/perl/lib/Clownfish/CFC/Perl/Build.pm | 42 +++++-----------------
 1 file changed, 8 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/706e3068/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm 
b/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
index cd3f3a7..eaa9dd7 100644
--- a/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
+++ b/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
@@ -73,17 +73,15 @@ sub new {
     push( @$cf_source, catdir( $AUTOGEN_DIR, 'source' ) );
     $self->clownfish_params( source => $cf_source );
 
-    my $cf_include = $self->clownfish_params('include');
-    if ( !defined($cf_include) ) {
-        if ($ENV{CLOWNFISH_INCLUDE}) {
-            $cf_include = [ split( /:/, $ENV{CLOWNFISH_INCLUDE} ) ];
-        }
-        else {
-            $cf_include = [ $self->cf_system_include_dirs ];
-        }
+    my $cf_include = $self->clownfish_params('include') || [];
+    # Add include dirs from CLOWNFISH_INCLUDE environment variable.
+    if ($ENV{CLOWNFISH_INCLUDE}) {
+        push( @$cf_include, split( /:/, $ENV{CLOWNFISH_INCLUDE} ) );
     }
-    elsif ( !ref($cf_include) ) {
-        $cf_include = [ $cf_include ];
+    # Add include dirs from @INC.
+    for my $dir (@INC) {
+        my $cf_incdir = catdir( $dir, 'Clownfish', '_include' );
+        push( @$cf_include, $cf_incdir ) if -d $cf_incdir;
     }
     $self->clownfish_params( include => $cf_include );
 
@@ -117,20 +115,6 @@ sub cf_base_path {
     return @BASE_PATH;
 }
 
-sub cf_system_include_dirs {
-    my $self_or_class = shift;
-
-    my @include_dirs;
-    for my $location ( qw( site vendor ) ) {
-        my $install_dir = $Config{"install${location}arch"};
-        my $include_dir = catdir( $install_dir, 'Clownfish', '_include' );
-        next unless -d $include_dir;
-        push(@include_dirs, $include_dir);
-    }
-
-    return @include_dirs;
-}
-
 sub cf_linker_flags {
     my $self_or_class = shift;
 
@@ -582,7 +566,6 @@ the Perl bindings for Clownfish modules.
     use File::Spec::Functions qw( catdir );
 
     my @cf_base_path    = Clownfish::CFC::Perl::Build->cf_base_path;
-    my @cf_sys_includes = Clownfish::CFC::Perl::Build->cf_system_include_dirs;
     my @cf_linker_flags = Clownfish::CFC::Perl::Build->cf_linker_flags(
         'Other::Module',
     );
@@ -592,11 +575,9 @@ the Perl bindings for Clownfish modules.
         dist_abstract      => 'Do something with this and that',
         dist_author        => 'The Author <[email protected]>',
         dist_version       => '0.1.0',
-        include_dirs       => [ @cf_sys_includes ],
         extra_linker_flags => [ @cf_linker_flags ],
         clownfish_params => {
             source  => [ catdir( @cf_base_path, 'core' ) ],
-            include => [ @cf_sys_includes ],
         },
         requires => {
             'Other::Module' => '0.3.0',
@@ -692,13 +673,6 @@ Clownfish .c files.
 Returns the base path components of the source tree where C<core> was found.
 Currently either C<()> or C<('..')>.
 
-=head2 cf_system_include_dirs()
-
-    my @dirs = Clownfish::CFC::Perl::Build->cf_system_include_dirs();
-
-Returns a list of Clownfish include directories of system-wide installations
-of Clownfish modules.
-
 =head2 cf_linker_flags( I<[module_names]> )
 
     my @flags = Clownfish::CFC::Perl::Build->cf_linker_flags(@module_names);

Reply via email to