Hello!
This is patch to add BUILD_REQUIRES and CONFIGURE_REQUIRES into EUMM.
PREREQ_PM and BUILD_REQUIRES are dumped as PREREQ_PM in 'Makefile'
because CPAN.pm does not know about BUILD_REQUIRES.
Please check if I done correct thing with PREREQ_PRINT.
--
Alexandr Ciornii, http://chorny.net
Only in ExtUtils-MakeMaker-6.44: blib
diff -u -r ExtUtils-MakeMaker-6.44.orig/Changes ExtUtils-MakeMaker-6.44/Changes
--- ExtUtils-MakeMaker-6.44.orig/Changes 2008-02-29 01:06:09.000000000
+0200
+++ ExtUtils-MakeMaker-6.44/Changes 2008-06-01 20:01:20.671875000 +0300
@@ -1,3 +1,6 @@
+ New Features
+ * BUILD_REQUIRES and CONFIGURE_REQUIRES (by Alexandr Ciornii)
+
6.44 Thu Feb 28 16:06:04 PST 2008
Bug Fixes
* Updated bundled ExtUtils::Install to 1.45 which should fix some
diff -u -r ExtUtils-MakeMaker-6.44.orig/lib/ExtUtils/MakeMaker.pm
ExtUtils-MakeMaker-6.44/lib/ExtUtils/MakeMaker.pm
--- ExtUtils-MakeMaker-6.44.orig/lib/ExtUtils/MakeMaker.pm 2008-02-29
01:06:55.000000000 +0200
+++ ExtUtils-MakeMaker-6.44/lib/ExtUtils/MakeMaker.pm 2008-06-05
20:16:55.796875000 +0300
@@ -82,6 +82,8 @@
PMLIBDIRS => 'ARRAY',
PMLIBPARENTDIRS => 'ARRAY',
PREREQ_PM => 'HASH',
+ CONFIGURE_REQUIRES => 'HASH',
+ BUILD_REQUIRES => 'HASH',
SKIP => 'ARRAY',
TYPEMAPS => 'ARRAY',
XS => 'HASH',
@@ -239,6 +241,7 @@
PERL_SRC PERM_RW PERM_RWX
PL_FILES PM PM_FILTER PMLIBDIRS PMLIBPARENTDIRS POLLUTE PPM_INSTALL_EXEC
PPM_INSTALL_SCRIPT PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ
+ BUILD_REQUIRES CONFIGURE_REQUIRES
SIGN SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
XS_VERSION clean depend dist dynamic_lib linkext macro realclean
tool_autosplit
@@ -369,7 +372,7 @@
if ("@ARGV" =~ /\bPREREQ_PRINT\b/) {
require Data::Dumper;
- print Data::Dumper->Dump([$self->{PREREQ_PM}], [qw(PREREQ_PM)]);
+ print Data::Dumper->Dump([$self->{PREREQ_PM},$self->{BUILD_REQUIRES}],
[qw(PREREQ_PM BUILD_REQUIRES)]);
exit 0;
}
@@ -393,32 +396,35 @@
my(%initial_att) = %$self; # record initial attributes
my(%unsatisfied) = ();
- foreach my $prereq (sort keys %{$self->{PREREQ_PM}}) {
- # 5.8.0 has a bug with require Foo::Bar alone in an eval, so an
- # extra statement is a workaround.
- my $file = "$prereq.pm";
- $file =~ s{::}{/}g;
- eval { require $file };
-
- my $pr_version = $prereq->VERSION || 0;
-
- # convert X.Y_Z alpha version #s to X.YZ for easier comparisons
- $pr_version =~ s/(\d+)\.(\d+)_(\d+)/$1.$2$3/;
-
- if ($@) {
- warn sprintf "Warning: prerequisite %s %s not found.\n",
- $prereq, $self->{PREREQ_PM}{$prereq}
- unless $self->{PREREQ_FATAL};
- $unsatisfied{$prereq} = 'not installed';
- } elsif ($pr_version < $self->{PREREQ_PM}->{$prereq} ){
- warn sprintf "Warning: prerequisite %s %s not found. We have
%s.\n",
- $prereq, $self->{PREREQ_PM}{$prereq},
- ($pr_version || 'unknown version')
- unless $self->{PREREQ_FATAL};
- $unsatisfied{$prereq} = $self->{PREREQ_PM}->{$prereq} ?
- $self->{PREREQ_PM}->{$prereq} : 'unknown version' ;
+
+ foreach my $prereq_type ($self->{BUILD_REQUIRES},$self->{PREREQ_PM}) {
+ foreach my $prereq (sort keys %{$prereq_type}) {
+ # 5.8.0 has a bug with require Foo::Bar alone in an eval, so an
+ # extra statement is a workaround.
+ my $file = "$prereq.pm";
+ $file =~ s{::}{/}g;
+ eval { require $file };
+
+ my $pr_version = $prereq->VERSION || 0;
+
+ # convert X.Y_Z alpha version #s to X.YZ for easier comparisons
+ $pr_version =~ s/(\d+)\.(\d+)_(\d+)/$1.$2$3/;
+
+ if ($@) {
+ warn sprintf "Warning: prerequisite %s %s not found.\n",
+ $prereq, $prereq_type->{$prereq}
+ unless $self->{PREREQ_FATAL};
+ $unsatisfied{$prereq} = 'not installed';
+ } elsif ($pr_version < $prereq_type->{$prereq} ){
+ warn sprintf "Warning: prerequisite %s %s not found. We have
%s.\n",
+ $prereq, $prereq_type->{$prereq},
+ ($pr_version || 'unknown version')
+ unless $self->{PREREQ_FATAL};
+ $unsatisfied{$prereq} = $prereq_type->{$prereq} ?
+ $prereq_type->{$prereq} : 'unknown version' ;
+ }
}
- }
+ }
if (%unsatisfied && $self->{PREREQ_FATAL}){
my $failedprereqs = join "\n", map {" $_ $unsatisfied{$_}"}
@@ -567,7 +573,13 @@
#
# MakeMaker Parameters:
END
-
+ if (exists $initial_att{'BUILD_REQUIRES'} and keys
%{$initial_att{'BUILD_REQUIRES'}}>0) {
+ #can modify %initial_att because it's life is short
+ $initial_att{'PREREQ_PM'} ||= {};
+ %{$initial_att{'PREREQ_PM'}} = (%{$initial_att{'PREREQ_PM'}},
%{$initial_att{'BUILD_REQUIRES'}});
+ #CPAN.pm takes prereqs from this field in 'Makefile'
+ #and does not know about BUILD_REQUIRES
+ }
foreach my $key (sort keys %initial_att){
next if $key eq 'ARGS';
diff -u -r ExtUtils-MakeMaker-6.44.orig/lib/ExtUtils/MM_Any.pm
ExtUtils-MakeMaker-6.44/lib/ExtUtils/MM_Any.pm
--- ExtUtils-MakeMaker-6.44.orig/lib/ExtUtils/MM_Any.pm 2008-02-29
01:06:28.000000000 +0200
+++ ExtUtils-MakeMaker-6.44/lib/ExtUtils/MM_Any.pm 2008-06-01
16:39:29.968750000 +0300
@@ -738,6 +738,18 @@
$prereq_pm .= sprintf "\n %-30s %s", "$mod:", $ver;
}
+ my $build_prereq = '';
+ foreach my $mod ( sort { lc $a cmp lc $b } keys %{$self->{BUILD_REQUIRES}}
) {
+ my $ver = $self->{BUILD_REQUIRES}{$mod};
+ $build_prereq .= sprintf "\n %-30s %s", "$mod:", $ver;
+ }
+
+ my $configure_prereq = '';
+ foreach my $mod ( sort { lc $a cmp lc $b } keys
%{$self->{CONFIGURE_REQUIRES}} ) {
+ my $ver = $self->{CONFIGURE_REQUIRES}{$mod};
+ $configure_prereq .= sprintf "\n %-30s %s", "$mod:", $ver;
+ }
+
my $author_value = defined $self->{AUTHOR}
? "\n - $self->{AUTHOR}"
: undef;
@@ -763,11 +775,13 @@
$meta .= sprintf "%-20s %s\n", "$key:", $val;
};
-
+ $meta .="requires: $prereq_pm\n";
+ $meta .="build_requires: $build_prereq\n" if $build_prereq;
+ $meta .="configure_requires: $configure_prereq\n" if $configure_prereq;
+
$meta .= <<"YAML";
-requires: $prereq_pm
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ url: http://module-build.sourceforge.net/META-spec-blead.html
version: 1.3
YAML
Only in ExtUtils-MakeMaker-6.44: Makefile
Only in ExtUtils-MakeMaker-6.44: pm_to_blib
diff -u -r ExtUtils-MakeMaker-6.44.orig/t/basic.t
ExtUtils-MakeMaker-6.44/t/basic.t
--- ExtUtils-MakeMaker-6.44.orig/t/basic.t 2007-11-26 02:08:16.000000000
+0200
+++ ExtUtils-MakeMaker-6.44/t/basic.t 2008-06-01 16:44:45.968750000 +0300
@@ -266,8 +266,12 @@
distribution_type: module
requires:
strict: 0
+build_requires:
+ warnings: 0
+configure_requires:
+ lib: 0
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ url: http://module-build.sourceforge.net/META-spec-blead.html
version: 1.3
END
Only in ExtUtils-MakeMaker-6.44/t: Big-Dummy
diff -u -r ExtUtils-MakeMaker-6.44.orig/t/lib/MakeMaker/Test/Setup/BFD.pm
ExtUtils-MakeMaker-6.44/t/lib/MakeMaker/Test/Setup/BFD.pm
--- ExtUtils-MakeMaker-6.44.orig/t/lib/MakeMaker/Test/Setup/BFD.pm
2008-01-01 05:06:43.000000000 +0200
+++ ExtUtils-MakeMaker-6.44/t/lib/MakeMaker/Test/Setup/BFD.pm 2008-06-01
12:57:49.796875000 +0300
@@ -37,6 +37,8 @@
VERSION_FROM => 'lib/Big/Dummy.pm',
EXE_FILES => [qw(bin/program)],
PREREQ_PM => { strict => 0 },
+ BUILD_REQUIRES => { warnings => 0 },
+ CONFIGURE_REQUIRES => { lib => 0 },
ABSTRACT_FROM => 'lib/Big/Dummy.pm',
AUTHOR => 'Michael G Schwern <[EMAIL PROTECTED]>',
);
diff -u -r ExtUtils-MakeMaker-6.44.orig/t/prereq.t
ExtUtils-MakeMaker-6.44/t/prereq.t
--- ExtUtils-MakeMaker-6.44.orig/t/prereq.t 2007-12-07 01:23:42.000000000
+0200
+++ ExtUtils-MakeMaker-6.44/t/prereq.t 2008-06-01 13:37:38.000000000 +0300
@@ -14,7 +14,7 @@
}
use strict;
-use Test::More tests => 13;
+use Test::More tests => 14;
use TieOut;
use MakeMaker::Test::Utils;
@@ -64,6 +64,17 @@
$warnings = '';
WriteMakefile(
NAME => 'Big::Dummy',
+ BUILD_REQUIRES => {
+ strict => 99999
+ }
+ );
+ is $warnings,
+ sprintf("Warning: prerequisite strict 99999 not found. We have %s.\n",
+ strict->VERSION),'BUILD_REQUIRES';
+
+ $warnings = '';
+ WriteMakefile(
+ NAME => 'Big::Dummy',
PREREQ_PM => {
"I::Do::Not::Exist" => 0,
}
Only in ExtUtils-MakeMaker-6.44/t: Recurs