Skip to content

Commit 02c29f5

Browse files
committed
no remove ARGV so EUMM-gen-ed Makefile regen still has
1 parent baf1fd1 commit 02c29f5

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

Makefile.PL

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ else
5656
print "\nrun as `perl Makefile.PL help` to show user options\n";
5757
}
5858

59-
our $verbose = 0;
60-
# Get debugging flags
61-
if ( grep { if (m/^verbose/i) { $verbose++; 1; } else { 0; } } @ARGV ) {
62-
@ARGV = grep { !m/^verbose/i } @ARGV;
63-
}
59+
our $verbose = grep m/^verbose/i, @ARGV; # Get debugging flags
6460
print "\$verbose set to $verbose" . ($verbose ? "" : " - enable by running as `perl Makefile.PL verbose`");
6561
print "\n\n";
6662

@@ -74,7 +70,7 @@ our $IS_W32API = ($IS_CYGWIN && grep { m/^interface=(W32API|WGL)/i } @ARGV );
7470
print "Build platform \$IS_W32API==$IS_W32API\n" if $IS_W32API and $verbose;
7571

7672
our $INCS;
77-
our $NO_LGCC = grep /^NO_LGCC$/, @ARGV; @ARGV = grep !/^NO_LGCC$/, @ARGV;
73+
our $NO_LGCC = grep /^NO_LGCC$/, @ARGV;
7874

7975
my $prepare_success = eval {
8076
# Look for available libs
@@ -143,9 +139,7 @@ my $build_config =
143139
!defined($OPTS) ? () : (OPTIMIZE => $OPTS),
144140
};
145141

146-
print "MakeMaker configuration:\n DEFINE=$DEFS\n INC=$INCS\n LIBS=$LIBS\n\n" if $verbose;
147-
148-
close(CONF) if (open(CONF,">", "lib/OpenGL/Config.pm")); # empty Config.pm
142+
WriteConfigPM( $build_config ); # generate final Config.pm
149143
WriteMakefile(
150144
NAME => 'OpenGL',
151145
VERSION_FROM=> 'lib/OpenGL.pm',
@@ -191,7 +185,6 @@ WriteMakefile(
191185
%$build_config,
192186
INC => $INCS . ' -I'.curdir(),
193187
); # Generate the Makefile
194-
WriteConfigPM( $build_config ); # Regenerate final Config.pm
195188

196189
if ($found_libs->{GLX} && $ENV{TERM} !~ /^xterm/) {
197190
print "\nThis configuration should be built under an X11 shell\n\n";
@@ -476,8 +469,6 @@ sub get_interface_lib {
476469
if @interface_opts > 1;
477470
($interface_lib) = @interface_opts;
478471
print "User set interface to $interface_lib\n" if $verbose && !$fallback;
479-
# Strip out interface args
480-
@$argv_ref = grep { !m/^interface=/i } @$argv_ref;
481472
return $interface_lib;
482473
}
483474
# Otherwise use available defaults
@@ -650,8 +641,8 @@ sub get_defines {
650641
sub WriteConfigPM
651642
{
652643
my($config) = @_;
653-
die "Unable to write to Config.pm\n" if (!open(CONFIGPM, ">", "lib/OpenGL/Config.pm"));
654-
print CONFIGPM q
644+
die "Unable to write to Config.pm\n" if !open my $fh, ">", "lib/OpenGL/Config.pm";
645+
print $fh q
655646
{
656647
# This is the Perl OpenGL build configuration file.
657648
# It contains the final OpenGL build arguments from
@@ -664,11 +655,10 @@ sub WriteConfigPM
664655
require Data::Dumper;
665656
# Ensure deterministic output
666657
{ no warnings; $Data::Dumper::Sortkeys = 1; }
667-
print CONFIGPM Data::Dumper->Dump( [$config], [qw(OpenGL::Config)] );
668-
print CONFIGPM qq
658+
print $fh Data::Dumper->Dump( [$config], [qw(OpenGL::Config)] );
659+
print $fh qq
669660
{
670661
1;
671662
__END__
672663
};
673-
close(CONFIGPM);
674664
}

0 commit comments

Comments
 (0)