I'm sorry, I worked through it but forgot to post what the
solutions were, for anyone following this as a thread in the
future.  Restating my Qs with As:

Q: How do I block the optimization from the Perl build being
    included the cc command?  I would prefer to leave it in
    the optimization variable in Config for future installs.

A: After the
          $build = Module::Build->new( ...operands... );
   one can (just for this build not permanently) override
   parameters under which perl was built (from Config).
   The one I wanted, to override the optimization in the C
   compiler used by perl, came out to
          $build->config(optimize => $opt);

   There are lots of other Config() items that one can apply
   this to.  I was just spoiled because ExtUtils::MakeMaker
   had an explicit
                       OPTIMIZE => $opt,
   in its WriteMakefile() operands.

Q2: What's the easiest way to communicate something from
      the Build.PL code to test code?

A2: Similar to the above, after the ->new() I did

    my $cmd = $build->prompt(
        "Enter a shell command to be run when the sky is falling:");
    if ($cmd) {$build->config_data('cmd' => $cmd)};

    Test code can access $cmd with:
    $cmd = Module::Build->current->config_data('cmd');

    Code that will run after installation of My::Module can access
    $cmd with:
    use My::Module::ConfigData;  # this gets created during the install
    $cmd = My::Module::ConfigData->config('cmd');

    There's a parallel capability that communicates booleans
    called feature(), but since booleans are a subset of
    GP values, I suspect features() will be less popular
    than config_data.

The web pages Module::Build::API and Module::Build::Cookbook
are where one can learn good stuff like this.

Best Regards to all,
cmac


On Feb 10, 2010, at 8:48 AM, Eric Wilhelm wrote:

# from cr...@animalhead.com
# on Sunday 07 February 2010 23:25:

I can
add the optimization I want to the extra_compiler_flags parameter,
but the optimization from the Perl build is included in the cc
command also.  I feel sorry for the compiler which is told to
optimize two different ways...

Passing options to ExtUtils::CBuilder from the Build.PL needs some work.
I'm sure there are about a dozen hacked-up build classes on the CPAN
which are trying to work with this in one way or another.
Module::Build needs some way to give authors a lot more rope, but in a
way that will allows it and EU::CBuilder to change.  Test cases and
patches are most welcomed.

--Eric
--
I arise in the morning torn between a desire to improve the world and a
desire to enjoy the world. This makes it hard to plan the day.
--E.B. White
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------

Reply via email to