lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [4/7] git commit: Make runtime Perl build work with CPAN layout.
Date Tue, 08 Jul 2014 01:18:51 GMT
Make runtime Perl build work with CPAN layout.

Correct some incompatibilities which assumed the repo layout.

Consolidate code which changes behavior for CPAN layouts inside the
module, leaving Build.PL with only straightforward arguments.


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

Branch: refs/heads/prep_cpan_dist_for_0.4.0
Commit: 0a6ee30f2a4e4a390f81535b34d235f4d216ffc1
Parents: 125a4ef
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Mon Jul 7 17:34:53 2014 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Mon Jul 7 17:48:42 2014 -0700

----------------------------------------------------------------------
 runtime/perl/Build.PL                    | 16 --------------
 runtime/perl/buildlib/Clownfish/Build.pm | 31 +++++++++++++++++++--------
 2 files changed, 22 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0a6ee30f/runtime/perl/Build.PL
----------------------------------------------------------------------
diff --git a/runtime/perl/Build.PL b/runtime/perl/Build.PL
index 94cf181..22cf778 100644
--- a/runtime/perl/Build.PL
+++ b/runtime/perl/Build.PL
@@ -17,13 +17,8 @@ use 5.008003;
 use strict;
 use warnings;
 use lib 'buildlib';
-use File::Spec::Functions qw( catdir );
 use Clownfish::Build;
 
-my @BASE_PATH        = Clownfish::Build->cf_base_path;
-my $CORE_SOURCE_DIR  = catdir( @BASE_PATH, 'core' );
-my $XS_SOURCE_DIR    = 'xs';
-
 my $builder = Clownfish::Build->new(
     module_name => 'Clownfish',
     license     => 'apache',
@@ -47,16 +42,6 @@ my $builder = Clownfish::Build->new(
             bugtracker => 'https://issues.apache.org/jira/browse/LUCY',
         },
     },
-    include_dirs => [
-        $XS_SOURCE_DIR,
-    ],
-    clownfish_params => {
-        source => [
-            $CORE_SOURCE_DIR,
-            $XS_SOURCE_DIR,
-        ],
-        include => [], # Don't use default includes.
-    },
     add_to_cleanup => [
         qw(
             Clownfish-*
@@ -70,4 +55,3 @@ my $builder = Clownfish::Build->new(
 
 $builder->create_build_script();
 
-__END__

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0a6ee30f/runtime/perl/buildlib/Clownfish/Build.pm
----------------------------------------------------------------------
diff --git a/runtime/perl/buildlib/Clownfish/Build.pm b/runtime/perl/buildlib/Clownfish/Build.pm
index 2c01db6..4e7137d 100644
--- a/runtime/perl/buildlib/Clownfish/Build.pm
+++ b/runtime/perl/buildlib/Clownfish/Build.pm
@@ -44,14 +44,29 @@ use Cwd qw( getcwd );
 my @BASE_PATH = __PACKAGE__->cf_base_path;
 
 my $COMMON_SOURCE_DIR = catdir( @BASE_PATH, 'common' );
-my $CHARMONIZER_C     = catfile( $COMMON_SOURCE_DIR, 'charmonizer.c' );
 my $CORE_SOURCE_DIR   = catdir( @BASE_PATH, 'core' );
 my $CFC_DIR           = catdir( @BASE_PATH, updir(), 'compiler', 'perl' );
-my $CFC_BUILD         = catfile( $CFC_DIR, 'Build' );
-my $LIB_DIR           = 'lib';
+my $XS_SOURCE_DIR = 'xs';
+my $CFC_BUILD     = catfile( $CFC_DIR, 'Build' );
+my $LIB_DIR       = 'lib';
+my $CHARMONIZER_C;
+my $IS_CPAN_DIST = !@BASE_PATH;
+if ($IS_CPAN_DIST) {
+    $CHARMONIZER_C = 'charmonizer.c';
+}
+else {
+    $CHARMONIZER_C = catfile( $COMMON_SOURCE_DIR, 'charmonizer.c' );
+}
 
 sub new {
-    my $self = shift->SUPER::new( recursive_test_files => 1, @_ );
+    my ( $class, %args ) = @_;
+    $args{include_dirs}     = $XS_SOURCE_DIR;
+    $args{clownfish_params} = {
+        autogen_header => _autogen_header(),
+        include        => [],                  # Don't use default includes.
+        source => [ $CORE_SOURCE_DIR, $XS_SOURCE_DIR ],
+    };
+    my $self = $class->SUPER::new( recursive_test_files => 1, %args );
 
     if ( $ENV{LUCY_VALGRIND} ) {
         my $optimize = $self->config('optimize') || '';
@@ -61,8 +76,6 @@ sub new {
 
     $self->charmonizer_params( charmonizer_c => $CHARMONIZER_C );
 
-    $self->clownfish_params( autogen_header => $self->autogen_header );
-
     return $self;
 }
 
@@ -85,7 +98,8 @@ sub _run_make {
 }
 
 sub ACTION_cfc {
-    my $self    = shift;
+    my $self = shift;
+    return if $IS_CPAN_DIST;
     my $old_dir = getcwd();
     chdir($CFC_DIR);
     if ( !-f 'Build' ) {
@@ -248,8 +262,7 @@ sub ACTION_test_valgrind {
     }
 }
 
-sub autogen_header {
-    my $self = shift;
+sub _autogen_header {
     return <<"END_AUTOGEN";
 /***********************************************
 


Mime
View raw message