This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix inclusion of META_MERGE in Makefile.PL
authorPali <pali@cpan.org>
Sun, 2 Jun 2019 11:34:26 +0000 (13:34 +0200)
committerNicolas R <atoomic@cpan.org>
Fri, 27 Sep 2019 20:35:51 +0000 (14:35 -0600)
(cherry picked from commit a145a59bef4ca21685181c0b912d9c7218e0742d)
Signed-off-by: Nicolas R <atoomic@cpan.org>
dist/Devel-PPPort/Makefile.PL

index 031ffa8..235b94c 100644 (file)
@@ -38,7 +38,6 @@ my %mf = (
   XSPROTOARG    => '-noprototypes',
   CONFIGURE     => \&configure,
 );
-delete $mf{META_MERGE} unless eval { ExtUtils::MakeMaker->VERSION (6.46) };
 WriteMakefile(%mf);
 
 sub configure
@@ -64,6 +63,36 @@ sub configure
     push @moreopts, LICENSE => 'perl';
   }
 
+  if (eval { ExtUtils::MakeMaker->VERSION (6.46) }) {
+    open FH, '<PPPort_pm.PL' or die "cannot open PPPort_pm.PL for reading: $!";
+    my $version;
+    while (my $line = <FH>) {
+      ($version) = $line =~ /^\$VERSION = '([\d.]+)';$/ and last;
+    };
+    die 'failed to extract $VERSION from PPPort_pm.PL' if not $version;
+    close FH;
+    print "Adding META_MERGE...\n";
+    push @moreopts, META_MERGE => {
+      'meta-spec' => { version => 2 },
+      provides => {
+        'Devel::PPPort' => {
+          file    => 'PPPort_pm.PL',
+          version => $version,
+        },
+      },
+      resources => {
+        bugtracker => {
+          web => 'https://rt.perl.org/rt3/',
+        },
+        repository => {
+          type => 'git',
+          url  => 'git://perl5.git.perl.org/perl.git',
+          web  => 'https://perl5.git.perl.org/perl.git',
+        },
+      },
+    };
+  }
+
   if (not $ENV{'PERL_CORE'}) {
     # Devel::PPPort is in the core since 5.7.3
     # 5.11.0+ has site before perl
@@ -81,14 +110,6 @@ sub configure
     $depend{'apicheck.i'} = 'ppport.h';
   }
 
-  open FH, '<PPPort_pm.PL' or die "cannot open PPPort_pm.PL for reading: $!";
-  my $version;
-  while (my $line = <FH>) {
-    ($version) = $line =~ /^\$VERSION = '([\d.]+)';$/ and last;
-  };
-  die 'failed to extract $VERSION from PPPort_pm.PL' if not $version;
-  close FH;
-
   if ($Config{gccversion}) {
     my $define = '-W -Wall';
     $define .= ' -Wdeclaration-after-statement' if $Config{gccversion} =~ /^(\d+\.\d+)\./ && $1 >= 3.4;
@@ -101,25 +122,6 @@ sub configure
     PL_FILES => \%PL_FILES,
     depend   => \%depend,
     clean    => { FILES => "@clean" },
-    META_MERGE    => {
-      'meta-spec' => { version => 2 },
-      provides => {
-        'Devel::PPPort' => {
-          file    => 'PPPort_pm.PL',
-          version => $version,
-        },
-      },
-      resources => {
-        bugtracker => {
-          web => 'https://rt.perl.org/rt3/',
-        },
-        repository => {
-          type => 'git',
-          url  => 'git://perl5.git.perl.org/perl.git',
-          web  => 'https://perl5.git.perl.org/perl.git',
-        },
-      },
-    },
     @moreopts,
   };
 }