diff options
author | Michael G. Schwern <schwern@pobox.com> | 2003-04-06 19:09:17 -0700 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-04-07 18:23:29 +0000 |
commit | dedf98bc6289c70e2368bc395e2ec91fed11fc33 (patch) | |
tree | b31d1cf8442731d09afd0e2749a95f1551690091 | |
parent | 9ac5eb64d274bdbd879ebb568a13f392d2a50575 (diff) | |
download | perl-dedf98bc6289c70e2368bc395e2ec91fed11fc33.tar.gz |
Re: [PATCH] ExtUtils::MakeMaker 6.10_02
Message-ID: <20030407090917.GA9221@windhund.schwern.org>
p4raw-id: //depot/perl@19162
30 files changed, 480 insertions, 150 deletions
@@ -1114,6 +1114,7 @@ lib/ExtUtils/t/INST_PREFIX.t See if MakeMaker can apply PREFIXs lib/ExtUtils/t/Liblist.t See if ExtUtils::Liblist works lib/ExtUtils/t/Manifest.t See if ExtUtils::Manifest works lib/ExtUtils/t/Mkbootstrap.t See if ExtUtils::Mkbootstrap works +lib/ExtUtils/t/MM_Any.t See if ExtUtils::MM_Any works lib/ExtUtils/t/MM_BeOS.t See if ExtUtils::MM_BeOS works lib/ExtUtils/t/MM_Cygwin.t See if ExtUtils::MM_Cygwin works lib/ExtUtils/t/MM_NW5.t See if ExtUtils::MM_NW5 works diff --git a/lib/ExtUtils/Command.pm b/lib/ExtUtils/Command.pm index b06430d564..12e2b99ea5 100644 --- a/lib/ExtUtils/Command.pm +++ b/lib/ExtUtils/Command.pm @@ -11,7 +11,7 @@ require Exporter; use vars qw(@ISA @EXPORT $VERSION); @ISA = qw(Exporter); @EXPORT = qw(cp rm_f rm_rf mv cat eqtime mkpath touch test_f); -$VERSION = '1.04'; +$VERSION = '1.05'; my $Is_VMS = $^O eq 'VMS'; diff --git a/lib/ExtUtils/Command/MM.pm b/lib/ExtUtils/Command/MM.pm index 4aa37384ec..a597cc48a9 100644 --- a/lib/ExtUtils/Command/MM.pm +++ b/lib/ExtUtils/Command/MM.pm @@ -9,7 +9,7 @@ use vars qw($VERSION @ISA @EXPORT); @EXPORT = qw(test_harness pod2man perllocal_install uninstall warn_if_old_packlist); -$VERSION = '0.02'; +$VERSION = '0.03'; my $Is_VMS = $^O eq 'VMS'; diff --git a/lib/ExtUtils/Install.pm b/lib/ExtUtils/Install.pm index 757679a6d9..5763f1bb97 100644 --- a/lib/ExtUtils/Install.pm +++ b/lib/ExtUtils/Install.pm @@ -2,7 +2,7 @@ package ExtUtils::Install; use 5.00503; use vars qw(@ISA @EXPORT $VERSION); -$VERSION = 1.31; +$VERSION = 1.32; use Exporter; use Carp (); @@ -425,7 +425,10 @@ sub pm_to_blib { mkpath($autodir,0,0755); while(my($from, $to) = each %$fromto) { - next if -f $to && -M $to < -M $from; + if( -f $to && -s $from == -s $to && -M $to < -M $from ) { + print "Skip $to (unchanged)\n"; + next; + } # When a pm_filter is defined, we need to pre-process the source first # to determine whether it has changed or not. Therefore, only perform diff --git a/lib/ExtUtils/Installed.pm b/lib/ExtUtils/Installed.pm index 1375a8299f..72bbb53365 100644 --- a/lib/ExtUtils/Installed.pm +++ b/lib/ExtUtils/Installed.pm @@ -9,18 +9,20 @@ use Config; use File::Find; use File::Basename; use File::Spec; -require VMS::Filespec if $^O eq 'VMS'; - -use vars qw($VERSION); -$VERSION = '0.06'; +my $Is_VMS = $^O eq 'VMS'; my $DOSISH = ($^O =~ /^(MSWin\d\d|os2|dos|mint)$/); +require VMS::Filespec if $Is_VMS; + +use vars qw($VERSION); +$VERSION = '0.07'; + sub _is_prefix { my ($self, $path, $prefix) = @_; return unless defined $prefix && defined $path; - if( $^O eq 'VMS' ) { + if( $Is_VMS ) { $prefix = VMS::Filespec::unixify($prefix); $path = VMS::Filespec::unixify($path); } @@ -78,7 +80,7 @@ sub new { my $sitearch = $Config{sitearchexp}; # File::Find does not know how to deal with VMS filepaths. - if( $^O eq 'VMS' ) { + if( $Is_VMS ) { $archlib = VMS::Filespec::unixify($archlib); $sitearch = VMS::Filespec::unixify($sitearch); } @@ -96,7 +98,7 @@ sub new { # Read the module packlists my $sub = sub { # Only process module .packlists - return if ($_) ne ".packlist" || $File::Find::dir eq $archlib; + return if $_ ne ".packlist" || $File::Find::dir eq $archlib; # Hack of the leading bits of the paths & convert to a module name my $module = $File::Find::name; @@ -110,7 +112,9 @@ sub new { $self->{$module}{version} = ''; foreach my $dir (@INC) { my $p = File::Spec->catfile($dir, $modfile); - if (-f $p) { + if (-r $p) { + $module = _module_name($p, $module) if $Is_VMS; + require ExtUtils::MM; $self->{$module}{version} = MM->parse_version($p); last; @@ -128,6 +132,36 @@ sub new { return(bless($self, $class)); } +# VMS's non-case preserving file-system means the package name can't +# be reconstructed from the filename. +sub _module_name { + my($file, $orig_module) = @_; + + my $module = ''; + if (open PACKFH, $file) { + while (<PACKFH>) { + if (/package\s+(\S+)\s*;/) { + my $pack = $1; + # Make a sanity check, that lower case $module + # is identical to lowercase $pack before + # accepting it + if (lc($pack) eq lc($orig_module)) { + $module = $pack; + last; + } + } + } + close PACKFH; + } + + print STDERR "Couldn't figure out the package name for $file\n" + unless $module; + + return $module; +} + + + sub modules { my ($self) = @_; diff --git a/lib/ExtUtils/Liblist.pm b/lib/ExtUtils/Liblist.pm index 8604f828e7..4b098083d9 100644 --- a/lib/ExtUtils/Liblist.pm +++ b/lib/ExtUtils/Liblist.pm @@ -1,7 +1,7 @@ package ExtUtils::Liblist; use vars qw($VERSION); -$VERSION = '1.00'; +$VERSION = '1.01'; use File::Spec; require ExtUtils::Liblist::Kid; diff --git a/lib/ExtUtils/Liblist/Kid.pm b/lib/ExtUtils/Liblist/Kid.pm index d17eb87491..9030eda00f 100644 --- a/lib/ExtUtils/Liblist/Kid.pm +++ b/lib/ExtUtils/Liblist/Kid.pm @@ -9,7 +9,7 @@ use 5.00503; # Broken out of MakeMaker from version 4.11 use vars qw($VERSION); -$VERSION = 1.29; +$VERSION = 1.30; use Config; use Cwd 'cwd'; diff --git a/lib/ExtUtils/MM_Any.pm b/lib/ExtUtils/MM_Any.pm index 20c6bd6215..c0ffb2fe5e 100644 --- a/lib/ExtUtils/MM_Any.pm +++ b/lib/ExtUtils/MM_Any.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_Any; use strict; use vars qw($VERSION @ISA); -$VERSION = 0.04; +$VERSION = 0.05; @ISA = qw(File::Spec); use Config; @@ -42,6 +42,34 @@ B<THIS MAY BE TEMPORARY!> These are methods which are by their nature cross-platform and should always be cross-platform. +=over 4 + +=item os_flavor_is + + $mm->os_flavor_is($this_flavor); + $mm->os_flavor_is(@one_of_these_flavors); + +Checks to see if the current operating system is one of the given flavors. + +This is useful for code like: + + if( $mm->os_flavor_is('Unix') ) { + $out = `foo 2>&1`; + } + else { + $out = `foo`; + } + +=cut + +sub os_flavor_is { + my $self = shift; + my %flavors = map { ($_ => 1) } $self->os_flavor; + return (grep { $flavors{$_} } @_) ? 1 : 0; +} + +=back + =head2 File::Spec wrappers ExtUtils::MM_Any is a subclass of File::Spec. The methods noted here @@ -213,7 +241,7 @@ Called by init_main. sub init_VERSION { my($self) = shift; - $self->{MAKEMAKER} = $INC{'ExtUtils/MakeMaker.pm'}; + $self->{MAKEMAKER} = $ExtUtils::MakeMaker::Filename; $self->{MM_VERSION} = $ExtUtils::MakeMaker::VERSION; $self->{MM_REVISION}= $ExtUtils::MakeMaker::Revision; $self->{VERSION_FROM} ||= ''; @@ -333,6 +361,7 @@ END CMD } + $manify .= "\t\$(NOECHO) \$(NOOP)\n" unless @man_cmds; $manify .= join '', map { "$_\n" } @man_cmds; return $manify; @@ -665,8 +694,8 @@ Defines at least these macros. Macro Description - NOOP - NOECHO + NOOP Do nothing + NOECHO Tell make not to display the command itself MAKEFILE FIRST_MAKEFILE @@ -676,6 +705,7 @@ Defines at least these macros. SHELL Program used to run shell commands + ECHO Print text adding a newline on the end RM_F Remove a file RM_RF Remove a directory TOUCH Update a file's timestamp @@ -755,6 +785,29 @@ sub platform_constants { return ''; } +=item os_flavor + + my @os_flavor = $mm->os_flavor; + +@os_flavor is the style of operating system this is, usually +corresponding to the MM_*.pm file we're using. + +The first element of @os_flavor is the major family (ie. Unix, +Windows, VMS, OS/2, MacOS, etc...) and the rest are sub families. + +Some examples: + + Cygwin98 ('Unix', 'Cygwin', 'Cygwin9x') + Windows NT ('Win32', 'WinNT') + Win98 ('Win32', 'Win9x') + Linux ('Unix', 'Linux') + MacOS Classic ('MacOS', 'MacOS Classic') + MacOS X ('Unix', 'Darwin', 'MacOS', 'MacOS X') + OS/2 ('OS/2') + +This is used to write code for styles of operating system. +See os_flavor_is() for use. + =back diff --git a/lib/ExtUtils/MM_BeOS.pm b/lib/ExtUtils/MM_BeOS.pm index 4f4a3e5dbb..e0b3390b0f 100644 --- a/lib/ExtUtils/MM_BeOS.pm +++ b/lib/ExtUtils/MM_BeOS.pm @@ -25,9 +25,19 @@ require ExtUtils::MM_Unix; use vars qw(@ISA $VERSION); @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -$VERSION = 1.03; +$VERSION = 1.04; +=item os_flavor (o) + +BeOS is BeOS. + +=cut + +sub os_flavor { + return('BeOS'); +} + =item init_linker libperl.a equivalent to be linked to dynamic extensions. diff --git a/lib/ExtUtils/MM_Cygwin.pm b/lib/ExtUtils/MM_Cygwin.pm index 120e1bb6a6..4529895fa0 100644 --- a/lib/ExtUtils/MM_Cygwin.pm +++ b/lib/ExtUtils/MM_Cygwin.pm @@ -10,7 +10,7 @@ require ExtUtils::MM_Any; require ExtUtils::MM_Unix; @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -$VERSION = 1.05; +$VERSION = 1.06; =head1 NAME @@ -27,6 +27,16 @@ See ExtUtils::MM_Unix for a documentation of the methods provided there. =over 4 +=item os_flavor (o) + +We're Unix and Cygwin. + +=cut + +sub os_flavor { + return('Unix', 'Cygwin'); +} + =item cflags (o) if configured for dynamic loading, triggers #define EXT in EXTERN.h diff --git a/lib/ExtUtils/MM_DOS.pm b/lib/ExtUtils/MM_DOS.pm index 93e01f2268..b985d00ca6 100644 --- a/lib/ExtUtils/MM_DOS.pm +++ b/lib/ExtUtils/MM_DOS.pm @@ -3,7 +3,7 @@ package ExtUtils::MM_DOS; use strict; use vars qw($VERSION @ISA); -$VERSION = 0.01; +$VERSION = 0.02; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; @@ -30,6 +30,14 @@ Unless otherwise stated, it works just like ExtUtils::MM_Unix =over 4 +=item os_flavor + +=cut + +sub os_flavor { + return('DOS'); +} + =item B<replace_manpage_separator> Generates Foo__Bar.3 style man page names diff --git a/lib/ExtUtils/MM_MacOS.pm b/lib/ExtUtils/MM_MacOS.pm index a83e37f9eb..4c43d2461e 100644 --- a/lib/ExtUtils/MM_MacOS.pm +++ b/lib/ExtUtils/MM_MacOS.pm @@ -12,7 +12,7 @@ require ExtUtils::MM_Unix; @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); use vars qw($VERSION); -$VERSION = '1.04'; +$VERSION = '1.05'; use Config; use Cwd 'cwd'; @@ -932,6 +932,16 @@ sub _include { # for Unix-style includes, with -I instead of -i } } +=item os_flavor + +MacOS Classic is MacOS and MacOS Classic. + +=cut + +sub os_flavor { + return('MacOS', 'MacOS Classic'); +} + =back =cut diff --git a/lib/ExtUtils/MM_NW5.pm b/lib/ExtUtils/MM_NW5.pm index 40c482386e..82c2d66dbc 100644 --- a/lib/ExtUtils/MM_NW5.pm +++ b/lib/ExtUtils/MM_NW5.pm @@ -23,7 +23,7 @@ use Config; use File::Basename; use vars qw(@ISA $VERSION); -$VERSION = '2.05'; +$VERSION = '2.06'; require ExtUtils::MM_Win32; @ISA = qw(ExtUtils::MM_Win32); @@ -37,6 +37,17 @@ my $GCC = 1 if $Config{'cc'} =~ /^gcc/i; my $DMAKE = 1 if $Config{'make'} =~ /^dmake/i; +=item os_flavor + +We're Netware in addition to being Windows. + +=cut + +sub os_flavor { + my $self = shift; + return ($self->SUPER::os_flavor, 'Netware'); +} + =item init_platform (o) Add Netware macros. diff --git a/lib/ExtUtils/MM_OS2.pm b/lib/ExtUtils/MM_OS2.pm index 47ecba86c9..656daa57ef 100644 --- a/lib/ExtUtils/MM_OS2.pm +++ b/lib/ExtUtils/MM_OS2.pm @@ -6,7 +6,7 @@ use vars qw($VERSION @ISA); use ExtUtils::MakeMaker qw(neatvalue); use File::Spec; -$VERSION = '1.03'; +$VERSION = '1.04'; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; @@ -42,7 +42,7 @@ sub init_dist { my($self) = @_; $self->{TO_UNIX} ||= <<'MAKE_TEXT'; -$(NOECHO) $(TEST_F) tmp.zip && $(RM) tmp.zip; $(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM) tmp.zip +$(NOECHO) $(TEST_F) tmp.zip && $(RM_F) tmp.zip; $(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM_F) tmp.zip MAKE_TEXT $self->SUPER::init_dist; @@ -136,6 +136,16 @@ sub init_linker { $self->{EXPORT_LIST} = '$(BASEEXT).def'; } +=item os_flavor + +OS/2 is OS/2 + +=cut + +sub os_flavor { + return('OS/2'); +} + =back =cut diff --git a/lib/ExtUtils/MM_UWIN.pm b/lib/ExtUtils/MM_UWIN.pm index 2bfddcf9a0..1667d552c8 100644 --- a/lib/ExtUtils/MM_UWIN.pm +++ b/lib/ExtUtils/MM_UWIN.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_UWIN; use strict; use vars qw($VERSION @ISA); -$VERSION = 0.01; +$VERSION = 0.02; require ExtUtils::MM_Unix; @ISA = qw(ExtUtils::MM_Unix); @@ -28,6 +28,17 @@ Unless otherwise stated it works just like ExtUtils::MM_Unix =over 4 +=item os_flavor + +In addition to being Unix, we're U/WIN. + +=cut + +sub os_flavor { + return('Unix', 'U/WIN'); +} + + =item B<replace_manpage_separator> =cut diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index 87d93bf9ad..6799836148 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -20,7 +20,7 @@ use vars qw($VERSION @ISA use ExtUtils::MakeMaker qw($Verbose neatvalue); -$VERSION = '1.35'; +$VERSION = '1.36'; require ExtUtils::MM_Any; @ISA = qw(ExtUtils::MM_Any); @@ -97,6 +97,17 @@ my $Updir = __PACKAGE__->updir; =over 4 +=item os_flavor (o) + +Simply says that we're Unix. + +=cut + +sub os_flavor { + return('Unix'); +} + + =item c_o (o) Defines the suffix rules to compile different flavors of C files to @@ -1059,12 +1070,14 @@ sub dynamic_lib { $armaybe = 'ar' if ($Is_OSF and $armaybe eq ':'); my(@m); my $ld_opt = $Is_OS2 ? '$(OPTIMIZE) ' : ''; # Useful on other systems too? + my $ld_fix = $Is_OS2 ? '|| ( $(RM_F) $@ && sh -c false )' : ''; push(@m,' # This section creates the dynamically loadable $(INST_DYNAMIC) # from $(OBJECT) and possibly $(MYEXTLIB). ARMAYBE = '.$armaybe.' OTHERLDFLAGS = '.$ld_opt.$otherldflags.' INST_DYNAMIC_DEP = '.$inst_dynamic_dep.' +INST_DYNAMIC_FIX = '.$ld_fix.' $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP) '); @@ -1105,7 +1118,7 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILE push(@m, ' LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) '.$ldrun.' $(LDDLFLAGS) '.$ldfrom. -' $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) $(PERL_ARCHIVE) '.$libs.' $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST)'); +' $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) $(PERL_ARCHIVE) '.$libs.' $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) $(INST_DYNAMIC_FIX)'); push @m, ' $(CHMOD) $(PERM_RWX) $@ '; @@ -1237,6 +1250,9 @@ sub fixin { # stolen from the pink Camel book, more or less my($does_shbang) = $Config{'sharpbang'} =~ /^\s*\#\!/; for my $file (@files) { + my $file_new = "$file.new"; + my $file_bak = "$file.bak"; + local(*FIXIN); local(*FIXOUT); open(FIXIN, $file) or croak "Can't process '$file': $!"; @@ -1288,7 +1304,7 @@ eval 'exec $interpreter $arg -S \$0 \${1+"\$\@"}' next; } - unless ( open(FIXOUT,">$file.new") ) { + unless ( open(FIXOUT,">$file_new") ) { warn "Can't create new $file: $!\n"; next; } @@ -1301,19 +1317,21 @@ eval 'exec $interpreter $arg -S \$0 \${1+"\$\@"}' close FIXIN; close FIXOUT; - unless ( rename($file, "$file.bak") ) { - warn "Can't rename $file to $file.bak: $!"; + chmod 0666, $file_bak; + unlink $file_bak; + unless ( rename($file, $file_bak) ) { + warn "Can't rename $file to $file_bak: $!"; next; } - unless ( rename("$file.new", $file) ) { - warn "Can't rename $file.new to $file: $!"; - unless ( rename("$file.bak", $file) ) { - warn "Can't rename $file.bak back to $file either: $!"; - warn "Leaving $file renamed as $file.bak\n"; + unless ( rename($file_new, $file) ) { + warn "Can't rename $file_new to $file: $!"; + unless ( rename($file_bak, $file) ) { + warn "Can't rename $file_bak back to $file either: $!"; + warn "Leaving $file renamed as $file_bak\n"; } next; } - unlink "$file.bak"; + unlink $file_bak; } continue { close(FIXIN) if fileno(FIXIN); system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';; @@ -2901,7 +2919,7 @@ $(OBJECT) : $(FIRST_MAKEFILE) push @m, q{ # We take a very conservative approach here, but it\'s worth it. # We move Makefile to Makefile.old here to avoid gnu make looping. -$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP) $(VERSION_FROM) +$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP) $(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?" $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..." $(NOECHO) $(RM_F) $(MAKEFILE_OLD) @@ -3892,7 +3910,8 @@ sub tool_xsubpp { } } - my(@tmdeps) = $self->catdir('$(XSUBPPDIR)','typemap'); + my $tmdir = File::Spec->catdir($self->{PERL_LIB},"ExtUtils"); + my(@tmdeps) = $self->catfile($tmdir,'typemap'); if( $self->{TYPEMAPS} ){ my $typemap; foreach $typemap (@{$self->{TYPEMAPS}}){ @@ -3927,11 +3946,9 @@ sub tool_xsubpp { } } - my $xsubpp = "xsubpp"; - return qq{ XSUBPPDIR = $xsdir -XSUBPP = \$(XSUBPPDIR)/$xsubpp +XSUBPP = \$(XSUBPPDIR)/xsubpp XSPROTOARG = $self->{XSPROTOARG} XSUBPPDEPS = @tmdeps \$(XSUBPP) XSUBPPARGS = @tmargs diff --git a/lib/ExtUtils/MM_VMS.pm b/lib/ExtUtils/MM_VMS.pm index 422f864761..39e2c652bd 100644 --- a/lib/ExtUtils/MM_VMS.pm +++ b/lib/ExtUtils/MM_VMS.pm @@ -20,8 +20,8 @@ BEGIN { use File::Basename; use vars qw($Revision @ISA $VERSION); -($VERSION) = '5.66'; -($Revision = substr(q$Revision: 1.82 $, 10)) =~ s/\s+$//; +($VERSION) = '5.67'; +($Revision = substr(q$Revision: 1.89 $, 10)) =~ s/\s+$//; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; @@ -707,11 +707,17 @@ Use VMS-style quoting on xsubpp command line. sub tool_xsubpp { my($self) = @_; return '' unless $self->needs_linking; - my($xsdir) = $self->catdir($self->{PERL_LIB},'ExtUtils'); - # drop back to old location if xsubpp is not in new location yet - $xsdir = $self->catdir($self->{PERL_SRC},'ext') - unless (-f $self->catfile($xsdir,'xsubpp')); - my(@tmdeps) = '$(XSUBPPDIR)typemap'; + + my $xsdir; + foreach my $dir (@INC) { + $xsdir = $self->catdir($dir, 'ExtUtils'); + if( -r $self->catfile($xsdir, "xsubpp") ) { + last; + } + } + + my $tmdir = File::Spec->catdir($self->{PERL_LIB},"ExtUtils"); + my(@tmdeps) = $self->catfile($tmdir,'typemap'); if( $self->{TYPEMAPS} ){ my $typemap; foreach $typemap (@{$self->{TYPEMAPS}}){ @@ -840,7 +846,7 @@ sub tools_other { # than just typing the literal string. my $extra_tools = <<'EXTRA_TOOLS'; -# Assumes \$(MMS) invokes MMS or MMK +# Assumes $(MMS) invokes MMS or MMK # (It is assumed in some cases later that the default makefile name # (Descrip.MMS for MM[SK]) is used.) USEMAKEFILE = /Descrip= @@ -848,7 +854,7 @@ USEMACROS = /Macro=( MACROEND = ) # Just in case anyone is using the old macro. -SAY = $ECHO +SAY = $(ECHO) EXTRA_TOOLS @@ -2161,8 +2167,8 @@ sub oneliner { =item B<echo> (o) -perl trips up on "<foo>" thinking its an input redirect. So we use the -native Write sys$output instead. +perl trips up on "<foo>" thinking it's an input redirect. So we use the +native Write command instead. Besides, its faster. =cut @@ -2170,12 +2176,12 @@ sub echo { my($self, $text, $file, $appending) = @_; $appending ||= 0; - die "The VMS version of echo() cannot currently append" if $appending; + my $opencmd = $appending ? 'Open/Append' : 'Open/Write'; - my @cmds = ("\$(NOECHO) Assign $file Sys\$Output"); - push @cmds, map { '$(NOECHO) Write Sys$Output '.$self->quote_literal($_) } + my @cmds = ("\$(NOECHO) $opencmd MMECHOFILE $file "); + push @cmds, map { '$(NOECHO) Write MMECHOFILE '.$self->quote_literal($_) } split /\n/, $text; - push @cmds, '$(NOECHO) Deassign Sys$Output'; + push @cmds, '$(NOECHO) Close MMECHOFILE'; return @cmds; } @@ -2226,7 +2232,7 @@ sub init_linker { $self->{EXPORT_LIST} ||= '$(BASEEXT).opt'; my $shr = $Config{dbgprefix} . 'PERLSHR'; - $self->{PERL_ARCHIVE} ||= $self->catfile($self->{PERL_SRC},"$shr.$Config{'dlext'}"); + $self->{PERL_ARCHIVE} ||= $self->catfile($self->{PERL_SRC}, "$shr.$Config{'dlext'}"); $self->{PERL_ARCHIVE_AFTER} ||= ''; } @@ -2237,7 +2243,7 @@ Expands MM[KS]/Make macros in a text string, using the contents of identically named elements of C<%$self>, and returns the result as a file specification in Unix syntax. -NOTE: This is the cannonical version of the method. The version in +NOTE: This is the canonical version of the method. The version in File::Spec::VMS is deprecated. =cut @@ -2295,7 +2301,7 @@ is a VMS-syntax file specification, and if it is not specified, fixpath() checks to see whether it matches the name of a directory in the current default directory, and returns a directory or file specification accordingly. -NOTE: This is the cannonical version of the method. The version in +NOTE: This is the canonical version of the method. The version in File::Spec::VMS is deprecated. =cut @@ -2348,6 +2354,16 @@ sub fixpath { } +=item os_flavor + +VMS is VMS. + +=cut + +sub os_flavor { + return('VMS'); +} + =back =cut diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index da1440feea..fef876754a 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -29,7 +29,7 @@ use vars qw(@ISA $VERSION $BORLAND $GCC $DMAKE $NMAKE); require ExtUtils::MM_Any; require ExtUtils::MM_Unix; @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -$VERSION = '1.06'; +$VERSION = '1.07'; $ENV{EMXSHELL} = 'sh'; # to run `commands` @@ -144,8 +144,10 @@ Using \ for Windows. sub init_DIRFILESEP { my($self) = shift; - # gotta be careful this isn't interpreted as an escape. - $self->{DIRFILESEP} = '^\\'; + # The ^ makes sure its not interpreted as an escape in nmake + $self->{DIRFILESEP} = $NMAKE ? '^\\' : + $DMAKE ? '\\\\' + : '\\'; } =item B<init_others> @@ -166,7 +168,8 @@ sub init_others { my ($self) = @_; # Used in favor of echo because echo won't strip quotes. :( - $self->{ECHO} ||= '$(PERLRUN) -le "print qq{@ARGV}"'; + $self->{ECHO} ||= $self->oneliner('print qq{@ARGV}', ['-l']); + $self->{TOUCH} ||= '$(PERLRUN) -MExtUtils::Command -e touch'; $self->{CHMOD} ||= '$(PERLRUN) -MExtUtils::Command -e chmod'; $self->{CP} ||= '$(PERLRUN) -MExtUtils::Command -e cp'; @@ -183,6 +186,9 @@ sub init_others { $self->SUPER::init_others; + # Setting SHELL from $Config{sh} can break dmake. Its ok without it. + delete $self->{SHELL}; + $self->{LDLOADLIBS} ||= $Config{libs}; # -Lfoo must come first for Borland, so we put it in LDDLFLAGS if ($BORLAND) { @@ -458,6 +464,15 @@ sub quote_literal { # Win98's command.com $text =~ s{"}{\\"}g; + # dmake eats '{' inside double quotes and leaves alone { outside double + # quotes; however it transforms {{ into { either inside and outside double + # quotes. It also translates }} into }. The escaping below is not + # 100% correct. + if( $DMAKE ) { + $text =~ s/{/{{/g; + $text =~ s/}}/}}}/g; + } + return qq{"$text"}; } @@ -485,6 +500,17 @@ sub max_exec_len { } +=item os_flavor + +Windows is Win32. + +=cut + +sub os_flavor { + return('Win32'); +} + + 1; __END__ diff --git a/lib/ExtUtils/MM_Win95.pm b/lib/ExtUtils/MM_Win95.pm index 1854d5d953..47aef7f16b 100644 --- a/lib/ExtUtils/MM_Win95.pm +++ b/lib/ExtUtils/MM_Win95.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_Win95; use vars qw($VERSION @ISA); -$VERSION = 0.02; +$VERSION = 0.03; require ExtUtils::MM_Win32; @ISA = qw(ExtUtils::MM_Win32); @@ -204,6 +204,19 @@ sub max_exec_len { return $self->{_MAX_EXEC_LEN} ||= 2500; } + +=item os_flavor + +Win95 and Win98 and WinME are collectively Win9x and Win32 + +=cut + +sub os_flavor { + my $self = shift; + return ($self->SUPER::os_flavor, 'Win9x'); +} + + =back diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index 87a388ada3..67fb3e7792 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -2,21 +2,20 @@ package ExtUtils::MakeMaker; BEGIN {require 5.005_03;} -$VERSION = "6.03"; -$Version_OK = "5.49"; # Makefiles older than $Version_OK will die - # (Will be checked from MakeMaker version 4.13 onwards) -($Revision = substr(q$Revision: 1.63 $, 10)) =~ s/\s+$//; +$VERSION = '6.10_02'; +($Revision = substr(q$Revision: 1.108 $, 10)) =~ s/\s+$//; require Exporter; use Config; use Carp (); +use File::Path; use vars qw( @ISA @EXPORT @EXPORT_OK - $ISA_TTY $Revision $VERSION $Verbose $Version_OK %Config - %Keep_after_flush %MM_Sections @Prepend_parent + $Revision $VERSION $Verbose %Config + @Prepend_parent @Parent %Recognized_Att_Keys @Get_from_Config @MM_Sections @Overridable - @Parent $PACKNAME + $Filename ); use strict; @@ -29,6 +28,10 @@ use strict; my $Is_VMS = $^O eq 'VMS'; my $Is_Win32 = $^O eq 'MSWin32'; +# Our filename for diagnostic and debugging purposes. More reliable +# than %INC (think caseless filesystems) +$Filename = __FILE__; + full_setup(); require ExtUtils::MM; # Things like CPAN assume loading ExtUtils::MakeMaker @@ -604,12 +607,12 @@ sub WriteEmptyMakefile { my %att = @_; my $self = MM->new(\%att); if (-f $self->{MAKEFILE_OLD}) { - chmod 0666, $self->{MAKEFILE_OLD}; - unlink $self->{MAKEFILE_OLD} or warn "unlink $self->{MAKEFILE_OLD}: $!"; + _unlink($self->{MAKEFILE_OLD}) or + warn "unlink $self->{MAKEFILE_OLD}: $!"; } if ( -f $self->{MAKEFILE} ) { - _rename($self->{MAKEFILE}, $self->{MAKEFILE_OLD}) - or warn "rename $self->{MAKEFILE} => $self->{MAKEFILE_OLD}: $!" + _rename($self->{MAKEFILE}, $self->{MAKEFILE_OLD}) or + warn "rename $self->{MAKEFILE} => $self->{MAKEFILE_OLD}: $!" } open MF, '>'.$self->{MAKEFILE} or die "open $self->{MAKEFILE} for write: $!"; print MF <<'EOP'; @@ -885,6 +888,13 @@ sub _rename { return rename $src, $dest; } +# This is an unlink for OS's where the target must be writable first. +sub _unlink { + my @files = @_; + chmod 0666, @files; + return unlink @files; +} + # The following mkbootstrap() is only for installations that are calling # the pre-4.1 mkbootstrap() from their old Makefiles. This MakeMaker @@ -2006,7 +2016,7 @@ MakeMaker object. The following lines will be parsed o.k.: $VERSION = '1.00'; *VERSION = \'1.01'; - ( $VERSION ) = '$Revision: 1.63 $ ' =~ /\$Revision:\s+([^\s]+)/; + ( $VERSION ) = '$Revision: 1.108 $ ' =~ /\$Revision:\s+([^\s]+)/; $FOO::VERSION = '1.10'; *FOO::VERSION = \'1.11'; our $VERSION = 1.2.3; # new for perl5.6.0 diff --git a/lib/ExtUtils/MakeMaker/FAQ.pod b/lib/ExtUtils/MakeMaker/FAQ.pod index 6d7ba70202..3e0489de33 100644 --- a/lib/ExtUtils/MakeMaker/FAQ.pod +++ b/lib/ExtUtils/MakeMaker/FAQ.pod @@ -61,6 +61,21 @@ MakeMaker. =over 4 +=item How to I prevent "object version X.XX does not match bootstrap parameter Y.YY" errors? + +XS code is very sensitive to the module version number and will +complain if the version number in your Perl module doesn't match. If +you change your module's version # without reruning Makefile.PL the old +version number will remain in the Makefile causing the XS code to be built +with the wrong number. + +To avoid this, you can force the Makefile to be rebuilt whenever you +change the module containing the version number by adding this to your +WriteMakefile() arguments. + + depend => { '$(FIRST_MAKEFILE)' => '$(VERSION_FROM)' } + + =item How do I make two or more XS files coexist in the same directory? Sometimes you need to have two and more XS files in the same package. diff --git a/lib/ExtUtils/Manifest.pm b/lib/ExtUtils/Manifest.pm index df4cb9e0eb..6f8ce1240e 100644 --- a/lib/ExtUtils/Manifest.pm +++ b/lib/ExtUtils/Manifest.pm @@ -12,7 +12,7 @@ use vars qw($VERSION @ISA @EXPORT_OK $Is_MacOS $Is_VMS $Debug $Verbose $Quiet $MANIFEST $DEFAULT_MSKIP); -$VERSION = 1.38; +$VERSION = 1.39; @ISA=('Exporter'); @EXPORT_OK = qw(mkmanifest manicheck filecheck fullcheck skipcheck @@ -29,9 +29,8 @@ $Verbose = defined $ENV{PERL_MM_MANIFEST_VERBOSE} ? $Quiet = 0; $MANIFEST = 'MANIFEST'; -my $manifest_mod = $INC{"ExtUtils/Manifest.pm"} || - ($Is_VMS ? $INC{'extutils/manifest.pm'} : ''); -$DEFAULT_MSKIP = (File::Spec->splitpath($manifest_mod))[1]. +my $Filename = __FILE__; +$DEFAULT_MSKIP = (File::Spec->splitpath($Filename))[1]. "$MANIFEST.SKIP"; @@ -86,6 +85,10 @@ that are found in the existing F<MANIFEST> file in the new one. =cut +sub _sort { + return sort { lc $a cmp lc $b } @_; +} + sub mkmanifest { my $manimiss = 0; my $read = (-r 'MANIFEST' && maniread()) or $manimiss++; @@ -99,7 +102,7 @@ sub mkmanifest { %all = (%$found, %$read); $all{$MANIFEST} = ($Is_VMS ? "$MANIFEST\t\t" : '') . 'This list of files' if $manimiss; # add new MANIFEST to known file list - foreach $file (sort keys %all) { + foreach $file (_sort keys %all) { if ($skip->($file)) { # Policy: only remove files if they're listed in MANIFEST.SKIP. # Don't remove files just because they don't exist. @@ -231,7 +234,7 @@ sub skipcheck { my $matches = _maniskip(); my @skipped = (); - foreach my $file (sort keys %$found){ + foreach my $file (_sort keys %$found){ if (&$matches($file)){ warn "Skipping $file\n"; push @skipped, $file; @@ -250,7 +253,7 @@ sub _check_files { my $found = manifind($p); my(@missfile) = (); - foreach my $file (sort keys %$read){ + foreach my $file (_sort keys %$read){ warn "Debug: manicheck checking from $MANIFEST $file\n" if $Debug; if ($dosnames){ $file = lc $file; @@ -274,7 +277,7 @@ sub _check_manifest { my $skip = _maniskip(); my @missentry = (); - foreach my $file (sort keys %$found){ + foreach my $file (_sort keys %$found){ next if $skip->($file); warn "Debug: manicheck checking from disk $file\n" if $Debug; unless ( exists $read->{$file} ) { @@ -534,8 +537,8 @@ sub maniadd { my $manifest = maniread(); open(MANIFEST, ">>$MANIFEST") or die "Could not open $MANIFEST: $!"; - while( my($file, $comment) = each %$additions ) { - $comment ||= ''; + foreach my $file (_sort keys %$additions) { + my $comment = $additions->{$file} || ''; printf MANIFEST "%-40s%s\n", $file, $comment unless exists $manifest->{$file}; } diff --git a/lib/ExtUtils/PATCHING b/lib/ExtUtils/PATCHING index 2170be2fa7..fec5c42495 100644 --- a/lib/ExtUtils/PATCHING +++ b/lib/ExtUtils/PATCHING @@ -10,6 +10,29 @@ avoid new features. If you want to add something to MakeMaker, consider instead working on Module::Build, MakeMaker's heir apparent. +Reporting bugs + +- Often the only information we have for fixing a bug is contained in your + report. So... + +- Please report your bugs via http://rt.cpan.org or by mailing to + makemaker@perl.org. RT is preferred. + +- Please report your bug immediately upon encountering it. Do not wait + until you have a patch to fix the bug. Patches are good, but not at + the expense of timely bug reports. + +- Please be as verbose as possible. Include the complete output of + your 'make test' or even 'make test TEST_VERBOSE=1' and a copy of the + generated Makefile. Err on the side of verbosity. The more data we + have to work with, the faster we can diagnose the problem. + +- If you find an undocumented feature, or if a feature has changed/been + added which causes a problem, report it. Do not assume it was done + deliberately. Even if it was done deliberately, we still want to hear + if it caused problems. + + Patching details - Please use unified diffs. (diff -u) @@ -109,12 +132,10 @@ Cross-Platform Compatibility creating one. Its ok to have an MM_* module with only one method. - Some shells have very small buffers. This means command lines must - be as small as possible. 20K is the upper limit for Unixen, and 256 - for VMS. Not sure what Windows and DOS are limited to, probably 1K. - This limit *includes* any files passed into it. Some modules (such as - bioperl) generate enourmous commands because of their large number of - files. If your command is just too long, consider making it an - ExtUtils::Command::MM function. + be as small as possible. If your command is just too long, consider + making it an ExtUtils::Command::MM function. If your command might + receive many arguments (such as pod2man or pm_to_blib) consider + using split_command() to split it into several, shorter calls. - Most shells quote differently. If you need to put a perl one-liner in the Makefile, please use oneliner() to generate it. diff --git a/lib/ExtUtils/README b/lib/ExtUtils/README index 95f66e9cb3..eda94c0585 100644 --- a/lib/ExtUtils/README +++ b/lib/ExtUtils/README @@ -14,13 +14,10 @@ Known Problems: ActivePerl likely broken if installed in C:\Program Files or other prefix with a space in the name. -manifypods target produces command lines too long for some systems - Using the MMS utility on VMS causes lots of extra newlines. Unknown why this is so, might be a bug in MMS. Problem not seen with MMK. -ActivePerl/Win95 disttest produces "File creation error" from somewhere -in running Makefile.PL after check_manifest() is run. Don't know why. +MacOS Classic is likely broken. See TODO for details. diff --git a/lib/ExtUtils/TODO b/lib/ExtUtils/TODO index 342ce9e2f7..42734c0893 100644 --- a/lib/ExtUtils/TODO +++ b/lib/ExtUtils/TODO @@ -30,20 +30,26 @@ Unify VMS->find_perl Consider if VMS->find_perl needs to have pieces put into maybe_command() -Consider if shell escaping all macro data is a good idea. - -Move Win32->init_others() ExtUtils::Command overrides into MM_Any. +Add a MM_Any->init_others() using ExtUtils::Command. Figure out and document the 4th arg to ExtUtils::Install::install() Consider if adding a nativize() routine to replace macify() and fixpath() is useful. -Eliminate the above from inside FS::VMS->catfile and catdir. Make into -MM_VMS wrappers. +Eliminate eliminate_macros() from inside FS::VMS->catfile and catdir. +Make into MM_VMS wrappers. Add "NO_META" to stop autogeneration (and auto overwrite) of META.yml. Test ExtUtils::Command::MM -Finish ExtUtils::MakeMaker::Tutorial
\ No newline at end of file +Finish ExtUtils::MakeMaker::Tutorial + +Add 'how to install additional files' to ExtUtils::MakeMaker::FAQ. + +Fix NORECUSE bug continuing to set DIR + +Give typemap location its own macro. + +Merge MM_VMS->tool_xsubpp diff --git a/lib/ExtUtils/t/00compile.t b/lib/ExtUtils/t/00compile.t index 19cddc5539..b53475ea4b 100644 --- a/lib/ExtUtils/t/00compile.t +++ b/lib/ExtUtils/t/00compile.t @@ -19,30 +19,20 @@ BEGIN { $Has_Test_Pod = eval 'use Test::Pod 0.95; 1'; } -my(@modules); - -chdir File::Spec->catdir(File::Spec->updir, 'lib'); -find( sub { - return if /~$/; - if( $File::Find::dir =~ /^blib|t$/ ) { - $File::Find::prune = 1; - return; - } - push @modules, $File::Find::name if /\.pm$/; - }, 'ExtUtils' -); - +chdir File::Spec->updir; +my $manifest = File::Spec->catfile('MANIFEST'); +open(MANIFEST, $manifest) or die "Can't open $manifest: $!"; +my @modules = map { m{^lib/(\S+)}; $1 } + grep { m{^lib/ExtUtils/\S*\.pm} } <MANIFEST>; +chomp @modules; +close MANIFEST; + +chdir 'lib'; plan tests => scalar @modules * 2; foreach my $file (@modules) { - local @INC = @INC; - unshift @INC, File::Spec->curdir; - - # This piece of insanity brought to you by non-case preserving - # file systems! We have extutils/command.pm, %INC has - # ExtUtils/Command.pm - # Furthermore, 5.8.0 has a bug about require alone in an eval. Thus - # the extra statement. - eval q{ require($file); 1 } unless grep { lc $file =~ lc $_ } keys %INC; + # 5.8.0 has a bug about require alone in an eval. Thus the extra + # statement. + eval q{ require($file); 1 }; is( $@, '', "require $file" ); SKIP: { diff --git a/lib/ExtUtils/t/MM_Any.t b/lib/ExtUtils/t/MM_Any.t new file mode 100644 index 0000000000..0326274fe7 --- /dev/null +++ b/lib/ExtUtils/t/MM_Any.t @@ -0,0 +1,33 @@ +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } + else { + unshift @INC, 't/lib'; + } +} +chdir 't'; + +use Test::More tests => 7; +BEGIN { use_ok('ExtUtils::MM') } + + +### OS Flavor methods + +can_ok( 'MM', 'os_flavor', 'os_flavor_is' ); + +# Can't really know what the flavors are going to be, so we just +# make sure it returns something. +my @flavors = MM->os_flavor; +ok( @flavors, 'os_flavor() returned something' ); + +ok( MM->os_flavor_is($flavors[rand @flavors]), + 'os_flavor_is() one flavor' ); +ok( MM->os_flavor_is($flavors[rand @flavors], 'BogusOS'), + ' many flavors' ); +ok( !MM->os_flavor_is('BogusOS'), ' wrong flavor' ); +ok( !MM->os_flavor_is(), ' no flavor' ); + diff --git a/lib/ExtUtils/t/MM_Cygwin.t b/lib/ExtUtils/t/MM_Cygwin.t index bc4165e036..5b0b04f6c6 100644 --- a/lib/ExtUtils/t/MM_Cygwin.t +++ b/lib/ExtUtils/t/MM_Cygwin.t @@ -16,7 +16,7 @@ use Test::More; BEGIN { if ($^O =~ /cygwin/i) { - plan tests => 13; + plan tests => 11; } else { plan skip_all => "This is not cygwin"; } @@ -82,18 +82,6 @@ my $res = $MM->manifypods(); like( $res, qr/pure_all.*foo.*foo.1/s, '... should add MAN3PODS targets' ); -SKIP: { - skip "Only relevent in the core", 2 unless $ENV{PERL_CORE}; - $MM->{PERL_SRC} = File::Spec->updir; - $MM->{MAN1PODS} = { bar => 1 }; - my $out = tie *STDOUT, 'FakeOut'; - $res = $MM->manifypods(); - is( $$out, '', '... should not warn if PERL_SRC provided' ); - like( $res, qr/bar \\\n\t1 \\\n\tfoo/, - '... should join MAN1PODS and MAN3PODS'); -} - - # init_linker { my $libperl = $Config{libperl} || 'libperl.a'; diff --git a/lib/ExtUtils/t/basic.t b/lib/ExtUtils/t/basic.t index 4e0a607856..f60e5eedfd 100644 --- a/lib/ExtUtils/t/basic.t +++ b/lib/ExtUtils/t/basic.t @@ -21,6 +21,10 @@ use MakeMaker::Test::Utils; use File::Find; use File::Spec; +# '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'; @@ -62,7 +66,7 @@ $| = 1; ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || diag("chdir failed: $!"); -my @mpl_out = `$perl Makefile.PL PREFIX=dummy-install`; +my @mpl_out = run(qq{$perl Makefile.PL "PREFIX=dummy-install"}); cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); @@ -89,7 +93,7 @@ my $make = make_run(); { # Supress 'make manifest' noise local $ENV{PERL_MM_MANIFEST_VERBOSE} = 0; - my $manifest_out = `$make manifest`; + my $manifest_out = run("$make manifest"); ok( -e 'MANIFEST', 'make manifest created a MANIFEST' ); ok( -s 'MANIFEST', ' its not empty' ); } @@ -97,8 +101,8 @@ my $make = make_run(); END { unlink 'MANIFEST'; } -`$make ppd`; -is( $?, 0, ' exited normally' ); +my $ppd_out = run("$make ppd"); +is( $?, 0, ' exited normally' ) || diag $ppd_out; ok( open(PPD, 'Big-Dummy.ppd'), ' .ppd file generated' ); my $ppd_html; { local $/; $ppd_html = <PPD> } @@ -124,19 +128,19 @@ like( $ppd_html, qr{^\s*</SOFTPKG>}m, ' </SOFTPKG>'); END { unlink 'Big-Dummy.ppd' } -my $test_out = `$make test`; +my $test_out = run("$make test"); like( $test_out, qr/All tests successful/, 'make test' ); is( $?, 0, ' exited normally' ); # Test 'make test TEST_VERBOSE=1' my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1); -$test_out = `$make_test_verbose`; +$test_out = run("$make_test_verbose"); like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' ); like( $test_out, qr/All tests successful/, ' successful' ); is( $?, 0, ' exited normally' ); -my $install_out = `$make install`; +my $install_out = run("$make install"); is( $?, 0, 'install' ) || diag $install_out; like( $install_out, qr/^Installing /m ); like( $install_out, qr/^Writing /m ); @@ -156,7 +160,7 @@ ok( $files{'perllocal.pod'},' perllocal.pod created' ); SKIP: { skip "VMS install targets do not preserve PREFIX", 8 if $Is_VMS; - $install_out = `$make install PREFIX=elsewhere`; + $install_out = run("$make install PREFIX=elsewhere"); is( $?, 0, 'install with PREFIX override' ) || diag $install_out; like( $install_out, qr/^Installing /m ); like( $install_out, qr/^Writing /m ); @@ -171,7 +175,7 @@ SKIP: { } -my $dist_test_out = `$make disttest`; +my $dist_test_out = run("$make disttest"); is( $?, 0, 'disttest' ) || diag($dist_test_out); # Test META.yml generation @@ -185,7 +189,7 @@ is( $manifest->{'meta.yml'}, 'Module meta-data in YAML' ); # Make sure init_dirscan doesn't go into the distdir -@mpl_out = `$perl Makefile.PL "PREFIX=dummy-install"`; +@mpl_out = run(qq{$perl Makefile.PL "PREFIX=dummy-install"}); cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); @@ -199,7 +203,7 @@ ok( grep(/^Writing $makefile for Big::Dummy/, @mpl_out) == 1, open(SAVERR, ">&STDERR") or die $!; open(STDERR, ">".File::Spec->devnull) or die $!; -my $realclean_out = `$make realclean`; +my $realclean_out = run("$make realclean"); is( $?, 0, 'realclean' ) || diag($realclean_out); open(STDERR, ">&SAVERR") or die $!; diff --git a/t/lib/MakeMaker/Test/Utils.pm b/t/lib/MakeMaker/Test/Utils.pm index 9260faf343..be3ec73d74 100644 --- a/t/lib/MakeMaker/Test/Utils.pm +++ b/t/lib/MakeMaker/Test/Utils.pm @@ -12,7 +12,7 @@ require Exporter; $VERSION = 0.02; @EXPORT = qw(which_perl perl_lib makefile_name makefile_backup - make make_run make_macro calibrate_mtime + make make_run run make_macro calibrate_mtime ); my $Is_VMS = $^O eq 'VMS'; @@ -39,6 +39,8 @@ MakeMaker::Test::Utils - Utility routines for testing MakeMaker my $mtime = calibrate_mtime; + my $out = run($cmd); + =head1 DESCRIPTION A consolidation of little utility functions used through out the @@ -230,6 +232,34 @@ sub calibrate_mtime { return $mtime; } +=item B<run> + + my $out = run($command); + my @out = run($command); + +Runs the given $command as an external program returning at least STDOUT +as $out. If possible it will return STDOUT and STDERR combined as you +would expect to see on a screen. + +=cut + +sub run { + my $cmd = shift; + + require ExtUtils::MM; + + # Unix can handle 2>&1 and OS/2 from 5.005_54 up. + # This makes our failure diagnostics nicer to read. + if( MM->os_flavor_is('Unix') or + ($] > 5.00554 and MM->os_flavor_is('OS/2')) + ) { + return `$cmd 2>&1`; + } + else { + return `$cmd`; + } +} + =back =head1 AUTHOR |