FAQ
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 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?

Cheers
--
Jens Rehsack
rehsack@gmail.com

Search Discussions

  • Leon Timmermans at Dec 1, 2014 at 4:59 pm

    On Mon, Dec 1, 2014 at 11:48 AM, Jens Rehsack 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
  • Jens Rehsack at Dec 2, 2014 at 7:17 am

    Am 01.12.2014 um 17:59 schrieb Leon Timmermans <fawaka@gmail.com>:

    On Mon, Dec 1, 2014 at 11:48 AM, Jens Rehsack 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 => ...,
    }
    },
    );
    Seems reasonable - but as you know in not to distant future, they shall
    also override CC, CCLD, ... (using ExtUtils::Builder or alike, instead
    of plain cc).

    Does the return hash of this callback overrides all EU::MM constants?
    Is there a minimum version of EU::MM for this CONFIGURE callback?
    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;
    }
    For some reason File::ConfigDir::Install doesn't just override postamble,
    it modifies the "install_*_*" instructions ...
    ...BigHelper (mohawk pointed to that) does something similar.

    Cheers
    --
    Jens Rehsack
    rehsack@gmail.com
  • Jens Rehsack at Dec 2, 2014 at 9:45 am

    Am 02.12.2014 um 08:17 schrieb Jens Rehsack <rehsack@gmail.com>:


    Am 01.12.2014 um 17:59 schrieb Leon Timmermans <fawaka@gmail.com>:
    On Mon, Dec 1, 2014 at 11:48 AM, Jens Rehsack 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 => ...,
    }
    },
    );
    Seems reasonable - but as you know in not to distant future, they shall
    also override CC, CCLD, ... (using ExtUtils::Builder or alike, instead
    of plain cc).

    Does the return hash of this callback overrides all EU::MM constants?
    I think I can answer this question on my own:

    File-ConfigDir-Install sno$ git diff
    diff --git a/t/01-makefile.t b/t/01-makefile.t
    index 5e9bd38..2b0759c 100644
    --- a/t/01-makefile.t
    +++ b/t/01-makefile.t
    @@ -35,8 +35,12 @@ delete $ENV{PERL_MM_OPT}; # local::lib + PREFIX below will FAIL
      WriteMakefile(
          NAME => 'File::ConfigDir::Install',
          VERSION_FROM => 'lib/File/ConfigDir/Install.pm',
    + CONFIGURE => sub {
    + {
          INST_ETC => "tlib-$$/etc",
          INST_LIB => "tlib-$$/lib",
    + },
    + },
          MAKEFILE => $FILE,
          PREREQ_PM => {},
          ($] >= 5.005 ?

    $ make && perl -Mblib t/01-makefile.t
    cp lib/File/ConfigDir/Install.pm blib/lib/File/ConfigDir/Install.pm
    Manifying 1 pod document
    'INST_ETC' is not a known MakeMaker parameter name.
    Generating a Unix-style test-21206-Makefile
    Writing test-21206-Makefile for File::ConfigDir::Install
    Writing MYMETA.yml and MYMETA.json
    ok 1 - Created test-21206-Makefile
    ok 2 - Recognized: t/etc/fsd-install.json
    # make -f test-21206-Makefile
    # cp t/etc/fsd-install.json tlib-21206/etc/fsd-install.json
    # Manifying 1 pod document
    ok 3 - Copied to blib for dist: t/etc/fsd-install.json
    ok 4 - Same content: t/etc/fsd-install.json
    # make -f test-21206-Makefile DESTDIR=/var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45 install
    # Skip tlib-21206/etc/fsd-install.json (unchanged)
    # Manifying 1 pod document
    # Installing /var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45/Users/sno/perl5/perlbrew/perls/perl-5.20.0/man/man3/File::ConfigDir::Install.3
    # Installing /var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45/Users/sno/perl5/perlbrew/perls/perl-5.20.0/etc/fsd-install.json
    # Appending installation info to /var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45/Users/sno/perl5/perlbrew/perls/perl-5.20.0/lib/5.20.0/darwin-2level/perllocal.pod
    # Checking for /var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45/Users/sno/perl5/perlbrew/perls/perl-5.20.0/etc/fsd-install.json
    ok 5 - Installed: t/etc/fsd-install.json
    1..5

    So neither the warning goes away nor existing constants are overwritten.
    Is there a minimum version of EU::MM for this CONFIGURE callback?
    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;
    }
    For some reason File::ConfigDir::Install doesn't just override postamble,
    it modifies the "install_*_*" instructions ...
    ...BigHelper (mohawk pointed to that) does something similar.
    I think there is more a hook like https://metacpan.org/pod/Class::Method::Modifiers#around-method-s-sub needed for each of overloaded function ...

    Cheers
    --
    Jens Rehsack
    rehsack@gmail.com
  • Leon Timmermans at Dec 9, 2014 at 10:30 pm

    On Tue, Dec 2, 2014 at 10:45 AM, Jens Rehsack wrote:

    Seems reasonable - but as you know in not to distant future, they shall
    also override CC, CCLD, ... (using ExtUtils::Builder or alike, instead
    of plain cc).

    Does the return hash of this callback overrides all EU::MM constants?
    I think I can answer this question on my own:

    File-ConfigDir-Install sno$ git diff
    diff --git a/t/01-makefile.t b/t/01-makefile.t
    index 5e9bd38..2b0759c 100644
    --- a/t/01-makefile.t
    +++ b/t/01-makefile.t
    @@ -35,8 +35,12 @@ delete $ENV{PERL_MM_OPT}; # local::lib + PREFIX below
    will FAIL
    WriteMakefile(
    NAME => 'File::ConfigDir::Install',
    VERSION_FROM => 'lib/File/ConfigDir/Install.pm',
    + CONFIGURE => sub {
    + {
    INST_ETC => "tlib-$$/etc",
    INST_LIB => "tlib-$$/lib",
    + },
    + },
    MAKEFILE => $FILE,
    PREREQ_PM => {},
    ($] >= 5.005 ?

    $ make && perl -Mblib t/01-makefile.t
    cp lib/File/ConfigDir/Install.pm blib/lib/File/ConfigDir/Install.pm
    Manifying 1 pod document
    'INST_ETC' is not a known MakeMaker parameter name.
    Generating a Unix-style test-21206-Makefile
    Writing test-21206-Makefile for File::ConfigDir::Install
    Writing MYMETA.yml and MYMETA.json
    ok 1 - Created test-21206-Makefile
    ok 2 - Recognized: t/etc/fsd-install.json
    # make -f test-21206-Makefile
    # cp t/etc/fsd-install.json tlib-21206/etc/fsd-install.json
    # Manifying 1 pod document
    ok 3 - Copied to blib for dist: t/etc/fsd-install.json
    ok 4 - Same content: t/etc/fsd-install.json
    # make -f test-21206-Makefile
    DESTDIR=/var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45 install
    # Skip tlib-21206/etc/fsd-install.json (unchanged)
    # Manifying 1 pod document
    # Installing
    /var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45/Users/sno/perl5/perlbrew/perls/perl-5.20.0/man/man3/File::ConfigDir::Install.3
    # Installing
    /var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45/Users/sno/perl5/perlbrew/perls/perl-5.20.0/etc/fsd-install.json
    # Appending installation info to
    /var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45/Users/sno/perl5/perlbrew/perls/perl-5.20.0/lib/5.20.0/darwin-2level/perllocal.pod
    # Checking for
    /var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45/Users/sno/perl5/perlbrew/perls/perl-5.20.0/etc/fsd-install.json
    ok 5 - Installed: t/etc/fsd-install.json
    1..5

    So neither the warning goes away nor existing constants are overwritten.
    Right. There seem to be two layers of verification, I had missed the second
    one. That is a bummer. There should be a way around this, I just need to
    find it.

    For some reason File::ConfigDir::Install doesn't just override postamble,
    it modifies the "install_*_*" instructions ...
    ...BigHelper (mohawk pointed to that) does something similar.
    I think there is more a hook like
    https://metacpan.org/pod/Class::Method::Modifiers#around-method-s-sub
    needed for each of overloaded function ...
    Right. There really ought to be a ExtUtils::MakeMaker::Extensible layer to
    make this all easier.

    Leon
  • Jens Rehsack at Dec 10, 2014 at 8:05 am

    Am 09.12.2014 um 23:30 schrieb Leon Timmermans <fawaka@gmail.com>:
    On Tue, Dec 2, 2014 at 10:45 AM, Jens Rehsack wrote:
    Seems reasonable - but as you know in not to distant future, they shall
    also override CC, CCLD, ... (using ExtUtils::Builder or alike, instead
    of plain cc).

    Does the return hash of this callback overrides all EU::MM constants?
    I think I can answer this question on my own:

    File-ConfigDir-Install sno$ git diff
    diff --git a/t/01-makefile.t b/t/01-makefile.t
    index 5e9bd38..2b0759c 100644
    --- a/t/01-makefile.t
    +++ b/t/01-makefile.t
    @@ -35,8 +35,12 @@ delete $ENV{PERL_MM_OPT}; # local::lib + PREFIX below will FAIL
    WriteMakefile(
    NAME => 'File::ConfigDir::Install',
    VERSION_FROM => 'lib/File/ConfigDir/Install.pm',
    + CONFIGURE => sub {
    + {
    INST_ETC => "tlib-$$/etc",
    INST_LIB => "tlib-$$/lib",
    + },
    + },
    MAKEFILE => $FILE,
    PREREQ_PM => {},
    ($] >= 5.005 ?

    $ make && perl -Mblib t/01-makefile.t
    cp lib/File/ConfigDir/Install.pm blib/lib/File/ConfigDir/Install.pm
    Manifying 1 pod document
    'INST_ETC' is not a known MakeMaker parameter name.
    Generating a Unix-style test-21206-Makefile
    Writing test-21206-Makefile for File::ConfigDir::Install
    Writing MYMETA.yml and MYMETA.json
    ok 1 - Created test-21206-Makefile
    ok 2 - Recognized: t/etc/fsd-install.json
    # make -f test-21206-Makefile
    # cp t/etc/fsd-install.json tlib-21206/etc/fsd-install.json
    # Manifying 1 pod document
    ok 3 - Copied to blib for dist: t/etc/fsd-install.json
    ok 4 - Same content: t/etc/fsd-install.json
    # make -f test-21206-Makefile DESTDIR=/var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45 install
    # Skip tlib-21206/etc/fsd-install.json (unchanged)
    # Manifying 1 pod document
    # Installing /var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45/Users/sno/perl5/perlbrew/perls/perl-5.20.0/man/man3/File::ConfigDir::Install.3
    # Installing /var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45/Users/sno/perl5/perlbrew/perls/perl-5.20.0/etc/fsd-install.json
    # Appending installation info to /var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45/Users/sno/perl5/perlbrew/perls/perl-5.20.0/lib/5.20.0/darwin-2level/perllocal.pod
    # Checking for /var/folders/5s/sk58jrwj7jj73phc9lcx9nh80000gn/T/cgOOrG5f45/Users/sno/perl5/perlbrew/perls/perl-5.20.0/etc/fsd-install.json
    ok 5 - Installed: t/etc/fsd-install.json
    1..5

    So neither the warning goes away nor existing constants are overwritten.

    Right. There seem to be two layers of verification, I had missed the second one. That is a bummer. There should be a way around this, I just need to find it.
    Would be cool, thanks!
    For some reason File::ConfigDir::Install doesn't just override postamble,
    it modifies the "install_*_*" instructions ...
    ...BigHelper (mohawk pointed to that) does something similar.
    I think there is more a hook like https://metacpan.org/pod/Class::Method::Modifiers#around-method-s-sub needed for each of overloaded function ...

    Right. There really ought to be a ExtUtils::MakeMaker::Extensible layer to make this all easier.
    I can care for this (with some wise words from #toolchain).
    What can be a reasonable approach for providing the "around"?

    Using Class::Method::Modifiers and suggest bundling for distributions for ancient environments?
    As far as I see it has only core dependencies...

    inc::latest does a great job for bundling. It does exactly what I want to reach with ExtUtils::BundleMaker.
    I tried it in LMU 0.400_010 - this sounds being a reasonable approach for distributions using ExtUtils::MakeMaker::Extensible.

    Cheers
    --
    Jens Rehsack
    rehsack@gmail.com

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcpan-workers @
categoriesperl
postedDec 1, '14 at 10:48a
activeDec 10, '14 at 8:05a
posts6
users2
websitecpan.org

2 users in discussion

Jens Rehsack: 4 posts Leon Timmermans: 2 posts

People

Translate

site design / logo © 2018 Grokbase