[libmarpa-r2-perl] 20/32: Work on shared library support: t+
Jonas Smedegaard
dr at jones.dk
Sat May 17 21:24:13 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag Marpa-R2-2.085_004
in repository libmarpa-r2-perl.
commit d8a2ac36e60d6b186221433eb9e969ad0b9f7032
Author: Jeffrey Kegler <JKEGL at cpan.org>
Date: Fri Apr 25 22:59:38 2014 -0700
Work on shared library support: t+
---
cpan/inc/Marpa/R2/Build_Me.pm | 62 ++++++++++++++++++++++++++++++-------------
cpan/libmarpa/dev/marpa.w | 2 +-
cpan/t/00-load.t | 7 ++---
3 files changed, 47 insertions(+), 24 deletions(-)
diff --git a/cpan/inc/Marpa/R2/Build_Me.pm b/cpan/inc/Marpa/R2/Build_Me.pm
index 6eb6b87..e4628b1 100644
--- a/cpan/inc/Marpa/R2/Build_Me.pm
+++ b/cpan/inc/Marpa/R2/Build_Me.pm
@@ -277,23 +277,41 @@ sub process_xs {
File::Path::mkpath( $spec->{archdir}, 0, ( oct 777 ) )
if not -d $spec->{archdir};
- my $libmarpa_archive;
- FIND_LIBRARY: {
- if ($Marpa::R2::USE_PERL_AUTOCONF) {
- my $libmarpa_libs_dir =
- File::Spec->catdir( $self->base_dir(), 'libmarpa_build',
- 'blib', 'arch', 'auto', 'libmarpa' );
- $libmarpa_archive = File::Spec->catfile( $libmarpa_libs_dir,
- "libmarpa$Config{lib_ext}" );
- last FIND_LIBRARY;
- } ## end if ($Marpa::R2::USE_PERL_AUTOCONF)
+ my @extra_linker_flags = ();
+ $DB::single = 1;
+ if ( defined $self->args('libmarpa-shared') ) {
+ $DB::single = 1;
+ die qq{"libmarpa-shared" not supported for Config::AutoConf}
+ if $Marpa::R2::USE_PERL_AUTOCONF;
my $libmarpa_libs_dir =
File::Spec->catdir( $self->base_dir(), 'libmarpa_build',
'.libs' );
- $libmarpa_archive =
- File::Spec->catfile( $libmarpa_libs_dir, 'libmarpa.a' );
- } ## end FIND_LIBRARY:
- push @{ $self->{properties}->{objects} }, $libmarpa_archive;
+ push @extra_linker_flags, '-L' . $libmarpa_libs_dir;
+ my $version_file_name = File::Spec->catfile( $self->base_dir(), 'libmarpa_build', 'VERSION' );
+ my $libmarpa_version = $self->file_slurp($version_file_name);
+ chomp $libmarpa_version;
+ my @libmarpa_version = split /[.]/xms, $libmarpa_version;
+ push @extra_linker_flags, sprintf q{-lmarpa-} . ( join q{.}, @libmarpa_version );
+ } ## end if ( defined $self->args('libmarpa-shared') )
+ else {
+ my $libmarpa_archive;
+ FIND_LIBRARY: {
+ if ($Marpa::R2::USE_PERL_AUTOCONF) {
+ my $libmarpa_libs_dir =
+ File::Spec->catdir( $self->base_dir(), 'libmarpa_build',
+ 'blib', 'arch', 'auto', 'libmarpa' );
+ $libmarpa_archive = File::Spec->catfile( $libmarpa_libs_dir,
+ "libmarpa$Config{lib_ext}" );
+ last FIND_LIBRARY;
+ } ## end if ($Marpa::R2::USE_PERL_AUTOCONF)
+ my $libmarpa_libs_dir =
+ File::Spec->catdir( $self->base_dir(), 'libmarpa_build',
+ '.libs' );
+ $libmarpa_archive =
+ File::Spec->catfile( $libmarpa_libs_dir, 'libmarpa.a' );
+ } ## end FIND_LIBRARY:
+ push @{ $self->{properties}->{objects} }, $libmarpa_archive;
+ } ## end else [ if ( defined $self->args('libmarpa-shared') ) ]
# .xs -> .bs
$self->add_to_cleanup( $spec->{bs_file} );
@@ -309,13 +327,13 @@ sub process_xs {
} ## end unless ( $self->up_to_date( $xs_file, $spec->{bs_file} ) )
# .o -> .(a|bundle)
- return marpa_link_c( $self, $spec );
+ return marpa_link_c( $self, $spec, \@extra_linker_flags );
} ## 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 ) = @_;
+ my ( $self, $spec, $extra_linker_flags ) = @_;
my $p = $self->{properties}; # For convenience
$self->add_to_cleanup( $spec->{lib_file} );
@@ -328,11 +346,13 @@ sub marpa_link_c {
my $module_name = $spec->{module_name} || $self->module_name;
+ my @extra_linker_flags = @{$p->{extra_linker_flags}};
+ push @extra_linker_flags, @{$extra_linker_flags};
$self->cbuilder->link(
module_name => $module_name,
objects => [ $spec->{obj_file}, @{$objects} ],
lib_file => $spec->{lib_file},
- extra_linker_flags => $p->{extra_linker_flags}
+ extra_linker_flags => \@extra_linker_flags
);
return $spec->{lib_file};
@@ -446,7 +466,13 @@ sub do_libmarpa {
$ENV{CFLAGS} = $original_cflags if defined $original_cflags;
# We need PIC, but do not want the overhead of building the shared library
- my @configure_command_args = qw(--with-pic --disable-shared);
+ my @configure_command_args = ();
+ if ( defined $self->args('libmarpa-shared') ) {
+ push @configure_command_args, qw(--disable-static);
+ }
+ else {
+ push @configure_command_args, qw(--with-pic --disable-shared);
+ }
my @debug_flags = ();
if ( defined $self->args('Marpa-debug') ) {
diff --git a/cpan/libmarpa/dev/marpa.w b/cpan/libmarpa/dev/marpa.w
index 3f2f722..da5adde 100644
--- a/cpan/libmarpa/dev/marpa.w
+++ b/cpan/libmarpa/dev/marpa.w
@@ -663,7 +663,7 @@ Marpa_Error_Code marpa_c_error(Marpa_Config* config, const char** p_error_string
const char* _marpa_tag(void)
{
#if defined(MARPA_TAG)
- return MARPA_TAG;
+ return # MARPA_TAG ;
#elif defined(__GNUC__)
return __DATE__ " " __TIME__;
#else
diff --git a/cpan/t/00-load.t b/cpan/t/00-load.t
index 8af102a..e681460 100644
--- a/cpan/t/00-load.t
+++ b/cpan/t/00-load.t
@@ -21,10 +21,8 @@ use English qw( -no_match_vars );
use Test::More tests => 4;
-use Marpa::R2;
-
-defined $INC{'Marpa/R2.pm'}
- or Test::More::BAIL_OUT('Could not load Marpa::R2');
+my $ok = eval { require Marpa::R2; 1; };
+Test::More::BAIL_OUT('Could not load Marpa::R2') if not $ok;
my $marpa_version_ok = defined $Marpa::R2::VERSION;
my $marpa_version_desc =
@@ -47,7 +45,6 @@ my $libmarpa_version_desc =
Test::More::ok( $libmarpa_version_ok, $libmarpa_version_desc );
Test::More::diag($marpa_string_version_desc);
-Test::More::diag('Libmarpa: ' . $Marpa::R2::LIBMARPA_FILE);
Test::More::diag($libmarpa_version_desc);
Test::More::diag('Libmarpa tag: ' . Marpa::R2::Thin::tag());
--
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