]> git.vpit.fr Git - perl/modules/re-engine-Hooks.git/blobdiff - Makefile.PL
Update VPIT::TestHelpers to 15e8aee3
[perl/modules/re-engine-Hooks.git] / Makefile.PL
index 957ee9648a74eae7f04ae855a9aca6ead2e457e6..932e352075cfeb251b4fe76393597b60c64bbbde 100644 (file)
@@ -1,4 +1,4 @@
-use 5.010001;
+use 5.010_001;
 
 use strict;
 use warnings;
@@ -16,6 +16,16 @@ my %PREREQ_PM = (
  'DynaLoader' => 0,
 );
 
+my %BUILD_REQUIRES = (
+ 'ExtUtils::Depends'   => 0,
+ 'ExtUtils::MakeMaker' => 0,
+ 'File::Spec'          => 0,
+ 'POSIX'               => 0,
+ 'Test::More'          => 0,
+ 'blib'                => 0,
+ %PREREQ_PM,
+);
+
 my %META = (
  configure_requires => {
   'ExtUtils::Depends'   => 0,
@@ -23,23 +33,37 @@ my %META = (
   'File::Spec'          => 0,
  },
  build_requires => {
-  'ExtUtils::Depends'   => 0,
-  'ExtUtils::MakeMaker' => 0,
-  'File::Spec'          => 0,
-  'POSIX'               => 0,
-  'Test::More'          => 0,
-  'blib'                => 0,
-  %PREREQ_PM,
+  %BUILD_REQUIRES,
  },
  dynamic_config => 1,
  resources => {
-  bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist",
+  bugtracker => "http://rt.cpan.org/Dist/Display.html?Name=$dist",
   homepage   => "http://search.cpan.org/dist/$dist/",
   license    => 'http://dev.perl.org/licenses/',
   repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
  },
 );
 
+my $latest_dev_rev = 23;
+
+sub is_outdated_dev_perl {
+ my ($rev) = "$]" =~ /^5\.([0-9]{2}[13579])/;
+
+ return unless defined $rev;
+
+ return $rev < $latest_dev_rev;
+}
+
+if (is_outdated_dev_perl) {
+ print STDERR <<EOF;
+     This version of perl ($]) is an outdated development release.
+     re::engine::Hooks supports all stable releases since 5.10.1, and
+     development releases after 5.$latest_dev_rev.0 only.
+     Please consider upgrading your perl to a more recent release.
+EOF
+ exit 0;
+}
+
 sub versioned_file {
  my ($file) = @_;
 
@@ -55,15 +79,14 @@ sub versioned_file {
  require File::Spec;
  my $versioned_file = File::Spec->catfile('src', $version, $file);
 
- return -e $versioned_file ? $versioned_file : undef;
+ return -e $versioned_file ? [ $file => $versioned_file ] : undef;
 }
 
 unless (defined versioned_file('regcomp.c')) {
  print STDERR <<EOF;
-     This version of perl ($]) is not supported by this version of
-     re::engine::Hooks. If your perl has been recently released,
-     make sure there isn't a newer version of the module available
-     on the CPAN.
+     This version of perl ($]) is not yet supported by this version of
+     re::engine::Hooks. If your perl has been recently released, make
+     sure there isn't a newer version of the module available on the CPAN.
 EOF
  exit 0;
 }
@@ -74,8 +97,8 @@ my @DEFINES = qw<-DPERL_EXT_RE_BUILD -DPERL_EXT>;
 use ExtUtils::Depends;
 
 my $ed = ExtUtils::Depends->new($name);
-$ed->add_c('re_comp.c');
-$ed->add_c('re_exec.c');
+$ed->add_c('regcomp.c');
+$ed->add_c('regexec.c');
 $ed->add_xs('Hooks.xs');
 $ed->add_pm($file => do { local $_ = $file; s/^lib/\$(INST_LIB)/; $_ });
 $ed->install('re_engine_hooks.h');
@@ -86,7 +109,7 @@ $ed_vars{clean}->{FILES} .= ' ' . join ' ', (
  "$dist-*",
  'Files.pm',
  qw<*.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt>,
- qw<re_comp.c re_exec.c dquote_static.c>,
+ qw<regcomp.c regexec.c dquote_static.c inline_invlist.c>,
 );
 
 WriteMakefile(
@@ -96,14 +119,15 @@ WriteMakefile(
  VERSION_FROM     => $file,
  ABSTRACT_FROM    => $file,
  PL_FILES         => {},
+ BUILD_REQUIRES   => \%BUILD_REQUIRES,
  PREREQ_PM        => \%PREREQ_PM,
  MIN_PERL_VERSION => '5.010001',
  META_MERGE       => \%META,
  dist             => {
-  PREOP    => "pod2text $file > \$(DISTVNAME)/README",
+  PREOP    => "pod2text -u $file > \$(DISTVNAME)/README",
   COMPRESS => 'gzip -9f', SUFFIX => 'gz'
  },
- XSPROTOARG                 => '-noprototypes',
+ XSPROTOARG       => '-noprototypes',
  @DEFINES,
  FUNCLIST         => [ qw<
   boot_re__engine__Hooks
@@ -127,35 +151,39 @@ WriteMakefile(
 package MY;
 
 sub postamble {
- my $regcomp_c       = main::versioned_file('regcomp.c');
- my $regexec_c       = main::versioned_file('regexec.c');
- my $dquote_static_c = main::versioned_file('dquote_static.c');
-
- my $dquote_static_dep = defined $dquote_static_c ? 'dquote_static.c' : '';
-
- my $rules = <<EOF;
-re_comp.c : $regcomp_c
-       - \$(RM_F) re_comp.c
-       \$(CP) $regcomp_c re_comp.c
+ my $regcomp_c        = main::versioned_file('regcomp.c');
+ my $regexec_c        = main::versioned_file('regexec.c');
+ my $dquote_static_c  = main::versioned_file('dquote_static.c');
+ my $inline_invlist_c = main::versioned_file('inline_invlist.c');
+
+ my @all_c          = ($regcomp_c, $regexec_c);
+ my @regcomp_c_deps = ('regcomp.c');
+ my @regexec_c_deps = ('regexec.c');
+
+ for my $extra_c ($dquote_static_c, $inline_invlist_c) {
+  next unless defined $extra_c;
+  push @all_c,           $extra_c;
+  push @regcomp_c_deps, $extra_c->[0];
+ }
 
-re_comp\$(OBJ_EXT) : re_comp.c $dquote_static_dep
+ my $rules;
 
-re_exec.c : $regexec_c
-       - \$(RM_F) re_exec.c
-       \$(CP) $regexec_c re_exec.c
+ for my $file_c (@all_c) {
+  my ($target_file, $versioned_file) = @$file_c;
+  $rules .= <<"RULE";
+$target_file : $versioned_file
+       - \$(RM_F) $target_file
+       \$(CP) $versioned_file $target_file
 
-re_exec\$(OBJ_EXT) : re_exec.c
+RULE
+ }
 
-EOF
+ $rules .= <<"RULE";
+regcomp\$(OBJ_EXT) : @regcomp_c_deps
 
- if (defined $dquote_static_c) {
-  $rules .= <<EOF;
-dquote_static.c : $dquote_static_c
-       - \$(RM_F) dquote_static.c
-       \$(CP) $dquote_static_c dquote_static.c
+regexec\$(OBJ_EXT) : @regexec_c_deps
 
-EOF
- }
+RULE
 
  $rules .= <<'EOF';
 configure_test.pl: args.dat