make2build-0.19_01 released

2005-10-14 Thread Steven Schubiger
For those people, who haven't been luckily enough to have
experienced the beginnings of make2build, a short say:

* It's a Makefile.PL - Build.PL converter
* The conversion table is still lacking MakeMaker - M:B arguments
* It's still a script, that perhaps will be reworked in a modular manner
* Could use some opinions of the MakeMaker/M::B crowd

http://search.cpan.org/~schubiger/make2build-0.19_01

PS: Michael, the mysterious question on Slide 21 of MakeMaker
is DOOMED may have been resolved.


Re: make2build-0.19_01 released

2005-10-14 Thread Michael G Schwern
On Fri, Oct 14, 2005 at 05:15:15PM +0200, Steven Schubiger wrote:
 For those people, who haven't been luckily enough to have
 experienced the beginnings of make2build, a short say:
 
 * It's a Makefile.PL - Build.PL converter
 * The conversion table is still lacking MakeMaker - M:B arguments
 * It's still a script, that perhaps will be reworked in a modular manner
 * Could use some opinions of the MakeMaker/M::B crowd
 
 http://search.cpan.org/~schubiger/make2build-0.19_01

(Slight problem.  The script never gets written to blib and thus never
 gets installed.  This is with Module::Build 0.2611.)

This does the override WriteMakefile trick.  Excellent!  I was just
wishing that existed the other day.  Since this is the most accurate way 
involving the least duplication to maintain both a Makefile.PL and a 
Build.PL, I would recommend its inclusion into Module::Build.

I would recommend a change in the way it works.  Rather than spitting out
a new Build.PL with static entries, the Build.PL should look something
like this:

# This does the trick of overriding WriteMakefile
use Module::Build::Compat::Make2Build;

do './Makefile.PL';

The advantages here are:

*  Any changes to the Makefile.PL are immediately reflected in the Build.PL

*  Any extra processing done in the Makefile.PL still happens when the
   user runs the Build.PL.  This includes prompting the user for more
   information and any calculations necessary to determine the arguments
   to WriteMakefile().

In fact, the only things this approach can't potentially handle are overrides 
of MakeMaker methods.  Nothing's going to handle that.

And a final recommendation.  Extend what the overriden WriteMakefile() can
handle to accept Module::Build-new arguments directly.  Since (nearly) 
all of WriteMakefile's arguments are upper-case, this is a simple
matter of passing any lowercase arguments straight through.  That way one
can maintain a Makefile.PL while still taking advantage of some of
Module::Build's features.


-- 
Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern
You are wicked and wrong to have broken inside and peeked at the
implementation and then relied upon it.
-- tchrist in [EMAIL PROTECTED]


Re: [Module::Build] Re: make2build-0.19_01 released

2005-10-14 Thread Ken Williams


On Oct 14, 2005, at 7:57 PM, Michael G Schwern wrote:

I would recommend a change in the way it works.  Rather than spitting 
out

a new Build.PL with static entries, the Build.PL should look something
like this:

# This does the trick of overriding WriteMakefile
use Module::Build::Compat::Make2Build;

do './Makefile.PL';



That would be fine for someone who wants to maintain the Makefile.PL as 
their primary builder script and have the Build.PL be subservient to 
it, but I think the main use for make2build will be for people who want 
to *switch* from MakeMaker to M::B.  If they ended up with a do 
'./Makefile.PL'; as their Build.PL, they'd have little (nothing?) to 
gain from making the conversion.


The main problem with the override WriteMakefile trick is that it 
runs all the code intended for the user's machine on the *author's* 
machine, effectively freezing everything that should be dynamic.  This 
works fine for simple modules, but fails (silently!) on something as 
simple as using a variable in the call to WriteMakefile().


I do still fantasize about a script that actually parses the 
Makefile.PL rather than using the override WriteMakefile trick.  The 
trick seems like it would get you 100% there for 20% of the 
Makefile.PLs, silently fail on 70%, and die on 10%.  Parsing seems like 
it could get you 100% there on maybe 60% of them and die on 40%.


These are of course very scientifically derived guesses. ;-)

Steven, you might be interested to have a look at the 
makefile_to_build_args() method in Module::Build::Compat as another 
source of parameter translation.  You can call it as a class method if 
you want.


 -Ken