From fad3b0eaeee8cf465e24382e865f7d39a869497f Mon Sep 17 00:00:00 2001 From: Rocky Bernstein Date: Mon, 4 Jul 2016 08:36:31 -0400 Subject: [PATCH 1/2] Set PERL env var on "test" and "install" --- lib/CPAN/Distribution.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/CPAN/Distribution.pm b/lib/CPAN/Distribution.pm index 5dfc52322..e337e3757 100644 --- a/lib/CPAN/Distribution.pm +++ b/lib/CPAN/Distribution.pm @@ -2885,7 +2885,7 @@ sub unsat_prereq { } elsif ( $self->{reqtype} =~ /^(r|c)$/ && (exists $prereq_pm->{requires}{$need_module} || exists $prereq_pm->{opt_requires} ) - && $nmo + && $nmo && !$inst_file ) { # continue installing as a prereq; this may be a @@ -3458,6 +3458,7 @@ sub test { # warn "XDEBUG: checking for notest: $self->{notest} $self"; my $make = $self->{modulebuild} ? "Build" : "make"; + local $ENV{PERL} = defined $ENV{PERL}? $ENV{PERL} : $^X; local $ENV{PERL5LIB} = defined($ENV{PERL5LIB}) ? $ENV{PERL5LIB} : ($ENV{PERLLIB} || ""); @@ -3881,6 +3882,7 @@ sub install { return; } + local $ENV{PERL} = defined $ENV{PERL}? $ENV{PERL} : $^X; my $system; if (my $commandline = $self->prefs->{install}{commandline}) { $system = $commandline; From c38cffb37e40d1bdd2b253171e6b43c271f3878c Mon Sep 17 00:00:00 2001 From: Rocky Bernstein Date: Mon, 4 Jul 2016 08:47:02 -0400 Subject: [PATCH 2/2] Pass -f Makefile in running plain "make" ExtUtils::MakeMaker writes a file called Makefile. Explicitly use that since GNU make can default to another name, e.g. GNUMakefile. Notes: * -f is in the POSIX spec for make. * This doesn't happen if a custom make command is used, or if Module::Build's "Build" script is run Also --- lib/CPAN/Distribution.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/CPAN/Distribution.pm b/lib/CPAN/Distribution.pm index e337e3757..8d06f8a3f 100644 --- a/lib/CPAN/Distribution.pm +++ b/lib/CPAN/Distribution.pm @@ -2102,7 +2102,7 @@ is part of the perl-%s distribution. To install that, you need to run return; } - my $make = $self->{modulebuild} ? "Build" : "make"; + my $make = $self->{modulebuild} ? "Build" : "make -f Makefile"; $CPAN::Frontend->myprint(sprintf "Running %s for %s\n", $make, $self->id); local $ENV{PERL5LIB} = defined($ENV{PERL5LIB}) ? $ENV{PERL5LIB} @@ -2162,7 +2162,13 @@ is part of the perl-%s distribution. To install that, you need to run } $system = join " ", $self->_build_command(), $CPAN::Config->{mbuild_arg}; } else { - $system = join " ", $self->_make_command(), $CPAN::Config->{make_arg}; + # ExtUtils::MakeMaker writes a file called Makefile. Explicitly use + # that since GNU make can default to another name, e.g. GNUMakefile. + # Note: -f is in the POSIX spec for make + my @make_args = -f "Makefile" ? + ($self->_make_command(), '-f', 'Makefile', $CPAN::Config->{make_arg}) : + ($self->_make_command(), $CPAN::Config->{make_arg}); + $system = join " ", @make_args; } $system =~ s/\s+$//; my $make_arg = $self->_make_phase_arg("make");