Skip Menu |

This queue is for tickets about the ExtUtils-MakeMaker CPAN distribution.

Report information
The Basics
Id: 28632
Status: resolved
Worked: 31 min
Priority: 0/
Queue: ExtUtils-MakeMaker

People
Owner: Nobody in particular
Requestors: nog [...] yapceurope.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 6.36
Fixed in: (no value)



Subject: MakeMaker does not set Makefile variables recursively
I have the following directory stucture ./Mpa ./Mpa/Base Both directories contain a Makefile.PL file. I do the following: cd ./Mpa perl Makefile.PL LD='xyz' When I check the Makefile in both directories, only the Makefile in ./Mpa has set the value for the variable LD. The Makefile in the subdirectory ./Mpa/Base has not changed the value for the variable LD. MakeMaker version: 6.30 (Revision: Revision: 4535 ) I have attached both Makefile.PL files and both generated Makefile files. If you need more information, please let me know. Thank you in advance, Norbert Gruener
Subject: Makefile
Download Makefile
application/octet-stream 21.6k

Message body not shown because it is not plain text.

Subject: Base-Makefile
Download Base-Makefile
application/octet-stream 15.9k

Message body not shown because it is not plain text.

Subject: Base-Makefile.PL
use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'Mpa_Corp::Mpa::Base', 'VERSION_FROM' => 'Base.pm', # finds $VERSION );
Subject: Makefile.PL
use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'Mpa_Corp::Mpa', 'VERSION' => '0.01', );
Subject: Re: [rt.cpan.org #28632] MakeMaker does not set Makefile variables recursively
Date: Thu, 02 Aug 2007 17:01:04 -0700
To: bug-ExtUtils-MakeMaker [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
via RT wrote: Show quoted text
> Thu Aug 02 08:28:57 2007: Request 28632 was acted upon. > Transaction: Ticket created by NOG > Queue: ExtUtils-MakeMaker > Subject: MakeMaker does not set Makefile variables recursively > Broken in: 6.30 > Severity: Important > Owner: Nobody > Requestors: nog@yapceurope.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=28632 > > > > I have the following directory stucture > ./Mpa > ./Mpa/Base > Both directories contain a Makefile.PL file. > > I do the following: > cd ./Mpa > perl Makefile.PL LD='xyz' > > When I check the Makefile in both directories, only the Makefile in > ./Mpa has set the value for the variable LD. The Makefile in the > subdirectory ./Mpa/Base has not changed the value for the variable LD. > > > MakeMaker version: 6.30 (Revision: Revision: 4535 ) > > > I have attached both Makefile.PL files and both generated Makefile files. > > If you need more information, please let me know.
Thanks for the report, Norbert, and for attaching all the generated Makefiles. Could you try it again with the latest version of MakeMaker, see if this problem has already been fixed? http://search.cpan.org/dist/ExtUtils-MakeMaker I suspect this is an issue with the pasthru() code which selects which variables get passed onto subdirectories. I admit its not part of the code which I understand well and I'll probably wind up asking the folks on makemaker@perl.org.
Subject: Re: [rt.cpan.org #28632] MakeMaker does not set Makefile variables recursively
Date: Sat, 4 Aug 2007 10:57:16 +0200
To: Michael G Schwern via RT <bug-ExtUtils-MakeMaker [...] rt.cpan.org>
From: Norbert Gruener <nog [...] yapceurope.org>
Hi Michael thank you for your fast reply! On Fri, Aug 03 2007, Michael G Schwern via RT wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=28632 > > > via RT wrote:
> > Thu Aug 02 08:28:57 2007: Request 28632 was acted upon. > > Transaction: Ticket created by NOG > > Queue: ExtUtils-MakeMaker > > Subject: MakeMaker does not set Makefile variables recursively > > Broken in: 6.30 > > Severity: Important > > Owner: Nobody > > Requestors: nog@yapceurope.org > > Status: new > > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=28632 > > > > > > > I have the following directory stucture > > ./Mpa > > ./Mpa/Base > > Both directories contain a Makefile.PL file. > > > > I do the following: > > cd ./Mpa > > perl Makefile.PL LD='xyz' > > > > When I check the Makefile in both directories, only the Makefile in > > ./Mpa has set the value for the variable LD. The Makefile in the > > subdirectory ./Mpa/Base has not changed the value for the variable LD. > > > > > > MakeMaker version: 6.30 (Revision: Revision: 4535 ) > > > > > > I have attached both Makefile.PL files and both generated Makefile files. > > > > If you need more information, please let me know.
> > Thanks for the report, Norbert, and for attaching all the generated Makefiles. > > Could you try it again with the latest version of MakeMaker, see if this > problem has already been fixed? > http://search.cpan.org/dist/ExtUtils-MakeMaker
Now I have installed the latest version from CPAN (Version: 6.36 Revision: 32261) but the behavior and the result stay the same. The variable does not get passed into the subdirectory. Show quoted text
> I suspect this is an issue with the pasthru() code which selects which > variables get passed onto subdirectories. I admit its not part of the code > which I understand well and I'll probably wind up asking the folks on > makemaker@perl.org.
I would appreciate if you could do that :-) Thank you in advance. Cheers, Norbert -- Ceterum censeo | PGP encrypted mail preferred. Redmond esse delendam. | PGP Key at www.MPA-Garching.MPG.de/~nog/
Subject: Re: [rt.cpan.org #28632] MakeMaker does not set Makefile variables recursively
Date: Wed, 26 Sep 2007 11:17:37 +0200
To: Michael G Schwern via RT <bug-ExtUtils-MakeMaker [...] rt.cpan.org>
From: Norbert Gruener <nog [...] yapceurope.org>
On Sat, Aug 04 2007, Norbert Gruener wrote: Show quoted text
> Hi Michael > > thank you for your fast reply! > > On Fri, Aug 03 2007, Michael G Schwern via RT wrote:
> > > > I suspect this is an issue with the pasthru() code which selects which > > variables get passed onto subdirectories. I admit its not part of the code > > which I understand well and I'll probably wind up asking the folks on > > makemaker@perl.org.
> > I would appreciate if you could do that :-)
Is there any chance that this problem gets tackled ? Cheers, Norbert -- Ceterum censeo | PGP encrypted mail preferred. Redmond esse delendam. | PGP Key at www.MPA-Garching.MPG.de/~nog/
I also see this problem and have asked on the perl-qa list about it. In my case I was trying to build XML::Parser which has: Makefile.PL Expat/Makefile.PL and the 'LD' variable is not getting passed to the lower level Makfile. In other words, if I do this: perl Makefile.PL LD="env MACOSX_DEPLOYMENT_TARGET=10.3 cc -arch ppc -arch i386" then the top-level Makefile has: LD = env MACOSX_DEPLOYMENT_TARGET=10.3 cc -arch ppc -arch i386 but the lower level (Expat/Makefile) does not. I suspect that this is because the lower level Makefile.PL is invoked with 'do', in eval_in_x(): { package main; do './Makefile.PL'; }; without passing any of the command-line args.
From: matisse [...] spamcop.net
Attaching a patch to t/recurs.t (from ExtUtils-MakeMaker-6.36) that adds a failing test case for this bug.
#!/usr/bin/perl -w # This tests MakeMaker against recursive builds BEGIN { if( $ENV{PERL_CORE} ) { chdir 't' if -d 't'; @INC = ('../lib', 'lib'); } else { unshift @INC, 't/lib'; } } use strict; use Config; use Test::More tests => 26; use MakeMaker::Test::Utils; use MakeMaker::Test::Setup::Recurs; # 'make disttest' sets a bunch of environment variables which interfere # with our testing. delete @ENV{qw(PREFIX LIB MAKEFLAGS)}; my $perl = which_perl(); my $Is_VMS = $^O eq 'VMS'; chdir('t'); perl_lib; my $Touch_Time = calibrate_mtime(); $| = 1; ok( setup_recurs(), 'setup' ); END { ok( chdir File::Spec->updir ); ok( teardown_recurs(), 'teardown' ); } ok( chdir('Recurs'), q{chdir'd to Recurs} ) || diag("chdir failed: $!"); # Check recursive Makefile building. my @mpl_out = run(qq{$perl Makefile.PL}); cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); my $makefile = makefile_name(); ok( -e $makefile, 'Makefile written' ); ok( -e File::Spec->catfile('prj2',$makefile), 'sub Makefile written' ); my $make = make_run(); my $make_out = run("$make"); is( $?, 0, 'recursive make exited normally' ) || diag $make_out; ok( chdir File::Spec->updir ); ok( teardown_recurs(), 'cleaning out recurs' ); ok( setup_recurs(), ' setting up fresh copy' ); ok( chdir('Recurs'), q{chdir'd to Recurs} ) || diag("chdir failed: $!"); # Check NORECURS @mpl_out = run(qq{$perl Makefile.PL "NORECURS=1"}); cmp_ok( $?, '==', 0, 'Makefile.PL NORECURS=1 exited with zero' ) || diag(@mpl_out); $makefile = makefile_name(); ok( -e $makefile, 'Makefile written' ); ok( !-e File::Spec->catfile('prj2',$makefile), 'sub Makefile not written' ); $make = make_run(); run("$make"); is( $?, 0, 'recursive make exited normally' ); ok( chdir File::Spec->updir ); ok( teardown_recurs(), 'cleaning out recurs' ); ok( setup_recurs(), ' setting up fresh copy' ); ok( chdir('Recurs'), q{chdir'd to Recurs} ) || diag("chdir failed: $!"); # Check that arguments aren't stomped when they have .. prepended # [rt.perl.org 4345] @mpl_out = run(qq{$perl Makefile.PL "INST_SCRIPT=cgi"}); cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); $makefile = makefile_name(); my $submakefile = File::Spec->catfile('prj2',$makefile); ok( -e $makefile, 'Makefile written' ); ok( -e $submakefile, 'sub Makefile written' ); my $inst_script = File::Spec->catdir(File::Spec->updir, 'cgi'); ok( open(MAKEFILE, $submakefile) ) || diag("Can't open $submakefile: $!"); { local $/; like( <MAKEFILE>, qr/^\s*INST_SCRIPT\s*=\s*\Q$inst_script\E/m, 'prepend .. not stomping WriteMakefile args' ) } close MAKEFILE; { # Quiet "make test" failure noise close *STDERR; my $test_out = run("$make test"); isnt $?, 0, 'test failure in a subdir causes make to fail'; }
On Sun Nov 11 15:23:49 2007, MATISSE wrote: Show quoted text
> Attaching a patch to t/recurs.t (from ExtUtils-MakeMaker-6.36) that adds > a failing test case for this bug.
Nuts. I attached the wrone file. This time I have attached the correct (patch) file.
--- recurs.t 2007-11-11 11:45:22.000000000 -0800 +++ recurs.t.new 2007-11-11 12:19:06.000000000 -0800 @@ -15,7 +15,7 @@ use strict; use Config; -use Test::More tests => 26; +use Test::More tests => 27; use MakeMaker::Test::Utils; use MakeMaker::Test::Setup::Recurs; @@ -91,9 +91,12 @@ diag("chdir failed: $!"); + # Check that arguments aren't stomped when they have .. prepended # [rt.perl.org 4345] -@mpl_out = run(qq{$perl Makefile.PL "INST_SCRIPT=cgi"}); +# and http://rt.cpan.org/Ticket/Display.html?id=28632 +my $test_LD_value = q{LD="test value for LD"}; +@mpl_out = run(qq{$perl Makefile.PL "INST_SCRIPT=cgi $test_LD_value"}); cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); @@ -107,8 +110,16 @@ my $inst_script = File::Spec->catdir(File::Spec->updir, 'cgi'); ok( open(MAKEFILE, $submakefile) ) || diag("Can't open $submakefile: $!"); { local $/; - like( <MAKEFILE>, qr/^\s*INST_SCRIPT\s*=\s*\Q$inst_script\E/m, - 'prepend .. not stomping WriteMakefile args' ) + my $sub_makefile_text = <MAKEFILE>; + like( $sub_makefile_text, qr/^\s*INST_SCRIPT\s*=\s*\Q$inst_script\E/m, + 'prepend .. not stomping WriteMakefile args' ); + + # http://rt.cpan.org/Ticket/Display.html?id=28632 + my ($got_ld) = ( $sub_makefile_text =~ /( ^ LD \s = \s .*? $)/msx ); + is($got_ld, + $test_LD_value, + 'perl Makefile.PL LD=test_value passed to sub-makefile' + ); } close MAKEFILE;
Subject: [rt.cpan.org #28632] MakeMaker does not set Makefile variables recursively
Date: Sat, 10 Mar 2012 13:44:03 +0200
To: bug-ExtUtils-MakeMaker [...] rt.cpan.org
From: Niko Tyni <ntyni [...] debian.org>
I sent this to makemaker@perl.org on March 4th, but it doesn't seem to have made it through, perhaps due to moderation issues or something. Sending it here in the RT ticket so it's not totally lost. ----- Forwarded message from Niko Tyni <ntyni@debian.org> ----- Date: Sun, 4 Mar 2012 09:16:46 +0200 From: Niko Tyni <ntyni@debian.org> To: makemaker@perl.org Cc: 660195@bugs.debian.org Subject: Passing variables down to recursive Makefile.PL invocations User-Agent: Mutt/1.5.21 (2010-09-15) Hi makemaker people, as discussed five years ago in [rt.cpan.org #28632], when building a distribution with separate Makefile.PL files in subdirectories, command line arguments to Makefile.PL are not passed through to recursive invocations. This seems to be the case for the current versions too, up to and including v6.63_02-9-g5072697 in <http://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker>. I'm bringing this up here on the makemaker list as Michael Schwern suggested so in the ticket. To summarize, the top level invocation perl Makefile.PL LD=foo will only affect the LD setting in the generated top-level Makefile but not in the subdirectory Makefile, which is generated from the subdirectory Makefile.PL. We're facing this in Debian because we need a way to set security related linker flags (-Wl,-z,relro to be precise) for the build, and the flags are not propagated to subdirectories in distributions like Imager (on CPAN.) That's http://bugs.debian.org/660195 (cc'd) FWIW. I've looked into this (for the MM_Unix part), and I see two whitelists of variables that do affect the recursively generated Makefiles or the respective 'make' invocations. Any others seem to get ignored in subdirectories. - ExtUtils::MakeMaker::new() lists POLLUTE PERL_CORE LINKTYPE. POLLUTE has special handling, but the others get set in the 'MakeMaker constants' section of the generated subdirectory Makefile. - ExtUtils::MM_Unix::passthru() lists LIB LIBPERL_A LINKTYPE OPTIMIZE PREFIX INSTALL_BASE. Those get added to the recursive make invocation command line in the top level Makefile (via the 'Makemaker subdirs' section and the PASTHRU variable.) For the time being, I've patched the latter list for Debian to include LD, but I was wondering how much of this is working as designed. Why aren't all command line settings propagated? There's a test case in the CPAN ticket so I'll spare the details, but let me know if you need any. Many thanks for your work on MakeMaker, -- Niko Tyni ntyni@debian.org Show quoted text
----- End forwarded message -----
RT-Send-CC: matisse [...] spamcop.net, ntyni [...] debian.org
I've applied the Debian patch to the EUMM repository and released v6.69_05 which incorporates the change, to CPAN. Many thanks.
This issue is now resolved with the release of 6.70 Many thanks.