[libmarpa-r2-perl] 22/32: Allowing use of external Libmarpa

Jonas Smedegaard dr at jones.dk
Sat Nov 22 18:38:39 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 01ce3f0abaf5f0db0f6be5e8148696f2f1259501
Author: Jeffrey Kegler <JKEGL at cpan.org>
Date:   Sat Jul 5 21:54:39 2014 -0700

    Allowing use of external Libmarpa
---
 cpan/core/cf/.gitignore       |  1 +
 cpan/inc/Marpa/R2/Build_Me.pm | 42 ++++++++++++++++++++++++++++++++++++++----
 2 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/cpan/core/cf/.gitignore b/cpan/core/cf/.gitignore
new file mode 100644
index 0000000..90e72d4
--- /dev/null
+++ b/cpan/core/cf/.gitignore
@@ -0,0 +1 @@
+LIBMARPA_SOURCE
diff --git a/cpan/inc/Marpa/R2/Build_Me.pm b/cpan/inc/Marpa/R2/Build_Me.pm
index 29438b0..c5611c6 100644
--- a/cpan/inc/Marpa/R2/Build_Me.pm
+++ b/cpan/inc/Marpa/R2/Build_Me.pm
@@ -283,19 +283,44 @@ sub process_xs {
 
     my $switched_to_file =
         File::Spec->catdir( $libmarpa_build_directory, 'SWITCHED_TO' );
+    my $libmarpa_mode_file =
+        File::Spec->catdir( $self->base_dir(), 'core', 'cf', 'LIBMARPA_MODE' );
     if ( defined $self->args('libmarpa-external') ) {
         my $libmarpa_external_flags = $self->args('libmarpa-external');
         push @extra_linker_flags, split q{ }, $libmarpa_external_flags;
         $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;
+        if ( -e $switched_to_file ) {
+            $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;
+        } ## end if ( -e $switched_to_file )
         $switched_to_file = undef;
+
+        # Is there a Libmarpa mode file?
+        # If not create it.
+        if ( not -e $libmarpa_mode_file ) {
+            open my $fh, q{>}, $libmarpa_mode_file;
+            print {$fh}
+                "DO NOT EDIT -- automatically generated by $PROGRAM_NAME\n",
+                "Switched to external Libmarpa: "
+                . localtime()->datetime . qq{\n}
+                or die "print failed: $ERRNO";
+            close $fh;
+        }
     } ## end if ( defined $self->args('libmarpa-external') )
     else {
         # Is there a switched to file?
         # If not create it.
+        $self->log_info("Using built-in Libmarpa\n");
+
+        if ( -e $libmarpa_mode_file ) {
+            $self->log_info("Deleting $libmarpa_mode_file\n");
+            File::Path::rmtree( $libmarpa_mode_file, 0, 0 );
+            die "Couldn't remove '$libmarpa_mode_file': $!\n"
+                if -e $libmarpa_mode_file;
+        } ## end if ( -e $libmarpa_mode_file )
+
         if ( not -e $switched_to_file ) {
             open my $fh, q{>}, $switched_to_file;
             print {$fh}
@@ -822,6 +847,15 @@ sub ACTION_code {
 
     # If it's a shared library, we don't build it here.
     if ( not defined $self->args('libmarpa-external') ) {
+        # If the mode file exists, any switch to the internal Libmarpa
+        # must be made explicitly
+        if ( not defined $self->args('libmarpa-internal') ) {
+            my $libmarpa_mode_file =
+                File::Spec->catdir( $self->base_dir(), 'core', 'cf', 'LIBMARPA_MODE' );
+            die "Libmarpa is external, but you did not explicity specify that -- you need to\n",
+            '  If you want to go back to the built-in Libmarpa, ',
+                qq{use Build's "--libmarpa-internal=on" flag\n};
+        }
         $self->do_libmarpa();
     }
 

-- 
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