Start using cached charmonizer.c. Simplify the build instructions for the Perl bindings of both Lucy and the Clownfish runtime by using the version of charmonizer.c cached in version control.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/cd9aecef Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/cd9aecef Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/cd9aecef Branch: refs/heads/master Commit: cd9aecef24e9d80b4914b4cc3a188fd639bff83c Parents: 671d41a Author: Marvin Humphrey <[email protected]> Authored: Sat Nov 3 11:19:54 2012 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Sat Nov 3 11:19:54 2012 -0700 ---------------------------------------------------------------------- clownfish/runtime/perl/buildlib/Clownfish/Build.pm | 50 ++++++--------- perl/buildlib/Lucy/Build.pm | 50 ++++++--------- 2 files changed, 40 insertions(+), 60 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/cd9aecef/clownfish/runtime/perl/buildlib/Clownfish/Build.pm ---------------------------------------------------------------------- diff --git a/clownfish/runtime/perl/buildlib/Clownfish/Build.pm b/clownfish/runtime/perl/buildlib/Clownfish/Build.pm index bf374d4..7f3cc11 100644 --- a/clownfish/runtime/perl/buildlib/Clownfish/Build.pm +++ b/clownfish/runtime/perl/buildlib/Clownfish/Build.pm @@ -45,7 +45,9 @@ my @BASE_PATH = __PACKAGE__->cf_base_path; my $CHARMONIZER_ORIG_DIR = rel2abs( catdir( @BASE_PATH, updir(), updir(), 'charmonizer' ) ); -my $CHARMONIZE_EXE_PATH = "charmonize$Config{_exe}"; +my $COMMON_SOURCE_DIR = catdir( @BASE_PATH, 'common' ); +my $CHARMONIZER_C = catfile( $COMMON_SOURCE_DIR, 'charmonizer.c' ); +my $CHARMONIZER_EXE_PATH = "charmonizer$Config{_exe}"; my $CHARMONY_H_PATH = 'charmony.h'; my $CHARMONY_PM_PATH = 'Charmony.pm'; my $CORE_SOURCE_DIR = catdir( @BASE_PATH, 'core' ); @@ -101,44 +103,32 @@ sub _run_make { chdir $current_directory if $dir; } -# Build the charmonize executable. -sub ACTION_build_charmonize { +# Compile and run the charmonizer executable, creating the charmony.h and +# Charmony.pm files. +sub ACTION_charmony { my $self = shift; - print "Building $CHARMONIZE_EXE_PATH...\n\n"; - my $meld_c = rel2abs("charmonize.c"); - $self->add_to_cleanup($meld_c); - $self->add_to_cleanup($CHARMONIZE_EXE_PATH); - my $charmonize_main = catfile( $CHARMONIZER_ORIG_DIR, 'charmonize.c' ); - $self->_run_make( - dir => $CHARMONIZER_ORIG_DIR, - args => [ "meld", "PERL=$^X", "FILES=$charmonize_main", "OUT=$meld_c" ], - ); - if ( !$self->up_to_date( $meld_c, $CHARMONIZE_EXE_PATH ) ) { - my $cc = $Config{cc}; + $self->add_to_cleanup($CHARMONIZER_EXE_PATH); + if ( !$self->up_to_date( $CHARMONIZER_C, $CHARMONIZER_EXE_PATH ) ) { + print "\nCompiling $CHARMONIZER_EXE_PATH...\n\n"; + my $cc = $self->config('cc'); my $outflag = $cc =~ /cl\b/ ? "/Fe" : "-o "; - system("$cc $meld_c $outflag$CHARMONIZE_EXE_PATH") - and die "Failed to compile $CHARMONIZE_EXE_PATH"; + system("$cc $CHARMONIZER_C $outflag$CHARMONIZER_EXE_PATH") + and die "Failed to compile $CHARMONIZER_EXE_PATH"; } -} -# Run the charmonize executable, creating the charmony.h and Charmony.pm -# files. -sub ACTION_run_charmonize { - my $self = shift; - $self->dispatch('build_charmonize'); - return if $self->up_to_date( $CHARMONIZE_EXE_PATH, [ + return if $self->up_to_date( $CHARMONIZER_EXE_PATH, [ $CHARMONY_H_PATH, $CHARMONY_PM_PATH, ] ); - print "\nRunning $CHARMONIZE_EXE_PATH...\n\n"; + print "\nRunning $CHARMONIZER_EXE_PATH...\n\n"; $self->add_to_cleanup($CHARMONY_H_PATH); $self->add_to_cleanup($CHARMONY_PM_PATH); - # Clean up after charmonize if it doesn't succeed on its own. + # Clean up after charmonizer if it doesn't succeed on its own. $self->add_to_cleanup("_charm*"); - # Prepare arguments to charmonize. + # Prepare arguments to charmonizer. my @command = ( - $CHARMONIZE_EXE_PATH, + $CHARMONIZER_EXE_PATH, '--cc=' . _quotify( $self->config('cc') ), '--enable-c', '--enable-perl', @@ -151,7 +141,7 @@ sub ACTION_run_charmonize { } print join( " ", @command ), $/; - system(@command) and die "Failed to run $CHARMONIZE_EXE_PATH: $!"; + system(@command) and die "Failed to run $CHARMONIZER_EXE_PATH: $!"; } sub _quotify { @@ -164,7 +154,7 @@ sub _quotify { # Build the charmonizer tests. sub ACTION_charmonizer_tests { my $self = shift; - $self->dispatch('run_charmonize'); + $self->dispatch('charmony'); print "Building Charmonizer Tests...\n\n"; my $flags = join( " ", $self->config('ccflags'), @@ -194,7 +184,7 @@ sub ACTION_cfc { sub ACTION_copy_clownfish_includes { my $self = shift; - $self->dispatch('run_charmonize'); + $self->dispatch('charmony'); $self->SUPER::ACTION_copy_clownfish_includes; http://git-wip-us.apache.org/repos/asf/lucy/blob/cd9aecef/perl/buildlib/Lucy/Build.pm ---------------------------------------------------------------------- diff --git a/perl/buildlib/Lucy/Build.pm b/perl/buildlib/Lucy/Build.pm index abcdae2..7c8ccd6 100644 --- a/perl/buildlib/Lucy/Build.pm +++ b/perl/buildlib/Lucy/Build.pm @@ -48,7 +48,9 @@ BEGIN { unshift @PATH, rel2abs( getcwd() ) } my @BASE_PATH = __PACKAGE__->cf_base_path; my $CHARMONIZER_ORIG_DIR = catdir( @BASE_PATH, 'charmonizer' ); -my $CHARMONIZE_EXE_PATH = "charmonize$Config{_exe}"; +my $COMMON_SOURCE_DIR = catdir( @BASE_PATH, 'common' ); +my $CHARMONIZER_C = catfile( $COMMON_SOURCE_DIR, 'charmonizer.c' ); +my $CHARMONIZER_EXE_PATH = "charmonizer$Config{_exe}"; my $CHARMONY_H_PATH = 'charmony.h'; my $CHARMONY_PM_PATH = 'Charmony.pm'; my $LEMON_DIR = catdir( @BASE_PATH, 'lemon' ); @@ -106,44 +108,32 @@ sub _run_make { chdir $current_directory if $dir; } -# Build the charmonize executable. -sub ACTION_build_charmonize { +# Compile and run the charmonizer executable, creating the charmony.h and +# Charmony.pm files. +sub ACTION_charmony { my $self = shift; - print "Building $CHARMONIZE_EXE_PATH...\n\n"; - my $meld_c = rel2abs("charmonize.c"); - $self->add_to_cleanup($meld_c); - $self->add_to_cleanup($CHARMONIZE_EXE_PATH); - my $charmonize_main = catfile( $CHARMONIZER_ORIG_DIR, 'charmonize.c' ); - $self->_run_make( - dir => $CHARMONIZER_ORIG_DIR, - args => [ "meld", "PERL=$^X", "FILES=$charmonize_main", "OUT=$meld_c" ], - ); - if ( !$self->up_to_date( $meld_c, $CHARMONIZE_EXE_PATH ) ) { - my $cc = $Config{cc}; + $self->add_to_cleanup($CHARMONIZER_EXE_PATH); + if ( !$self->up_to_date( $CHARMONIZER_C, $CHARMONIZER_EXE_PATH ) ) { + print "\nCompiling $CHARMONIZER_EXE_PATH...\n\n"; + my $cc = $self->config('cc'); my $outflag = $cc =~ /cl\b/ ? "/Fe" : "-o "; - system("$cc $meld_c $outflag$CHARMONIZE_EXE_PATH") - and die "Failed to compile $CHARMONIZE_EXE_PATH"; + system("$cc $CHARMONIZER_C $outflag$CHARMONIZER_EXE_PATH") + and die "Failed to compile $CHARMONIZER_EXE_PATH"; } -} -# Run the charmonize executable, creating the charmony.h and Charmony.pm -# files. -sub ACTION_run_charmonize { - my $self = shift; - $self->dispatch('build_charmonize'); - return if $self->up_to_date( $CHARMONIZE_EXE_PATH, [ + return if $self->up_to_date( $CHARMONIZER_EXE_PATH, [ $CHARMONY_H_PATH, $CHARMONY_PM_PATH, ] ); - print "\nRunning $CHARMONIZE_EXE_PATH...\n\n"; + print "\nRunning $CHARMONIZER_EXE_PATH...\n\n"; $self->add_to_cleanup($CHARMONY_H_PATH); $self->add_to_cleanup($CHARMONY_PM_PATH); - # Clean up after charmonize if it doesn't succeed on its own. + # Clean up after charmonizer if it doesn't succeed on its own. $self->add_to_cleanup("_charm*"); - # Prepare arguments to charmonize. + # Prepare arguments to charmonizer. my @command = ( - $CHARMONIZE_EXE_PATH, + $CHARMONIZER_EXE_PATH, '--cc=' . _quotify( $self->config('cc') ), '--enable-c', '--enable-perl', @@ -156,7 +146,7 @@ sub ACTION_run_charmonize { } print join( " ", @command ), $/; - system(@command) and die "Failed to run $CHARMONIZE_EXE_PATH: $!"; + system(@command) and die "Failed to run $CHARMONIZER_EXE_PATH: $!"; } sub _quotify { @@ -169,7 +159,7 @@ sub _quotify { # Build the charmonizer tests. sub ACTION_charmonizer_tests { my $self = shift; - $self->dispatch('run_charmonize'); + $self->dispatch('charmony'); print "Building Charmonizer Tests...\n\n"; my $flags = join( " ", $self->config('ccflags'), @@ -209,7 +199,7 @@ sub ACTION_cfc { sub ACTION_copy_clownfish_includes { my $self = shift; - $self->dispatch('run_charmonize'); + $self->dispatch('charmony'); $self->SUPER::ACTION_copy_clownfish_includes;
