Author: kwilliams
Date: Tue Jun 12 20:56:07 2007
New Revision: 9644

Modified:
   Module-Build/trunk/Changes
   Module-Build/trunk/lib/Module/Build/Authoring.pod
   Module-Build/trunk/lib/Module/Build/Base.pm
   Module-Build/trunk/website/META-spec.pod

Log:
Add config_requires

Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes  (original)
+++ Module-Build/trunk/Changes  Tue Jun 12 20:56:07 2007
@@ -1,5 +1,8 @@
 Revision history for Perl extension Module::Build.
 
+ - Added config_requires as a new type of prereq.  [Suggested by Adam
+   Kennedy]
+
  - Patch 31156 from bleadperl: some filename dot and extension help
    for Module::Build on VMS. [Craig Berry]
 

Modified: Module-Build/trunk/lib/Module/Build/Authoring.pod
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Authoring.pod   (original)
+++ Module-Build/trunk/lib/Module/Build/Authoring.pod   Tue Jun 12 20:56:07 2007
@@ -141,20 +141,51 @@
 
 =head1 PREREQUISITES
 
-There are three basic types of prerequisites that can be defined: 1)
-"requires" - are versions of modules that are required for certain
-functionality to be available; 2) "recommends" - are versions of
-modules that are recommended to provide enhanced functionality; and 3)
-"conflicts" - are versions of modules that conflict with, and that can
-cause problems with the distribution.
-
-Each of the three types of prerequisites listed above can be applied
-to different aspects of the Build process.  For the module distribution
-itself you simply define "requires", "recommends", or "conflicts".  The
-types can also apply to other aspects of the Build process.  Currently,
-only "build_requires" is defined which is used for modules which are
-required during the Build process.
+=head2 Types of prerequisites
 
+To specify what versions of other modules are used by this
+distribution, several types of prerequisites can be defined with the
+following parameters:
+
+=over 3
+
+=item config_requires
+
+Items that must be installed I<before> configuring this distribution
+(i.e. before running the F<Build.PL> script).  This might be a
+specific minimum version of C<Module::Build> or any other module the
+F<Build.PL> needs in order to do its stuff.  Clients like C<CPAN.pm>
+or C<CPANPLUS> will be expected to pick C<config_requires> out of the
+F<META.yml> file and install these items before running the
+C<Build.PL>.
+
+*TODO* auto-add M::B?  In what circumstances?
+
+=item build_requires
+
+Items that are necessary for building and testing this distribution,
+but aren't necessary after installation.  This can help users who only
+want to install these items temporarily.  It also helps reduce the
+size of the CPAN dependency graph if everything isn't smooshed into
+C<requires>.
+
+=item requires
+
+Items that are necessary for basic functioning.
+
+=item recommends
+
+Items that are recommended for enhanced functionality, but there are
+ways to use this distribution without having them installed.  You
+might also think of this as "can use" or "is aware of" or "changes
+behavior in the presence of".
+
+=item conflicts
+
+Items that can cause problems with this distribution when installed.
+This is pretty rare.
+
+=back
 
 =head2 Format of prerequisites
 
@@ -168,7 +199,7 @@
                perl => '5.6.0'
               },
 
-These four version specifiers have different effects.  The value
+The above four version specifiers have different effects.  The value
 C<'2.4'> means that B<at least> version 2.4 of C<Foo::Module> must be
 installed.  The value C<0> means that B<any> version of C<Bar::Module>
 is acceptable, even if C<Bar::Module> doesn't define a version.  The

Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm Tue Jun 12 20:56:07 2007
@@ -785,6 +785,7 @@
   meta_merge
   original_prefix
   prefix_relpaths
+  config_requires
 );
 
 __PACKAGE__->add_property($_) for qw(
@@ -3369,7 +3370,16 @@
     $node->{resources}{license} = $url;
   }
 
-  foreach ( @{$self->prereq_action_types} ) {
+  if (exists $p->{config_requires}) {
+    foreach my $spec (keys %{$p->{config_requires}}) {
+      warn ("Warning: $spec is listed in 'config_requires', but ".
+           "it is not found in any of the other prereq fields.\n")
+       unless grep exists $p->{$_}{$spec}, 
+              grep !/conflicts$/, @{$self->prereq_action_types};
+    }
+  }
+
+  foreach ( 'config_requires', @{$self->prereq_action_types} ) {
     if (exists $p->{$_} and keys %{ $p->{$_} }) {
       $add_node->($_, $p->{$_});
     }

Modified: Module-Build/trunk/website/META-spec.pod
==============================================================================
--- Module-Build/trunk/website/META-spec.pod    (original)
+++ Module-Build/trunk/website/META-spec.pod    Tue Jun 12 20:56:07 2007
@@ -255,6 +255,20 @@
 described in L<VERSION SPECIFICATIONS>.  These dependencies are not
 required after the module is installed.
 
+=head2 config_requires
+
+Example:
+
+  build_requires:
+    Data::Dumper: 0
+    File::Find: 1.03
+
+(Spec 1.0) [optional] {map} A YAML mapping indicating the Perl modules
+required before configuring this distribution.  The keys are the
+module names, and the values are version specifications as described
+in L<VERSION SPECIFICATIONS>.  These dependencies are not required
+after the module is installed.
+
 =head2 conflicts
 
 Example:
@@ -641,4 +655,14 @@
 
 =back
 
+=item June 12, 2007
+
+=over 2
+
+=item *
+
+Added C<config_requires>.
+
+=back
+
 =back

Reply via email to