You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2014/08/01 15:56:02 UTC
[8/8] git commit: Search all dirs in @INC for Clownfish headers
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/14f990fc
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/14f990fc
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/14f990fc
Branch: refs/heads/include_dir_fixes
Commit: 14f990fc5f4b95b7a6d0b08edbfc479b7756e32c
Parents: 7924668
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri Aug 1 13:47:46 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Aug 1 15:49:31 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/14f990fc/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 <au...@example.com>',
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);