[libmarpa-r2-perl] 19/32: Packaging
Jonas Smedegaard
dr at jones.dk
Sat Nov 22 18:38:38 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag Marpa-R2-2.087_000
in repository libmarpa-r2-perl.
commit da5251fc70ad6569831d3ff6dd45c8490eec09c6
Author: Jeffrey Kegler <JKEGL at cpan.org>
Date: Sat Jul 5 14:34:30 2014 -0700
Packaging
---
cpan/inc/Marpa/R2/Build_Me.pm | 48 +++++++++++++++++++++++++++++++++++--------
cpan/lib/Marpa/R2.pm | 13 +++---------
2 files changed, 42 insertions(+), 19 deletions(-)
diff --git a/cpan/inc/Marpa/R2/Build_Me.pm b/cpan/inc/Marpa/R2/Build_Me.pm
index 3c3e35a..29438b0 100644
--- a/cpan/inc/Marpa/R2/Build_Me.pm
+++ b/cpan/inc/Marpa/R2/Build_Me.pm
@@ -281,11 +281,31 @@ sub process_xs {
my $libmarpa_build_directory =
File::Spec->catdir( $self->base_dir(), 'libmarpa_build' );
+ my $switched_to_file =
+ File::Spec->catdir( $libmarpa_build_directory, 'SWITCHED_TO' );
if ( defined $self->args('libmarpa-external') ) {
- my $libmarpa_external_flags = $self->args('libmarpa-external');
+ my $libmarpa_external_flags = $self->args('libmarpa-external');
push @extra_linker_flags, split q{ }, $libmarpa_external_flags;
- } else
- {
+ $self->log_info("Using external Libmarpa\n");
+ $self->log_info("Deleting $switched_to_file\n");
+ File::Path::rmtree( $switched_to_file, 0, 0 );
+ die "Couldn't remove '$switched_to_file': $!\n"
+ if -e $switched_to_file;
+ $switched_to_file = undef;
+ } ## end if ( defined $self->args('libmarpa-external') )
+ else {
+ # Is there a switched to file?
+ # If not create it.
+ if ( not -e $switched_to_file ) {
+ open my $fh, q{>}, $switched_to_file;
+ print {$fh}
+ "DO NOT EDIT -- automatically generated by $PROGRAM_NAME\n",
+ "Last switch to built-in Libmarpa: "
+ . localtime()->datetime . qq{\n}
+ or die "print failed: $ERRNO";
+ close $fh;
+ } ## end if ( not -e $switched_to_file )
+
my $libmarpa_archive;
FIND_LIBRARY: {
if ($Marpa::R2::USE_PERL_AUTOCONF) {
@@ -302,7 +322,7 @@ sub process_xs {
File::Spec->catfile( $libmarpa_libs_dir, 'libmarpa.a' );
} ## end FIND_LIBRARY:
push @{ $self->{properties}->{objects} }, $libmarpa_archive;
- }
+ } ## end else [ if ( defined $self->args('libmarpa-external') ) ]
# .xs -> .bs
$self->add_to_cleanup( $spec->{bs_file} );
@@ -318,22 +338,32 @@ sub process_xs {
} ## end unless ( $self->up_to_date( $xs_file, $spec->{bs_file} ) )
# .o -> .(a|bundle)
- return marpa_link_c( $self, $spec, \@extra_linker_flags );
+ return marpa_link_c( $self, $spec, \@extra_linker_flags, $switched_to_file );
} ## end sub process_xs
# The following was initially copied from Module::Build, and has
# been customized for Marpa.
sub marpa_link_c {
- my ( $self, $spec, $extra_linker_flags ) = @_;
+ my ( $self, $spec, $extra_linker_flags, $switched_to_file ) = @_;
my $p = $self->{properties}; # For convenience
$self->add_to_cleanup( $spec->{lib_file} );
my $objects = $p->{objects} || [];
- return $spec->{lib_file}
- if $self->up_to_date( [ $spec->{obj_file}, @{$objects} ],
- $spec->{lib_file} );
+ my @dependencies = ($spec->{obj_file});
+ push @dependencies, @{$objects};
+ push @dependencies, $switched_to_file if defined $switched_to_file;
+ # Always relink if libmarpa-external is specified
+ if (
+ not defined $self->args('libmarpa-external') and
+ $self->up_to_date( \@dependencies,
+ $spec->{lib_file}
+ )
+ )
+ {
+ return $spec->{lib_file};
+ } ## end if ( $self->up_to_date( [ $spec->{obj_file}, @{$objects...}]))
my $module_name = $spec->{module_name} || $self->module_name;
diff --git a/cpan/lib/Marpa/R2.pm b/cpan/lib/Marpa/R2.pm
index 595633b..5547ce6 100644
--- a/cpan/lib/Marpa/R2.pm
+++ b/cpan/lib/Marpa/R2.pm
@@ -76,20 +76,13 @@ LOAD_EXPLICIT_LIBRARY: {
$Marpa::R2::LIBMARPA_FILE = $file;
}
-eval {
+my $ok = eval {
require XSLoader;
XSLoader::load( 'Marpa::R2', $Marpa::R2::STRING_VERSION );
1;
-} or do {
- say STDERR "XSLoader problem: ", $EVAL_ERROR;
- say STDERR "Trying DynaLaoder";
- require DynaLoader;
-## no critic(ClassHierarchies::ProhibitExplicitISA)
- push @ISA, 'DynaLoader';
- Dynaloader::bootstrap Marpa::R2 $Marpa::R2::STRING_VERSION;
};
-# or Carp::croak("Could not load XS version of Marpa::R2: $EVAL_ERROR");
-
+Carp::croak( "Marpa::R2 failed due to an XSLoader problem\n" . $EVAL_ERROR )
+ if not $ok;
if ( not $ENV{'MARPA_AUTHOR_TEST'} ) {
$Marpa::R2::DEBUG = 0;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmarpa-r2-perl.git
More information about the Pkg-perl-cvs-commits
mailing list