diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-07-07 11:04:30 +0100 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-07-07 12:29:48 +0100 |
commit | 4b5789fe5c4c75816682f2e7a76a6b20720758fc (patch) | |
tree | 68c34a2f2734fdd9b41ac1414b03a2a7051fd64c /cpan/ExtUtils-MakeMaker/lib | |
parent | f229537a3ecd9db056c7d315dbbf103a048e10dc (diff) | |
download | perl-4b5789fe5c4c75816682f2e7a76a6b20720758fc.tar.gz |
Update ExtUtils-MakeMaker to CPAN version 6.58
[DELTA]
6.58 Wed Jul 6 14:17:06 PDT 2011
No changes since 6.57_11
6.57_11 Thu May 19 17:26:31 PDT 2011
Bug Fixes
* Changed CPAN::Meta to accept version objects. [github #16]
* Massage bad versions and warn the user about them. [github #15]
* Protect against CPAN::Meta dying during metafile validation
and generation.
VMS
* Fix prereq.t to work around "local %ENV = %ENV" bug
Win32
* Liblist::Kid can now recognize long compiler paths
(Christian Walde) [github #11]
6.57_10 Sun, 03 Apr 2011 19:36:38 +1000
Bug Fixes
* Relaxed strictures on prerequisite versions. Invalid versions now
issue a warning and are set to 0 rather than dying. [github #7]
* Upgraded CPAN::Meta to 2.110930 which fixes a glitch in writing
MYMETA.yml if your module's version number was 1.4. [github #9]
* Convert LICENSE entries which are unknown to CPAN::Meta to
"unknown" rather than dying. [github #10]
6.57_09 Mon, 28 Mar 2011 11:13:39 +1100
Misc
* Make CPAN ignore bundled modules
* Accidentally rolled Version::Requirements into the version bundle
* Deleted now unused ExtUtils::MakeMaker::YAML
6.57_08 Sun, 27 Mar 2011 21:52:47 +1100
VMS
* Removed dependency on cc_runtime.h for VMS as well.
Misc
* Changed how modules are bundled to avoid replacing XS version of
Scalar::Util with a pure Perl version [github #4]
6.57_07 Fri, 25 Mar 2011 14:31:31 +1100
Enhancements
* Generates META.json and MYMETA.json in addition to
META.yml and MYMETA.yml (David Golden)
* MYMETA has the runtime requirements made priority over META_*
keys to allow generation of a correct META.* into the dist while
still generating an accurate MYMETA.* locally (Matt S Trout)
* Distributions should not depend on cc_runtime.h from core as it is
only needed for B::CC
* Now uses CPAN::Meta to generate META files.
Bug Fixes
* MYMETA.yml generation from META.yml actually works (Matt S Trout)
* All required META fields are generated, even if they must be filled
with "unknown" in place of real data (David Golden)
Test Fixes
* miniperl.t is no longer run outside of the perl core. Its only relevant
to bleadperl and requires no backwards compatibility [rt.cpan.org 61868]
Cygwin
* Rebase behaviour was improved (Reini Urban)
* Build man pages (Reini Urban)
Win32
* Spot valid lib files on Win32 when .a and .lib are mixed.
(Christian Walde) [github #3]
* Extensive testing of ExtUtils::Liblist::Kid for Win32
(Christian Walde)
* Implemented proper emulation of DOS escaping rules in ExtUtils::MM_Win32
(Christian Walde)
6.57_06 Wed Oct 06 13:49:00 EEST 2010
Win32
* Work around dmake's limitations on how long a "line" can be.
[rt.cpan.org 61286]
* ActivePerl 1007 can now see gcc. [rt.cpan.org 55752] (Christian Walde)
Bug Fixes
* Fix for AUTHOR and undocumented usage of MM->new() (Alexandr Ciornii)
Diffstat (limited to 'cpan/ExtUtils-MakeMaker/lib')
29 files changed, 919 insertions, 1299 deletions
diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm index 40bf780dea..5a33bff6a3 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm @@ -8,9 +8,9 @@ use warnings; require Exporter; our @ISA = qw(Exporter); -our @EXPORT = qw(test_harness pod2man perllocal_install uninstall +our @EXPORT = qw(test_harness pod2man perllocal_install uninstall warn_if_old_packlist); -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; my $Is_VMS = $^O eq 'VMS'; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm index 2184c4a6d7..a4e26666e4 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm @@ -2,7 +2,7 @@ package ExtUtils::Liblist; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; use File::Spec; require ExtUtils::Liblist::Kid; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm index cf4826fe36..a0e2f24302 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm @@ -6,214 +6,241 @@ package ExtUtils::Liblist::Kid; # $self is not a Makemaker. use 5.006; + # Broken out of MakeMaker from version 4.11 use strict; -our $VERSION = 6.57_05; +use warnings; +our $VERSION = '6.58'; -use Config; +use ExtUtils::MakeMaker::Config; use Cwd 'cwd'; use File::Basename; use File::Spec; sub ext { - if ($^O eq 'VMS') { return &_vms_ext; } - elsif($^O eq 'MSWin32') { return &_win32_ext; } - else { return &_unix_os2_ext; } + if ( $^O eq 'VMS' ) { return &_vms_ext; } + elsif ( $^O eq 'MSWin32' ) { return &_win32_ext; } + else { return &_unix_os2_ext; } } sub _unix_os2_ext { - my($self,$potential_libs, $verbose, $give_libs) = @_; + my ( $self, $potential_libs, $verbose, $give_libs ) = @_; $verbose ||= 0; - if ($^O =~ 'os2' and $Config{perllibs}) { - # Dynamic libraries are not transitive, so we may need including - # the libraries linked against perl.dll again. + if ( $^O =~ 'os2' and $Config{perllibs} ) { + + # Dynamic libraries are not transitive, so we may need including + # the libraries linked against perl.dll again. - $potential_libs .= " " if $potential_libs; - $potential_libs .= $Config{perllibs}; + $potential_libs .= " " if $potential_libs; + $potential_libs .= $Config{perllibs}; } - return ("", "", "", "", ($give_libs ? [] : ())) unless $potential_libs; + return ( "", "", "", "", ( $give_libs ? [] : () ) ) unless $potential_libs; warn "Potential libraries are '$potential_libs':\n" if $verbose; - my($so) = $Config{so}; - my($libs) = defined $Config{perllibs} ? $Config{perllibs} : $Config{libs}; + my ( $so ) = $Config{so}; + my ( $libs ) = defined $Config{perllibs} ? $Config{perllibs} : $Config{libs}; my $Config_libext = $Config{lib_ext} || ".a"; my $Config_dlext = $Config{dlext}; - # compute $extralibs, $bsloadlibs and $ldloadlibs from # $potential_libs # this is a rewrite of Andy Dougherty's extliblist in perl - my(@searchpath); # from "-L/path" entries in $potential_libs - my(@libpath) = split " ", $Config{'libpth'}; - my(@ldloadlibs, @bsloadlibs, @extralibs, @ld_run_path, %ld_run_path_seen); - my(@libs, %libs_seen); - my($fullname, @fullname); - my($pwd) = cwd(); # from Cwd.pm - my($found) = 0; - - foreach my $thislib (split ' ', $potential_libs) { - - # Handle possible linker path arguments. - if ($thislib =~ s/^(-[LR]|-Wl,-R)//){ # save path flag type - my($ptype) = $1; - unless (-d $thislib){ - warn "$ptype$thislib ignored, directory does not exist\n" - if $verbose; - next; - } - my($rtype) = $ptype; - if (($ptype eq '-R') or ($ptype eq '-Wl,-R')) { - if ($Config{'lddlflags'} =~ /-Wl,-R/) { - $rtype = '-Wl,-R'; - } elsif ($Config{'lddlflags'} =~ /-R/) { - $rtype = '-R'; - } - } - unless (File::Spec->file_name_is_absolute($thislib)) { - warn "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n"; - $thislib = $self->catdir($pwd,$thislib); - } - push(@searchpath, $thislib); - push(@extralibs, "$ptype$thislib"); - push(@ldloadlibs, "$rtype$thislib"); - next; - } - - # Handle possible library arguments. - unless ($thislib =~ s/^-l//){ - warn "Unrecognized argument in LIBS ignored: '$thislib'\n"; - next; - } - - my($found_lib)=0; - foreach my $thispth (@searchpath, @libpath) { - - # Try to find the full name of the library. We need this to - # determine whether it's a dynamically-loadable library or not. - # This tends to be subject to various os-specific quirks. - # For gcc-2.6.2 on linux (March 1995), DLD can not load - # .sa libraries, with the exception of libm.sa, so we - # deliberately skip them. - if (@fullname = - $self->lsdir($thispth,"^\Qlib$thislib.$so.\E[0-9]+")){ - # Take care that libfoo.so.10 wins against libfoo.so.9. - # Compare two libraries to find the most recent version - # number. E.g. if you have libfoo.so.9.0.7 and - # libfoo.so.10.1, first convert all digits into two - # decimal places. Then we'll add ".00" to the shorter - # strings so that we're comparing strings of equal length - # Thus we'll compare libfoo.so.09.07.00 with - # libfoo.so.10.01.00. Some libraries might have letters - # in the version. We don't know what they mean, but will - # try to skip them gracefully -- we'll set any letter to - # '0'. Finally, sort in reverse so we can take the - # first element. - - #TODO: iterate through the directory instead of sorting - - $fullname = "$thispth/" . - (sort { my($ma) = $a; - my($mb) = $b; - $ma =~ tr/A-Za-z/0/s; - $ma =~ s/\b(\d)\b/0$1/g; - $mb =~ tr/A-Za-z/0/s; - $mb =~ s/\b(\d)\b/0$1/g; - while (length($ma) < length($mb)) { $ma .= ".00"; } - while (length($mb) < length($ma)) { $mb .= ".00"; } - # Comparison deliberately backwards - $mb cmp $ma;} @fullname)[0]; - } elsif (-f ($fullname="$thispth/lib$thislib.$so") - && (($Config{'dlsrc'} ne "dl_dld.xs") || ($thislib eq "m"))){ - } elsif (-f ($fullname="$thispth/lib${thislib}_s$Config_libext") - && ($Config{'archname'} !~ /RM\d\d\d-svr4/) - && ($thislib .= "_s") ){ # we must explicitly use _s version - } elsif (-f ($fullname="$thispth/lib$thislib$Config_libext")){ - } elsif (defined($Config_dlext) - && -f ($fullname="$thispth/lib$thislib.$Config_dlext")){ - } elsif (-f ($fullname="$thispth/$thislib$Config_libext")){ - } elsif (-f ($fullname="$thispth/lib$thislib.dll$Config_libext")){ - } elsif (-f ($fullname="$thispth/Slib$thislib$Config_libext")){ - } elsif ($^O eq 'dgux' - && -l ($fullname="$thispth/lib$thislib$Config_libext") - && readlink($fullname) =~ /^elink:/s) { - # Some of DG's libraries look like misconnected symbolic - # links, but development tools can follow them. (They - # look like this: - # - # libm.a -> elink:${SDE_PATH:-/usr}/sde/\ - # ${TARGET_BINARY_INTERFACE:-m88kdgux}/usr/lib/libm.a - # - # , the compilation tools expand the environment variables.) - } else { - warn "$thislib not found in $thispth\n" if $verbose; - next; - } - warn "'-l$thislib' found at $fullname\n" if $verbose; - push @libs, $fullname unless $libs_seen{$fullname}++; - $found++; - $found_lib++; - - # Now update library lists - - # what do we know about this library... - my $is_dyna = ($fullname !~ /\Q$Config_libext\E\z/); - my $in_perl = ($libs =~ /\B-l\Q${thislib}\E\b/s); + my ( @searchpath ); # from "-L/path" entries in $potential_libs + my ( @libpath ) = split " ", $Config{'libpth'}; + my ( @ldloadlibs, @bsloadlibs, @extralibs, @ld_run_path, %ld_run_path_seen ); + my ( @libs, %libs_seen ); + my ( $fullname, @fullname ); + my ( $pwd ) = cwd(); # from Cwd.pm + my ( $found ) = 0; + + foreach my $thislib ( split ' ', $potential_libs ) { + + # Handle possible linker path arguments. + if ( $thislib =~ s/^(-[LR]|-Wl,-R)// ) { # save path flag type + my ( $ptype ) = $1; + unless ( -d $thislib ) { + warn "$ptype$thislib ignored, directory does not exist\n" + if $verbose; + next; + } + my ( $rtype ) = $ptype; + if ( ( $ptype eq '-R' ) or ( $ptype eq '-Wl,-R' ) ) { + if ( $Config{'lddlflags'} =~ /-Wl,-R/ ) { + $rtype = '-Wl,-R'; + } + elsif ( $Config{'lddlflags'} =~ /-R/ ) { + $rtype = '-R'; + } + } + unless ( File::Spec->file_name_is_absolute( $thislib ) ) { + warn "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n"; + $thislib = $self->catdir( $pwd, $thislib ); + } + push( @searchpath, $thislib ); + push( @extralibs, "$ptype$thislib" ); + push( @ldloadlibs, "$rtype$thislib" ); + next; + } + + # Handle possible library arguments. + unless ( $thislib =~ s/^-l// ) { + warn "Unrecognized argument in LIBS ignored: '$thislib'\n"; + next; + } + + my ( $found_lib ) = 0; + foreach my $thispth ( @searchpath, @libpath ) { + + # Try to find the full name of the library. We need this to + # determine whether it's a dynamically-loadable library or not. + # This tends to be subject to various os-specific quirks. + # For gcc-2.6.2 on linux (March 1995), DLD can not load + # .sa libraries, with the exception of libm.sa, so we + # deliberately skip them. + if ( @fullname = $self->lsdir( $thispth, "^\Qlib$thislib.$so.\E[0-9]+" ) ) { + + # Take care that libfoo.so.10 wins against libfoo.so.9. + # Compare two libraries to find the most recent version + # number. E.g. if you have libfoo.so.9.0.7 and + # libfoo.so.10.1, first convert all digits into two + # decimal places. Then we'll add ".00" to the shorter + # strings so that we're comparing strings of equal length + # Thus we'll compare libfoo.so.09.07.00 with + # libfoo.so.10.01.00. Some libraries might have letters + # in the version. We don't know what they mean, but will + # try to skip them gracefully -- we'll set any letter to + # '0'. Finally, sort in reverse so we can take the + # first element. + + #TODO: iterate through the directory instead of sorting + + $fullname = "$thispth/" . ( + sort { + my ( $ma ) = $a; + my ( $mb ) = $b; + $ma =~ tr/A-Za-z/0/s; + $ma =~ s/\b(\d)\b/0$1/g; + $mb =~ tr/A-Za-z/0/s; + $mb =~ s/\b(\d)\b/0$1/g; + while ( length( $ma ) < length( $mb ) ) { $ma .= ".00"; } + while ( length( $mb ) < length( $ma ) ) { $mb .= ".00"; } + + # Comparison deliberately backwards + $mb cmp $ma; + } @fullname + )[0]; + } + elsif ( -f ( $fullname = "$thispth/lib$thislib.$so" ) + && ( ( $Config{'dlsrc'} ne "dl_dld.xs" ) || ( $thislib eq "m" ) ) ) + { + } + elsif (-f ( $fullname = "$thispth/lib${thislib}_s$Config_libext" ) + && ( $Config{'archname'} !~ /RM\d\d\d-svr4/ ) + && ( $thislib .= "_s" ) ) + { # we must explicitly use _s version + } + elsif ( -f ( $fullname = "$thispth/lib$thislib$Config_libext" ) ) { + } + elsif ( defined( $Config_dlext ) + && -f ( $fullname = "$thispth/lib$thislib.$Config_dlext" ) ) + { + } + elsif ( -f ( $fullname = "$thispth/$thislib$Config_libext" ) ) { + } + elsif ( -f ( $fullname = "$thispth/lib$thislib.dll$Config_libext" ) ) { + } + elsif ( -f ( $fullname = "$thispth/Slib$thislib$Config_libext" ) ) { + } + elsif ($^O eq 'dgux' + && -l ( $fullname = "$thispth/lib$thislib$Config_libext" ) + && readlink( $fullname ) =~ /^elink:/s ) + { + + # Some of DG's libraries look like misconnected symbolic + # links, but development tools can follow them. (They + # look like this: + # + # libm.a -> elink:${SDE_PATH:-/usr}/sde/\ + # ${TARGET_BINARY_INTERFACE:-m88kdgux}/usr/lib/libm.a + # + # , the compilation tools expand the environment variables.) + } + else { + warn "$thislib not found in $thispth\n" if $verbose; + next; + } + warn "'-l$thislib' found at $fullname\n" if $verbose; + push @libs, $fullname unless $libs_seen{$fullname}++; + $found++; + $found_lib++; + + # Now update library lists + + # what do we know about this library... + my $is_dyna = ( $fullname !~ /\Q$Config_libext\E\z/ ); + my $in_perl = ( $libs =~ /\B-l\Q${thislib}\E\b/s ); # include the path to the lib once in the dynamic linker path # but only if it is a dynamic lib and not in Perl itself - my($fullnamedir) = dirname($fullname); + my ( $fullnamedir ) = dirname( $fullname ); push @ld_run_path, $fullnamedir - if $is_dyna && !$in_perl && - !$ld_run_path_seen{$fullnamedir}++; - - # Do not add it into the list if it is already linked in - # with the main perl executable. - # We have to special-case the NeXT, because math and ndbm - # are both in libsys_s - unless ($in_perl || - ($Config{'osname'} eq 'next' && - ($thislib eq 'm' || $thislib eq 'ndbm')) ){ - push(@extralibs, "-l$thislib"); - } - - # We might be able to load this archive file dynamically - if ( ($Config{'dlsrc'} =~ /dl_next/ && $Config{'osvers'} lt '4_0') - || ($Config{'dlsrc'} =~ /dl_dld/) ) - { - # We push -l$thislib instead of $fullname because - # it avoids hardwiring a fixed path into the .bs file. - # Mkbootstrap will automatically add dl_findfile() to - # the .bs file if it sees a name in the -l format. - # USE THIS, when dl_findfile() is fixed: - # push(@bsloadlibs, "-l$thislib"); - # OLD USE WAS while checking results against old_extliblist - push(@bsloadlibs, "$fullname"); - } else { - if ($is_dyna){ + if $is_dyna + && !$in_perl + && !$ld_run_path_seen{$fullnamedir}++; + + # Do not add it into the list if it is already linked in + # with the main perl executable. + # We have to special-case the NeXT, because math and ndbm + # are both in libsys_s + unless ( + $in_perl + || ( $Config{'osname'} eq 'next' + && ( $thislib eq 'm' || $thislib eq 'ndbm' ) ) + ) + { + push( @extralibs, "-l$thislib" ); + } + + # We might be able to load this archive file dynamically + if ( ( $Config{'dlsrc'} =~ /dl_next/ && $Config{'osvers'} lt '4_0' ) + || ( $Config{'dlsrc'} =~ /dl_dld/ ) ) + { + + # We push -l$thislib instead of $fullname because + # it avoids hardwiring a fixed path into the .bs file. + # Mkbootstrap will automatically add dl_findfile() to + # the .bs file if it sees a name in the -l format. + # USE THIS, when dl_findfile() is fixed: + # push(@bsloadlibs, "-l$thislib"); + # OLD USE WAS while checking results against old_extliblist + push( @bsloadlibs, "$fullname" ); + } + else { + if ( $is_dyna ) { + # For SunOS4, do not add in this shared library if # it is already linked in the main perl executable - push(@ldloadlibs, "-l$thislib") - unless ($in_perl and $^O eq 'sunos'); - } else { - push(@ldloadlibs, "-l$thislib"); - } - } - last; # found one here so don't bother looking further - } - warn "Note (probably harmless): " - ."No library found for -l$thislib\n" - unless $found_lib>0; + push( @ldloadlibs, "-l$thislib" ) + unless ( $in_perl and $^O eq 'sunos' ); + } + else { + push( @ldloadlibs, "-l$thislib" ); + } + } + last; # found one here so don't bother looking further + } + warn "Note (probably harmless): " . "No library found for -l$thislib\n" + unless $found_lib > 0; } - unless( $found ) { - return ('','','','', ($give_libs ? \@libs : ())); + unless ( $found ) { + return ( '', '', '', '', ( $give_libs ? \@libs : () ) ); } else { - return ("@extralibs", "@bsloadlibs", "@ldloadlibs", - join(":",@ld_run_path), ($give_libs ? \@libs : ())); + return ( "@extralibs", "@bsloadlibs", "@ldloadlibs", join( ":", @ld_run_path ), ( $give_libs ? \@libs : () ) ); } } @@ -221,329 +248,378 @@ sub _win32_ext { require Text::ParseWords; - my($self, $potential_libs, $verbose, $give_libs) = @_; + my ( $self, $potential_libs, $verbose, $give_libs ) = @_; $verbose ||= 0; # If user did not supply a list, we punt. # (caller should probably use the list in $Config{libs}) - return ("", "", "", "", ($give_libs ? [] : ())) unless $potential_libs; - - my $cc = $Config{cc}; - my $VC = $cc =~ /^cl/i; - my $BC = $cc =~ /^bcc/i; - my $GC = $cc =~ /^gcc/i; - my $so = $Config{'so'}; - my $libs = $Config{'perllibs'}; - my $libpth = $Config{'libpth'}; - my $libext = $Config{'lib_ext'} || ".lib"; - my(@libs, %libs_seen); - - if ($libs and $potential_libs !~ /:nodefault/i) { - # If Config.pm defines a set of default libs, we always - # tack them on to the user-supplied list, unless the user - # specified :nodefault - - $potential_libs .= " " if $potential_libs; - $potential_libs .= $libs; - } - warn "Potential libraries are '$potential_libs':\n" if $verbose; + return ( "", "", "", "", ( $give_libs ? [] : () ) ) unless $potential_libs; - # normalize to forward slashes - $libpth =~ s,\\,/,g; - $potential_libs =~ s,\\,/,g; + # TODO: make this use MM_Win32.pm's compiler detection + my %libs_seen; + my @extralibs; + my $cc = $Config{cc} || ''; + my $VC = $cc =~ /\bcl\b/i; + my $GC = $cc =~ /\bgcc\b/i; + my $libext = _win32_lib_extensions(); + my @searchpath = ( '' ); # from "-L/path" entries in $potential_libs + my @libpath = _win32_default_search_paths( $VC ); + my $pwd = cwd(); # from Cwd.pm + my $search = 1; - # compute $extralibs from $potential_libs + # compute @extralibs from $potential_libs + my @lib_search_list = _win32_make_lib_search_list( $potential_libs, $verbose ); + for ( @lib_search_list ) { - my @searchpath; # from "-L/path" in $potential_libs - my @libpath = Text::ParseWords::quotewords('\s+', 0, $libpth); - my @extralibs; - my $pwd = cwd(); # from Cwd.pm - my $lib = ''; - my $found = 0; - my $search = 1; - my($fullname); + my $thislib = $_; - # add "$Config{installarchlib}/CORE" to default search path - push @libpath, "$Config{installarchlib}/CORE"; + # see if entry is a flag + if ( /^:\w+$/ ) { + $search = 0 if lc eq ':nosearch'; + $search = 1 if lc eq ':search'; + _debug( "Ignoring unknown flag '$thislib'\n", $verbose ) if !/^:(no)?(search|default)$/i; + next; + } - if ($VC and exists $ENV{LIB} and $ENV{LIB}) { - push @libpath, split /;/, $ENV{LIB}; - } + # if searching is disabled, do compiler-specific translations + unless ( $search ) { + s/^-l(.+)$/$1.lib/ unless $GC; + s/^-L/-libpath:/ if $VC; + push( @extralibs, $_ ); + next; + } - foreach (Text::ParseWords::quotewords('\s+', 0, $potential_libs)){ + # handle possible linker path arguments + if ( s/^-L// and not -d ) { + _debug( "$thislib ignored, directory does not exist\n", $verbose ); + next; + } + elsif ( -d ) { + unless ( File::Spec->file_name_is_absolute( $_ ) ) { + warn "Warning: '$thislib' changed to '-L$pwd/$_'\n"; + $_ = $self->catdir( $pwd, $_ ); + } + push( @searchpath, $_ ); + next; + } - my $thislib = $_; + my @paths = ( @searchpath, @libpath ); + my ( $fullname, $path ) = _win32_search_file( $thislib, $libext, \@paths, $verbose, $GC ); - # see if entry is a flag - if (/^:\w+$/) { - $search = 0 if lc eq ':nosearch'; - $search = 1 if lc eq ':search'; - warn "Ignoring unknown flag '$thislib'\n" - if $verbose and !/^:(no)?(search|default)$/i; - next; - } - - # if searching is disabled, do compiler-specific translations - unless ($search) { - s/^-l(.+)$/$1.lib/ unless $GC; - s/^-L/-libpath:/ if $VC; - push(@extralibs, $_); - $found++; - next; - } - - # handle possible linker path arguments - if (s/^-L// and not -d) { - warn "$thislib ignored, directory does not exist\n" - if $verbose; - next; - } - elsif (-d) { - unless (File::Spec->file_name_is_absolute($_)) { - warn "Warning: '$thislib' changed to '-L$pwd/$_'\n"; - $_ = $self->catdir($pwd,$_); - } - push(@searchpath, $_); - next; - } - - # handle possible library arguments - if (s/^-l// and $GC and !/^lib/i) { - $_ = "lib$_"; - } - $_ .= $libext if !/\Q$libext\E$/i; - - my $secondpass = 0; - LOOKAGAIN: - - # look for the file itself - if (-f) { - warn "'$thislib' found as '$_'\n" if $verbose; - $found++; - push(@extralibs, $_); - next; - } - - my $found_lib = 0; - foreach my $thispth (@searchpath, @libpath){ - unless (-f ($fullname="$thispth\\$_")) { - warn "'$thislib' not found as '$fullname'\n" if $verbose; - next; - } - warn "'$thislib' found as '$fullname'\n" if $verbose; - $found++; - $found_lib++; - push(@extralibs, $fullname); - push @libs, $fullname unless $libs_seen{$fullname}++; - last; - } - - # do another pass with (or without) leading 'lib' if they used -l - if (!$found_lib and $thislib =~ /^-l/ and !$secondpass++) { - if ($GC) { - goto LOOKAGAIN if s/^lib//i; - } - elsif (!/^lib/i) { - $_ = "lib$_"; - goto LOOKAGAIN; - } - } - - # give up - warn "Note (probably harmless): " - ."No library found for $thislib\n" - unless $found_lib>0; + if ( !$fullname ) { + warn "Note (probably harmless): No library found for $thislib\n"; + next; + } + _debug( "'$thislib' found as '$fullname'\n", $verbose ); + push( @extralibs, $fullname ); + $libs_seen{$fullname} = 1 if $path; # why is this a special case? } - return ('','','','', ($give_libs ? \@libs : ())) unless $found; + my @libs = keys %libs_seen; + + return ( '', '', '', '', ( $give_libs ? \@libs : () ) ) unless @extralibs; # make sure paths with spaces are properly quoted - @extralibs = map { (/\s/ && !/^".*"$/) ? qq["$_"] : $_ } @extralibs; - @libs = map { (/\s/ && !/^".*"$/) ? qq["$_"] : $_ } @libs; - $lib = join(' ',@extralibs); + @extralibs = map { /\s/ ? qq["$_"] : $_ } @extralibs; + @libs = map { /\s/ ? qq["$_"] : $_ } @libs; + + my $lib = join( ' ', @extralibs ); # normalize back to backward slashes (to help braindead tools) # XXX this may break equally braindead GNU tools that don't understand # backslashes, either. Seems like one can't win here. Cursed be CP/M. $lib =~ s,/,\\,g; - warn "Result: $lib\n" if $verbose; - wantarray ? ($lib, '', $lib, '', ($give_libs ? \@libs : ())) : $lib; + _debug( "Result: $lib\n", $verbose ); + wantarray ? ( $lib, '', $lib, '', ( $give_libs ? \@libs : () ) ) : $lib; } +sub _win32_make_lib_search_list { + my ( $potential_libs, $verbose ) = @_; -sub _vms_ext { - my($self, $potential_libs, $verbose, $give_libs) = @_; - $verbose ||= 0; - - my(@crtls,$crtlstr); - @crtls = ( ($Config{'ldflags'} =~ m-/Debug-i ? $Config{'dbgprefix'} : '') - . 'PerlShr/Share' ); - push(@crtls, grep { not /\(/ } split /\s+/, $Config{'perllibs'}); - push(@crtls, grep { not /\(/ } split /\s+/, $Config{'libc'}); - # In general, we pass through the basic libraries from %Config unchanged. - # The one exception is that if we're building in the Perl source tree, and - # a library spec could be resolved via a logical name, we go to some trouble - # to insure that the copy in the local tree is used, rather than one to - # which a system-wide logical may point. - if ($self->{PERL_SRC}) { - my($locspec,$type); - foreach my $lib (@crtls) { - if (($locspec,$type) = $lib =~ m{^([\w\$-]+)(/\w+)?} and $locspec =~ /perl/i) { - if (lc $type eq '/share') { $locspec .= $Config{'exe_ext'}; } - elsif (lc $type eq '/library') { $locspec .= $Config{'lib_ext'}; } - else { $locspec .= $Config{'obj_ext'}; } - $locspec = $self->catfile($self->{PERL_SRC},$locspec); - $lib = "$locspec$type" if -e $locspec; - } - } - } - $crtlstr = @crtls ? join(' ',@crtls) : ''; - - unless ($potential_libs) { - warn "Result:\n\tEXTRALIBS: \n\tLDLOADLIBS: $crtlstr\n" if $verbose; - return ('', '', $crtlstr, '', ($give_libs ? [] : ())); - } - - my(%found,@fndlibs,$ldlib); - my $cwd = cwd(); - my($so,$lib_ext,$obj_ext) = @Config{'so','lib_ext','obj_ext'}; - # List of common Unix library names and their VMS equivalents - # (VMS equivalent of '' indicates that the library is automatically - # searched by the linker, and should be skipped here.) - my(@flibs, %libs_seen); - my %libmap = ( 'm' => '', 'f77' => '', 'F77' => '', 'V77' => '', 'c' => '', - 'malloc' => '', 'crypt' => '', 'resolv' => '', 'c_s' => '', - 'socket' => '', 'X11' => 'DECW$XLIBSHR', - 'Xt' => 'DECW$XTSHR', 'Xm' => 'DECW$XMLIBSHR', - 'Xmu' => 'DECW$XMULIBSHR'); - if ($Config{'vms_cc_type'} ne 'decc') { $libmap{'curses'} = 'VAXCCURSE'; } - - warn "Potential libraries are '$potential_libs'\n" if $verbose; - - # First, sort out directories and library names in the input - my(@dirs, @libs); - foreach my $lib (split ' ',$potential_libs) { - push(@dirs,$1), next if $lib =~ /^-L(.*)/; - push(@dirs,$lib), next if $lib =~ /[:>\]]$/; - push(@dirs,$lib), next if -d $lib; - push(@libs,$1), next if $lib =~ /^-l(.*)/; - push(@libs,$lib); - } - push(@dirs,split(' ',$Config{'libpth'})); - - # Now make sure we've got VMS-syntax absolute directory specs - # (We don't, however, check whether someone's hidden a relative - # path in a logical name.) - foreach my $dir (@dirs) { - unless (-d $dir) { - warn "Skipping nonexistent Directory $dir\n" if $verbose > 1; - $dir = ''; - next; - } - warn "Resolving directory $dir\n" if $verbose; - if (File::Spec->file_name_is_absolute($dir)) { - $dir = $self->fixpath($dir,1); + # If Config.pm defines a set of default libs, we always + # tack them on to the user-supplied list, unless the user + # specified :nodefault + my $libs = $Config{'perllibs'}; + $potential_libs = join( ' ', $potential_libs, $libs ) if $libs and $potential_libs !~ /:nodefault/i; + _debug( "Potential libraries are '$potential_libs':\n", $verbose ); + + $potential_libs =~ s,\\,/,g; # normalize to forward slashes + + my @list = Text::ParseWords::quotewords( '\s+', 0, $potential_libs ); + + return @list; +} + +sub _win32_default_search_paths { + my ( $VC ) = @_; + + my $libpth = $Config{'libpth'} || ''; + $libpth =~ s,\\,/,g; # normalize to forward slashes + + my @libpath = Text::ParseWords::quotewords( '\s+', 0, $libpth ); + push @libpath, "$Config{installarchlib}/CORE"; # add "$Config{installarchlib}/CORE" to default search path + + if ( $VC and exists $ENV{LIB} and $ENV{LIB} ) { + push @libpath, split /;/, $ENV{LIB}; } - else { - $dir = $self->catdir($cwd,$dir); + + return @libpath; +} + +sub _win32_search_file { + my ( $thislib, $libext, $paths, $verbose, $GC ) = @_; + + my @file_list = _win32_build_file_list( $thislib, $GC, $libext ); + + for my $lib_file ( @file_list ) { + for my $path ( @{$paths} ) { + my $fullname = $lib_file; + $fullname = "$path\\$fullname" if $path; + + return ( $fullname, $path ) if -f $fullname; + + _debug( "'$thislib' not found as '$fullname'\n", $verbose ); + } } - } - @dirs = grep { length($_) } @dirs; - unshift(@dirs,''); # Check each $lib without additions first - - LIB: foreach my $lib (@libs) { - if (exists $libmap{$lib}) { - next unless length $libmap{$lib}; - $lib = $libmap{$lib}; + + return; +} + +sub _win32_build_file_list { + my ( $lib, $GC, $extensions ) = @_; + + my @pre_fixed = _win32_build_prefixed_list( $lib, $GC ); + return map _win32_attach_extensions( $_, $extensions ), @pre_fixed; +} + +sub _win32_build_prefixed_list { + my ( $lib, $GC ) = @_; + + return $lib if $lib !~ s/^-l//; + return $lib if $lib =~ /^lib/ and !$GC; + + ( my $no_prefix = $lib ) =~ s/^lib//i; + $lib = "lib$lib" if $no_prefix eq $lib; + + return ( $lib, $no_prefix ) if $GC; + return ( $no_prefix, $lib ); +} + +sub _win32_attach_extensions { + my ( $lib, $extensions ) = @_; + return map _win32_try_attach_extension( $lib, $_ ), @{$extensions}; +} + +sub _win32_try_attach_extension { + my ( $lib, $extension ) = @_; + + return $lib if $lib =~ /\Q$extension\E$/i; + return "$lib$extension"; +} + +sub _win32_lib_extensions { + my %extensions; + $extensions{ $Config{'lib_ext'} } = 1 if $Config{'lib_ext'}; + $extensions{".lib"} = 1; + return [ keys %extensions ]; +} + +sub _debug { + my ( $message, $verbose ) = @_; + return if !$verbose; + warn $message; + return; +} + +sub _vms_ext { + my ( $self, $potential_libs, $verbose, $give_libs ) = @_; + $verbose ||= 0; + + my ( @crtls, $crtlstr ); + @crtls = ( ( $Config{'ldflags'} =~ m-/Debug-i ? $Config{'dbgprefix'} : '' ) . 'PerlShr/Share' ); + push( @crtls, grep { not /\(/ } split /\s+/, $Config{'perllibs'} ); + push( @crtls, grep { not /\(/ } split /\s+/, $Config{'libc'} ); + + # In general, we pass through the basic libraries from %Config unchanged. + # The one exception is that if we're building in the Perl source tree, and + # a library spec could be resolved via a logical name, we go to some trouble + # to insure that the copy in the local tree is used, rather than one to + # which a system-wide logical may point. + if ( $self->{PERL_SRC} ) { + my ( $locspec, $type ); + foreach my $lib ( @crtls ) { + if ( ( $locspec, $type ) = $lib =~ m{^([\w\$-]+)(/\w+)?} and $locspec =~ /perl/i ) { + if ( lc $type eq '/share' ) { $locspec .= $Config{'exe_ext'}; } + elsif ( lc $type eq '/library' ) { $locspec .= $Config{'lib_ext'}; } + else { $locspec .= $Config{'obj_ext'}; } + $locspec = $self->catfile( $self->{PERL_SRC}, $locspec ); + $lib = "$locspec$type" if -e $locspec; + } + } } + $crtlstr = @crtls ? join( ' ', @crtls ) : ''; - my(@variants,$cand); - my($ctype) = ''; + unless ( $potential_libs ) { + warn "Result:\n\tEXTRALIBS: \n\tLDLOADLIBS: $crtlstr\n" if $verbose; + return ( '', '', $crtlstr, '', ( $give_libs ? [] : () ) ); + } - # If we don't have a file type, consider it a possibly abbreviated name and - # check for common variants. We try these first to grab libraries before - # a like-named executable image (e.g. -lperl resolves to perlshr.exe - # before perl.exe). - if ($lib !~ /\.[^:>\]]*$/) { - push(@variants,"${lib}shr","${lib}rtl","${lib}lib"); - push(@variants,"lib$lib") if $lib !~ /[:>\]]/; + my ( %found, @fndlibs, $ldlib ); + my $cwd = cwd(); + my ( $so, $lib_ext, $obj_ext ) = @Config{ 'so', 'lib_ext', 'obj_ext' }; + + # List of common Unix library names and their VMS equivalents + # (VMS equivalent of '' indicates that the library is automatically + # searched by the linker, and should be skipped here.) + my ( @flibs, %libs_seen ); + my %libmap = ( + 'm' => '', + 'f77' => '', + 'F77' => '', + 'V77' => '', + 'c' => '', + 'malloc' => '', + 'crypt' => '', + 'resolv' => '', + 'c_s' => '', + 'socket' => '', + 'X11' => 'DECW$XLIBSHR', + 'Xt' => 'DECW$XTSHR', + 'Xm' => 'DECW$XMLIBSHR', + 'Xmu' => 'DECW$XMULIBSHR' + ); + if ( $Config{'vms_cc_type'} ne 'decc' ) { $libmap{'curses'} = 'VAXCCURSE'; } + + warn "Potential libraries are '$potential_libs'\n" if $verbose; + + # First, sort out directories and library names in the input + my ( @dirs, @libs ); + foreach my $lib ( split ' ', $potential_libs ) { + push( @dirs, $1 ), next if $lib =~ /^-L(.*)/; + push( @dirs, $lib ), next if $lib =~ /[:>\]]$/; + push( @dirs, $lib ), next if -d $lib; + push( @libs, $1 ), next if $lib =~ /^-l(.*)/; + push( @libs, $lib ); } - push(@variants,$lib); - warn "Looking for $lib\n" if $verbose; - foreach my $variant (@variants) { - my($fullname, $name); - - foreach my $dir (@dirs) { - my($type); - - $name = "$dir$variant"; - warn "\tChecking $name\n" if $verbose > 2; - $fullname = VMS::Filespec::rmsexpand($name); - if (defined $fullname and -f $fullname) { - # It's got its own suffix, so we'll have to figure out the type - if ($fullname =~ /(?:$so|exe)$/i) { $type = 'SHR'; } - elsif ($fullname =~ /(?:$lib_ext|olb)$/i) { $type = 'OLB'; } - elsif ($fullname =~ /(?:$obj_ext|obj)$/i) { - warn "Note (probably harmless): " - ."Plain object file $fullname found in library list\n"; - $type = 'OBJ'; - } - else { - warn "Note (probably harmless): " - ."Unknown library type for $fullname; assuming shared\n"; - $type = 'SHR'; - } + push( @dirs, split( ' ', $Config{'libpth'} ) ); + + # Now make sure we've got VMS-syntax absolute directory specs + # (We don't, however, check whether someone's hidden a relative + # path in a logical name.) + foreach my $dir ( @dirs ) { + unless ( -d $dir ) { + warn "Skipping nonexistent Directory $dir\n" if $verbose > 1; + $dir = ''; + next; } - elsif (-f ($fullname = VMS::Filespec::rmsexpand($name,$so)) or - -f ($fullname = VMS::Filespec::rmsexpand($name,'.exe'))) { - $type = 'SHR'; - $name = $fullname unless $fullname =~ /exe;?\d*$/i; + warn "Resolving directory $dir\n" if $verbose; + if ( File::Spec->file_name_is_absolute( $dir ) ) { + $dir = $self->fixpath( $dir, 1 ); } - elsif (not length($ctype) and # If we've got a lib already, - # don't bother - ( -f ($fullname = VMS::Filespec::rmsexpand($name,$lib_ext)) or - -f ($fullname = VMS::Filespec::rmsexpand($name,'.olb')))) { - $type = 'OLB'; - $name = $fullname unless $fullname =~ /olb;?\d*$/i; + else { + $dir = $self->catdir( $cwd, $dir ); } - elsif (not length($ctype) and # If we've got a lib already, - # don't bother - ( -f ($fullname = VMS::Filespec::rmsexpand($name,$obj_ext)) or - -f ($fullname = VMS::Filespec::rmsexpand($name,'.obj')))) { - warn "Note (probably harmless): " - ."Plain object file $fullname found in library list\n"; - $type = 'OBJ'; - $name = $fullname unless $fullname =~ /obj;?\d*$/i; + } + @dirs = grep { length( $_ ) } @dirs; + unshift( @dirs, '' ); # Check each $lib without additions first + + LIB: foreach my $lib ( @libs ) { + if ( exists $libmap{$lib} ) { + next unless length $libmap{$lib}; + $lib = $libmap{$lib}; } - if (defined $type) { - $ctype = $type; $cand = $name; - last if $ctype eq 'SHR'; + + my ( @variants, $cand ); + my ( $ctype ) = ''; + + # If we don't have a file type, consider it a possibly abbreviated name and + # check for common variants. We try these first to grab libraries before + # a like-named executable image (e.g. -lperl resolves to perlshr.exe + # before perl.exe). + if ( $lib !~ /\.[^:>\]]*$/ ) { + push( @variants, "${lib}shr", "${lib}rtl", "${lib}lib" ); + push( @variants, "lib$lib" ) if $lib !~ /[:>\]]/; + } + push( @variants, $lib ); + warn "Looking for $lib\n" if $verbose; + foreach my $variant ( @variants ) { + my ( $fullname, $name ); + + foreach my $dir ( @dirs ) { + my ( $type ); + + $name = "$dir$variant"; + warn "\tChecking $name\n" if $verbose > 2; + $fullname = VMS::Filespec::rmsexpand( $name ); + if ( defined $fullname and -f $fullname ) { + + # It's got its own suffix, so we'll have to figure out the type + if ( $fullname =~ /(?:$so|exe)$/i ) { $type = 'SHR'; } + elsif ( $fullname =~ /(?:$lib_ext|olb)$/i ) { $type = 'OLB'; } + elsif ( $fullname =~ /(?:$obj_ext|obj)$/i ) { + warn "Note (probably harmless): " . "Plain object file $fullname found in library list\n"; + $type = 'OBJ'; + } + else { + warn "Note (probably harmless): " . "Unknown library type for $fullname; assuming shared\n"; + $type = 'SHR'; + } + } + elsif (-f ( $fullname = VMS::Filespec::rmsexpand( $name, $so ) ) + or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.exe' ) ) ) + { + $type = 'SHR'; + $name = $fullname unless $fullname =~ /exe;?\d*$/i; + } + elsif ( + not length( $ctype ) and # If we've got a lib already, + # don't bother + ( -f ( $fullname = VMS::Filespec::rmsexpand( $name, $lib_ext ) ) or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.olb' ) ) ) + ) + { + $type = 'OLB'; + $name = $fullname unless $fullname =~ /olb;?\d*$/i; + } + elsif ( + not length( $ctype ) and # If we've got a lib already, + # don't bother + ( -f ( $fullname = VMS::Filespec::rmsexpand( $name, $obj_ext ) ) or -f ( $fullname = VMS::Filespec::rmsexpand( $name, '.obj' ) ) ) + ) + { + warn "Note (probably harmless): " . "Plain object file $fullname found in library list\n"; + $type = 'OBJ'; + $name = $fullname unless $fullname =~ /obj;?\d*$/i; + } + if ( defined $type ) { + $ctype = $type; + $cand = $name; + last if $ctype eq 'SHR'; + } + } + if ( $ctype ) { + + # This has to precede any other CRTLs, so just make it first + if ( $cand eq 'VAXCCURSE' ) { unshift @{ $found{$ctype} }, $cand; } + else { push @{ $found{$ctype} }, $cand; } + warn "\tFound as $cand (really $fullname), type $ctype\n" + if $verbose > 1; + push @flibs, $name unless $libs_seen{$fullname}++; + next LIB; + } } - } - if ($ctype) { - # This has to precede any other CRTLs, so just make it first - if ($cand eq 'VAXCCURSE') { unshift @{$found{$ctype}}, $cand; } - else { push @{$found{$ctype}}, $cand; } - warn "\tFound as $cand (really $fullname), type $ctype\n" - if $verbose > 1; - push @flibs, $name unless $libs_seen{$fullname}++; - next LIB; - } + warn "Note (probably harmless): " . "No library found for $lib\n"; } - warn "Note (probably harmless): " - ."No library found for $lib\n"; - } - - push @fndlibs, @{$found{OBJ}} if exists $found{OBJ}; - push @fndlibs, map { "$_/Library" } @{$found{OLB}} if exists $found{OLB}; - push @fndlibs, map { "$_/Share" } @{$found{SHR}} if exists $found{SHR}; - my $lib = join(' ',@fndlibs); - - $ldlib = $crtlstr ? "$lib $crtlstr" : $lib; - warn "Result:\n\tEXTRALIBS: $lib\n\tLDLOADLIBS: $ldlib\n" if $verbose; - wantarray ? ($lib, '', $ldlib, '', ($give_libs ? \@flibs : ())) : $lib; + + push @fndlibs, @{ $found{OBJ} } if exists $found{OBJ}; + push @fndlibs, map { "$_/Library" } @{ $found{OLB} } if exists $found{OLB}; + push @fndlibs, map { "$_/Share" } @{ $found{SHR} } if exists $found{SHR}; + my $lib = join( ' ', @fndlibs ); + + $ldlib = $crtlstr ? "$lib $crtlstr" : $lib; + warn "Result:\n\tEXTRALIBS: $lib\n\tLDLOADLIBS: $ldlib\n" if $verbose; + wantarray ? ( $lib, '', $ldlib, '', ( $give_libs ? \@flibs : () ) ) : $lib; } 1; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm index 945f24513b..ce3e0738ad 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm @@ -3,7 +3,7 @@ package ExtUtils::MM; use strict; use ExtUtils::MakeMaker::Config; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::Liblist; require ExtUtils::MakeMaker; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_AIX.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_AIX.pm index 021238523e..3d33e7fdad 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_AIX.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_AIX.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_AIX; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm index a38f2740f7..6a50c012df 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_Any; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; use Carp; use File::Spec; @@ -486,8 +486,8 @@ clean :: clean_subdirs split /\s+/, $attribs{FILES} ; } - push(@files, qw[$(MAKE_APERL_FILE) - MYMETA.yml perlmain.c tmon.out mon.out so_locations + push(@files, qw[$(MAKE_APERL_FILE) + MYMETA.json MYMETA.yml perlmain.c tmon.out mon.out so_locations blibdirs.ts pm_to_blib pm_to_blib.ts *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT) $(BOOTSTRAP) $(BASEEXT).bso @@ -728,6 +728,13 @@ CMD return $manify; } +sub _has_cpan_meta { + return eval { + $INC{'CPAN/Meta.pm'} or require CPAN::Meta; + CPAN::Meta->VERSION(2.110350); + 1; + }; +} =head3 metafile_target @@ -743,28 +750,106 @@ possible. sub metafile_target { my $self = shift; - - return <<'MAKE_FRAG' if $self->{NO_META}; + return <<'MAKE_FRAG' if $self->{NO_META} or ! _has_cpan_meta(); metafile : $(NOECHO) $(NOOP) MAKE_FRAG - my @metadata = $self->metafile_data( + my %metadata = $self->metafile_data( $self->{META_ADD} || {}, $self->{META_MERGE} || {}, ); - my $meta = $self->metafile_file(@metadata); - my @write_meta = $self->echo($meta, 'META_new.yml'); + + _fix_metadata_before_conversion( \%metadata ); + + # paper over validation issues, but still complain, necessary because + # there's no guarantee that the above will fix ALL errors + my $meta = eval { CPAN::Meta->create( \%metadata, { lazy_validation => 1 } ) }; + warn $@ if $@ and + $@ !~ /encountered CODE.*, but JSON can only represent references to arrays or hashes/; + + # use the original metadata straight if the conversion failed + # or if it can't be stringified. + if( !$meta || + !eval { $meta->as_string( { version => "1.4" } ) } || + !eval { $meta->as_string } + ) + { + $meta = bless \%metadata, 'CPAN::Meta'; + } - return sprintf <<'MAKE_FRAG', join("\n\t", @write_meta); + my @write_metayml = $self->echo( + $meta->as_string({version => "1.4"}), 'META_new.yml' + ); + my @write_metajson = $self->echo( + $meta->as_string(), 'META_new.json' + ); + + my $metayml = join("\n\t", @write_metayml); + my $metajson = join("\n\t", @write_metajson); + return sprintf <<'MAKE_FRAG', $metayml, $metajson; metafile : create_distdir $(NOECHO) $(ECHO) Generating META.yml %s -$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml + $(NOECHO) $(ECHO) Generating META.json + %s + -$(NOECHO) $(MV) META_new.json $(DISTVNAME)/META.json MAKE_FRAG } +=begin private + +=head3 _fix_metadata_before_conversion + + _fix_metadata_before_conversion( \%metadata ); + +Fixes errors in the metadata before it's handed off to CPAN::Meta for +conversion. This hopefully results in something that can be used further +on, no guarantee is made though. + +=end private + +=cut + +sub _fix_metadata_before_conversion { + my ( $metadata ) = @_; + + my $bad_version = $metadata->{version} && + !CPAN::Meta::Validator->new->version( 'version', $metadata->{version} ); + + # just delete all invalid versions + if( $bad_version ) { + warn "Can't parse version '$metadata->{version}'\n"; + $metadata->{version} = ''; + } + + my $validator = CPAN::Meta::Validator->new( $metadata ); + return if $validator->is_valid; + + # fix non-camelcase custom resource keys (only other trick we know) + for my $error ( $validator->errors ) { + my ( $key ) = ( $error =~ /Custom resource '(.*)' must be in CamelCase./ ); + next if !$key; + + # first try to remove all non-alphabetic chars + ( my $new_key = $key ) =~ s/[^_a-zA-Z]//g; + + # if that doesn't work, uppercase first one + $new_key = ucfirst $new_key if !$validator->custom_1( $new_key ); + + # copy to new key if that worked + $metadata->{resources}{$new_key} = $metadata->{resources}{$key} + if $validator->custom_1( $new_key ); + + # and delete old one in any case + delete $metadata->{resources}{$key}; + } + + return; +} + =begin private @@ -816,57 +901,16 @@ sub metafile_data { my $self = shift; my($meta_add, $meta_merge) = @_; - # The order in which standard meta keys should be written. - my @meta_order = qw( - name - version - abstract - author - license - distribution_type - - configure_requires - build_requires - requires - - resources - - provides - no_index - - generated_by - meta-spec - ); - - # Check the original args so we can tell between the user setting it - # to an empty hash and it just being initialized. - my $configure_requires; - if( $self->{ARGS}{CONFIGURE_REQUIRES} ) { - $configure_requires = $self->{CONFIGURE_REQUIRES}; - } else { - $configure_requires = { - 'ExtUtils::MakeMaker' => 0, - }; - } - my $build_requires; - if( $self->{ARGS}{BUILD_REQUIRES} ) { - $build_requires = $self->{BUILD_REQUIRES}; - } else { - $build_requires = { - 'ExtUtils::MakeMaker' => 0, - }; - } - my %meta = ( + # required name => $self->{DISTNAME}, - version => $self->{VERSION}, - abstract => $self->{ABSTRACT}, + version => _normalize_version($self->{VERSION}), + abstract => $self->{ABSTRACT} || 'unknown', license => $self->{LICENSE} || 'unknown', - distribution_type => $self->{PM} ? 'module' : 'script', + dynamic_config => 1, - configure_requires => $configure_requires, - - build_requires => $build_requires, + # optional + distribution_type => $self->{PM} ? 'module' : 'script', no_index => { directory => [qw(t inc)] @@ -882,8 +926,18 @@ sub metafile_data { # The author key is required and it takes a list. $meta{author} = defined $self->{AUTHOR} ? $self->{AUTHOR} : []; - $meta{requires} = $self->{PREREQ_PM} if defined $self->{PREREQ_PM}; - $meta{requires}{perl} = $self->{MIN_PERL_VERSION} if $self->{MIN_PERL_VERSION}; + # Check the original args so we can tell between the user setting it + # to an empty hash and it just being initialized. + if( $self->{ARGS}{CONFIGURE_REQUIRES} ) { + $meta{configure_requires} + = _normalize_prereqs($self->{CONFIGURE_REQUIRES}); + } else { + $meta{configure_requires} = { + 'ExtUtils::MakeMaker' => 0, + }; + } + + %meta = $self->_add_requirements_to_meta( %meta ); while( my($key, $val) = each %$meta_add ) { $meta{$key} = $val; @@ -893,24 +947,62 @@ sub metafile_data { $self->_hash_merge(\%meta, $key, $val); } - my @meta_pairs; + return %meta; +} + - # Put the standard keys first in the proper order. - for my $key (@meta_order) { - next unless exists $meta{$key}; +=begin private - push @meta_pairs, $key, delete $meta{$key}; - } +=cut - # Then tack everything else onto the end, alpha sorted. - for my $key (sort {lc $a cmp lc $b} keys %meta) { - push @meta_pairs, $key, $meta{$key}; +sub _add_requirements_to_meta { + my ( $self, %meta ) = @_; + + # Check the original args so we can tell between the user setting it + # to an empty hash and it just being initialized. + + if( $self->{ARGS}{BUILD_REQUIRES} ) { + $meta{build_requires} = _normalize_prereqs($self->{BUILD_REQUIRES}); + } else { + $meta{build_requires} = { + 'ExtUtils::MakeMaker' => 0, + }; } - return @meta_pairs + $meta{requires} = _normalize_prereqs($self->{PREREQ_PM}) + if defined $self->{PREREQ_PM}; + $meta{requires}{perl} = _normalize_version($self->{MIN_PERL_VERSION}) + if $self->{MIN_PERL_VERSION}; + + return %meta; } -=begin private +sub _normalize_prereqs { + my ($hash) = @_; + my %prereqs; + while ( my ($k,$v) = each %$hash ) { + $prereqs{$k} = _normalize_version($v); + } + return \%prereqs; +} + +# Adapted from Module::Build::Base +sub _normalize_version { + my ($version) = @_; + $version = 0 unless defined $version; + + if ( ref $version eq 'version' ) { # version objects + $version = $version->is_qv ? $version->normal : $version->stringify; + } + elsif ( $version =~ /^[^v][^.]*\.[^.]+\./ ) { # no leading v, multiple dots + # normalize string tuples without "v": "1.2.3" -> "v1.2.3" + $version = "v$version"; + } + else { + # leave alone + } + return $version; +} =head3 _dump_hash @@ -1069,16 +1161,25 @@ distdir. sub distmeta_target { my $self = shift; - my $add_meta = $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']); -eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) } + my @add_meta = ( + $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']), +exit unless -e q{META.yml}; +eval { maniadd({q{META.yml} => q{Module YAML meta-data (added by MakeMaker)}}) } or print "Could not add META.yml to MANIFEST: $${'@'}\n" CODE + $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']) +exit unless -f q{META.json}; +eval { maniadd({q{META.json} => q{Module JSON meta-data (added by MakeMaker)}}) } + or print "Could not add META.json to MANIFEST: $${'@'}\n" +CODE + ); - my $add_meta_to_distdir = $self->cd('$(DISTVNAME)', $add_meta); + my @add_meta_to_distdir = map { $self->cd('$(DISTVNAME)', $_) } @add_meta; - return sprintf <<'MAKE', $add_meta_to_distdir; + return sprintf <<'MAKE', @add_meta_to_distdir; distmeta : create_distdir metafile $(NOECHO) %s + $(NOECHO) %s MAKE @@ -1096,12 +1197,9 @@ or from internal data. sub mymeta { my $self = shift; + my $file = shift || ''; # for testing - my $mymeta; - - if ( -e 'META.yml' ) { - $mymeta = $self->_mymeta_from_meta(); - } + my $mymeta = $self->_mymeta_from_meta($file); unless ( $mymeta ) { my @metadata = $self->metafile_data( @@ -1111,6 +1209,10 @@ sub mymeta { $mymeta = {@metadata}; } + # Overwrite the non-configure dependency hashes + + $mymeta = { $self->_add_requirements_to_meta( %$mymeta ) }; + $mymeta->{dynamic_config} = 0; return $mymeta; @@ -1119,14 +1221,20 @@ sub mymeta { sub _mymeta_from_meta { my $self = shift; + my $metafile = shift || ''; # for testing + + return unless _has_cpan_meta(); my $meta; - eval { - my @yaml = ExtUtils::MakeMaker::YAML::LoadFile('META.yml'); - $meta = $yaml[0]; - }; + for my $file ( $metafile, "META.json", "META.yml" ) { + next unless -e $file; + eval { + $meta = CPAN::Meta->load_file($file)->as_struct( {version => "1.4"} ); + }; + last if $meta; + } return undef unless $meta; - + # META.yml before 6.25_01 cannot be trusted. META.yml lived in the source directory. # There was a good chance the author accidentally uploaded a stale META.yml if they # rolled their own tarball rather than using "make dist". @@ -1138,20 +1246,9 @@ sub _mymeta_from_meta { } } - # Overwrite the non-configure dependency hashs - delete $meta->{requires}; - delete $meta->{build_requires}; - delete $meta->{recommends}; - if ( exists $self->{PREREQ_PM} ) { - $meta->{requires} = $self->{PREREQ_PM} || {}; - } - if ( exists $self->{BUILD_REQUIRES} ) { - $meta->{build_requires} = $self->{BUILD_REQUIRES} || {}; - } return $meta; } - =head3 write_mymeta $self->write_mymeta( $mymeta ); @@ -1166,18 +1263,19 @@ sub write_mymeta { my $self = shift; my $mymeta = shift; - require ExtUtils::MakeMaker::YAML; - my $mymeta_content = ExtUtils::MakeMaker::YAML::Dump($mymeta); + return unless _has_cpan_meta(); - open(my $myfh, ">", "MYMETA.yml") - or die "Unable to open MYMETA.yml: $!"; - print $myfh $mymeta_content; - close $myfh; - - return; + _fix_metadata_before_conversion( $mymeta ); + + # this can still blow up + # not sure if i should just eval this and skip file creation if it + # blows up + my $meta_obj = CPAN::Meta->new( $mymeta, { lazy_validation => 1 } ); + $meta_obj->save( 'MYMETA.json' ); + $meta_obj->save( 'MYMETA.yml', { version => "1.4" } ); + return 1; } - =head3 realclean (o) Defines the realclean target. @@ -1398,7 +1496,7 @@ sub init_INST { # perl has been built and installed. Setting INST_LIB allows # you to build directly into, say $Config{privlibexp}. unless ($self->{INST_LIB}){ - if ($self->{PERL_CORE}) { + if ($self->{PERL_CORE}) { if (defined $Cross::platform) { $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->catdir($self->{PERL_LIB},"..","xlib", @@ -1407,9 +1505,9 @@ sub init_INST { else { $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB}; } - } else { - $self->{INST_LIB} = $self->catdir($Curdir,"blib","lib"); - } + } else { + $self->{INST_LIB} = $self->catdir($Curdir,"blib","lib"); + } } my @parentdir = split(/::/, $self->{PARENT_NAME}); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_BeOS.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_BeOS.pm index 0eeb795e48..15918c9e0a 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_BeOS.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_BeOS.pm @@ -26,7 +26,7 @@ require ExtUtils::MM_Any; require ExtUtils::MM_Unix; our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; =item os_flavor diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm index d6ce3a7d68..7417b436e9 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm @@ -9,7 +9,7 @@ require ExtUtils::MM_Unix; require ExtUtils::MM_Win32; our @ISA = qw( ExtUtils::MM_Unix ); -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; =head1 NAME diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_DOS.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_DOS.pm index 68612a80ac..915fc33cf4 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_DOS.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_DOS.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_DOS; use strict; -our $VERSION = 6.57_05; +our $VERSION = '6.58'; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Darwin.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Darwin.pm index 20aeb79164..ca120a346c 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Darwin.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Darwin.pm @@ -7,7 +7,7 @@ BEGIN { our @ISA = qw( ExtUtils::MM_Unix ); } -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; =head1 NAME diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_MacOS.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_MacOS.pm index 4dcb6e55ec..33e5036e28 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_MacOS.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_MacOS.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_MacOS; use strict; -our $VERSION = 6.57_05; +our $VERSION = '6.58'; sub new { die <<'UNSUPPORTED'; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_NW5.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_NW5.pm index 2089e8f88c..3e4ca58e52 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_NW5.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_NW5.pm @@ -22,7 +22,7 @@ use strict; use ExtUtils::MakeMaker::Config; use File::Basename; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Win32; our @ISA = qw(ExtUtils::MM_Win32); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_OS2.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_OS2.pm index 46d57be293..4d10020408 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_OS2.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_OS2.pm @@ -5,7 +5,7 @@ use strict; use ExtUtils::MakeMaker qw(neatvalue); use File::Spec; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_QNX.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_QNX.pm index 5efd3771f3..f81c1c30b7 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_QNX.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_QNX.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_QNX; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_UWIN.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_UWIN.pm index 032bf35b84..6b9b6a6b02 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_UWIN.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_UWIN.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_UWIN; use strict; -our $VERSION = 6.57_05; +our $VERSION = '6.58'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm index 6964eea088..b8548876c2 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm @@ -15,7 +15,8 @@ use ExtUtils::MakeMaker qw($Verbose neatvalue); # If we make $VERSION an our variable parse_version() breaks use vars qw($VERSION); -$VERSION = '6.57_05'; +$VERSION = '6.58'; +$VERSION = eval $VERSION; require ExtUtils::MM_Any; our @ISA = qw(ExtUtils::MM_Any); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VMS.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VMS.pm index d6b63eba63..3d52b87e23 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VMS.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VMS.pm @@ -15,7 +15,7 @@ BEGIN { use File::Basename; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VOS.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VOS.pm index e5b60d78e3..9a427c6c31 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VOS.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_VOS.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_VOS; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win32.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win32.pm index faaf219ecb..5a1fd32234 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win32.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win32.pm @@ -27,13 +27,21 @@ use ExtUtils::MakeMaker qw( neatvalue ); require ExtUtils::MM_Any; require ExtUtils::MM_Unix; our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; $ENV{EMXSHELL} = 'sh'; # to run `commands` -my $BORLAND = $Config{'cc'} =~ /^bcc/i ? 1 : 0; -my $GCC = $Config{'cc'} =~ /\bgcc$/i ? 1 : 0; -my $DLLTOOL = $Config{'dlltool'} || 'dlltool'; +my ( $BORLAND, $GCC, $DLLTOOL ) = _identify_compiler_environment( \%Config ); + +sub _identify_compiler_environment { + my ( $config ) = @_; + + my $BORLAND = $config->{cc} =~ /^bcc/i ? 1 : 0; + my $GCC = $config->{cc} =~ /\bgcc\b/i ? 1 : 0; + my $DLLTOOL = $config->{dlltool} || 'dlltool'; + + return ( $BORLAND, $GCC, $DLLTOOL ); +} =head2 Overridden methods @@ -195,6 +203,8 @@ sub init_platform { my($self) = shift; $self->{MM_Win32_VERSION} = $VERSION; + + return; } sub platform_constants { @@ -211,6 +221,36 @@ sub platform_constants { } +=item constants + +Add MAXLINELENGTH for dmake before all the constants are output. + +=cut + +sub constants { + my $self = shift; + + my $make_text = $self->SUPER::constants; + return $make_text unless $self->is_make_type('dmake'); + + # dmake won't read any single "line" (even those with escaped newlines) + # larger than a certain size which can be as small as 8k. PM_TO_BLIB + # on large modules like DateTime::TimeZone can create lines over 32k. + # So we'll crank it up to a <ironic>WHOPPING</ironic> 64k. + # + # This has to come here before all the constants and not in + # platform_constants which is after constants. + my $size = $self->{MAXLINELENGTH} || 64 * 1024; + my $prefix = qq{ +# Get dmake to read long commands like PM_TO_BLIB +MAXLINELENGTH = $size + +}; + + return $prefix . $make_text; +} + + =item special_targets Add .USESHELL target for dmake. @@ -447,9 +487,31 @@ sub oneliner { sub quote_literal { my($self, $text) = @_; - # I don't know if this is correct, but it seems to work on - # Win98's command.com - $text =~ s{"}{\\"}g; + # DOS batch processing is hilarious: + # Quotes need to be converted into triple quotes. + # Certain special characters need to be escaped with a caret if an odd + # number of quotes came before them. + my @text = split '', $text; + my $quote_count = 0; + my %caret_chars = map { $_ => 1 } qw( < > | ); + for my $char ( @text ) { + if ( $char eq '"' ) { + $quote_count++; + $char = '"""'; + } + elsif ( $caret_chars{$char} and $quote_count % 2 ) { + $char = "^$char"; + } + elsif ( $char eq "\\" ) { + $char = "\\\\"; + } + } + $text = join '', @text; + + # There is a terribly confusing edge case here, where this will do entirely the wrong thing: + # perl -e "use Data::Dumper; @ARGV = '%PATH%'; print Dumper( \@ARGV );print qq{@ARGV};" -- + # I have no idea how to fix this manually, much less programmatically. + # However as it is such a rare edge case i'll just leave this documentation here and hope it never happens. # dmake eats '{' inside double quotes and leaves alone { outside double # quotes; however it transforms {{ into { either inside and outside double diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win95.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win95.pm index 19f5c7d61e..71115a86e5 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win95.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win95.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_Win95; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require ExtUtils::MM_Win32; our @ISA = qw(ExtUtils::MM_Win32); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MY.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MY.pm index 464f814f0f..5591d4741d 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MY.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MY.pm @@ -3,7 +3,7 @@ package ExtUtils::MY; use strict; require ExtUtils::MM; -our $VERSION = 6.57_05; +our $VERSION = '6.58'; our @ISA = qw(ExtUtils::MM); { diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm index be9624e389..6173b6be09 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm @@ -7,7 +7,7 @@ BEGIN {require 5.006;} require Exporter; use ExtUtils::MakeMaker::Config; -use Carp (); +use Carp; use File::Path; our $Verbose = 0; # exported @@ -18,7 +18,8 @@ our @Overridable; my @Prepend_parent; my %Recognized_Att_Keys; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; +$VERSION = eval $VERSION; # Emulate something resembling CVS $Revision$ (our $Revision = $VERSION) =~ s{_}{}; @@ -47,13 +48,13 @@ require ExtUtils::MY; # XXX pre-5.8 versions of ExtUtils::Embed expect sub WriteMakefile { - Carp::croak "WriteMakefile: Need even number of args" if @_ % 2; + croak "WriteMakefile: Need even number of args" if @_ % 2; require ExtUtils::MY; my %att = @_; _convert_compat_attrs(\%att); - + _verify_att(\%att); my $mm = MM->new(\%att); @@ -114,7 +115,7 @@ my %Special_Sigs = ( @Att_Sigs{keys %Recognized_Att_Keys} = ('') x keys %Recognized_Att_Keys; @Att_Sigs{keys %Special_Sigs} = values %Special_Sigs; -sub _convert_compat_attrs { +sub _convert_compat_attrs { #result of running several times should be same my($att) = @_; if (exists $att->{AUTHOR}) { if ($att->{AUTHOR}) { @@ -176,7 +177,7 @@ sub _format_att { sub prompt ($;$) { ## no critic my($mess, $def) = @_; - Carp::confess("prompt function called without an argument") + confess("prompt function called without an argument") unless defined $mess; my $isa_tty = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; @@ -224,7 +225,7 @@ sub eval_in_subdirs { sub eval_in_x { my($self,$dir) = @_; - chdir $dir or Carp::carp("Couldn't change to directory $dir: $!"); + chdir $dir or carp("Couldn't change to directory $dir: $!"); { package main; @@ -401,6 +402,8 @@ sub new { my($class,$self) = @_; my($key); + _convert_compat_attrs($self) if defined $self && $self; + # Store the original args passed to WriteMakefile() foreach my $k (keys %$self) { $self->{ARGS}{$k} = $self->{$k}; @@ -408,13 +411,17 @@ sub new { $self = {} unless defined $self; - $self->{PREREQ_PM} ||= {}; - $self->{BUILD_REQUIRES} ||= {}; - # Temporarily bless it into MM so it can be used as an # object. It will be blessed into a temp package later. bless $self, "MM"; + # Cleanup all the module requirement bits + for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES)) { + $self->{$key} ||= {}; + $self->clean_versions( $key ); + } + + if ("@ARGV" =~ /\bPREREQ_PRINT\b/) { $self->_PREREQ_PRINT; } @@ -446,7 +453,7 @@ sub new { }; if (!$perl_version_ok) { if (!defined $perl_version_ok) { - warn <<'END'; + die <<'END'; Warning: MIN_PERL_VERSION is not in a recognized format. Recommended is a quoted numerical value like '5.005' or '5.008001'. END @@ -515,13 +522,13 @@ END _convert_compat_attrs(\%configure_att); $self = { %$self, %configure_att }; } else { - Carp::croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n"; + croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n"; } } # This is for old Makefiles written pre 5.00, will go away if ( Carp::longmess("") =~ /runsubdirpl/s ){ - Carp::carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n"); + carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n"); } my $newclass = ++$PACKNAME; @@ -692,11 +699,11 @@ END } sub WriteEmptyMakefile { - Carp::croak "WriteEmptyMakefile: Need an even number of args" if @_ % 2; + croak "WriteEmptyMakefile: Need an even number of args" if @_ % 2; my %att = @_; my $self = MM->new(\%att); - + my $new = $self->{MAKEFILE}; my $old = $self->{MAKEFILE_OLD}; if (-f $old) { @@ -1029,9 +1036,10 @@ sub flush { unless ($self->{NO_MYMETA}) { # Write MYMETA.yml to communicate metadata up to the CPAN clients - print STDOUT "Writing MYMETA.yml\n"; + if ( $self->write_mymeta( $self->mymeta ) ) {; + print STDOUT "Writing MYMETA.yml and MYMETA.json\n"; + } - $self->write_mymeta( $self->mymeta ); } my %keep = map { ($_ => 1) } qw(NEEDS_LINKING HAS_LINK_CODE); if ($self->{PARENT} && !$self->{_KEEP_AFTER_FLUSH}) { @@ -1103,6 +1111,22 @@ sub neatvalue { return "{ ".join(', ',@m)." }"; } +# Look for weird version numbers, warn about them and set them to 0 +# before CPAN::Meta chokes. +sub clean_versions { + my($self, $key) = @_; + + my $reqs = $self->{$key}; + for my $module (keys %$reqs) { + my $version = $reqs->{$module}; + + if( !defined $version or $version !~ /^[\d_\.]+$/ ) { + carp "Unparsable version '$version' for prerequisite $module"; + $reqs->{$module} = 0; + } + } +} + sub selfdocument { my($self) = @_; my(@m); @@ -1491,8 +1515,8 @@ the first line in the "=head1 NAME" section. $2 becomes the abstract. =item AUTHOR Array of strings containing name (and email address) of package author(s). -Is used in META.yml and PPD (Perl Package Description) files for PPM (Perl -Package Manager). +Is used in CPAN Meta files (META.yml or META.json) and PPD +(Perl Package Description) files for PPM (Perl Package Manager). =item BINARY_LOCATION @@ -1509,7 +1533,8 @@ located in the C<x86> directory relative to the PPD itself. A hash of modules that are needed to build your module but not run it. -This will go into the C<build_requires> field of your F<META.yml>. +This will go into the C<build_requires> field of your CPAN Meta file. +(F<META.yml> or F<META.json>). The format is the same as PREREQ_PM. @@ -1556,7 +1581,8 @@ be determined by some evaluation method. A hash of modules that are required to run Makefile.PL itself, but not to run your distribution. -This will go into the C<configure_requires> field of your F<META.yml>. +This will go into the C<configure_requires> field of your CPAN Meta file +(F<META.yml> or F<META.json>) Defaults to C<<< { "ExtUtils::MakeMaker" => 0 } >>> @@ -1963,7 +1989,8 @@ may hold a name for that binary. Defaults to perl =item META_MERGE -A hashrefs of items to add to the F<META.yml>. +A hashrefs of items to add to the CPAN Meta file (F<META.yml> or +F<META.json>). They differ in how they behave if they have the same key as the default metadata. META_ADD will override the default value with its @@ -2012,14 +2039,14 @@ Boolean. Attribute to inhibit descending into subdirectories. =item NO_META When true, suppresses the generation and addition to the MANIFEST of -the META.yml module meta-data file during 'make distdir'. +the META.yml and META.json module meta-data files during 'make distdir'. Defaults to false. =item NO_MYMETA -When true, suppresses the generation of MYMETA.yml module meta-data file -during 'perl Makefile.PL'. +When true, suppresses the generation of MYMETA.yml and MYMETA.json module +meta-data files during 'perl Makefile.PL'. Defaults to false. @@ -2276,7 +2303,8 @@ A hash of modules that are needed to run your module. The keys are the module names ie. Test::More, and the minimum version is the value. If the required version number is 0 any version will do. -This will go into the C<requires> field of your F<META.yml>. +This will go into the C<requires> field of your CPAN Meta file +(F<META.yml> or F<META.json>). PREREQ_PM => { # Require Test::More at least 0.47 @@ -2641,8 +2669,8 @@ Copies all the files that are in the MANIFEST file to a newly created directory with the name C<$(DISTNAME)-$(VERSION)>. If that directory exists, it will be removed first. -Additionally, it will create a META.yml module meta-data file in the -distdir and add this to the distdir's MANIFEST. You can shut this +Additionally, it will create META.yml and META.json module meta-data file +in the distdir and add this to the distdir's MANIFEST. You can shut this behavior off with the NO_META flag. =item make disttest @@ -2716,26 +2744,37 @@ An example: ); -=head2 Module Meta-Data +=head2 Module Meta-Data (META and MYMETA) Long plaguing users of MakeMaker based modules has been the problem of getting basic information about the module out of the sources I<without> running the F<Makefile.PL> and doing a bunch of messy -heuristics on the resulting F<Makefile>. To this end a simple module -meta-data file has been introduced, F<META.yml>. - -F<META.yml> is a YAML document (see http://www.yaml.org) containing -basic information about the module (name, version, prerequisites...) -in an easy to read format. The format is developed and defined by the -Module::Build developers (see -http://module-build.sourceforge.net/META-spec.html) - -MakeMaker will automatically generate a F<META.yml> file for you and -add it to your F<MANIFEST> as part of the 'distdir' target (and thus -the 'dist' target). This is intended to seamlessly and rapidly -populate CPAN with module meta-data. If you wish to shut this feature -off, set the C<NO_META> C<WriteMakefile()> flag to true. - +heuristics on the resulting F<Makefile>. Over the years, it has become +standard to keep this information in one or more CPAN Meta files +distributed with each distribution. + +The original format of CPAN Meta files was L<YAML> and the corresponding +file was called F<META.yml>. In 2010, version 2 of the L<CPAN::Meta::Spec> +was released, which mandates JSON format for the metadata in order to +overcome certain compatibility issues between YAML serializers and to +avoid breaking older clients unable to handle a new version of the spec. +The L<CPAN::Meta> library is now standard for accessing old and new-style +Meta files. + +If L<CPAN::Meta> is installed, MakeMaker will automatically generate +F<META.json> and F<META.yml> files for you and add them to your F<MANIFEST> as +part of the 'distdir' target (and thus the 'dist' target). This is intended to +seamlessly and rapidly populate CPAN with module meta-data. If you wish to +shut this feature off, set the C<NO_META> C<WriteMakefile()> flag to true. + +At the 2008 QA Hackathon in Oslo, Perl module toolchain maintainers agrees +to use the CPAN Meta format to communicate post-configuration requirements +between toolchain components. These files, F<MYMETA.json> and F<MYMETA.yml>, +are generated when F<Makefile.PL> generates a F<Makefile> (if L<CPAN::Meta> +is installed). Clients like L<CPAN> or L<CPANPLUS> will read this +files to see what prerequisites must be fulfilled before building or testing +the distribution. If you with to shut this feature off, set the C<NO_MYMETA> +C<WriteMakeFile()> flag to true. =head2 Disabling an extension @@ -2812,6 +2851,8 @@ not normally available. L<ExtUtils::ModuleMaker> and L<Module::Starter> are both modules to help you setup your distribution. +L<CPAN::Meta> and L<CPAN::Meta::Spec> explain CPAN Meta files in detail. + =head1 AUTHORS Andy Dougherty C<doughera@lafayette.edu>, Andreas KE<ouml>nig diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm index a7ac47d94a..70ee092c78 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm @@ -2,7 +2,7 @@ package ExtUtils::MakeMaker::Config; use strict; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; use Config (); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod index f3354231d1..ae9cf1ac58 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod @@ -1,6 +1,6 @@ package ExtUtils::MakeMaker::FAQ; -our $VERSION = '6.57_01'; +our $VERSION = '6.58'; 1; __END__ diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Tutorial.pod b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Tutorial.pod index d5ff9086c3..dee1b10dbc 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Tutorial.pod +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Tutorial.pod @@ -1,6 +1,6 @@ package ExtUtils::MakeMaker::Tutorial; -our $VERSION = 6.57_01; +our $VERSION = 6.58; =head1 NAME diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/YAML.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/YAML.pm deleted file mode 100644 index 55ff6fdf43..0000000000 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/YAML.pm +++ /dev/null @@ -1,658 +0,0 @@ -package ExtUtils::MakeMaker::YAML;
-
-use strict;
-
-# UTF Support?
-sub HAVE_UTF8 () { $] >= 5.007003 }
-BEGIN {
- if ( HAVE_UTF8 ) {
- # The string eval helps hide this from Test::MinimumVersion
- eval "require utf8;";
- die "Failed to load UTF-8 support" if $@;
- }
-
- # Class structure
- require 5.004;
- require Exporter;
- require Carp;
- $ExtUtils::MakeMaker::YAML::VERSION = '1.44';
- @ExtUtils::MakeMaker::YAML::ISA = qw{ Exporter };
- @ExtUtils::MakeMaker::YAML::EXPORT = qw{ Load Dump };
- @ExtUtils::MakeMaker::YAML::EXPORT_OK = qw{ LoadFile DumpFile freeze thaw };
-
- # Error storage
- $ExtUtils::MakeMaker::YAML::errstr = '';
-}
-
-# The character class of all characters we need to escape
-# NOTE: Inlined, since it's only used once
-# my $RE_ESCAPE = '[\\x00-\\x08\\x0b-\\x0d\\x0e-\\x1f\"\n]';
-
-# Printed form of the unprintable characters in the lowest range
-# of ASCII characters, listed by ASCII ordinal position.
-my @UNPRINTABLE = qw(
- z x01 x02 x03 x04 x05 x06 a
- x08 t n v f r x0e x0f
- x10 x11 x12 x13 x14 x15 x16 x17
- x18 x19 x1a e x1c x1d x1e x1f
-);
-
-# Printable characters for escapes
-my %UNESCAPES = (
- z => "\x00", a => "\x07", t => "\x09",
- n => "\x0a", v => "\x0b", f => "\x0c",
- r => "\x0d", e => "\x1b", '\\' => '\\',
-);
-
-# Special magic boolean words
-my %QUOTE = map { $_ => 1 } qw{
- null Null NULL
- y Y yes Yes YES n N no No NO
- true True TRUE false False FALSE
- on On ON off Off OFF
-};
-
-
-
-
-
-#####################################################################
-# Implementation
-
-# Create an empty ExtUtils::MakeMaker::YAML object
-sub new {
- my $class = shift;
- bless [ @_ ], $class;
-}
-
-# Create an object from a file
-sub read {
- my $class = ref $_[0] ? ref shift : shift;
-
- # Check the file
- my $file = shift or return $class->_error( 'You did not specify a file name' );
- return $class->_error( "File '$file' does not exist" ) unless -e $file;
- return $class->_error( "'$file' is a directory, not a file" ) unless -f _;
- return $class->_error( "Insufficient permissions to read '$file'" ) unless -r _;
-
- # Slurp in the file
- local $/ = undef;
- local *CFG;
- unless ( open(CFG, $file) ) {
- return $class->_error("Failed to open file '$file': $!");
- }
- my $contents = <CFG>;
- unless ( close(CFG) ) {
- return $class->_error("Failed to close file '$file': $!");
- }
-
- $class->read_string( $contents );
-}
-
-# Create an object from a string
-sub read_string {
- my $class = ref $_[0] ? ref shift : shift;
- my $self = bless [], $class;
- my $string = $_[0];
- unless ( defined $string ) {
- return $self->_error("Did not provide a string to load");
- }
-
- # Byte order marks
- # NOTE: Keeping this here to educate maintainers
- # my %BOM = (
- # "\357\273\277" => 'UTF-8',
- # "\376\377" => 'UTF-16BE',
- # "\377\376" => 'UTF-16LE',
- # "\377\376\0\0" => 'UTF-32LE'
- # "\0\0\376\377" => 'UTF-32BE',
- # );
- if ( $string =~ /^(?:\376\377|\377\376|\377\376\0\0|\0\0\376\377)/ ) {
- return $self->_error("Stream has a non UTF-8 BOM");
- } else {
- # Strip UTF-8 bom if found, we'll just ignore it
- $string =~ s/^\357\273\277//;
- }
-
- # Try to decode as utf8
- utf8::decode($string) if HAVE_UTF8;
-
- # Check for some special cases
- return $self unless length $string;
- unless ( $string =~ /[\012\015]+\z/ ) {
- return $self->_error("Stream does not end with newline character");
- }
-
- # Split the file into lines
- my @lines = grep { ! /^\s*(?:\#.*)?\z/ }
- split /(?:\015{1,2}\012|\015|\012)/, $string;
-
- # Strip the initial YAML header
- @lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/ and shift @lines;
-
- # A nibbling parser
- while ( @lines ) {
- # Do we have a document header?
- if ( $lines[0] =~ /^---\s*(?:(.+)\s*)?\z/ ) {
- # Handle scalar documents
- shift @lines;
- if ( defined $1 and $1 !~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/ ) {
- push @$self, $self->_read_scalar( "$1", [ undef ], \@lines );
- next;
- }
- }
-
- if ( ! @lines or $lines[0] =~ /^(?:---|\.\.\.)/ ) {
- # A naked document
- push @$self, undef;
- while ( @lines and $lines[0] !~ /^---/ ) {
- shift @lines;
- }
-
- } elsif ( $lines[0] =~ /^\s*\-/ ) {
- # An array at the root
- my $document = [ ];
- push @$self, $document;
- $self->_read_array( $document, [ 0 ], \@lines );
-
- } elsif ( $lines[0] =~ /^(\s*)\S/ ) {
- # A hash at the root
- my $document = { };
- push @$self, $document;
- $self->_read_hash( $document, [ length($1) ], \@lines );
-
- } else {
- Carp::croak("ExtUtils::MakeMaker::YAML failed to classify the line '$lines[0]'");
- }
- }
-
- $self;
-}
-
-# Deparse a scalar string to the actual scalar
-sub _read_scalar {
- my ($self, $string, $indent, $lines) = @_;
-
- # Trim trailing whitespace
- $string =~ s/\s*\z//;
-
- # Explitic null/undef
- return undef if $string eq '~';
-
- # Single quote
- if ( $string =~ /^\'(.*?)\'\z/ ) {
- return '' unless defined $1;
- $string = $1;
- $string =~ s/\'\'/\'/g;
- return $string;
- }
-
- # Double quote.
- # The commented out form is simpler, but overloaded the Perl regex
- # engine due to recursion and backtracking problems on strings
- # larger than 32,000ish characters. Keep it for reference purposes.
- # if ( $string =~ /^\"((?:\\.|[^\"])*)\"\z/ ) {
- if ( $string =~ /^\"([^\\"]*(?:\\.[^\\"]*)*)\"\z/ ) {
- # Reusing the variable is a little ugly,
- # but avoids a new variable and a string copy.
- $string = $1;
- $string =~ s/\\"/"/g;
- $string =~ s/\\([never\\fartz]|x([0-9a-fA-F]{2}))/(length($1)>1)?pack("H2",$2):$UNESCAPES{$1}/gex;
- return $string;
- }
-
- # Special cases
- if ( $string =~ /^[\'\"!&]/ ) {
- Carp::croak("ExtUtils::MakeMaker::YAML does not support a feature in line '$lines->[0]'");
- }
- return {} if $string eq '{}';
- return [] if $string eq '[]';
-
- # Regular unquoted string
- return $string unless $string =~ /^[>|]/;
-
- # Error
- Carp::croak("ExtUtils::MakeMaker::YAML failed to find multi-line scalar content") unless @$lines;
-
- # Check the indent depth
- $lines->[0] =~ /^(\s*)/;
- $indent->[-1] = length("$1");
- if ( defined $indent->[-2] and $indent->[-1] <= $indent->[-2] ) {
- Carp::croak("ExtUtils::MakeMaker::YAML found bad indenting in line '$lines->[0]'");
- }
-
- # Pull the lines
- my @multiline = ();
- while ( @$lines ) {
- $lines->[0] =~ /^(\s*)/;
- last unless length($1) >= $indent->[-1];
- push @multiline, substr(shift(@$lines), length($1));
- }
-
- my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n";
- my $t = (substr($string, 1, 1) eq '-') ? '' : "\n";
- return join( $j, @multiline ) . $t;
-}
-
-# Parse an array
-sub _read_array {
- my ($self, $array, $indent, $lines) = @_;
-
- while ( @$lines ) {
- # Check for a new document
- if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) {
- while ( @$lines and $lines->[0] !~ /^---/ ) {
- shift @$lines;
- }
- return 1;
- }
-
- # Check the indent level
- $lines->[0] =~ /^(\s*)/;
- if ( length($1) < $indent->[-1] ) {
- return 1;
- } elsif ( length($1) > $indent->[-1] ) {
- Carp::croak("ExtUtils::MakeMaker::YAML found bad indenting in line '$lines->[0]'");
- }
-
- if ( $lines->[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/ ) {
- # Inline nested hash
- my $indent2 = length("$1");
- $lines->[0] =~ s/-/ /;
- push @$array, { };
- $self->_read_hash( $array->[-1], [ @$indent, $indent2 ], $lines );
-
- } elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*\z/ ) {
- # Array entry with a value
- shift @$lines;
- push @$array, $self->_read_scalar( "$2", [ @$indent, undef ], $lines );
-
- } elsif ( $lines->[0] =~ /^\s*\-\s*\z/ ) {
- shift @$lines;
- unless ( @$lines ) {
- push @$array, undef;
- return 1;
- }
- if ( $lines->[0] =~ /^(\s*)\-/ ) {
- my $indent2 = length("$1");
- if ( $indent->[-1] == $indent2 ) {
- # Null array entry
- push @$array, undef;
- } else {
- # Naked indenter
- push @$array, [ ];
- $self->_read_array( $array->[-1], [ @$indent, $indent2 ], $lines );
- }
-
- } elsif ( $lines->[0] =~ /^(\s*)\S/ ) {
- push @$array, { };
- $self->_read_hash( $array->[-1], [ @$indent, length("$1") ], $lines );
-
- } else {
- Carp::croak("ExtUtils::MakeMaker::YAML failed to classify line '$lines->[0]'");
- }
-
- } elsif ( defined $indent->[-2] and $indent->[-1] == $indent->[-2] ) {
- # This is probably a structure like the following...
- # ---
- # foo:
- # - list
- # bar: value
- #
- # ... so lets return and let the hash parser handle it
- return 1;
-
- } else {
- Carp::croak("ExtUtils::MakeMaker::YAML failed to classify line '$lines->[0]'");
- }
- }
-
- return 1;
-}
-
-# Parse an array
-sub _read_hash {
- my ($self, $hash, $indent, $lines) = @_;
-
- while ( @$lines ) {
- # Check for a new document
- if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) {
- while ( @$lines and $lines->[0] !~ /^---/ ) {
- shift @$lines;
- }
- return 1;
- }
-
- # Check the indent level
- $lines->[0] =~ /^(\s*)/;
- if ( length($1) < $indent->[-1] ) {
- return 1;
- } elsif ( length($1) > $indent->[-1] ) {
- Carp::croak("ExtUtils::MakeMaker::YAML found bad indenting in line '$lines->[0]'");
- }
-
- # Get the key
- unless ( $lines->[0] =~ s/^\s*([^\'\" ][^\n]*?)\s*:(\s+|$)// ) {
- if ( $lines->[0] =~ /^\s*[?\'\"]/ ) {
- Carp::croak("ExtUtils::MakeMaker::YAML does not support a feature in line '$lines->[0]'");
- }
- Carp::croak("ExtUtils::MakeMaker::YAML failed to classify line '$lines->[0]'");
- }
- my $key = $1;
-
- # Do we have a value?
- if ( length $lines->[0] ) {
- # Yes
- $hash->{$key} = $self->_read_scalar( shift(@$lines), [ @$indent, undef ], $lines );
- } else {
- # An indent
- shift @$lines;
- unless ( @$lines ) {
- $hash->{$key} = undef;
- return 1;
- }
- if ( $lines->[0] =~ /^(\s*)-/ ) {
- $hash->{$key} = [];
- $self->_read_array( $hash->{$key}, [ @$indent, length($1) ], $lines );
- } elsif ( $lines->[0] =~ /^(\s*)./ ) {
- my $indent2 = length("$1");
- if ( $indent->[-1] >= $indent2 ) {
- # Null hash entry
- $hash->{$key} = undef;
- } else {
- $hash->{$key} = {};
- $self->_read_hash( $hash->{$key}, [ @$indent, length($1) ], $lines );
- }
- }
- }
- }
-
- return 1;
-}
-
-# Save an object to a file
-sub write {
- my $self = shift;
- my $file = shift or return $self->_error('No file name provided');
-
- # Write it to the file
- open( CFG, '>' . $file ) or return $self->_error(
- "Failed to open file '$file' for writing: $!"
- );
- print CFG $self->write_string;
- close CFG;
-
- return 1;
-}
-
-# Save an object to a string
-sub write_string {
- my $self = shift;
- return '' unless @$self;
-
- # Iterate over the documents
- my $indent = 0;
- my @lines = ();
- foreach my $cursor ( @$self ) {
- push @lines, '---';
-
- # An empty document
- if ( ! defined $cursor ) {
- # Do nothing
-
- # A scalar document
- } elsif ( ! ref $cursor ) {
- $lines[-1] .= ' ' . $self->_write_scalar( $cursor, $indent );
-
- # version object
- } elsif ( ref $cursor eq 'version' ) {
- $lines[-1] .= ' ' . $self->_write_scalar( $cursor->stringify, $indent );
-
- # A list at the root
- } elsif ( ref $cursor eq 'ARRAY' ) {
- unless ( @$cursor ) {
- $lines[-1] .= ' []';
- next;
- }
- push @lines, $self->_write_array( $cursor, $indent, {} );
-
- # A hash at the root
- } elsif ( ref $cursor eq 'HASH' ) {
- unless ( %$cursor ) {
- $lines[-1] .= ' {}';
- next;
- }
- push @lines, $self->_write_hash( $cursor, $indent, {} );
-
- } else {
- Carp::croak("Cannot serialize " . ref($cursor));
- }
- }
-
- join '', map { "$_\n" } @lines;
-}
-
-sub _write_scalar {
- my $string = $_[1];
- return '~' unless defined $string;
- return "''" unless length $string;
- if ( $string =~ /[\x00-\x08\x0b-\x0d\x0e-\x1f\"\'\n]/ ) {
- $string =~ s/\\/\\\\/g;
- $string =~ s/"/\\"/g;
- $string =~ s/\n/\\n/g;
- $string =~ s/([\x00-\x1f])/\\$UNPRINTABLE[ord($1)]/g;
- return qq|"$string"|;
- }
- if ( $string =~ /(?:^\W|\s)/ or $QUOTE{$string} ) {
- return "'$string'";
- }
- return $string;
-}
-
-sub _write_array {
- my ($self, $array, $indent, $seen) = @_;
- if ( $seen->{refaddr($array)}++ ) {
- die "ExtUtils::MakeMaker::YAML does not support circular references";
- }
- my @lines = ();
- foreach my $el ( @$array ) {
- my $line = (' ' x $indent) . '-';
- my $type = ref $el;
- if ( ! $type ) {
- $line .= ' ' . $self->_write_scalar( $el, $indent + 1 );
- push @lines, $line;
-
- # version object
- } elsif ( $type eq 'version' ) {
- $line .= ' ' . $self->_write_scalar( $el->stringify, $indent + 1 );
- push @lines, $line;
-
- } elsif ( $type eq 'ARRAY' ) {
- if ( @$el ) {
- push @lines, $line;
- push @lines, $self->_write_array( $el, $indent + 1, $seen );
- } else {
- $line .= ' []';
- push @lines, $line;
- }
-
- } elsif ( $type eq 'HASH' ) {
- if ( keys %$el ) {
- push @lines, $line;
- push @lines, $self->_write_hash( $el, $indent + 1, $seen );
- } else {
- $line .= ' {}';
- push @lines, $line;
- }
-
- } else {
- die "ExtUtils::MakeMaker::YAML does not support $type references";
- }
- }
-
- @lines;
-}
-
-sub _write_hash {
- my ($self, $hash, $indent, $seen) = @_;
- if ( $seen->{refaddr($hash)}++ ) {
- die "ExtUtils::MakeMaker::YAML does not support circular references";
- }
- my @lines = ();
- foreach my $name ( sort keys %$hash ) {
- my $el = $hash->{$name};
- my $line = (' ' x $indent) . "$name:";
- my $type = ref $el;
- if ( ! $type ) {
- $line .= ' ' . $self->_write_scalar( $el, $indent + 1 );
- push @lines, $line;
-
- # version object
- } elsif ( $type eq 'version' ) {
- $line .= ' ' . $self->_write_scalar( $el->stringify, $indent + 1 );
- push @lines, $line;
-
- } elsif ( $type eq 'ARRAY' ) {
- if ( @$el ) {
- push @lines, $line;
- push @lines, $self->_write_array( $el, $indent + 1, $seen );
- } else {
- $line .= ' []';
- push @lines, $line;
- }
-
- } elsif ( $type eq 'HASH' ) {
- if ( keys %$el ) {
- push @lines, $line;
- push @lines, $self->_write_hash( $el, $indent + 1, $seen );
- } else {
- $line .= ' {}';
- push @lines, $line;
- }
-
- } else {
- die "ExtUtils::MakeMaker::YAML does not support $type references";
- }
- }
-
- @lines;
-}
-
-# Set error
-sub _error {
- $ExtUtils::MakeMaker::YAML::errstr = $_[1];
- undef;
-}
-
-# Retrieve error
-sub errstr {
- $ExtUtils::MakeMaker::YAML::errstr;
-}
-
-
-
-
-
-#####################################################################
-# YAML Compatibility
-
-sub Dump {
- ExtUtils::MakeMaker::YAML->new(@_)->write_string;
-}
-
-sub Load {
- my $self = ExtUtils::MakeMaker::YAML->read_string(@_);
- unless ( $self ) {
- Carp::croak("Failed to load YAML document from string");
- }
- if ( wantarray ) {
- return @$self;
- } else {
- # To match YAML.pm, return the last document
- return $self->[-1];
- }
-}
-
-BEGIN {
- *freeze = *Dump;
- *thaw = *Load;
-}
-
-sub DumpFile {
- my $file = shift;
- ExtUtils::MakeMaker::YAML->new(@_)->write($file);
-}
-
-sub LoadFile {
- my $self = ExtUtils::MakeMaker::YAML->read($_[0]);
- unless ( $self ) {
- Carp::croak("Failed to load YAML document from '" . ($_[0] || '') . "'");
- }
- if ( wantarray ) {
- return @$self;
- } else {
- # Return only the last document to match YAML.pm,
- return $self->[-1];
- }
-}
-
-
-
-
-
-#####################################################################
-# Use Scalar::Util if possible, otherwise emulate it
-
-BEGIN {
- eval {
- require Scalar::Util;
- *refaddr = *Scalar::Util::refaddr;
- };
- eval <<'END_PERL' if $@;
-# Failed to load Scalar::Util
-sub refaddr {
- my $pkg = ref($_[0]) or return undef;
- if (!!UNIVERSAL::can($_[0], 'can')) {
- bless $_[0], 'Scalar::Util::Fake';
- } else {
- $pkg = undef;
- }
- "$_[0]" =~ /0x(\w+)/;
- my $i = do { local $^W; hex $1 };
- bless $_[0], $pkg if defined $pkg;
- $i;
-}
-END_PERL
-
-}
-
-1;
-
-__END__
-
-=pod
-
-=head1 NAME
-
-ExtUtils::MakeMaker::YAML - clone of YAML::Tiny
-
-=head1 SYNOPSIS
-
-See L<YAML::Tiny>
-
-=head1 AUTHOR
-
-Adam Kennedy E<lt>adamk@cpan.orgE<gt>
-
-=head1 SEE ALSO
-
-L<YAML>, L<YAML::Syck>
-
-=head1 COPYRIGHT
-
-Copyright 2006 - 2010 Adam Kennedy.
-
-This program is free software; you can redistribute
-it and/or modify it under the same terms as Perl itself.
-
-=cut
diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mkbootstrap.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mkbootstrap.pm index fbf24156c6..bc3bd34f92 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mkbootstrap.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mkbootstrap.pm @@ -3,7 +3,7 @@ package ExtUtils::Mkbootstrap; # There's just too much Dynaloader incest here to turn on strict vars. use strict 'refs'; -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; require Exporter; our @ISA = ('Exporter'); diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mksymlists.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mksymlists.pm index 9aac3fd74a..e7ff00ceb6 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mksymlists.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Mksymlists.pm @@ -10,7 +10,7 @@ use Config; our @ISA = qw(Exporter); our @EXPORT = qw(&Mksymlists); -our $VERSION = '6.57_05'; +our $VERSION = '6.58'; sub Mksymlists { my(%spec) = @_; diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/testlib.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/testlib.pm index 7314410926..623e01090c 100644 --- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/testlib.pm +++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/testlib.pm @@ -3,7 +3,7 @@ package ExtUtils::testlib; use strict; use warnings; -our $VERSION = 6.57_05; +our $VERSION = '6.58'; use Cwd; use File::Spec; |