lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r932806 - /lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm
Date Sat, 10 Apr 2010 23:37:43 GMT
Author: marvin
Date: Sat Apr 10 23:37:43 2010
New Revision: 932806

URL: http://svn.apache.org/viewvc?rev=932806&view=rev
Log:
Make it possible to pass config "cc" settings via Build.PL or ./Build and have
them applied to CBuilder.  Quote the $cc value in case it is multiple terms,
e.g. "ccache cc".  Contributed by Peter Karman.


Modified:
    lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm

Modified: lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm?rev=932806&r1=932805&r2=932806&view=diff
==============================================================================
--- lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm (original)
+++ lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm Sat Apr 10 23:37:43 2010
@@ -18,7 +18,7 @@ sub new {
 # link command that works on at least one system and hope for the best.
 sub link_executable {
     my ( $self, %args ) = @_;
-    if ( $Config{cc} eq 'cl' ) {
+    if ( $self->{'config'}->{'cc'} eq 'cl' ) {
         my ( $objects, $exe_file ) = @args{qw( objects exe_file )};
         $self->do_system("link /out:$exe_file @$objects");
         return $exe_file;
@@ -51,7 +51,7 @@ sub extra_ccflags {
     my $extra_ccflags = defined $ENV{CFLAGS} ? "$ENV{CFLAGS} " : "";
     my $gcc_version 
         = $ENV{REAL_GCC_VERSION}
-        || $Config{gccversion}
+        || $self->config('gccversion')
         || undef;
     if ( defined $gcc_version ) {
         $gcc_version =~ /^(\d+(\.\d+))/
@@ -74,7 +74,7 @@ sub extra_ccflags {
     }
 
     # Compile as C++ under MSVC.
-    if ( $Config{cc} eq 'cl' ) {
+    if ( $self->config('cc') eq 'cl' ) {
         $extra_ccflags .= '/TP ';
     }
 
@@ -129,7 +129,9 @@ sub ACTION_charmonizer {
 
     print "Building $CHARMONIZE_EXE_PATH...\n\n";
 
-    my $cbuilder = Lucy::Build::CBuilder->new;
+    my $cbuilder = Lucy::Build::CBuilder->new( 
+        config => { cc => $self->config('cc') },
+    );
 
     my @o_files;
     for (@all_source) {
@@ -170,8 +172,8 @@ sub ACTION_charmony {
     $self->add_to_cleanup($charmony_path);
 
     # Prepare arguments to charmonize.
-    my $cc        = "$Config{cc}";
-    my $flags     = "$Config{ccflags} " . $self->extra_ccflags;
+    my $cc        = $self->config('cc'); 
+    my $flags     = $self->config('ccflags') . ' ' . $self->extra_ccflags;
     my $verbosity = $ENV{DEBUG_CHARM} ? 2 : 1;
     $flags =~ s/"/\\"/g;
 
@@ -181,8 +183,8 @@ sub ACTION_charmony {
             and die "Failed to write charmony.h";
     }
     else {
-        system("./$CHARMONIZE_EXE_PATH $cc \"$flags\" $verbosity")
-            and die "Failed to write charmony.h";
+        system("./$CHARMONIZE_EXE_PATH \"$cc\" \"$flags\" $verbosity")
+            and die "Failed to write charmony.h: $!";
     }
 }
 
@@ -382,7 +384,7 @@ sub _valgrind_base_command {
 sub ACTION_test_valgrind {
     my $self = shift;
     die "Must be run under a perl that was compiled with -DDEBUGGING"
-        unless $Config{ccflags} =~ /-D?DEBUGGING\b/;
+        unless $self->config('ccflags') =~ /-D?DEBUGGING\b/;
     $self->dispatch('code');
     $self->dispatch('suppressions');
 
@@ -444,7 +446,9 @@ sub ACTION_compile_custom_xs {
 
     require ExtUtils::ParseXS;
 
-    my $cbuilder = Lucy::Build::CBuilder->new;
+    my $cbuilder = Lucy::Build::CBuilder->new(
+        config => { cc => $self->config('cc') },
+    );
     my $archdir = catdir( $self->blib, 'arch', 'auto', 'Lucy', );
     mkpath( $archdir, 0, 0777 ) unless -d $archdir;
     my @include_dirs = (



Mime
View raw message