Re: Integrating C::AC into MakeMaker/MB

[email protected] (Leon Timmermans)
Newsgroups perl.cpan.workers
Message-ID <CAHhgV8gFYdquFgbqcmZyY-X9Qxte-kMUQU5uDNPmkJyqFT8MyA@mail.gmail.com>
On Mon, Dec 1, 2014 at 11:48 AM, Jens Rehsack <[email protected]> wrote:

> Hi,
>
> I run into some trouble integrating some right linker flags to a
> Makefile.PL - insane warnings from EU::MM is an offenseless artifact,
> deleted flags is next escalation.
>
> I don't want discuss about utility and futility of the misplaced parameter
> approvals (EU::MM is a Makefile generator, not a configuration tester), I
> want to discuss a reasonable approach to pass check results into Makefile
> without doing the mistakes of Module::Install again.
>
> My naive approach was passing EXTRALIBS and LDLOADLIBS instead of LIBS (
> https://github.com/i-scream/Unix-Statgrab/blob/master/Makefile.PL#L102-105)
> - I grabbed the idea from Net-SSLeay ...
> But Dave objects (https://github.com/autarch/File-LibMagic/pull/3) and
> beside being always right I have to concede a point to Dave regarding
> "warnings confuse end-users".
>

I think you can work around the warning using a CONFIGURE callback:

WriteMakefile(
    ....
   CONFIGURE => sub {
        return {
            EXTRALIBS => ...,
            LDLOADLIBS => ...,
        }
    },
);


> I played a bit with MakeMaker extensions hacking
> https://metacpan.org/pod/File::ConfigDir::Install and mohawk pointed me
> to https://metacpan.org/pod/ExtUtils::MakeMaker::BigHelper ...
> I know, all those MM extensions (ShareDir::Install ...) will not play well
> together.
>
> What should be a reasonable way out - having a pluggable API for all those
> extensions?
>

They can be made to cooperate by not exporting the postambles to MY::, but
instead glue them together something like this:

my @extensions = (...);
load($_) for @extensions
my @methods = map { my $method = $extension . "::postamble" } @extensions;
sub MY::postamble {
    my ($makemaker, %args) = @_;
    return join "\n\n", map { $makemaker->$_(%args) } @methods;
}

Leon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.