From: Jarkko Hietaniemi Date: Thu, 30 May 2002 20:24:10 +0000 (+0000) Subject: Upgrade to ExtUtils::MakeMaker 6.01. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=69ff8adf802894e0957dae2b89f4e2c30fa38e90;p=p5sagit%2Fp5-mst-13.2.git Upgrade to ExtUtils::MakeMaker 6.01. p4raw-id: //depot/perl@16904 --- diff --git a/MANIFEST b/MANIFEST index cb3fc6f..7b805c9 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1069,6 +1069,7 @@ lib/ExtUtils/t/prefixify.t See if MakeMaker can apply a PREFIX lib/ExtUtils/t/problems.t How MakeMaker reacts to build problems lib/ExtUtils/t/testlib.t See if ExtUtils::testlib works lib/ExtUtils/t/VERSION_FROM.t See if MakeMaker's VERSION_FROM works +lib/ExtUtils/t/writemakefile_args.t See if WriteMakefile works lib/ExtUtils/t/zz_cleanup_dummy.t Cleanup MakeMaker test module lib/ExtUtils/testlib.pm Fixes up @INC to use just-built extension lib/ExtUtils/typemap Extension interface types diff --git a/lib/ExtUtils/Changes b/lib/ExtUtils/Changes index 56d4435..5f274c9 100644 --- a/lib/ExtUtils/Changes +++ b/lib/ExtUtils/Changes @@ -1,3 +1,20 @@ +6.01 Thu May 30 14:48:57 EDT 2002 + - MacOS Classic fixes from Pudge: recursive make repair, + post_initialize() now used, DEFINE & INC work with relative paths, + removed dead hybrid method/function call code. + * WriteMakefile now a bit more tolerant of wrong arguments, it will + warn and try to soldier on rather than just vomiting. + - Netware whitespace nits (bleadperl@16811) + - Netware Perl version number tag when building dynamic libraries + needs to match the current perl version instead of being hard coded + (a mutation of bleadperl@16851) + - OS/2 bug in TEST_F target found by John Poltorak (bleadperl@16839) + - README in 6.00 still declared this as alpha. + +6.00 Sat May 25 17:14:09 EDT 2002 + - VMS 8-level limit test tweak (bleadperl@16764) + * Here goes nothing. + 5.96_01 Wed May 22 19:11:09 EDT 2002 - Fixed ExtUtils::testlib so it doesn't taint @INC. - Fixed ExtUtils::Command so it groks % shell wildcard on VMS. diff --git a/lib/ExtUtils/Command.pm b/lib/ExtUtils/Command.pm index b4f66f8..22eece7 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.03_01'; +$VERSION = '1.04'; my $Is_VMS = $^O eq 'VMS'; @@ -126,7 +126,7 @@ sub touch expand_wildcards(); while (@ARGV) { - my $file = shift(@ARGV); + my $file = shift(@ARGV); open(FILE,">>$file") || die "Cannot write $file:$!"; close(FILE); utime($t,$t,$file); diff --git a/lib/ExtUtils/Liblist/Kid.pm b/lib/ExtUtils/Liblist/Kid.pm index c990095..a7e4c2d 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.28_01; +$VERSION = 1.29; use Config; use Cwd 'cwd'; diff --git a/lib/ExtUtils/MM_BeOS.pm b/lib/ExtUtils/MM_BeOS.pm index 5d9b08b..5118747 100644 --- a/lib/ExtUtils/MM_BeOS.pm +++ b/lib/ExtUtils/MM_BeOS.pm @@ -25,7 +25,7 @@ require ExtUtils::MM_Unix; use vars qw(@ISA $VERSION); @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -$VERSION = 1.02_01; +$VERSION = 1.03; =item perl_archive diff --git a/lib/ExtUtils/MM_Cygwin.pm b/lib/ExtUtils/MM_Cygwin.pm index 59d89c2..09dd692 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.02_01; +$VERSION = 1.03; sub cflags { my($self,$libperl)=@_; diff --git a/lib/ExtUtils/MM_MacOS.pm b/lib/ExtUtils/MM_MacOS.pm index f32b5dc..326ca6d 100644 --- a/lib/ExtUtils/MM_MacOS.pm +++ b/lib/ExtUtils/MM_MacOS.pm @@ -4,6 +4,7 @@ # built-in ExtUtils::MM_Unix methods if MakeMaker.pm is run under MacOS. # # Author: Matthias Neeracher +# Maintainer: Chris Nandor package ExtUtils::MM_MacOS; require ExtUtils::MM_Any; @@ -11,7 +12,7 @@ require ExtUtils::MM_Unix; @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); use vars qw($VERSION); -$VERSION = '1.00'; +$VERSION = '1.01'; use Config; use Cwd 'cwd'; @@ -60,27 +61,54 @@ sub new { } } - $class = ++$ExtUtils::MakeMaker::PACKNAME; + my $newclass = ++$ExtUtils::MakeMaker::PACKNAME; + local @ExtUtils::MakeMaker::Parent = @ExtUtils::MakeMaker::Parent; # Protect against non-local exits { - print "Blessing Object into class [$class]\n" if $Verbose>=2; - ExtUtils::MakeMaker::mv_all_methods("MY",$class); - bless $self, $class; - push @Parent, $self; - @{"$class\:\:ISA"} = 'MM'; - } - - if (defined $Parent[-2]){ - $self->{PARENT} = $Parent[-2]; - my $key; - for $key (keys %Prepend_dot_dot) { - next unless defined $self->{PARENT}{$key}; - $self->{$key} = $self->{PARENT}{$key}; - $self->{$key} = File::Spec->catdir("::",$self->{$key}) - unless File::Spec->file_name_is_absolute($self->{$key}); - } - $self->{PARENT}->{CHILDREN}->{$class} = $self if $self->{PARENT}; + no strict 'refs'; + print "Blessing Object into class [$newclass]\n" if $Verbose>=2; + ExtUtils::MakeMaker::mv_all_methods("MY",$newclass); + bless $self, $newclass; + push @Parent, $self; + require ExtUtils::MY; + @{"$newclass\:\:ISA"} = 'MM'; + } + + if (defined $ExtUtils::MakeMaker::Parent[-2]){ + $self->{PARENT} = $ExtUtils::MakeMaker::Parent[-2]; + my $key; + for $key (@ExtUtils::MakeMaker::Prepend_parent) { + next unless defined $self->{PARENT}{$key}; + $self->{$key} = $self->{PARENT}{$key}; + unless ($^O eq 'VMS' && $key =~ /PERL$/) { + $self->{$key} = $self->catdir("..",$self->{$key}) + unless $self->file_name_is_absolute($self->{$key}); + } else { + # PERL or FULLPERL will be a command verb or even a + # command with an argument instead of a full file + # specification under VMS. So, don't turn the command + # into a filespec, but do add a level to the path of + # the argument if not already absolute. + my @cmd = split /\s+/, $self->{$key}; + $cmd[1] = $self->catfile('[-]',$cmd[1]) + unless (@cmd < 2) || $self->file_name_is_absolute($cmd[1]); + $self->{$key} = join(' ', @cmd); + } + } + if ($self->{PARENT}) { + $self->{PARENT}->{CHILDREN}->{$newclass} = $self; + foreach my $opt (qw(POLLUTE PERL_CORE)) { + if (exists $self->{PARENT}->{$opt} + and not exists $self->{$opt}) + { + # inherit, but only if already unspecified + $self->{$opt} = $self->{PARENT}->{$opt}; + } + } + } + my @fm = grep /^FIRST_MAKEFILE=/, @ARGV; + $self->parse_args(@fm) if @fm; } else { - $self->parse_args(@ARGV); + $self->parse_args(split(' ', $ENV{PERL_MM_OPT} || ''),@ARGV); } $self->{NAME} ||= $self->guess_name; @@ -118,7 +146,7 @@ END delete $self->{SKIP}; # free memory # We skip many sections for MacOS, but we don't say anything about it in the Makefile - for (qw/post_initialize const_config tool_autosplit + for (qw/ const_config tool_autosplit tool_xsubpp tools_other dist macro depend post_constants pasthru c_o xs_c xs_o top_targets linkext dynamic_bs dynamic_lib static_lib manifypods @@ -268,10 +296,6 @@ LIBPERL_A, VERSION_FROM, VERSION, DISTNAME, VERSION_SYM. sub init_main { my($self) = @_; - unless (ref $self){ - ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); - $self = $ExtUtils::MakeMaker::Parent[-1]; - } # --- Initialize Module Name and Paths @@ -404,10 +428,6 @@ Initializes LDLOADLIBS, LIBS sub init_others { # --- Initialize Other Attributes my($self) = shift; - unless (ref $self){ - ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); - $self = $ExtUtils::MakeMaker::Parent[-1]; - } if ( !$self->{OBJECT} ) { # init_dirscan should have found out, if we have C files @@ -444,10 +464,6 @@ Initializes DIR, XS, PM, C, O_FILES, H, PL_FILES, MAN*PODS, EXE_FILES. sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) my($self) = @_; - unless (ref $self){ - ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); - $self = $ExtUtils::MakeMaker::Parent[-1]; - } my($name, %dir, %xs, %c, %h, %ignore, %pl_files, %manifypods); local(%pm); #the sub in find() has to see this hash @@ -582,10 +598,6 @@ Initializes lots of constants and .SUFFIXES and .PHONY sub constants { my($self) = @_; - unless (ref $self){ - ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); - $self = $ExtUtils::MakeMaker::Parent[-1]; - } my(@m,$tmp); for $tmp (qw/ @@ -630,10 +642,10 @@ MM_VERSION = $ExtUtils::MakeMaker::VERSION if ($self->{DEFINE}) { $self->{DEFINE} =~ s/-D/-d /g; # Preprocessor definitions may be useful - $self->{DEFINE} =~ s/-I\S+//g; # UN*X includes probably are not useful + $self->{DEFINE} =~ s/-I\S+/_include($1)/eg; # UN*X includes probably are not useful } if ($self->{INC}) { - $self->{INC} =~ s/-I\S+//g; # UN*X includes probably are not useful + $self->{INC} =~ s/-I(\S+)/_include($1)/eg; # UN*X includes probably are not useful } for $tmp (qw/ FULLEXT BASEEXT ROOTEXT DEFINE INC @@ -667,10 +679,6 @@ sub static { # --- Static Loading Sections --- my($self) = shift; - unless (ref $self){ - ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); - $self = $ExtUtils::MakeMaker::Parent[-1]; - } my($extlib) = $self->{MYEXTLIB} ? "\nstatic :: myextlib\n" : ""; ' all :: static @@ -690,10 +698,6 @@ files. sub dlsyms { my($self,%attribs) = @_; - unless (ref $self){ - ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); - $self = $ExtUtils::MakeMaker::Parent[-1]; - } return '' unless !$self->{SKIPHASH}{'dynamic'}; @@ -728,10 +732,6 @@ sub dynamic { # --- dynamic Loading Sections --- my($self) = shift; - unless (ref $self){ - ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); - $self = $ExtUtils::MakeMaker::Parent[-1]; - } ' all :: dynamic @@ -752,10 +752,6 @@ sub clean { # --- Cleanup and Distribution Sections --- my($self, %attribs) = @_; - unless (ref $self){ - ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); - $self = $ExtUtils::MakeMaker::Parent[-1]; - } my(@m,$dir); push(@m, ' # Delete temporary files but do not touch installed files. We don\'t delete @@ -795,10 +791,6 @@ Defines the realclean target. sub realclean { my($self, %attribs) = @_; - unless (ref $self){ - ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); - $self = $ExtUtils::MakeMaker::Parent[-1]; - } my(@m); push(@m,' # Delete temporary files (via clean) and also delete installed files @@ -832,10 +824,6 @@ realclean purge :: clean sub rulez { my($self) = shift; - unless (ref $self){ - ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); - $self = $ExtUtils::MakeMaker::Parent[-1]; - } qq' install install_static install_dynamic :: \t\$(MACPERL_SRC)PerlInstall -l \$(PERL_LIB) @@ -877,6 +865,18 @@ $target :: $plfile join "", @m; } +sub _include { # for Unix-style includes, with -I instead of -i + my($inc) = @_; + require File::Spec::Unix; + + # allow only relative paths + if (File::Spec::Unix->file_name_is_absolute($inc)) { + return ''; + } else { + return '-i ' . macify($inc); + } +} + 1; __END__ diff --git a/lib/ExtUtils/MM_NW5.pm b/lib/ExtUtils/MM_NW5.pm index 54a7df5..61d6436 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.04_01'; +$VERSION = '2.05'; require ExtUtils::MM_Win32; @ISA = qw(ExtUtils::MM_Win32); @@ -327,7 +327,10 @@ MAKE_FRAG MAKE_FRAG } - $m .= ' $(LD) $(LDFLAGS) $(OBJECT:.obj=.obj) -desc "Perl 5.8.0 Extension ($(BASEEXT)) XS_VERSION: $(XS_VERSION)" -nlmversion $(NLM_VERSION)'; + # Reconstruct the X.Y.Z version. + my $version = join '.', map { sprintf "%d", $_ } + $] =~ /(\d)\.(\d{3})(\d{2})/; + $m .= sprintf ' $(LD) $(LDFLAGS) $(OBJECT:.obj=.obj) -desc "Perl %s Extension ($(BASEEXT)) XS_VERSION: $(XS_VERSION)" -nlmversion $(NLM_VERSION)', $version; # Taking care of long names like FileHandle, ByteLoader, SDBM_File etc if($self->{NLM_SHORT_NAME}) { diff --git a/lib/ExtUtils/MM_OS2.pm b/lib/ExtUtils/MM_OS2.pm index 3e69620..fb72f5f 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.02_01'; +$VERSION = '1.03'; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index 03dbd25..cb516a5 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -19,7 +19,7 @@ use vars qw($VERSION @ISA use ExtUtils::MakeMaker qw($Verbose neatvalue); -$VERSION = '1.31_01'; +$VERSION = '1.32'; require ExtUtils::MM_Any; @ISA = qw(ExtUtils::MM_Any); diff --git a/lib/ExtUtils/MM_VMS.pm b/lib/ExtUtils/MM_VMS.pm index 32b75b4..3fedae8 100644 --- a/lib/ExtUtils/MM_VMS.pm +++ b/lib/ExtUtils/MM_VMS.pm @@ -14,7 +14,7 @@ use VMS::Filespec; use File::Basename; use File::Spec; use vars qw($Revision @ISA $VERSION); -($VERSION) = $Revision = '5.64_01'; +($VERSION) = $Revision = '5.65'; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 8e3ae45..03af82e 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 $PERLMAKE); require ExtUtils::MM_Any; require ExtUtils::MM_Unix; @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -$VERSION = '1.04_01'; +$VERSION = '1.05'; $ENV{EMXSHELL} = 'sh'; # to run `commands` diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index c93365e..69cf106 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -2,10 +2,10 @@ package ExtUtils::MakeMaker; BEGIN {require 5.005_03;} -$VERSION = "5.96_01"; +$VERSION = "6.01"; $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.55 $, 10)) =~ s/\s+$//; +($Revision = substr(q$Revision: 1.59 $, 10)) =~ s/\s+$//; require Exporter; use Config; @@ -44,12 +44,81 @@ sub WriteMakefile { require ExtUtils::MY; my %att = @_; + + _verify_att(\%att); + my $mm = MM->new(\%att); $mm->flush; return $mm; } + +# Basic signatures of the attributes WriteMakefile takes. Each is +# the reference type. Any not noted simply take strings. +my %Att_Sigs = +( + C => 'array', + CONFIG => 'array', + CONFIGURE => 'code', + DIR => 'array', + DL_FUNCS => 'hash', + DL_VARS => 'array', + EXCLUDE_EXT=> 'array', + EXE_FILES => 'array', + FUNCLIST => 'array', + H => 'array', + IMPORTS => 'hash', + INCLUDE_EXT=> 'array', + LIBS => ['array','string'], + MAN1PODS => 'hash', + MAN3PODS => 'hash', + PL_FILES => 'hash', + PM => 'hash', + PMLIBDIRS => 'array', + PREREQ_PM => 'hash', + SKIP => 'array', + TYPEMAPS => 'array', + XS => 'hash', + + clean => 'hash', + depend => 'hash', + dist => 'hash', + dynamic_lib=> 'hash', + linkext => 'hash', + macro => 'hash', + realclean => 'hash', + test => 'hash', + tool_autosplit => 'hash', +); + +my %Default_Att = ( + string => '', + hash => {}, + array => [], + code => sub {} + ); + +sub _verify_att { + my($att) = @_; + + while( my($key, $val) = each %$att ) { + my $sig = $Att_Sigs{$key}; + my @sigs = ref $sig ? @$sig : ($sig || 'string'); + my $given = lc ref $val || 'string'; + unless( grep $given eq $_, @sigs ) { + my $takes = join " or ", map { $_ ne 'string' ? "$_ reference" + : "string/number" + } @sigs; + my $has = $given ne 'string' ? "$given reference" + : "string/number"; + warn "WARNING: $key takes a $takes not a $has.\n". + " Please inform the author.\n"; + $att->{$key} = $Default_Att{$sigs[0]}; + } + } +} + sub prompt ($;$) { my($mess,$def)=@_; $ISA_TTY = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; # Pipe? @@ -1289,7 +1358,9 @@ Ref to array of *.h file names. Similar to C. =item IMPORTS This attribute is used to specify names to be imported into the -extension. It is only used on OS/2 and Win32. +extension. Takes a hash ref. + +It is only used on OS/2 and Win32. =item INC @@ -1426,7 +1497,7 @@ INSTALLSCRIPT. =item LDFROM -defaults to "$(OBJECT)" and is used in the ld command to specify +Defaults to "$(OBJECT)" and is used in the ld command to specify what files to link/load from (also see dynamic_lib below for how to specify ld flags) @@ -1817,7 +1888,7 @@ MakeMaker object. The following lines will be parsed o.k.: $VERSION = '1.00'; *VERSION = \'1.01'; - ( $VERSION ) = '$Revision: 1.55 $ ' =~ /\$Revision:\s+([^\s]+)/; + ( $VERSION ) = '$Revision: 1.59 $ ' =~ /\$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/Manifest.pm b/lib/ExtUtils/Manifest.pm index 90d96ac..7ca5bdd 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.37_01; +$VERSION = 1.38; @ISA=('Exporter'); @EXPORT_OK = ('mkmanifest', 'manicheck', 'fullcheck', 'filecheck', 'skipcheck', 'maniread', 'manicopy'); diff --git a/lib/ExtUtils/Mkbootstrap.pm b/lib/ExtUtils/Mkbootstrap.pm index 45713c3..ba452fe 100644 --- a/lib/ExtUtils/Mkbootstrap.pm +++ b/lib/ExtUtils/Mkbootstrap.pm @@ -1,6 +1,6 @@ package ExtUtils::Mkbootstrap; -$VERSION = 1.14_01; +$VERSION = 1.15; use Config; use Exporter; diff --git a/lib/ExtUtils/Mksymlists.pm b/lib/ExtUtils/Mksymlists.pm index c5b4053..85922ab 100644 --- a/lib/ExtUtils/Mksymlists.pm +++ b/lib/ExtUtils/Mksymlists.pm @@ -11,7 +11,7 @@ use Config; use vars qw(@ISA @EXPORT $VERSION); @ISA = 'Exporter'; @EXPORT = '&Mksymlists'; -$VERSION = 1.18_00; +$VERSION = 1.19; sub Mksymlists { my(%spec) = @_; diff --git a/lib/ExtUtils/t/writemakefile_args.t b/lib/ExtUtils/t/writemakefile_args.t new file mode 100644 index 0000000..3877aa6 --- /dev/null +++ b/lib/ExtUtils/t/writemakefile_args.t @@ -0,0 +1,100 @@ +#!/usr/bin/perl -w + +# This is a test of the verification of the arguments to +# WriteMakefile. + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; +use Test::More tests => 12; + +use TieOut; +use MakeMaker::Test::Utils; + +use ExtUtils::MakeMaker; + +chdir 't'; + +perl_lib(); + +ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || + diag("chdir failed: $!"); + +{ + ok( my $stdout = tie *STDOUT, 'TieOut' ); + my $warnings = ''; + local $SIG{__WARN__} = sub { + $warnings .= join '', @_; + }; + + my $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION_FROM => 'lib/Big/Dummy.pm', + MAN3PODS => ' ', # common mistake + ); + + is( $warnings, <{MAN3PODS}, {}, 'Wrong argument type corrected' ); + + $warnings = ''; + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION_FROM => 'lib/Big/Dummy.pm', + AUTHOR => sub {}, + ); + + is( $warnings, <{AUTHOR}, '' ); + + + # LIBS accepts *both* a string or an array ref. The first cut of + # our verification did not take this into account. + $warnings = ''; + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION_FROM => 'lib/Big/Dummy.pm', + LIBS => '-lwibble -lwobble', + ); + + # We'll get warnings about the bogus libs, that's ok. + unlike( $warnings, qr/WARNING: .* takes/ ); + is_deeply( $mm->{LIBS}, ['-lwibble -lwobble'] ); + + $warnings = ''; + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION_FROM => 'lib/Big/Dummy.pm', + LIBS => ['-lwibble', '-lwobble'], + ); + + # We'll get warnings about the bogus libs, that's ok. + unlike( $warnings, qr/WARNING: .* takes/ ); + is_deeply( $mm->{LIBS}, ['-lwibble', '-lwobble'] ); + + $warnings = ''; + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION_FROM => 'lib/Big/Dummy.pm', + LIBS => { wibble => "wobble" }, + ); + + # We'll get warnings about the bogus libs, that's ok. + like( $warnings, qr{^WARNING: LIBS takes a array reference or string/number not a hash reference}m ); + is_deeply( $mm->{LIBS}, [] ); + +} diff --git a/lib/ExtUtils/testlib.pm b/lib/ExtUtils/testlib.pm index d8c99bb..043a6d4 100644 --- a/lib/ExtUtils/testlib.pm +++ b/lib/ExtUtils/testlib.pm @@ -1,5 +1,5 @@ package ExtUtils::testlib; -$VERSION = 1.14_01; +$VERSION = 1.15; use Cwd; use File::Spec;