lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [4/6] git commit: Remove dependency of Clownfish::CFC::Perl::Build on Charmonizer
Date Tue, 22 Apr 2014 20:59:10 GMT
Remove dependency of Clownfish::CFC::Perl::Build on Charmonizer

Add a new field 'cflags' to the 'clownfish_params' Module::Build
property to pass additional compiler flags.


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

Branch: refs/heads/master
Commit: 85dad61a24d2e3476f0251c49b253084a9a0030c
Parents: 93b82be
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sun Feb 16 22:13:42 2014 +0100
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Tue Apr 22 22:57:06 2014 +0200

----------------------------------------------------------------------
 compiler/perl/lib/Clownfish/CFC/Perl/Build.pm | 11 +++++---
 runtime/perl/buildlib/Clownfish/Build.pm      | 31 ++++++++++++++++++----
 2 files changed, 34 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/85dad61a/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 da22e53..8ace1ac 100644
--- a/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
+++ b/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
@@ -17,7 +17,7 @@ use strict;
 use warnings;
 
 package Clownfish::CFC::Perl::Build;
-use base qw( Clownfish::CFC::Perl::Build::Charmonic );
+use base qw( Module::Build );
 our $VERSION = '0.01';
 
 use File::Spec::Functions qw( catdir catfile curdir updir abs2rel rel2abs );
@@ -91,7 +91,7 @@ sub new {
 
     my $include_dirs = $self->include_dirs;
     push( @$include_dirs,
-        curdir(), # for ppport.h and charmony.h
+        curdir(), # for ppport.h
         catdir( $AUTOGEN_DIR, 'include' ),
         @$cf_include,
     );
@@ -377,7 +377,7 @@ sub ACTION_compile_custom_xs {
         push @$c_files, @{ $self->rscan_dir( $source_dir, qr/\.c$/ ) };
     }
     # Compile with -fvisibility=hidden on GCC >= 4.0
-    my $extra_cflags = $self->charmony("EXTRA_CFLAGS");
+    my $extra_cflags = $self->clownfish_params('cflags') || '';
     if ( $self->config('gccversion') && $Config{dlext} ne 'dll' ) {
         my @version_nums = split( /\./, $self->config('gccversion') );
         if ( $version_nums[0] >= 4 ) {
@@ -631,6 +631,11 @@ system include directories if needed.
 A string that will be prepended to the files generated by the Clownfish
 compiler.
 
+=head3 cflags
+
+A string with additional compiler flags used to compile the Clownfish .c
+files.
+
 =head1 METHODS
 
 =head2 my @path = Clownfish::CFC::Perl::Build->cf_base_path();

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/85dad61a/runtime/perl/buildlib/Clownfish/Build.pm
----------------------------------------------------------------------
diff --git a/runtime/perl/buildlib/Clownfish/Build.pm b/runtime/perl/buildlib/Clownfish/Build.pm
index 991ac5a..2c01db6 100644
--- a/runtime/perl/buildlib/Clownfish/Build.pm
+++ b/runtime/perl/buildlib/Clownfish/Build.pm
@@ -25,7 +25,10 @@ package Clownfish::Build;
 # yet. So we look in 'clownfish/compiler/perl/lib' directly and cleanup @INC
 # afterwards.
 use lib '../../compiler/perl/lib';
-use base qw( Clownfish::CFC::Perl::Build );
+use base qw(
+    Clownfish::CFC::Perl::Build
+    Clownfish::CFC::Perl::Build::Charmonic
+);
 no lib '../../compiler/perl/lib';
 
 our $VERSION = '0.003000';
@@ -97,22 +100,40 @@ sub ACTION_cfc {
 sub ACTION_copy_clownfish_includes {
     my $self = shift;
 
-    $self->depends_on('charmony');
-
     $self->SUPER::ACTION_copy_clownfish_includes;
 
-    $self->cf_copy_include_file( 'charmony.h' );
     $self->cf_copy_include_file( 'XSBind.h' );
 }
 
 sub ACTION_clownfish {
     my $self = shift;
 
-    $self->depends_on(qw( charmony cfc ));
+    $self->depends_on('cfc');
 
     $self->SUPER::ACTION_clownfish;
 }
 
+sub ACTION_compile_custom_xs {
+    my $self = shift;
+
+    $self->depends_on('charmony');
+
+    # Add extra compiler flags from Charmonizer.
+    my $charm_cflags = $self->charmony('EXTRA_CFLAGS');
+    if ($charm_cflags) {
+        my $cf_cflags = $self->clownfish_params('cflags');
+        if ($cf_cflags) {
+            $cf_cflags .= " $charm_cflags";
+        }
+        else {
+            $cf_cflags = $charm_cflags;
+        }
+        $self->clownfish_params( cflags => $cf_cflags );
+    }
+
+    $self->SUPER::ACTION_compile_custom_xs;
+}
+
 sub ACTION_suppressions {
     my $self       = shift;
     my $LOCAL_SUPP = 'local.supp';


Mime
View raw message