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 2012/04/11 21:26:31 UTC
[lucy-commits] svn commit: r1324923 - in /lucy/trunk:
clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm perl/buildlib/Lucy/Build.pm
Author: nwellnhof
Date: Wed Apr 11 19:26:30 2012
New Revision: 1324923
URL: http://svn.apache.org/viewvc?rev=1324923&view=rev
Log:
LUCY-215 Add C::C::P::B->cf_base_path
Returns the base path of the Clownfish source tree. Either '..' for
development, or '.' for distros.
Modified:
lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm
lucy/trunk/perl/buildlib/Lucy/Build.pm
Modified: lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm
URL: http://svn.apache.org/viewvc/lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm?rev=1324923&r1=1324922&r2=1324923&view=diff
==============================================================================
--- lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm (original)
+++ lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm Wed Apr 11 19:26:30 2012
@@ -38,6 +38,19 @@ else {
);
}
+=for Rationale
+
+When the distribution tarball for the Perl bindings is built, core/, and any
+other needed files/directories are copied into the perl/ directory within the
+main source directory. Then the distro is built from the contents of the
+perl/ directory, leaving out all the files in ruby/, etc. However, during
+development, the files are accessed from their original locations.
+
+=cut
+
+my @BASE_PATH;
+push(@BASE_PATH, updir()) unless -e 'core';
+
my $AUTOGEN_DIR = 'autogen';
my $LIB_DIR = 'lib';
my $BUILDLIB_DIR = 'buildlib';
@@ -70,25 +83,9 @@ sub new {
catfile( $AUTOGEN_DIR, 'include' ),
);
$self->include_dirs($include_dirs);
-
-=for Rationale
-
-When the distribution tarball for the Perl bindings is built, core/, and any
-other needed files/directories are copied into the perl/ directory within the
-main source directory. Then the distro is built from the contents of the
-perl/ directory, leaving out all the files in ruby/, etc. However, during
-development, the files are accessed from their original locations.
-
-=cut
-
my $cf_source = $self->clownfish_params('source');
if ( !defined($cf_source) ) {
- if ( -e 'core' ) {
- $cf_source = [ 'core' ];
- }
- else {
- $cf_source = [ catdir( updir(), 'core' ) ];
- }
+ $cf_source = [ catdir( @BASE_PATH, 'core' ) ];
}
elsif ( !ref($cf_source) ) {
$cf_source = [ $cf_source ];
@@ -121,6 +118,11 @@ END_AUTOGEN
return $self;
}
+sub cf_base_path {
+ my $self_or_class = shift;
+ return @BASE_PATH;
+}
+
sub cf_system_include_dirs {
my $self_or_class = shift;
@@ -550,6 +552,13 @@ compiler.
=head1 METHODS
+=head2 my @path = Clownfish::CFC::Perl::Build->cf_base_path();
+
+Returns the base path of the source tree where 'core' etc. will be found.
+Currently either () or ('..').
+
+=head1 METHODS
+
=head2 my @dirs = Clownfish::CFC::Perl::Build->cf_system_include_dirs();
Returns a list of Clownfish include directories of system-wide installations
Modified: lucy/trunk/perl/buildlib/Lucy/Build.pm
URL: http://svn.apache.org/viewvc/lucy/trunk/perl/buildlib/Lucy/Build.pm?rev=1324923&r1=1324922&r2=1324923&view=diff
==============================================================================
--- lucy/trunk/perl/buildlib/Lucy/Build.pm (original)
+++ lucy/trunk/perl/buildlib/Lucy/Build.pm Wed Apr 11 19:26:30 2012
@@ -45,35 +45,23 @@ use Cwd qw( getcwd );
BEGIN { unshift @PATH, rel2abs( getcwd() ) }
-=for Rationale
+my @BASE_PATH = __PACKAGE__->cf_base_path;
-When the distribution tarball for the Perl binding of Lucy is built, core/,
-charmonizer/, and any other needed files/directories are copied into the
-perl/ directory within the main Lucy directory. Then the distro is built from
-the contents of the perl/ directory, leaving out all the files in ruby/, etc.
-However, during development, the files are accessed from their original
-locations.
-
-=cut
-
-my $is_distro_not_devel = -e 'core';
-my $base_dir = rel2abs( $is_distro_not_devel ? getcwd() : updir() );
-
-my $CHARMONIZER_ORIG_DIR = catdir( $base_dir, 'charmonizer' );
+my $CHARMONIZER_ORIG_DIR = catdir( @BASE_PATH, 'charmonizer' );
my $CHARMONIZE_EXE_PATH
= catfile( $CHARMONIZER_ORIG_DIR, "charmonize$Config{_exe}" );
my $CHARMONY_PATH = 'charmony.h';
-my $LEMON_DIR = catdir( $base_dir, 'lemon' );
+my $LEMON_DIR = catdir( @BASE_PATH, 'lemon' );
my $LEMON_EXE_PATH = catfile( $LEMON_DIR, "lemon$Config{_exe}" );
my $SNOWSTEM_SRC_DIR
- = catdir( $base_dir, qw( modules analysis snowstem source ) );
+ = catdir( @BASE_PATH, qw( modules analysis snowstem source ) );
my $SNOWSTEM_INC_DIR = catdir( $SNOWSTEM_SRC_DIR, 'include' );
my $SNOWSTOP_SRC_DIR
- = catdir( $base_dir, qw( modules analysis snowstop source ) );
-my $UCD_INC_DIR = catdir( $base_dir, qw( modules unicode ucd ) );
-my $UTF8PROC_SRC_DIR = catdir( $base_dir, qw( modules unicode utf8proc ) );
-my $CORE_SOURCE_DIR = catdir( $base_dir, 'core' );
-my $CLOWNFISH_DIR = catdir( $base_dir, 'clownfish', 'perl' );
+ = catdir( @BASE_PATH, qw( modules analysis snowstop source ) );
+my $UCD_INC_DIR = catdir( @BASE_PATH, qw( modules unicode ucd ) );
+my $UTF8PROC_SRC_DIR = catdir( @BASE_PATH, qw( modules unicode utf8proc ) );
+my $CORE_SOURCE_DIR = catdir( @BASE_PATH, 'core' );
+my $CLOWNFISH_DIR = catdir( @BASE_PATH, 'clownfish', 'perl' );
my $CLOWNFISH_BUILD = catfile( $CLOWNFISH_DIR, 'Build' );
my $XS_SOURCE_DIR = 'xs';
my $LIB_DIR = 'lib';