You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2014/07/08 03:18:50 UTC

[3/7] git commit: Adapt CFC Perl build for CPAN dist compat.

Adapt CFC Perl build for CPAN dist compat.

The CFC build process has to work properly in both the repo layout and
the layout of a CPAN dist.


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

Branch: refs/heads/prep_cpan_dist_for_0.4.0
Commit: 8055a731e3fbf126f7e2f9c20c094c7351114fdf
Parents: 2433806
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Jul 7 11:51:54 2014 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Mon Jul 7 17:48:42 2014 -0700

----------------------------------------------------------------------
 compiler/perl/Build.PL                        |  6 ----
 compiler/perl/buildlib/Clownfish/CFC/Build.pm | 37 ++++++++++++++++++----
 2 files changed, 30 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8055a731/compiler/perl/Build.PL
----------------------------------------------------------------------
diff --git a/compiler/perl/Build.PL b/compiler/perl/Build.PL
index 842a4e1..24a67f3 100644
--- a/compiler/perl/Build.PL
+++ b/compiler/perl/Build.PL
@@ -18,7 +18,6 @@ use strict;
 use warnings;
 use lib 'buildlib';
 use Clownfish::CFC::Build;
-use File::Spec::Functions qw( updir catdir curdir );
 
 my $builder = Clownfish::CFC::Build->new(
     module_name => 'Clownfish::CFC',
@@ -31,11 +30,6 @@ my $builder = Clownfish::CFC::Build->new(
         'ExtUtils::ParseXS'  => 2.16,
         'Devel::PPPort'      => 3.13,
     },
-    include_dirs   => [
-        curdir(), # for charmony.h
-        catdir( updir(), 'include' ),
-    ],
-    c_source       => catdir( updir(),   'src' ),
     add_to_cleanup => [
         qw(
             MANIFEST.bak

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8055a731/compiler/perl/buildlib/Clownfish/CFC/Build.pm
----------------------------------------------------------------------
diff --git a/compiler/perl/buildlib/Clownfish/CFC/Build.pm b/compiler/perl/buildlib/Clownfish/CFC/Build.pm
index 93fa675..8de7c9c 100644
--- a/compiler/perl/buildlib/Clownfish/CFC/Build.pm
+++ b/compiler/perl/buildlib/Clownfish/CFC/Build.pm
@@ -24,21 +24,44 @@ use lib 'lib';
 use base qw( Clownfish::CFC::Perl::Build::Charmonic );
 no lib 'lib';
 
-use File::Spec::Functions qw( catfile updir catdir );
+use File::Spec::Functions qw( catfile updir catdir curdir );
 use Config;
 use Cwd qw( getcwd );
 use Carp;
 
-my $base_dir = catdir( updir(), updir() );
-my $COMMON_SOURCE_DIR = catdir( updir(), 'common' );
-my $CHARMONIZER_C     = catfile( $COMMON_SOURCE_DIR, 'charmonizer.c' );
-my $PPPORT_H_PATH = catfile( updir(), qw( include ppport.h ) );
-my $LEMON_DIR = catdir( $base_dir, 'lemon' );
+# Establish the filepaths for various assets.  If the file `LICENSE` is found
+# in the current working directory, this is a CPAN distribution rather than a
+# checkout from version control and things live in different dirs.
+my $CHARMONIZER_C;
+my $LEMON_DIR;
+my $INCLUDE;
+my $CFC_SOURCE_DIR;
+my $IS_CPAN = -e 'LICENSE';
+if ($IS_CPAN) {
+    $CHARMONIZER_C  = 'charmonizer.c';
+    $INCLUDE        = 'include';
+    $LEMON_DIR      = 'lemon';
+    $CFC_SOURCE_DIR = 'src';
+}
+else {
+    $CHARMONIZER_C = catfile( updir(), 'common', 'charmonizer.c' );
+    $INCLUDE        = catdir( updir(), 'include' );
+    $LEMON_DIR      = catdir( updir(), updir(), 'lemon' );
+    $CFC_SOURCE_DIR = catdir( updir(), 'src' );
+}
 my $LEMON_EXE_PATH = catfile( $LEMON_DIR, "lemon$Config{_exe}" );
-my $CFC_SOURCE_DIR = catdir( updir(), 'src' );
+my $PPPORT_H_PATH  = catfile( $INCLUDE,   'ppport.h' );
 
 sub new {
     my ( $class, %args ) = @_;
+    $args{c_source} = $CFC_SOURCE_DIR;
+    $args{include_dirs} ||= [];
+    my @aux_include = (
+        $INCLUDE,
+        $CFC_SOURCE_DIR,
+        curdir(),    # for charmony.h
+    );
+    push @{ $args{include_dirs} }, @aux_include;
     return $class->SUPER::new(
         %args,
         recursive_test_files => 1,