in reply to Re^2: 2nd run of WriteMakefile ignores MY overloads
in thread 2nd run of WriteMakefile ignores MY overloads

I was right, you don't need to run it twice :)

http://search.cpan.org/dist/PAR-Packer/MANIFEST http://cpansearch.perl.org/src/RSCHUPP/PAR-Packer-1.013/myldr/Makefile.PL redefines CFLAGS (and friends) in postamble, after MakeMaker has expanded all the stuff ( LINKTYPE and everything )

$ h2xs -AX -n Bunk ... sub MY::postamble { use Data::Dump(); warn join "\n", Data::Dump::pp(@_), "postamble @_ ", Data::Dump::pp( $_[0]->{ARGS}, $_[0]->{LINKTYPE} ); "" } ... $ perl Bunk/Makefile.PL ... postamble PACK001=HASH(0xa556a4) ( { ABSTRACT_FROM => "lib/Bunk.pm", AUTHOR => ["A. U. Thor <a.u.thor\@a.galaxy.far.far.away>"], NAME => "Bunk", PREREQ_PM => {}, VERSION_FROM => "lib/Bunk.pm", }, "dynamic", ) at Bunk\Makefile.PL line 15. Writing Makefile for Bunk Writing MYMETA.yml and MYMETA.json $ perl Bunk/Makefile.PL LINKTYPE=static ... postamble PACK001=HASH(0xa556c4) ( { ABSTRACT_FROM => "lib/Bunk.pm", AUTHOR => ["A. U. Thor <a.u.thor\@a.galaxy.far.far.away>"], LINKTYPE => "static", NAME => "Bunk", PREREQ_PM => {}, VERSION_FROM => "lib/Bunk.pm", }, "static", ) at Bunk\Makefile.PL line 15. Writing Makefile for Bunk Writing MYMETA.yml and MYMETA.json

The PACK001=HASH(0xa556c4) gives a hint as to why calling WriteMakefile twice doesn't work -- MakeMaker is eeeew

:) MakeMaker Is DOOMED! but Module::Build doesn't support static linking

Replies are listed 'Best First'.
Re^4: 2nd run of WriteMakefile ignores MY overloads
by bulk88 (Priest) on Apr 05, 2012 at 06:02 UTC
    The PACK001=HASH(0xa556c4) gives a hint as to why calling WriteMakefile twice doesn't work -- MakeMaker is eeeew

    ... All I can say. PAR Packer isn't remotely near a normal XS library. You can define macros again in postamble, but the makefile becomes unreadable to mere mortals. No core dual lifes use Module::Build as of Perl 5.12. I wont be the first.

    I figured out the problem. EUMM deletes or something, I can't tell whats going on, the MY package methods after inheriting them, see cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm#l966 in perl.git. Why? I have no idea. Workaround in Makefile.pl below. My problem is resolved.
    use 5.010000; use ExtUtils::MakeMaker; use Config qw(%Config); use Data::Dumper; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. %param = ( NAME => 'MM123', VERSION_FROM => 'lib/MM123.pm', # finds $VERSION PREREQ_PM => {}, # e.g., Module::Name => 1.1 ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => 'lib/MM123.pm', # retrieve abstract from modu +le AUTHOR => 'A. U. Thor <a.u.thor@a.galaxy.far.far.away>' +) : ()), # e.g., '-lm' DEFINE => '', # e.g., '-DHAVE_SOMETHING' INC => '-I.', # e.g., '-I. -I/usr/include/other' ); *MY::postamble = sub { print "postamble hook worked\n"; return ' # POSTAMBLE WORKED '; }; WriteMakefile(%param); *MY::postamble = sub { print "postamble hook worked\n"; return ' # POSTAMBLE WORKED '; }; WriteMakefile(%param);
    C:\pl\mmbug>perl makefile.pl WARNING: Setting ABSTRACT via file 'lib/MM123.pm' failed at C:/perl512/lib/ExtUtils/MakeMaker.pm line 583 postamble hook worked Writing Makefile for MM123 WARNING: Setting ABSTRACT via file 'lib/MM123.pm' failed at C:/perl512/lib/ExtUtils/MakeMaker.pm line 583 postamble hook worked Writing Makefile for MM123 C:\pl\mmbug>

      You just gotta love that schwern, deleting symbols is awesome