From: Michael G. Schwern Date: Fri, 29 Mar 2002 04:12:47 +0000 (-0500) Subject: MakeMaker sync 5.48_03 -> 5.53_01 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f6d6199cd6711f5e8a8e6c1a57445fa6f848c822;p=p5sagit%2Fp5-mst-13.2.git MakeMaker sync 5.48_03 -> 5.53_01 Message-ID: <20020329091247.GA7432@blackrider> (with two nits: (1) change lib/Extutils/Command/MM.pm in MANIFEST to be lib/ExtUtils/Command/MM.pm (2) Add @INC to compile.t) p4raw-id: //depot/perl@15599 --- diff --git a/MANIFEST b/MANIFEST index c56fcdc..68b8b1c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -933,29 +933,41 @@ lib/Exporter.t See if Exporter works lib/Exporter/Heavy.pm Complicated routines for Exporter lib/ExtUtils/Changes MakeMaker change log lib/ExtUtils/Command.pm Utilities for Make on non-UNIX platforms +lib/ExtUtils/Command/MM.pm Calling MM functions from the cmd line lib/ExtUtils/Constant.pm generate XS code to import C header constants lib/ExtUtils/Embed.pm Utilities for embedding Perl in C programs lib/ExtUtils/Install.pm Handles 'make install' on extensions lib/ExtUtils/Installed.pm Information on installed extensions lib/ExtUtils/instmodsh Give information about installed extensions lib/ExtUtils/Liblist.pm Locates libraries +lib/ExtUtils/Liblist/Kid.pm Does the real work of the above lib/ExtUtils/MakeMaker.pm Write Makefiles for extensions lib/ExtUtils/Manifest.pm Utilities to write MANIFEST files lib/ExtUtils/MANIFEST.SKIP The default MANIFEST.SKIP lib/ExtUtils/Mkbootstrap.pm Writes a bootstrap file (see MakeMaker) lib/ExtUtils/Mksymlists.pm Writes a linker options file for extensions +lib/ExtUtils/MM.pm MakeMaker adaptor class +lib/ExtUtils/MM_Any.pm MakeMaker methods for Any OS lib/ExtUtils/MM_BeOS.pm MakeMaker methods for BeOS lib/ExtUtils/MM_Cygwin.pm MakeMaker methods for Cygwin +lib/ExtUtils/MM_DOS.pm MakeMaker methods for DOS lib/ExtUtils/MM_NW5.pm MakeMaker methods for NetWare lib/ExtUtils/MM_OS2.pm MakeMaker methods for OS/2 -lib/ExtUtils/MM_Unix.pm MakeMaker base class for Unix +lib/ExtUtils/MM_UWIN.pm MakeMaker methods for U/WIN +lib/ExtUtils/MM_Unix.pm MakeMaker methods for Unix lib/ExtUtils/MM_VMS.pm MakeMaker methods for VMS lib/ExtUtils/MM_Win32.pm MakeMaker methods for Win32 +lib/ExtUtils/MM_Win95.pm MakeMaker methods for Win95 +lib/ExtUtils/MY.pm MakeMaker user override class lib/ExtUtils/Packlist.pm Manipulates .packlist files +lib/ExtUtils/t/Big-Fat-Dummy/Makefile.PL MakeMaker dummy module +lib/ExtUtils/t/Big-Fat-Dummy/lib/Big/Fat/Dummy.pm MakeMaker dummy module +lib/ExtUtils/t/Big-Fat-Dummy/t/compile.t MakeMaker dummy module +lib/ExtUtils/t/basic.t See if MakeMaker can build a module lib/ExtUtils/t/Command.t See if ExtUtils::Command works (Win32 only) lib/ExtUtils/t/Constant.t See if ExtUtils::Constant works lib/ExtUtils/t/Embed.t See if ExtUtils::Embed and embedding works -lib/ExtUtils/t/hints.t See if hint files are honored. +lib/ExtUtils/t/hints.t See if hint files are honored. lib/ExtUtils/t/Installed.t See if ExtUtils::Installed works lib/ExtUtils/t/Manifest.t See if ExtUtils::Manifest works lib/ExtUtils/t/Mkbootstrap.t See if ExtUtils::Mkbootstrap works @@ -966,7 +978,10 @@ lib/ExtUtils/t/MM_Unix.t See if ExtUtils::MM_UNIX works lib/ExtUtils/t/MM_VMS.t See if ExtUtils::MM_VMS works lib/ExtUtils/t/MM_Win32.t See if ExtUtils::MM_Win32 works lib/ExtUtils/t/Packlist.t See if Packlist works -lib/ExtUtils/t/testlib.t Fixes up @INC to use just-built extension +lib/ExtUtils/t/Problem-Module/Makefile.PL MakeMaker dummy module +lib/ExtUtils/t/Problem-Module/subdir/Makefile.PL MakeMaker dummy module +lib/ExtUtils/t/problems.t How MakeMaker reacts to build problems +lib/ExtUtils/t/testlib.t See if ExtUtils::testlib works lib/ExtUtils/testlib.pm Fixes up @INC to use just-built extension lib/ExtUtils/typemap Extension interface types lib/ExtUtils/xsubpp External subroutine preprocessor @@ -2230,6 +2245,7 @@ t/lib/Math/BigFloat/Subclass.pm Empty subclass of BigFloat for test t/lib/Math/BigInt/BareCalc.pm Bigint's simulation of Calc t/lib/Math/BigInt/Subclass.pm Empty subclass of BigInt for test t/lib/Math/BigRat/Test.pm Math::BigRat test helper +t/lib/MakeMaker/Test/Utils.pm MakeMaker test utilities t/lib/sample-tests/bailout Test data for Test::Harness t/lib/sample-tests/combined Test data for Test::Harness t/lib/sample-tests/descriptive Test data for Test::Harness diff --git a/lib/ExtUtils/Changes b/lib/ExtUtils/Changes index 8aee23c..62c4575 100644 --- a/lib/ExtUtils/Changes +++ b/lib/ExtUtils/Changes @@ -1,3 +1,159 @@ +5.53_01 Fri Mar 29 00:13:02 EST 2002 + [[ Bug Fixes ]] + - Removed duplicate NAME macro definition + - Fixed makemakerdflt target for VMS + * bleadperl@11460 introduced a bug with recursive Makefile.PL's not + having '.' in @INC. PDL should build now. + * MANIFEST.SKIP only working on file names, not full relative paths. + Only since 5.51_01 (RT 413) + * make test TEST_VERBOSE=1 was busted by 5.50_01 (RT 423) + * Error messages from dying Makefile.PL's and hint files were + accidentally supressed in 5.48_04. Fixed. + * Makefile.PL's are supposed to be run in package main. 5.48_04 + broke this. Fixed. + * Fixing installing on VMS. + +5.52_01 Tue Mar 26 00:24:26 EST 2002 + [[ Bug Fixes ]] + * ActivePerl 5.6.1/build 631 now 100% + - Fixed some SelfLoader warnings + * ExtUtils::MM_Win32 not subclassed off of ExtUtils::MM_Any properly + - Bug in local $ENV{FOO} was causing failures in MM_Win32 tests. + Compensating for the bug. + - $Config{prefixexp} is sometimes bad on ActivePerl, compensating + - Accidentally left htmlifypods tests in MM_Win32 tests + + [[ Doc Changes ]] + - Expanding Known Good list + - Adding Known Programs to README + +5.51_01 Mon Mar 18 01:37:02 EST 2002 + [[ API Changes ]] + - Removing xsubpp and typemap from the distribution. These are not + Perl version independent files and should not be upgraded. + - Removing ExtUtils::Embed. Version specific module and should + not be updated. + - Removing ExtUtils::Constant. Not directly tied to MakeMaker. + Will be distributed seperately by Nick Clark. + + [[ New Features ]] + * realclean now deletes 'dist' directory. + + [[ Bug Fixes ]] + * Fixing ExtUtils::Installed for VMS + * Fixed it so MakeMaker can build itself without needing an eariler + version installed + * Fixed ExtUtils::Installed so packlists work on VMS + * ExtUtils::MM_VMS test had a stupid typo that prevented most + of the tests from running. + - Fixing VMS so 'mmk' is always 'mmk all' (bleadperl 15218) + - ExtUtils::MM_Any->catfile was calling catdir + - Added Ken William's "speed up ExtUtils::Manifest" patch. + - Added Nick Clark's return value of manifest routines patch + (bleadperl@14978) + - Merging in bleadperl changes (14438, 14453, 14611, 14612, 14622, + 14655, 14677, 14688, 14902, 15023, 15187, 15367) + - bleadperl change 15325 (VMS 'mmk all' hack) rejected. + - ExtUtils::MM_Any->test_via_harness() now using -MExtUtils::testlib + instead of -I's. This keeps the command line shorter on VMS, but + it means TEST_LIB doesn't work anymore. May prove problematic. + - PERLRUN now uses FULLPERL instead of PERL. This avoids + accidental use of miniperl. May cause problems in the core. + - Fixed test_via_harness() on VMS so it uses PERLRUN. + - ExtUtils::Manifest wrongly handling MANIFEST on VMS. + - ExtUtils::Manifest::maniskip broken due to misuse of /o on a regex. + +5.50_01 Mon Mar 4 23:44:48 EST 2002 + [[ API Changes ]] + htmlifypods and all HTML targets have been removed. It didn't + work properly. A target for HTMLifying of docs will be + added sometime in the future (read: send a patch). + - Deprecated ROOTEXT variable removed (its been deprecated for + more than five years). + - Removed ExtUtils::Miniperl from the CPAN distribution. Can't + see how its useful outside the core. + + [[ New Features ]] + * Emacs backup files (ie. *~) are no longer copied into blib + (this means you won't get Foo.pm~ accidentally installed anymore). + - prefixify() now returns if the prefixification worked or not. + - added the Perl patchlevel info to the description embedded in DLLs + (Ilya Zakharevich perl change 14810) + + [[ Bug Fixes ]] + * 5.49_01 broke anything that depended on the MM class to be loaded + with ExtUtils::MakeMaker, like CPAN. Temporarily fixed. + * Many places wrongfully assume MM methods can be called as class + methods! Inside and outside of MakeMaker. + * DOS now acts like Win32 instead of Unix. This should be less wrong. + - Netware tweak from Ananth Kesari (perl change 14780) + + [[ Doc Changes ]] + * made the docs about the behavior of PREFIX a bit more vague + reflecting its odd behavior. + - Replaced references to %Config with things people are more likely + to understand in PREFIX & LIB docs. + - Put PREFIX before LIB in the docs. + + [[ Internal Refactorings ]] + - File::Spec wrappers consolidated in MM_Any + - test_via_harness/script consolidated in MM_Any + * Added ExtUtils::Command::MM to replace large -e "one-liners" + * Added ExtUtils::MM_UWIN, took UWIN specific code out of MM_Unix. + * Added ExtUtils::MM_DOS, took some DOS specific code out of MM_Unix + - Added a dist() override to MM_OS2. + - Took the OS/2 specific code out of MM_Unix's dist() + - Starting to quote as many command line switches as possible + to make VMS have to override less of MM_Unix. + +5.49_01 Mon Feb 4 00:42:40 EST 2002 + - Default TEST_LIBS now contains absolute paths, so tests can + chdir without breaking @INC. + - Some bug fixes in MM_Win32 were missing in MM_NW5. + - LLIBPERL was not being set. + - Gisle Aas fixed a warning in prompt when the user hits ctrl-D + or pipes STDIN to /dev/null. + - VMS's test is now a proper ->can check. + - Stray newline in Command.t causing havoc (bleadperl 14441) + + * Lots of internal changes. Everything from here on is an internal + change. + - Broke ExtUtils::Liblist::Kid out into its own .pm. Temporary. + - Broke MM and MY out into their own .pm's. Possibly temporary. + - Broke ExtUtils::MM_Win95 out of ExtUtils::MM_Win32. MM_Win95 + is now an MM_Win32 subclass. + - Removed wrapper methods from ExtUtils::Liblist that were + defering File::Spec loading. Almost everything uses File::Spec + - Changed most of the 'our's to 'use vars' in prep for 5.005_03 + backporting + - Changed ExtUtils::MakeMaker->import(...) cargo-cultery in MM_* + modules to proper "use ExtUtils::MakeMaker qw(...)" + - All non-Unix MM_* modules now directly inherit from MM_Unix. + They did this before, but in a round-about way. + - MM_* modules no longer directly muck with @MM::ISA. Instead + @MM::ISA does that itself. + - Removed unnecessary require of Exporter in many MM_* modules. + - MM_Cygwin was using an MM_Unix function directly without have + explicitly required MM_Unix. + - Most of MM_NW5 was redundant with MM_Win32. So MM_NW5 is now + a subclass of Win32 and the reduendant code has been deleted. + - Replaced lots of calls to File::Spec->updir, curdir and rootdir + with a global in MM_Unix. Should make things a bit faster. + - Untabified ExtUtils::MakeMaker. I hate tabs. + - "Which MM subclass should I use" logic moved from EU::MakeMaker + to EU::MM. + - Deprecated EU::MakeMaker::Version_check deleted. + +5.48_04 Mon Jan 21 19:28:38 EST 2002 + - No longer requiring Test::More + - Now tested to work with a clean 5.6.1 + - Stripped out $Revision: 1.25 $ based $VERSIONs. + - Rolled in patches from p5p, vmsperl & VOS (14325, 14338, 14360, 14364) + * hint files now run in a safer context. Only $self is available. + - ExtUtils::testlib now provides absolute paths into @INC. + No longer obsolete + - Little test fixes + 5.48_03 Thu Jan 17 23:44:38 EST 2002 * moved bin/inst to bin/instmodsh * Some Win32 backporting fixes. The -x switch doesn't seem to diff --git a/lib/ExtUtils/Command.pm b/lib/ExtUtils/Command.pm index bf1e0e5..4b998b2 100644 --- a/lib/ExtUtils/Command.pm +++ b/lib/ExtUtils/Command.pm @@ -1,6 +1,6 @@ package ExtUtils::Command; -use 5.006_001; +use 5.006; use strict; # use AutoLoader; use Carp; @@ -12,7 +12,7 @@ require Exporter; our(@ISA, @EXPORT, $VERSION); @ISA = qw(Exporter); @EXPORT = qw(cp rm_f rm_rf mv cat eqtime mkpath touch test_f); -$VERSION = '1.02'; +$VERSION = '1.03_01'; =head1 NAME @@ -33,8 +33,7 @@ ExtUtils::Command - utilities to replace common UNIX commands in Makefiles etc. =head1 DESCRIPTION -The module is used in the Win32 port to replace common UNIX commands. -Most commands are wrappers on generic modules File::Path and File::Basename. +The module is used to replace common UNIX commands. =over 4 diff --git a/lib/ExtUtils/Command/MM.pm b/lib/ExtUtils/Command/MM.pm new file mode 100644 index 0000000..702353a --- /dev/null +++ b/lib/ExtUtils/Command/MM.pm @@ -0,0 +1,56 @@ +package ExtUtils::Command::MM; + +use strict; + +require 5.006; +require Exporter; +use vars qw($VERSION @ISA @EXPORT); +@ISA = qw(Exporter); + +@EXPORT = qw(test_harness); +$VERSION = '0.01'; + +=head1 NAME + +ExtUtils::Command::MM - Commands for the MM's to use in Makefiles + +=head1 SYNOPSIS + + perl -MExtUtils::Command::MM -e "function" files... + + +=head1 DESCRIPTION + +B The interface is not stable. + +ExtUtils::Command::MM encapsulates code which would otherwise have to +be done with large "one" liners. + +They all read their input from @ARGV unless otherwise noted. + +Any $(FOO) used in the examples are make variables, not Perl. + +=over 4 + +=item B + + perl -MExtUtils::Command::MM -e "test_harness($(TEST_VERBOSE))" t/*.t + +Runs the given tests via Test::Harness. Will exit with non-zero if +the test fails. + +Typically used with t/*.t files. + +=cut + +sub test_harness { + require Test::Harness; + $Test::Harness::verbose = shift; + Test::Harness::runtests(@ARGV); +} + +=back + +=cut + +1; diff --git a/lib/ExtUtils/Install.pm b/lib/ExtUtils/Install.pm index c1168f2..22a4bbf 100644 --- a/lib/ExtUtils/Install.pm +++ b/lib/ExtUtils/Install.pm @@ -1,6 +1,6 @@ package ExtUtils::Install; -use 5.006_001; +use 5.006; our(@ISA, @EXPORT, $VERSION); $VERSION = 1.29; diff --git a/lib/ExtUtils/Installed.pm b/lib/ExtUtils/Installed.pm index 5b7f663..8498f35 100644 --- a/lib/ExtUtils/Installed.pm +++ b/lib/ExtUtils/Installed.pm @@ -1,6 +1,6 @@ package ExtUtils::Installed; -use 5.006_001; +use 5.006; use strict; use Carp qw(); use ExtUtils::Packlist; @@ -9,203 +9,191 @@ use Config; use File::Find; use File::Basename; use File::Spec; -our $VERSION = '0.04'; +require VMS::Filespec if $^O eq 'VMS'; + +our $VERSION = '0.05'; my $DOSISH = ($^O =~ /^(MSWin\d\d|os2|dos|mint)$/); -sub _is_prefix -{ -my ($self, $path, $prefix) = @_; -if (substr($path, 0, length($prefix)) eq $prefix) - { - return(1); - } -if ($DOSISH) - { - $path =~ s|\\|/|g; - $prefix =~ s|\\|/|g; - if ($path =~ m{^\Q$prefix\E}i) - { - return(1); - } - } -return(0); +sub _is_prefix { + my ($self, $path, $prefix) = @_; + return unless defined $prefix && defined $path; + + if( $^O eq 'VMS' ) { + $prefix = VMS::Filespec::unixify($prefix); + $path = VMS::Filespec::unixify($path); + } + return 1 if substr($path, 0, length($prefix)) eq $prefix; + + if ($DOSISH) { + $path =~ s|\\|/|g; + $prefix =~ s|\\|/|g; + return 1 if $path =~ m{^\Q$prefix\E}i; + } + return(0); } -sub _is_doc($$) -{ -my ($self, $path) = @_; -my $man1dir = $Config{man1direxp}; -my $man3dir = $Config{man3direxp}; -return(($man1dir && $self->_is_prefix($path, $man1dir)) - || - ($man3dir && $self->_is_prefix($path, $man3dir)) - ? 1 : 0) +sub _is_doc { + my ($self, $path) = @_; + my $man1dir = $Config{man1direxp}; + my $man3dir = $Config{man3direxp}; + return(($man1dir && $self->_is_prefix($path, $man1dir)) + || + ($man3dir && $self->_is_prefix($path, $man3dir)) + ? 1 : 0) } -sub _is_type($$$) -{ -my ($self, $path, $type) = @_; -return(1) if ($type eq "all"); - -if ($type eq "doc") - { - return($self->_is_doc($path)) - } -if ($type eq "prog") - { - return($self->_is_prefix($path, $Config{prefixexp}) - && - !($self->_is_doc($path)) - ? 1 : 0); - } -return(0); +sub _is_type { + my ($self, $path, $type) = @_; + return 1 if $type eq "all"; + + return($self->_is_doc($path)) if $type eq "doc"; + + if ($type eq "prog") { + return($self->_is_prefix($path, $Config{prefix} || $Config{prefixexp}) + && + !($self->_is_doc($path)) + ? 1 : 0); + } + return(0); } -sub _is_under($$;) -{ -my ($self, $path, @under) = @_; -$under[0] = "" if (! @under); -foreach my $dir (@under) - { - return(1) if ($self->_is_prefix($path, $dir)); - } -return(0); -} +sub _is_under { + my ($self, $path, @under) = @_; + $under[0] = "" if (! @under); + foreach my $dir (@under) { + return(1) if ($self->_is_prefix($path, $dir)); + } -sub new($) -{ -my ($class) = @_; -$class = ref($class) || $class; -my $self = {}; - -my $archlib = $Config{archlibexp}; -my $sitearch = $Config{sitearchexp}; - -if ($DOSISH) - { - $archlib =~ s|\\|/|g; - $sitearch =~ s|\\|/|g; - } - -# Read the core packlist -$self->{Perl}{packlist} = - ExtUtils::Packlist->new( File::Spec->catfile($archlib, '.packlist') ); -$self->{Perl}{version} = $Config{version}; - -# Read the module packlists -my $sub = sub - { - # Only process module .packlists - return if ($_) ne ".packlist" || $File::Find::dir eq $archlib; - - # Hack of the leading bits of the paths & convert to a module name - my $module = $File::Find::name; - $module =~ s!\Q$archlib\E/auto/(.*)/.packlist!$1!s; - $module =~ s!\Q$sitearch\E/auto/(.*)/.packlist!$1!s; - my $modfile = "$module.pm"; - $module =~ s!/!::!g; - - # Find the top-level module file in @INC - $self->{$module}{version} = ''; - foreach my $dir (@INC) - { - my $p = File::Spec->catfile($dir, $modfile); - if (-f $p) - { - $self->{$module}{version} = MM->parse_version($p); - last; - } - } - - # Read the .packlist - $self->{$module}{packlist} = ExtUtils::Packlist->new($File::Find::name); - }; -find($sub, $archlib, $sitearch); - -return(bless($self, $class)); + return(0); } -sub modules($) -{ -my ($self) = @_; -return(sort(keys(%$self))); +sub new { + my ($class) = @_; + $class = ref($class) || $class; + my $self = {}; + + my $archlib = $Config{archlibexp}; + my $sitearch = $Config{sitearchexp}; + + # File::Find does not know how to deal with VMS filepaths. + if( $^O eq 'VMS' ) { + $archlib = VMS::Filespec::unixify($archlib); + $sitearch = VMS::Filespec::unixify($sitearch); + } + + if ($DOSISH) { + $archlib =~ s|\\|/|g; + $sitearch =~ s|\\|/|g; + } + + # Read the core packlist + $self->{Perl}{packlist} = + ExtUtils::Packlist->new( File::Spec->catfile($archlib, '.packlist') ); + $self->{Perl}{version} = $Config{version}; + + # Read the module packlists + my $sub = sub { + # Only process module .packlists + return if ($_) ne ".packlist" || $File::Find::dir eq $archlib; + + # Hack of the leading bits of the paths & convert to a module name + my $module = $File::Find::name; + + $module =~ s!\Q$archlib\E/?auto/(.*)/.packlist!$1!s or + $module =~ s!\Q$sitearch\E/?auto/(.*)/.packlist!$1!s; + my $modfile = "$module.pm"; + $module =~ s!/!::!g; + + # Find the top-level module file in @INC + $self->{$module}{version} = ''; + foreach my $dir (@INC) { + my $p = File::Spec->catfile($dir, $modfile); + if (-f $p) { + require ExtUtils::MM; + $self->{$module}{version} = MM->parse_version($p); + last; + } + } + + # Read the .packlist + $self->{$module}{packlist} = + ExtUtils::Packlist->new($File::Find::name); + }; + + my(@dirs) = grep { -e } ($archlib, $sitearch); + find($sub, @dirs) if @dirs; + + return(bless($self, $class)); } -sub files($$;$) -{ -my ($self, $module, $type, @under) = @_; - -# Validate arguments -Carp::croak("$module is not installed") if (! exists($self->{$module})); -$type = "all" if (! defined($type)); -Carp::croak('type must be "all", "prog" or "doc"') - if ($type ne "all" && $type ne "prog" && $type ne "doc"); - -my (@files); -foreach my $file (keys(%{$self->{$module}{packlist}})) - { - push(@files, $file) - if ($self->_is_type($file, $type) && $self->_is_under($file, @under)); - } -return(@files); +sub modules { + my ($self) = @_; + return sort keys %$self; } -sub directories($$;$) -{ -my ($self, $module, $type, @under) = @_; -my (%dirs); -foreach my $file ($self->files($module, $type, @under)) - { - $dirs{dirname($file)}++; - } -return(sort(keys(%dirs))); +sub files { + my ($self, $module, $type, @under) = @_; + + # Validate arguments + Carp::croak("$module is not installed") if (! exists($self->{$module})); + $type = "all" if (! defined($type)); + Carp::croak('type must be "all", "prog" or "doc"') + if ($type ne "all" && $type ne "prog" && $type ne "doc"); + + my (@files); + foreach my $file (keys(%{$self->{$module}{packlist}})) { + push(@files, $file) + if ($self->_is_type($file, $type) && + $self->_is_under($file, @under)); + } + return(@files); } -sub directory_tree($$;$) -{ -my ($self, $module, $type, @under) = @_; -my (%dirs); -foreach my $dir ($self->directories($module, $type, @under)) - { - $dirs{$dir}++; - my ($last) = (""); - while ($last ne $dir) - { - $last = $dir; - $dir = dirname($dir); - last if (! $self->_is_under($dir, @under)); - $dirs{$dir}++; - } - } -return(sort(keys(%dirs))); +sub directories { + my ($self, $module, $type, @under) = @_; + my (%dirs); + foreach my $file ($self->files($module, $type, @under)) { + $dirs{dirname($file)}++; + } + return sort keys %dirs; } -sub validate($;$) -{ -my ($self, $module, $remove) = @_; -Carp::croak("$module is not installed") if (! exists($self->{$module})); -return($self->{$module}{packlist}->validate($remove)); +sub directory_tree { + my ($self, $module, $type, @under) = @_; + my (%dirs); + foreach my $dir ($self->directories($module, $type, @under)) { + $dirs{$dir}++; + my ($last) = (""); + while ($last ne $dir) { + $last = $dir; + $dir = dirname($dir); + last if !$self->_is_under($dir, @under); + $dirs{$dir}++; + } + } + return(sort(keys(%dirs))); } -sub packlist($$) -{ -my ($self, $module) = @_; -Carp::croak("$module is not installed") if (! exists($self->{$module})); -return($self->{$module}{packlist}); +sub validate { + my ($self, $module, $remove) = @_; + Carp::croak("$module is not installed") if (! exists($self->{$module})); + return($self->{$module}{packlist}->validate($remove)); } -sub version($$) -{ -my ($self, $module) = @_; -Carp::croak("$module is not installed") if (! exists($self->{$module})); -return($self->{$module}{version}); +sub packlist { + my ($self, $module) = @_; + Carp::croak("$module is not installed") if (! exists($self->{$module})); + return($self->{$module}{packlist}); } -sub DESTROY -{ +sub version { + my ($self, $module) = @_; + Carp::croak("$module is not installed") if (! exists($self->{$module})); + return($self->{$module}{version}); } + 1; __END__ diff --git a/lib/ExtUtils/Liblist.pm b/lib/ExtUtils/Liblist.pm index b627867..391fbe4 100644 --- a/lib/ExtUtils/Liblist.pm +++ b/lib/ExtUtils/Liblist.pm @@ -1,5 +1,7 @@ package ExtUtils::Liblist; +use File::Spec; +require ExtUtils::Liblist::Kid; @ISA = qw(ExtUtils::Liblist::Kid File::Spec); sub lsdir { @@ -9,530 +11,6 @@ sub lsdir { grep /$rex/, readdir $dir; } -sub file_name_is_absolute { - require File::Spec; - shift; - 'File::Spec'->file_name_is_absolute(@_); -} - - -package ExtUtils::Liblist::Kid; - -# This kid package is to be used by MakeMaker. It will not work if -# $self is not a Makemaker. - -use 5.006_001; -# Broken out of MakeMaker from version 4.11 - -our $VERSION = 1.27_01; - -use Config; -use Cwd 'cwd'; -use File::Basename; - -sub 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) = @_; - 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}; - } - return ("", "", "", "", ($give_libs ? [] : ())) unless $potential_libs; - warn "Potential libraries are '$potential_libs':\n" if $verbose; - - my($so) = $Config{'so'}; - my($libs) = $Config{'perllibs'}; - my $Config_libext = $Config{lib_ext} || ".a"; - - - # 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, $thislib, $thispth, @fullname); - my($pwd) = cwd(); # from Cwd.pm - my($found) = 0; - - foreach $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 ($self->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 $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 (-f ($fullname="$thispth/$thislib$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; - my($fullnamedir) = dirname($fullname); - push @ld_run_path, $fullnamedir unless $ld_run_path_seen{$fullnamedir}++; - 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); - - # 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; - } - return ('','','','', ($give_libs ? \@libs : ())) unless $found; - ("@extralibs", "@bsloadlibs", "@ldloadlibs",join(":",@ld_run_path), ($give_libs ? \@libs : ())); -} - -sub _win32_ext { - - require Text::ParseWords; - - my($self, $potential_libs, $verbose, $give_libs) = @_; - - # 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 = 1 if $cc =~ /^cl/i; - my $BC = 1 if $cc =~ /^bcc/i; - my $GC = 1 if $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; - - # normalize to forward slashes - $libpth =~ s,\\,/,g; - $potential_libs =~ s,\\,/,g; - - # compute $extralibs from $potential_libs - - 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, $thislib, $thispth); - - # add "$Config{installarchlib}/CORE" to default search path - push @libpath, "$Config{installarchlib}/CORE"; - - if ($VC and exists $ENV{LIB} and $ENV{LIB}) { - push @libpath, split /;/, $ENV{LIB}; - } - - foreach (Text::ParseWords::quotewords('\s+', 0, $potential_libs)){ - - $thislib = $_; - - # 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 ($self->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 $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; - - } - - return ('','','','', ($give_libs ? \@libs : ())) unless $found; - - # make sure paths with spaces are properly quoted - @extralibs = map { (/\s/ && !/^".*"$/) ? qq["$_"] : $_ } @extralibs; - @libs = map { (/\s/ && !/^".*"$/) ? qq["$_"] : $_ } @libs; - $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; -} - - -sub _vms_ext { - my($self, $potential_libs,$verbose,$give_libs) = @_; - my(@crtls,$crtlstr); - my($dbgqual) = $self->{OPTIMIZE} || $Config{'optimize'} || - $self->{CCFLAS} || $Config{'ccflags'}; - @crtls = ( ($dbgqual =~ 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($lib,$locspec,$type); - foreach $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(@dirs,@libs,$dir,$lib,%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 there VMS equivalents - # (VMS equivalent of '' indicates that the library is automatially - # 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 - foreach $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 $dir (@dirs) { - unless (-d $dir) { - warn "Skipping nonexistent Directory $dir\n" if $verbose > 1; - $dir = ''; - next; - } - warn "Resolving directory $dir\n" if $verbose; - if ($self->file_name_is_absolute($dir)) { $dir = $self->fixpath($dir,1); } - else { $dir = $self->catdir($cwd,$dir); } - } - @dirs = grep { length($_) } @dirs; - unshift(@dirs,''); # Check each $lib without additions first - - LIB: foreach $lib (@libs) { - if (exists $libmap{$lib}) { - next unless length $libmap{$lib}; - $lib = $libmap{$lib}; - } - - my(@variants,$variant,$name,$test,$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 $variant (@variants) { - foreach $dir (@dirs) { - my($type); - - $name = "$dir$variant"; - warn "\tChecking $name\n" if $verbose > 2; - if (-f ($test = VMS::Filespec::rmsexpand($name))) { - # It's got its own suffix, so we'll have to figure out the type - if ($test =~ /(?:$so|exe)$/i) { $type = 'SHR'; } - elsif ($test =~ /(?:$lib_ext|olb)$/i) { $type = 'OLB'; } - elsif ($test =~ /(?:$obj_ext|obj)$/i) { - warn "Note (probably harmless): " - ."Plain object file $test found in library list\n"; - $type = 'OBJ'; - } - else { - warn "Note (probably harmless): " - ."Unknown library type for $test; assuming shared\n"; - $type = 'SHR'; - } - } - elsif (-f ($test = VMS::Filespec::rmsexpand($name,$so)) or - -f ($test = VMS::Filespec::rmsexpand($name,'.exe'))) { - $type = 'SHR'; - $name = $test unless $test =~ /exe;?\d*$/i; - } - elsif (not length($ctype) and # If we've got a lib already, don't bother - ( -f ($test = VMS::Filespec::rmsexpand($name,$lib_ext)) or - -f ($test = VMS::Filespec::rmsexpand($name,'.olb')))) { - $type = 'OLB'; - $name = $test unless $test =~ /olb;?\d*$/i; - } - elsif (not length($ctype) and # If we've got a lib already, don't bother - ( -f ($test = VMS::Filespec::rmsexpand($name,$obj_ext)) or - -f ($test = VMS::Filespec::rmsexpand($name,'.obj')))) { - warn "Note (probably harmless): " - ."Plain object file $test found in library list\n"; - $type = 'OBJ'; - $name = $test unless $test =~ /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 $test), 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"; - } - - 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}; - $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; - __END__ =head1 NAME @@ -569,12 +47,12 @@ Dependent libraries can be linked in one of three ways: by the ld command when the perl binary is linked with the extension library. See EXTRALIBS below. -=item * For dynamic extensions +=item * For dynamic extensions at build/link time by the ld command when the shared object is built/linked. See LDLOADLIBS below. -=item * For dynamic extensions +=item * For dynamic extensions at load time by the DynaLoader when the shared object is loaded. See BSLOADLIBS below. diff --git a/lib/ExtUtils/Liblist/Kid.pm b/lib/ExtUtils/Liblist/Kid.pm new file mode 100644 index 0000000..b38e9b6 --- /dev/null +++ b/lib/ExtUtils/Liblist/Kid.pm @@ -0,0 +1,530 @@ +package ExtUtils::Liblist::Kid; + +# XXX Splitting this out into its own .pm is a temporary solution. + +# This kid package is to be used by MakeMaker. It will not work if +# $self is not a Makemaker. + +use 5.006; +# Broken out of MakeMaker from version 4.11 + +our $VERSION = 1.28_01; + +use 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; } +} + +sub _unix_os2_ext { + my($self,$potential_libs, $verbose, $give_libs) = @_; + 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}; + } + return ("", "", "", "", ($give_libs ? [] : ())) unless $potential_libs; + warn "Potential libraries are '$potential_libs':\n" if $verbose; + + my($so) = $Config{'so'}; + my($libs) = $Config{'perllibs'}; + my $Config_libext = $Config{lib_ext} || ".a"; + + + # 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, $thislib, $thispth, @fullname); + my($pwd) = cwd(); # from Cwd.pm + my($found) = 0; + + foreach $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 $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 (-f ($fullname="$thispth/$thislib$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; + my($fullnamedir) = dirname($fullname); + push @ld_run_path, $fullnamedir + unless $ld_run_path_seen{$fullnamedir}++; + 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); + + # 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; + } + + unless( $found ) { + return ('','','','', ($give_libs ? \@libs : ())); + } + else { + return ("@extralibs", "@bsloadlibs", "@ldloadlibs", + join(":",@ld_run_path), ($give_libs ? \@libs : ())); + } +} + +sub _win32_ext { + + require Text::ParseWords; + + my($self, $potential_libs, $verbose, $give_libs) = @_; + + # 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 = 1 if $cc =~ /^cl/i; + my $BC = 1 if $cc =~ /^bcc/i; + my $GC = 1 if $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; + + # normalize to forward slashes + $libpth =~ s,\\,/,g; + $potential_libs =~ s,\\,/,g; + + # compute $extralibs from $potential_libs + + 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, $thislib, $thispth); + + # add "$Config{installarchlib}/CORE" to default search path + push @libpath, "$Config{installarchlib}/CORE"; + + if ($VC and exists $ENV{LIB} and $ENV{LIB}) { + push @libpath, split /;/, $ENV{LIB}; + } + + foreach (Text::ParseWords::quotewords('\s+', 0, $potential_libs)){ + + $thislib = $_; + + # 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 $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; + + } + + return ('','','','', ($give_libs ? \@libs : ())) unless $found; + + # make sure paths with spaces are properly quoted + @extralibs = map { (/\s/ && !/^".*"$/) ? qq["$_"] : $_ } @extralibs; + @libs = map { (/\s/ && !/^".*"$/) ? qq["$_"] : $_ } @libs; + $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; +} + + +sub _vms_ext { + my($self, $potential_libs,$verbose,$give_libs) = @_; + my(@crtls,$crtlstr); + my($dbgqual) = $self->{OPTIMIZE} || $Config{'optimize'} || + $self->{CCFLAS} || $Config{'ccflags'}; + @crtls = ( ($dbgqual =~ 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($lib,$locspec,$type); + foreach $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(@dirs,@libs,$dir,$lib,%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 there VMS equivalents + # (VMS equivalent of '' indicates that the library is automatially + # 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 + foreach $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 $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); + } + else { + $dir = $self->catdir($cwd,$dir); + } + } + @dirs = grep { length($_) } @dirs; + unshift(@dirs,''); # Check each $lib without additions first + + LIB: foreach $lib (@libs) { + if (exists $libmap{$lib}) { + next unless length $libmap{$lib}; + $lib = $libmap{$lib}; + } + + my(@variants,$variant,$name,$test,$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 $variant (@variants) { + foreach $dir (@dirs) { + my($type); + + $name = "$dir$variant"; + warn "\tChecking $name\n" if $verbose > 2; + if (-f ($test = VMS::Filespec::rmsexpand($name))) { + # It's got its own suffix, so we'll have to figure out the type + if ($test =~ /(?:$so|exe)$/i) { $type = 'SHR'; } + elsif ($test =~ /(?:$lib_ext|olb)$/i) { $type = 'OLB'; } + elsif ($test =~ /(?:$obj_ext|obj)$/i) { + warn "Note (probably harmless): " + ."Plain object file $test found in library list\n"; + $type = 'OBJ'; + } + else { + warn "Note (probably harmless): " + ."Unknown library type for $test; assuming shared\n"; + $type = 'SHR'; + } + } + elsif (-f ($test = VMS::Filespec::rmsexpand($name,$so)) or + -f ($test = VMS::Filespec::rmsexpand($name,'.exe'))) { + $type = 'SHR'; + $name = $test unless $test =~ /exe;?\d*$/i; + } + elsif (not length($ctype) and # If we've got a lib already, don't bother + ( -f ($test = VMS::Filespec::rmsexpand($name,$lib_ext)) or + -f ($test = VMS::Filespec::rmsexpand($name,'.olb')))) { + $type = 'OLB'; + $name = $test unless $test =~ /olb;?\d*$/i; + } + elsif (not length($ctype) and # If we've got a lib already, don't bother + ( -f ($test = VMS::Filespec::rmsexpand($name,$obj_ext)) or + -f ($test = VMS::Filespec::rmsexpand($name,'.obj')))) { + warn "Note (probably harmless): " + ."Plain object file $test found in library list\n"; + $type = 'OBJ'; + $name = $test unless $test =~ /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 $test), 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"; + } + + 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}; + $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/lib/ExtUtils/MANIFEST.SKIP b/lib/ExtUtils/MANIFEST.SKIP index 5ddf32a..61dde53 100644 --- a/lib/ExtUtils/MANIFEST.SKIP +++ b/lib/ExtUtils/MANIFEST.SKIP @@ -4,7 +4,7 @@ ,v$ # Avoid Makemaker generated and utility files. -^MANIFEST\. +^MANIFEST\.bak ^Makefile$ ^blib/ ^MakeMaker-\d diff --git a/lib/ExtUtils/MM.pm b/lib/ExtUtils/MM.pm new file mode 100644 index 0000000..2c23263 --- /dev/null +++ b/lib/ExtUtils/MM.pm @@ -0,0 +1,80 @@ +package ExtUtils::MM; + +use strict; +use Config; +use vars qw(@ISA $VERSION); +$VERSION = 0.04; + +require ExtUtils::Liblist; +require ExtUtils::MakeMaker; + +@ISA = qw(ExtUtils::Liblist ExtUtils::MakeMaker); + +=head1 NAME + +ExtUtils::MM - OS adjusted ExtUtils::MakeMaker subclass + +=head1 SYNOPSIS + + require ExtUtils::MM; + my $mm = MM->new(...); + +=head1 DESCRIPTION + +B + +ExtUtils::MM is a subclass of ExtUtils::MakeMaker which automatically +chooses the appropriate OS specific subclass for you +(ie. ExtUils::MM_Unix, etc...). + +It also provides a convenient alias via the MM class (I didn't want +MakeMaker modules outside of ExtUtils/). + +This class might turn out to be a temporary solution, but MM won't go +away. + +=cut + +{ + # Convenient alias. + package MM; + use vars qw(@ISA); + @ISA = qw(ExtUtils::MM); + sub DESTROY {} +} + +my %Is = (); +$Is{VMS} = 1 if $^O eq 'VMS'; +$Is{OS2} = 1 if $^O eq 'os2'; +$Is{MacOS} = 1 if $^O eq 'MacOS'; +if( $^O eq 'MSWin32' ) { + Win32::IsWin95() ? $Is{Win95} = 1 : $Is{Win32} = 1; +} +$Is{UWIN} = 1 if $^O eq 'uwin'; +$Is{Cygwin} = 1 if $^O eq 'cygwin'; +$Is{NW5} = 1 if $Config{osname} eq 'NetWare'; # intentional +$Is{BeOS} = 1 if $^O =~ /beos/i; # XXX should this be that loose? +$Is{DOS} = 1 if $^O eq 'dos'; + +$Is{Unix} = 1 if !keys %Is; + +if( $Is{NW5} ) { + $^O = 'NetWare'; + delete $Is{Win32}; +} + +_assert( keys %Is == 1 ); +my($OS) = keys %Is; + + +my $class = "ExtUtils::MM_$OS"; +eval "require $class" unless $INC{"ExtUtils/MM_$OS.pm"}; +die $@ if $@; +unshift @ISA, $class; + + +sub _assert { + my $sanity = shift; + die sprintf "Assert failed at %s line %d\n", (caller)[1,2] unless $sanity; + return; +} diff --git a/lib/ExtUtils/MM_Any.pm b/lib/ExtUtils/MM_Any.pm new file mode 100644 index 0000000..214c316 --- /dev/null +++ b/lib/ExtUtils/MM_Any.pm @@ -0,0 +1,180 @@ +package ExtUtils::MM_Any; + +use strict; +use vars qw($VERSION @ISA); +$VERSION = 0.04; + +use Config; +use File::Spec; + + +=head1 NAME + +ExtUtils::MM_Any - Platform agnostic MM methods + +=head1 SYNOPSIS + + FOR INTERNAL USE ONLY! + + package ExtUtils::MM_SomeOS; + + # Temporarily, you have to subclass both. Put MM_Any first. + require ExtUtils::MM_Any; + require ExtUtils::MM_Unix; + @ISA = qw(ExtUtils::MM_Any ExtUtils::Unix); + +=head1 DESCRIPTION + +B + +ExtUtils::MM_Any is a superclass for the ExtUtils::MM_* set of +modules. It contains methods which are either inherently +cross-platform or are written in a cross-platform manner. + +Subclass off of ExtUtils::MM_Any I ExtUtils::MM_Unix. This is a +temporary solution. + +B + +=head1 Inherently Cross-Platform Methods + +These are methods which are by their nature cross-platform and should +always be cross-platform. + +=head2 File::Spec wrappers B + +The following methods are deprecated wrappers around File::Spec +functions. They exist from before File::Spec did and in fact are from +which File::Spec sprang. + +They are all deprecated. Please use File::Spec directly. + +=over 4 + +=item canonpath + +=cut + +sub canonpath { + shift; + return File::Spec->canonpath(@_);; +} + +=item catdir + +=cut + +sub catdir { + shift; + return File::Spec->catdir(@_); +} + +=item catfile + +=cut + +sub catfile { + shift; + return File::Spec->catfile(@_); +} + +=item curdir + +=cut + +my $Curdir = File::Spec->curdir; +sub curdir { + return $Curdir; +} + +=item file_name_is_absolute + +=cut + +sub file_name_is_absolute { + shift; + return File::Spec->file_name_is_absolute(@_); +} + +=item path + +=cut + +sub path { + return File::Spec->path(); +} + +=item rootdir + +=cut + +my $Rootdir = File::Spec->rootdir; +sub rootdir { + return $Rootdir; +} + +=item updir + +=cut + +my $Updir = File::Spec->updir; +sub updir { + return $Updir; +} + +=back + +=head1 Thought To Be Cross-Platform Methods + +These are methods which are thought to be cross-platform by virtue of +having been written in a way to avoid incompatibilities. + +=over 4 + +=item test_via_harness + + my $command = $mm->test_via_harness($perl, $tests); + +Returns a $command line which runs the given set of $tests with +Test::Harness and the given $perl. + +Used on the t/*.t files. + +=cut + +sub test_via_harness { + my($self, $perl, $tests) = @_; + + return qq{\t$perl "-MExtUtils::testlib" "-MExtUtils::Command::MM" }. + qq{"-e" "test_harness(\$(TEST_VERBOSE))" $tests\n}; +} + +=item test_via_script + + my $command = $mm->test_via_script($perl, $script); + +Returns a $command line which just runs a single test without +Test::Harness. No checks are done on the results, they're just +printed. + +Used for test.pl, since they don't always follow Test::Harness +formatting. + +=cut + +sub test_via_script { + my($self, $perl, $script) = @_; + return "\t$perl \$(TEST_LIBS) $script\n"; +} + +=back + +=head1 AUTHOR + +Michael G Schwern with code from ExtUtils::MM_Unix +and ExtUtils::MM_Win32. + + +=cut + +1; diff --git a/lib/ExtUtils/MM_BeOS.pm b/lib/ExtUtils/MM_BeOS.pm index 298025d..addf335 100644 --- a/lib/ExtUtils/MM_BeOS.pm +++ b/lib/ExtUtils/MM_BeOS.pm @@ -1,7 +1,5 @@ package ExtUtils::MM_BeOS; -our $VERSION = '1.00'; - =head1 NAME ExtUtils::MM_BeOS - methods to override UN*X behaviour in ExtUtils::MakeMaker @@ -22,12 +20,13 @@ the semantics. use Config; use File::Spec; -require Exporter; +require ExtUtils::MM_Any; +require ExtUtils::MM_Unix; -require ExtUtils::MakeMaker; -ExtUtils::MakeMaker->import(qw( $Verbose &neatvalue)); +use vars qw(@ISA $VERSION); +@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_unix ); +$VERSION = 1.01_01; -unshift @MM::ISA, 'ExtUtils::MM_BeOS'; =item perl_archive @@ -42,6 +41,8 @@ sub perl_archive return File::Spec->catdir('$(PERL_INC)',$Config{libperl}); } +=back + 1; __END__ diff --git a/lib/ExtUtils/MM_Cygwin.pm b/lib/ExtUtils/MM_Cygwin.pm index 50463fb..8e8d99c 100644 --- a/lib/ExtUtils/MM_Cygwin.pm +++ b/lib/ExtUtils/MM_Cygwin.pm @@ -1,30 +1,22 @@ package ExtUtils::MM_Cygwin; use strict; - -our $VERSION = '1.00'; +use vars qw($VERSION @ISA); use Config; -#use Cwd; -#use File::Basename; -require Exporter; - -require ExtUtils::MakeMaker; -ExtUtils::MakeMaker->import(qw( $Verbose &neatvalue)); - use File::Spec; -unshift @MM::ISA, 'ExtUtils::MM_Cygwin'; +require ExtUtils::MM_Any; +require ExtUtils::MM_Unix; +@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -sub canonpath { - shift; - return File::Spec->canonpath(@_); -} +$VERSION = 1.01_01; sub cflags { my($self,$libperl)=@_; return $self->{CFLAGS} if $self->{CFLAGS}; - my $base =$self->ExtUtils::MM_Unix::cflags($libperl); + + my $base = $self->SUPER::cflags($libperl); foreach (split /\n/, $base) { / *= */ and $self->{$`} = $'; }; @@ -61,7 +53,7 @@ Warning: I could not locate your pod2man program. Please make sure, END $pod2man_exe = "-S pod2man"; } - my(@m); + my(@m) = (); push @m, qq[POD2MAN_EXE = $pod2man_exe\n], qq[POD2MAN = \$(PERL) -we '%m=\@ARGV;for (keys %m){' \\\n], @@ -72,7 +64,8 @@ q[-e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "], -e 'chmod(oct($(PERM_RW))), $$m{$$_} or warn "chmod $(PERM_RW) $$m{$$_}: $$!\n";}' ]; push @m, "\nmanifypods : pure_all "; - push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}}; + push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, + keys %{$self->{MAN3PODS}}; push(@m,"\n"); if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) { @@ -84,16 +77,14 @@ q[-e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "], join('', @m); } -sub perl_archive -{ - if ($Config{useshrplib} eq 'true') - { - my $libperl = '$(PERL_INC)' .'/'. "$Config{libperl}"; - $libperl =~ s/a$/dll.a/; - return $libperl; - } else { - return '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a"); - } +sub perl_archive { + if ($Config{useshrplib} eq 'true') { + my $libperl = '$(PERL_INC)' .'/'. "$Config{libperl}"; + $libperl =~ s/a$/dll.a/; + return $libperl; + } else { + return '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a"); + } } 1; diff --git a/lib/ExtUtils/MM_DOS.pm b/lib/ExtUtils/MM_DOS.pm new file mode 100644 index 0000000..3481ac1 --- /dev/null +++ b/lib/ExtUtils/MM_DOS.pm @@ -0,0 +1,53 @@ +package ExtUtils::MM_DOS; + +use strict; +use vars qw($VERSION @ISA); + +$VERSION = 0.01; + +require ExtUtils::MM_Win32; +@ISA = qw(ExtUtils::MM_Win32); + + +=head1 NAME + +ExtUtils::MM_DOS - DOS specific subclass of ExtUtils::MM_Win32 + +=head1 SYNOPSIS + + Don't use this module directly. + Use ExtUtils::MM and let it choose. + +=head1 DESCRIPTION + +This is a subclass of ExtUtils::MM_Win32 which contains functionality +for DOS. + +Unless otherwise stated, it works just like ExtUtils::MM_Win32 + +=head2 Overridden methods + +=over 4 + +=item B + +=cut + +sub replace_manpage_separator { + my($self, $man) = @_; + + $man =~ s,/+,__,g; + return $man; +} + +=back + +=head1 AUTHOR + +Michael G Schwern with code from ExtUtils::MM_Unix + +=head1 SEE ALSO + +L, L + +1; diff --git a/lib/ExtUtils/MM_NW5.pm b/lib/ExtUtils/MM_NW5.pm index 5b00186..9a3834c 100644 --- a/lib/ExtUtils/MM_NW5.pm +++ b/lib/ExtUtils/MM_NW5.pm @@ -1,7 +1,5 @@ package ExtUtils::MM_NW5; -our $VERSION = '1.00'; - =head1 NAME ExtUtils::MM_NW5 - methods to override UN*X behaviour in ExtUtils::MakeMaker @@ -21,206 +19,29 @@ the semantics. =cut use Config; -#use Cwd; use File::Basename; -require Exporter; - -use ExtUtils::MakeMaker; -Exporter::import('ExtUtils::MakeMaker', - qw( $Verbose &neatvalue)); - -$ENV{EMXSHELL} = 'sh'; # to run `commands` -unshift @MM::ISA, 'ExtUtils::MM_NW5'; - -$BORLAND = 1 if $Config{'cc'} =~ /^bcc/i; -$GCC = 1 if $Config{'cc'} =~ /^gcc/i; -$DMAKE = 1 if $Config{'make'} =~ /^dmake/i; -$NMAKE = 1 if $Config{'make'} =~ /^nmake/i; -$PERLMAKE = 1 if $Config{'make'} =~ /^pmake/i; - -# a few workarounds for command.com (very basic) -{ - package ExtUtils::MM_Win95; - - # the $^O test may be overkill, but we want to be sure Win32::IsWin95() - # exists before we try it - - unshift @MM::ISA, 'ExtUtils::MM_Win95' - if ($^O =~ /Win32/ && Win32::IsWin95()); - - sub xs_c { - my($self) = shift; - return '' unless $self->needs_linking(); - ' -.xs.c: - $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\ - $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c - ' - } - - sub xs_cpp { - my($self) = shift; - return '' unless $self->needs_linking(); - ' -.xs.cpp: - $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\ - $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp - '; - } - - # many makes are too dumb to use xs_c then c_o - sub xs_o { - my($self) = shift; - return '' unless $self->needs_linking(); - ' -.xs$(OBJ_EXT): - $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\ - $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c - $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c - '; - } -} # end of command.com workarounds - -sub dlsyms { - my($self,%attribs) = @_; - - my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {}; - my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || []; - my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || []; - my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {}; - my(@m); - (my $boot = $self->{NAME}) =~ s/:/_/g; - - if (not $self->{SKIPHASH}{'dynamic'}) { - push(@m," -$self->{BASEEXT}.def: Makefile.PL -", - q! $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Mksymlists \\ - -e "Mksymlists('NAME' => '!, $self->{NAME}, - q!', 'DLBASE' => '!,$self->{DLBASE}, - q!', 'DL_FUNCS' => !,neatvalue($funcs), - q!, 'FUNCLIST' => !,neatvalue($funclist), - q!, 'IMPORTS' => !,neatvalue($imports), - q!, 'DL_VARS' => !, neatvalue($vars), q!);" -!); - } - join('',@m); -} - -sub replace_manpage_separator { - my($self,$man) = @_; - $man =~ s,/+,.,g; - $man; -} - -sub maybe_command { - my($self,$file) = @_; - my @e = exists($ENV{'PATHEXT'}) - ? split(/;/, $ENV{PATHEXT}) - : qw(.com .exe .bat .cmd); - my $e = ''; - for (@e) { $e .= "\Q$_\E|" } - chop $e; - # see if file ends in one of the known extensions - if ($file =~ /($e)$/i) { - return $file if -e $file; - } - else { - for (@e) { - return "$file$_" if -e "$file$_"; - } - } - return; -} - -sub file_name_is_absolute { - shift; - return File::Spec->file_name_is_absolute(@_); -} -sub find_perl { - my($self, $ver, $names, $dirs, $trace) = @_; - my($name, $dir); - if ($trace >= 2){ - print "Looking for perl $ver by these names: -@$names -in these dirs: -@$dirs -"; - } - foreach $dir (@$dirs){ - next unless defined $dir; # $self->{PERL_SRC} may be undefined - foreach $name (@$names){ - my ($abs, $val); - if (File::Spec->file_name_is_absolute($name)) { # /foo/bar - $abs = $name; - } elsif (File::Spec->canonpath($name) eq File::Spec->canonpath(basename($name))) { # foo - $abs = File::Spec->catfile($dir, $name); - } else { # foo/bar - $abs = File::Spec->canonpath(File::Spec->catfile($self->curdir, $name)); - } - print "Checking $abs\n" if ($trace >= 2); - next unless $self->maybe_command($abs); - print "Executing $abs\n" if ($trace >= 2); - $val = `$abs -e "require $ver;" 2>&1`; - if ($? == 0) { - print "Using PERL=$abs\n" if $trace; - return $abs; - } elsif ($trace >= 2) { - print "Result: `$val'\n"; - } - } - } - print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; - 0; # false and not empty -} +use vars qw(@ISA $VERSION); +$VERSION = '2.01_01'; -sub catdir { - shift; - return File::Spec->catdir(@_); -} +require ExtUtils::MM_Win32; +@ISA = qw(ExtUtils::MM_Win32); -=item catfile +use ExtUtils::MakeMaker qw( &neatvalue ); -Concatenate one or more directory names and a filename to form a -complete path ending with a filename +$ENV{EMXSHELL} = 'sh'; # to run `commands` -=cut +$BORLAND = 1 if $Config{'cc'} =~ /^bcc/i; +$GCC = 1 if $Config{'cc'} =~ /^gcc/i; +$DMAKE = 1 if $Config{'make'} =~ /^dmake/i; +$NMAKE = 1 if $Config{'make'} =~ /^nmake/i; +$PERLMAKE = 1 if $Config{'make'} =~ /^pmake/i; -sub catfile { - shift; - return File::Spec->catfile(@_); -} sub init_others { my ($self) = @_; - &ExtUtils::MM_Unix::init_others; - $self->{'TOUCH'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e touch'; - $self->{'CHMOD'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e chmod'; - $self->{'CP'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e cp'; - $self->{'RM_F'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_f'; - $self->{'RM_RF'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_rf'; - $self->{'MV'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mv'; - $self->{'NOOP'} = 'rem'; - $self->{'TEST_F'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e test_f'; - $self->{'LD'} = $Config{'ld'} || 'link'; - $self->{'AR'} = $Config{'ar'} || 'lib'; - $self->{'LDLOADLIBS'} ||= $Config{'libs'}; - # -Lfoo must come first for Borland, so we put it in LDDLFLAGS - if ($BORLAND) { - my $libs = $self->{'LDLOADLIBS'}; - my $libpath = ''; - while ($libs =~ s/(?:^|\s)(("?)-L.+?\2)(?:\s|$)/ /) { - $libpath .= ' ' if length $libpath; - $libpath .= $1; - } - $self->{'LDLOADLIBS'} = $libs; - $self->{'LDDLFLAGS'} ||= $Config{'lddlflags'}; - $self->{'LDDLFLAGS'} .= " $libpath"; - } - $self->{'DEV_NULL'} = '> NUL'; - # $self->{'NOECHO'} = ''; # till we have it working + $self->SUPER::init_others(@_); # incpath is copied to makefile var INCLUDE in constants sub, here just make it empty my $libpth = $Config{'libpth'}; @@ -244,6 +65,7 @@ sub init_others Initializes lots of constants and .SUFFIXES and .PHONY =cut + # NetWare override sub const_cccmd { my($self,$libperl)=@_; @@ -319,14 +141,13 @@ PATH = \$(PATH);\$(TOOLPATH) }; push @m, qq{ -MAKEMAKER = $INC{'ExtUtils\MakeMaker.pm'} +MAKEMAKER = $INC{'ExtUtils/MakeMaker.pm'} MM_VERSION = $ExtUtils::MakeMaker::VERSION }; push @m, q{ # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle). # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle) -# ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) !!! Deprecated from MM 5.32 !!! # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) # DLBASE = Basename part of dynamic library. May be just equal BASEEXT. }; @@ -345,17 +166,11 @@ XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})." C_FILES = ".join(" \\\n\t", @{$self->{C}})." O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})." H_FILES = ".join(" \\\n\t", @{$self->{H}})." -HTMLLIBPODS = ".join(" \\\n\t", sort keys %{$self->{HTMLLIBPODS}})." -HTMLSCRIPTPODS = ".join(" \\\n\t", sort keys %{$self->{HTMLSCRIPTPODS}})." MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})." MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})." "; for $tmp (qw/ - INST_HTMLPRIVLIBDIR INSTALLHTMLPRIVLIBDIR - INST_HTMLSITELIBDIR INSTALLHTMLSITELIBDIR - INST_HTMLSCRIPTDIR INSTALLHTMLSCRIPTDIR - INST_HTMLLIBDIR HTMLEXT INST_MAN1DIR INSTALLMAN1DIR MAN1EXT INST_MAN3DIR INSTALLMAN3DIR MAN3EXT /) { @@ -439,83 +254,6 @@ PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{ } -sub path { - return File::Spec->path(); -} - -=item static_lib (o) - -Defines how to produce the *.a (or equivalent) files. - -=cut - -sub static_lib { - my($self) = @_; -# Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC -# return '' unless $self->needs_linking(); #might be because of a subdir - - return '' unless $self->has_link_code; - - my(@m); - push(@m, <<'END'); -$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)\.exists - $(RM_RF) $@ -END - - # If this extension has its own library (eg SDBM_File) - # then copy that to $(INST_STATIC) and add $(OBJECT) into it. - push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB}; - - push @m, -q{ $(AR) }.($BORLAND ? '$@ $(OBJECT:^"+")' - : ($GCC ? '-ru $@ $(OBJECT)' - : '-out:$@ $(OBJECT)')).q{ - }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld - $(CHMOD) 755 $@ -}; - -# Old mechanism - still available: - - push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs}."\n\n" - if $self->{PERL_SRC}; - - push @m, $self->dir_target('$(INST_ARCHAUTODIR)'); - join('', "\n",@m); -} - -=item dynamic_bs (o) - -Defines targets for bootstrap files. - -=cut - -sub dynamic_bs { - my($self, %attribs) = @_; - return ' -BOOTSTRAP = -' unless $self->has_link_code(); - - return ' -BOOTSTRAP = '."$self->{BASEEXT}.bs".' - -# As Mkbootstrap might not write a file (if none is required) -# we use touch to prevent make continually trying to remake it. -# The DynaLoader only reads a non-empty file. -$(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)\.exists - '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))" - '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \ - -MExtUtils::Mkbootstrap \ - -e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');" - '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP) - $(CHMOD) 644 $@ - -$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists - '."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT) - -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT) - $(CHMOD) 644 $@ -'; -} - =item dynamic_lib (o) Defines how to produce the *.so (or equivalent) files. @@ -617,422 +355,6 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) join('',@m); } -sub perl_archive -{ - my ($self) = @_; - return '$(PERL_INC)\\'.$Config{'libperl'}; -} - -sub export_list -{ - my ($self) = @_; - return "$self->{BASEEXT}.def"; -} - -=item canonpath - -No physical check on the filesystem, but a logical cleanup of a -path. On UNIX eliminated successive slashes and successive "/.". - -=cut - -sub canonpath { - my($self,$path) = @_; - $path =~ s/^([a-z]:)/\u$1/; - $path =~ s|/|\\|g; - $path =~ s|(.)\\+|$1\\|g ; # xx////xx -> xx/xx - $path =~ s|(\\\.)+\\|\\|g ; # xx/././xx -> xx/xx - $path =~ s|^(\.\\)+|| unless $path eq ".\\"; # ./xx -> xx - $path =~ s|\\$|| - unless $path =~ m#^([a-z]:)?\\#; # xx/ -> xx - $path .= '.' if $path =~ m#\\$#; - $path; -} - -=item perl_script - -Takes one argument, a file name, and returns the file name, if the -argument is likely to be a perl script. On MM_Unix this is true for -any ordinary, readable file. - -=cut - -sub perl_script { - my($self,$file) = @_; - return $file if -r $file && -f _; - return "$file.pl" if -r "$file.pl" && -f _; - return "$file.bat" if -r "$file.bat" && -f _; - return; -} - -=item pm_to_blib - -Defines target that copies all files in the hash PM to their -destination and autosplits them. See L - -=cut - -sub pm_to_blib { - my $self = shift; - my($autodir) = File::Spec->catdir('$(INST_LIB)','auto'); - return q{ -pm_to_blib: $(TO_INST_PM) - }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \ - "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \ - -e "pm_to_blib(}. - ($NMAKE ? 'qw[ <{NOECHO}.q{$(TOUCH) $@ -}; -} - -=item test_via_harness (o) - -Helper method to write the test targets - -=cut - -sub test_via_harness { - my($self, $perl, $tests) = @_; - "\t$perl".q! -Mblib -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e "use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;" !."$tests\n"; -} - - -=item tool_autosplit (override) - -Use Win32 quoting on command line. - -=cut - -sub tool_autosplit{ - my($self, %attribs) = @_; - my($asl) = ""; - $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN}; - q{ -# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto -AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MAutoSplit }.$asl.q{ -e "autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1);" -}; -} - -=item tools_other (o) - -Win32 overrides. - -Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in -the Makefile. Also defines the perl programs MKPATH, -WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL. - -=cut - -sub tools_other { - my($self) = shift; - my @m; - my $bin_sh = $Config{sh} || 'cmd /c'; - push @m, qq{ -SHELL = $bin_sh -} unless $DMAKE; # dmake determines its own shell - - for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL/ ) { - push @m, "$_ = $self->{$_}\n"; - } - - push @m, q{ -# The following is a portable way to say mkdir -p -# To see which directories are created, change the if 0 to if 1 -MKPATH = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mkpath - -# This helps us to minimize the effect of the .exists files A yet -# better solution would be to have a stable file in the perl -# distribution with a timestamp of zero. But this solution doesn't -# need any changes to the core distribution and works with older perls -EQUALIZE_TIMESTAMP = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e eqtime -}; - - - return join "", @m if $self->{PARENT}; - - push @m, q{ -# Here we warn users that an old packlist file was found somewhere, -# and that they should call some uninstall routine -WARN_IF_OLD_PACKLIST = $(PERL) -lwe "exit unless -f $$ARGV[0];" \\ --e "print 'WARNING: I have found an old package in';" \\ --e "print ' ', $$ARGV[0], '.';" \\ --e "print 'Please make sure the two installations are not conflicting';" - -UNINST=0 -VERBINST=1 - -MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \ --e "install({ @ARGV },'$(VERBINST)',0,'$(UNINST)');" - -DOC_INSTALL = $(PERL) -e "$$\=\"\n\n\";" \ --e "print '=head2 ', scalar(localtime), ': C<', shift, '>', ' L<', shift, '>';" \ --e "print '=over 4';" \ --e "while (defined($$key = shift) and defined($$val = shift)) { print '=item *';print 'C<', \"$$key: $$val\", '>'; }" \ --e "print '=back';" - -UNINSTALL = $(PERL) -MExtUtils::Install \ --e "uninstall($$ARGV[0],1,1); print \"\nUninstall is deprecated. Please check the";" \ --e "print \" packlist above carefully.\n There may be errors. Remove the\";" \ --e "print \" appropriate files manually.\n Sorry for the inconveniences.\n\"" -}; - - return join "", @m; -} - -=item xs_o (o) - -Defines suffix rules to go from XS to object files directly. This is -only intended for broken make implementations. - -=cut - -sub xs_o { # many makes are too dumb to use xs_c then c_o - my($self) = shift; - return '' -} - -=item top_targets (o) - -Defines the targets all, subdirs, config, and O_FILES - -=cut - -sub top_targets { -# --- Target Sections --- - - my($self) = shift; - my(@m); - push @m, ' -#all :: config $(INST_PM) subdirs linkext manifypods -'; - - push @m, ' -all :: pure_all htmlifypods manifypods - '.$self->{NOECHO}.'$(NOOP) -' - unless $self->{SKIPHASH}{'all'}; - - push @m, ' -pure_all :: config pm_to_blib subdirs linkext - '.$self->{NOECHO}.'$(NOOP) - -subdirs :: $(MYEXTLIB) - '.$self->{NOECHO}.'$(NOOP) - -config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)\.exists - '.$self->{NOECHO}.'$(NOOP) - -config :: $(INST_ARCHAUTODIR)\.exists - '.$self->{NOECHO}.'$(NOOP) - -config :: $(INST_AUTODIR)\.exists - '.$self->{NOECHO}.'$(NOOP) -'; - - push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]); - - if (%{$self->{HTMLLIBPODS}}) { - push @m, qq[ -config :: \$(INST_HTMLLIBDIR)/.exists - $self->{NOECHO}\$(NOOP) - -]; - push @m, $self->dir_target(qw[$(INST_HTMLLIBDIR)]); - } - - if (%{$self->{HTMLSCRIPTPODS}}) { - push @m, qq[ -config :: \$(INST_HTMLSCRIPTDIR)/.exists - $self->{NOECHO}\$(NOOP) - -]; - push @m, $self->dir_target(qw[$(INST_HTMLSCRIPTDIR)]); - } - - if (%{$self->{MAN1PODS}}) { - push @m, qq[ -config :: \$(INST_MAN1DIR)\\.exists - $self->{NOECHO}\$(NOOP) - -]; - push @m, $self->dir_target(qw[$(INST_MAN1DIR)]); - } - if (%{$self->{MAN3PODS}}) { - push @m, qq[ -config :: \$(INST_MAN3DIR)\\.exists - $self->{NOECHO}\$(NOOP) - -]; - push @m, $self->dir_target(qw[$(INST_MAN3DIR)]); - } - - push @m, ' -$(O_FILES): $(H_FILES) -' if @{$self->{O_FILES} || []} && @{$self->{H} || []}; - - push @m, q{ -help: - perldoc ExtUtils::MakeMaker -}; - - push @m, q{ -Version_check: - }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \ - -MExtUtils::MakeMaker=Version_check \ - -e "Version_check('$(MM_VERSION)')" -}; - - join('',@m); -} - -=item htmlifypods (o) - -Defines targets and routines to translate the pods into HTML manpages -and put them into the INST_HTMLLIBDIR and INST_HTMLSCRIPTDIR -directories. - -Same as MM_Unix version (changes command-line quoting). - -=cut - -sub htmlifypods { - my($self, %attribs) = @_; - return "\nhtmlifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n" unless - %{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}}; - my($dist); - my($pod2html_exe); - if (defined $self->{PERL_SRC}) { - $pod2html_exe = File::Spec->catfile($self->{PERL_SRC},'pod','pod2html'); - } else { - $pod2html_exe = File::Spec->catfile($Config{scriptdirexp},'pod2html'); - } - unless ($pod2html_exe = $self->perl_script($pod2html_exe)) { - # No pod2html but some HTMLxxxPODS to be installed - print <{MAKEFILE}, q[';" \\ --e "print qq(Htmlifying $$m{$$_}\n);" \\ --e "$$dir = dirname($$m{$$_}); mkpath($$dir) unless -d $$dir;" \\ --e "system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2HTML_EXE) ].qq[$$_>$$m{$$_}])==0 or warn qq(Couldn\\047t install $$m{$$_}\n);" \\ --e "chmod(oct($(PERM_RW))), $$m{$$_} or warn qq(chmod $(PERM_RW) $$m{$$_}: $$!\n);}" -]; - push @m, "\nhtmlifypods : pure_all "; - push @m, join " \\\n\t", keys %{$self->{HTMLLIBPODS}}, keys %{$self->{HTMLSCRIPTPODS}}; - - push(@m,"\n"); - if (%{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}}) { - push @m, "\t$self->{NOECHO}\$(POD2HTML) \\\n\t"; - push @m, join " \\\n\t", %{$self->{HTMLLIBPODS}}, %{$self->{HTMLSCRIPTPODS}}; - } - join('', @m); -} - -=item manifypods (o) - -We don't want manpage process. - -=cut - -sub manifypods { - my($self) = shift; - return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n"; -} - -=item dist_ci (o) - -Same as MM_Unix version (changes command-line quoting). - -=cut - -sub dist_ci { - my($self) = shift; - my @m; - push @m, q{ -ci : - $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=maniread \\ - -e "@all = keys %{ maniread() };" \\ - -e "print(\"Executing $(CI) @all\n\"); system(\"$(CI) @all\");" \\ - -e "print(\"Executing $(RCS_LABEL) ...\n\"); system(\"$(RCS_LABEL) @all\");" -}; - join "", @m; -} - -=item dist_core (o) - -Same as MM_Unix version (changes command-line quoting). - -=cut - -sub dist_core { - my($self) = shift; - my @m; - push @m, q{ -dist : $(DIST_DEFAULT) - }.$self->{NOECHO}.q{$(PERL) -le "print \"Warning: Makefile possibly out of date with $$vf\" if " \ - -e "-e ($$vf=\"$(VERSION_FROM)\") and -M $$vf < -M \"}.$self->{MAKEFILE}.q{\";" - -tardist : $(DISTVNAME).tar$(SUFFIX) - -zipdist : $(DISTVNAME).zip - -$(DISTVNAME).tar$(SUFFIX) : distdir - $(PREOP) - $(TO_UNIX) - $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) - $(RM_RF) $(DISTVNAME) - $(COMPRESS) $(DISTVNAME).tar - $(POSTOP) - -$(DISTVNAME).zip : distdir - $(PREOP) - $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) - $(RM_RF) $(DISTVNAME) - $(POSTOP) - -uutardist : $(DISTVNAME).tar$(SUFFIX) - uuencode $(DISTVNAME).tar$(SUFFIX) \\ - $(DISTVNAME).tar$(SUFFIX) > \\ - $(DISTVNAME).tar$(SUFFIX)_uu - -shdist : distdir - $(PREOP) - $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar - $(RM_RF) $(DISTVNAME) - $(POSTOP) -}; - join "", @m; -} - -=item pasthru (o) - -Defines the string that is passed to recursive make calls in -subdirectories. - -=cut - -sub pasthru { - my($self) = shift; - return "PASTHRU = " . ($NMAKE ? "-nologo" : ""); -} - - 1; __END__ diff --git a/lib/ExtUtils/MM_OS2.pm b/lib/ExtUtils/MM_OS2.pm index f598c71..1db55c4 100644 --- a/lib/ExtUtils/MM_OS2.pm +++ b/lib/ExtUtils/MM_OS2.pm @@ -1,20 +1,16 @@ package ExtUtils::MM_OS2; use strict; +use vars qw($VERSION @ISA); -our $VERSION = '1.00'; - -#use Config; -#use Cwd; -#use File::Basename; -require Exporter; - -require ExtUtils::MakeMaker; -ExtUtils::MakeMaker->import(qw( $Verbose &neatvalue)); - +use ExtUtils::MakeMaker qw(neatvalue); use File::Spec; -unshift @MM::ISA, 'ExtUtils::MM_OS2'; +$VERSION = '1.02_01'; + +require ExtUtils::MM_Any; +require ExtUtils::MM_Unix; +@ISA = qw(ExtUtils::MM_Any ExtUtils::MM_Unix); =pod @@ -38,6 +34,17 @@ the semantics. =cut +sub dist { + my($self, %attribs) = @_; + + $attribs{TO_UNIX} ||= sprintf <<'MAKE_TEXT', $self->{NOECHO}; +%s$(TEST_F) tmp.zip && $(RM) tmp.zip; \\ +$(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM) tmp.zip +MAKE_TEXT + + return $self->SUPER::dist(%attribs); +} + sub dlsyms { my($self,%attribs) = @_; @@ -111,14 +118,8 @@ sub maybe_command { return; } -sub file_name_is_absolute { - shift; - return File::Spec->file_name_is_absolute(@_); -} - -sub perl_archive -{ - return "\$(PERL_INC)/libperl\$(LIB_EXT)"; +sub perl_archive { + return "\$(PERL_INC)/libperl\$(LIB_EXT)"; } =item perl_archive_after diff --git a/lib/ExtUtils/MM_UWIN.pm b/lib/ExtUtils/MM_UWIN.pm new file mode 100644 index 0000000..59384a2 --- /dev/null +++ b/lib/ExtUtils/MM_UWIN.pm @@ -0,0 +1,52 @@ +package ExtUtils::MM_UWIN; + +use strict; +use vars qw($VERSION @ISA); +$VERSION = 0.01; + +require ExtUtils::MM_Unix; +@ISA = qw(ExtUtils::MM_Unix); + + +=head1 NAME + +ExtUtils::MM_UWIN - U/WIN specific subclass of ExtUtils::MM_Unix + +=head1 SYNOPSIS + + Don't use this module directly. + Use ExtUtils::MM and let it choose. + +=head1 DESCRIPTION + +This is a subclass of ExtUtils::MM_Unix which contains functionality for +the AT&T U/WIN UNIX on Windows environment. + +Unless otherwise stated it works just like ExtUtils::MM_Unix + +=head2 Overridden methods + +=over 4 + +=item B + +=cut + +sub replace_manpage_separator { + my($self, $man) = @_; + + $man =~ s,/+,.,g; + return $man; +} + +=back + +=head1 AUTHOR + +Michael G Schwern with code from ExtUtils::MM_Unix + +=head1 SEE ALSO + +L, L + +1; diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index 5a875f2..ecfe831 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -1,5 +1,7 @@ package ExtUtils::MM_Unix; +require 5.005_03; # Maybe further back, dunno + use strict; use Exporter (); @@ -8,18 +10,22 @@ use File::Basename qw(basename dirname fileparse); use File::Spec; use DirHandle; use strict; -our ($Is_Mac,$Is_OS2,$Is_VMS,$Is_Win32,$Is_Dos, - $Verbose,%pm,%static,$Xsubpp_Version); +use vars qw($VERSION @ISA + $Is_Mac $Is_OS2 $Is_VMS $Is_Win32 $Is_Dos $Is_VOS + $Verbose %pm %static $Xsubpp_Version); + +use ExtUtils::MakeMaker qw($Verbose neatvalue); -our $VERSION = '1.12607'; +$VERSION = '1.17_01'; -require ExtUtils::MakeMaker; -ExtUtils::MakeMaker->import(qw($Verbose &neatvalue)); +require ExtUtils::MM_Any; +@ISA = qw(ExtUtils::MM_Any); -$Is_OS2 = $^O eq 'os2'; -$Is_Mac = $^O eq 'MacOS'; +$Is_OS2 = $^O eq 'os2'; +$Is_Mac = $^O eq 'MacOS'; $Is_Win32 = $^O eq 'MSWin32'; -$Is_Dos = $^O eq 'dos'; +$Is_Dos = $^O eq 'dos'; +$Is_VOS = $^O eq 'vos'; if ($Is_VMS = $^O eq 'VMS') { require VMS::Filespec; @@ -67,90 +73,15 @@ Makefile.PL. Overridable methods are marked as (o). All methods are overridable by a platform specific MM_*.pm file (See L) and L). -=head2 Preloaded methods - -=over 2 - -=item canonpath - -No physical check on the filesystem, but a logical cleanup of a -path. On UNIX eliminated successive slashes and successive "/.". - -=cut - -sub canonpath { - my($self,$path) = @_; - - # Handle POSIX-style node names beginning with double slash - my $node = ''; - if ( $^O =~ m/^(?:qnx|nto)$/ && $path =~ s:^(//[^/]+)(/|\z):/:s ) { - $node = $1; - } - $path =~ s|(?<=[^/])/+|/|g ; # xx////xx -> xx/xx - $path =~ s|(/\.)+/|/|g ; # xx/././xx -> xx/xx - $path =~ s|^(\./)+||s unless $path eq "./"; # ./xx -> xx - $path =~ s|(?<=[^/])/\z|| ; # xx/ -> xx - return "$node$path"; -} - -=item catdir - -Concatenate two or more directory names to form a complete path ending -with a directory. But remove the trailing slash from the resulting -string, because it doesn't look good, isn't necessary and confuses -OS2. Of course, if this is the root directory, don't cut off the -trailing slash :-) - =cut -# '; - -sub catdir { - shift; - return File::Spec->catdir(@_); -} - -=item catfile - -Concatenate one or more directory names and a filename to form a -complete path ending with a filename - -=cut - -sub catfile { - shift; - return File::Spec->catdir(@_); -} - -=item curdir - -Returns a string representing of the current directory. "." on UNIX. - -=cut - -sub curdir { - return File::Spec->curdir(); -} - -=item rootdir - -Returns a string representing of the root directory. "/" on UNIX. - -=cut - -sub rootdir { - return File::Spec->rootdir(); -} - -=item updir - -Returns a string representing of the parent directory. ".." on UNIX. - -=cut - -sub updir { - return File::Spec->updir(); -} +# So we don't have to keep calling the methods over and over again, +# we have these globals to cache the values. They have to be global +# else the SelfLoaded methods can't see them. +use vars qw($Curdir $Rootdir $Updir); +$Curdir = File::Spec->curdir; +$Rootdir = File::Spec->rootdir; +$Updir = File::Spec->updir; sub c_o; sub clean; @@ -173,13 +104,11 @@ sub dynamic_lib; sub exescan; sub export_list; sub extliblist; -sub file_name_is_absolute; sub find_perl; sub fixin; sub force; sub guess_name; sub has_link_code; -sub htmlifypods; sub init_dirscan; sub init_main; sub init_others; @@ -198,7 +127,6 @@ sub needs_linking; sub nicetext; sub parse_version; sub pasthru; -sub path; sub perl_archive; sub perl_archive_after; sub perl_script; @@ -233,12 +161,13 @@ sub xsubpp_version; use SelfLoader; +# SelfLoader not smart enough to avoid autoloading DESTROY +sub DESTROY { } + 1; __DATA__ -=back - =head2 SelfLoaded methods =over 2 @@ -261,30 +190,30 @@ sub c_o { $cpp_cmd =~ s/^CCCMD\s*=\s*\$\(CC\)/$cpp/; push @m, ' .c.i: - '. $cpp_cmd . ' $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.c > $*.i + '. $cpp_cmd . ' $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c > $*.i '; } push @m, ' .c.s: - $(CCCMD) -S $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.c + $(CCCMD) -S $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c '; push @m, ' .c$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.c + $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c '; push @m, ' .C$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.C -' if $^O ne 'os2' and $^O ne 'MSWin32' and $^O ne 'dos'; #Case-specific + $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.C +' if !$Is_OS2 and !$Is_Win32 and !$Is_Dos; #Case-specific push @m, ' .cpp$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.cpp + $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cpp .cxx$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.cxx + $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cxx .cc$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.cc + $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cc '; join "", @m; } @@ -441,19 +370,21 @@ EOT push( @otherfiles, @errfiles, 'perlmain.err' ); } push(@otherfiles, $attribs{FILES}) if $attribs{FILES}; - push(@otherfiles, qw[./blib $(MAKE_APERL_FILE) $(INST_ARCHAUTODIR)/extralibs.all - perlmain.c tmon.out mon.out]); - if ($^O eq 'vos') { - push(@otherfiles, qw[*.kp]); - } else { - push(@otherfiles, qw[core core.*perl.*.? *perl.core]); - } - push(@otherfiles, qw[so_locations pm_to_blib + push(@otherfiles, qw[./blib $(MAKE_APERL_FILE) + $(INST_ARCHAUTODIR)/extralibs.all + perlmain.c tmon.out mon.out so_locations pm_to_blib *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT) $(BOOTSTRAP) $(BASEEXT).bso $(BASEEXT).def lib$(BASEEXT).def $(BASEEXT).exp $(BASEEXT).x ]); + if( $Is_VOS ) { + push(@otherfiles, qw[*.kp]); + } + else { + push(@otherfiles, qw[core core.*perl.*.? *perl.core]); + } + push @m, "\t-$self->{RM_RF} @otherfiles\n"; # See realclean and ext/utils/make_ext for usage of Makefile.old push(@m, @@ -552,7 +483,7 @@ sub constants { PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC PERL_INC PERL FULLPERL PERLRUN PERLRUNINST TEST_LIBS - FULL_AR PERL_CORE + FULL_AR PERL_CORE NOOP NOECHO / ) { next unless defined $self->{$tmp}; @@ -575,7 +506,6 @@ MM_VERSION = $ExtUtils::MakeMaker::VERSION push @m, q{ # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle). # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle) -# ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) !!! Deprecated from MM 5.32 !!! # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) # DLBASE = Basename part of dynamic library. May be just equal BASEEXT. }; @@ -594,17 +524,11 @@ XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})." C_FILES = ".join(" \\\n\t", @{$self->{C}})." O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})." H_FILES = ".join(" \\\n\t", @{$self->{H}})." -HTMLLIBPODS = ".join(" \\\n\t", sort keys %{$self->{HTMLLIBPODS}})." -HTMLSCRIPTPODS = ".join(" \\\n\t", sort keys %{$self->{HTMLSCRIPTPODS}})." MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})." MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})." "; for $tmp (qw/ - INST_HTMLPRIVLIBDIR INSTALLHTMLPRIVLIBDIR - INST_HTMLSITELIBDIR INSTALLHTMLSITELIBDIR - INST_HTMLSCRIPTDIR INSTALLHTMLSCRIPTDIR - INST_HTMLLIBDIR HTMLEXT INST_MAN1DIR INSTALLMAN1DIR MAN1EXT INST_MAN3DIR INSTALLMAN3DIR MAN3EXT /) { @@ -681,12 +605,6 @@ PERL_ARCHIVE = $tmp PERL_ARCHIVE_AFTER = $tmp "; -# push @m, q{ -#INST_PM = }.join(" \\\n\t", sort values %{$self->{PM}}).q{ -# -#PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{ -#}; - push @m, q{ TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{ @@ -765,49 +683,37 @@ Defines a lot of macros for distribution support. sub dist { my($self, %attribs) = @_; - my(@m); # VERSION should be sanitised before use as a file name - my($version) = $attribs{VERSION} || '$(VERSION)'; - my($name) = $attribs{NAME} || '$(DISTNAME)'; - my($tar) = $attribs{TAR} || 'tar'; # eg /usr/bin/gnutar - my($tarflags) = $attribs{TARFLAGS} || 'cvf'; - my($zip) = $attribs{ZIP} || 'zip'; # eg pkzip Yuck! - my($zipflags) = $attribs{ZIPFLAGS} || '-r'; - my($compress) = $attribs{COMPRESS} || 'gzip --best'; - my($suffix) = $attribs{SUFFIX} || '.gz'; # eg .gz - my($shar) = $attribs{SHAR} || 'shar'; # eg "shar --gzip" - my($preop) = $attribs{PREOP} || "$self->{NOECHO}\$(NOOP)"; # eg update MANIFEST - my($postop) = $attribs{POSTOP} || "$self->{NOECHO}\$(NOOP)"; # eg remove the distdir - - my($to_unix) = $attribs{TO_UNIX} || ($Is_OS2 - ? "$self->{NOECHO}" - . '$(TEST_F) tmp.zip && $(RM) tmp.zip;' - . ' $(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM) tmp.zip' - : "$self->{NOECHO}\$(NOOP)"); - - my($ci) = $attribs{CI} || 'ci -u'; - my($rcs_label)= $attribs{RCS_LABEL}|| 'rcs -Nv$(VERSION_SYM): -q'; - my($dist_cp) = $attribs{DIST_CP} || 'best'; - my($dist_default) = $attribs{DIST_DEFAULT} || 'tardist'; + $attribs{VERSION} ||= '$(VERSION)'; + $attribs{NAME} ||= '$(DISTNAME)'; + $attribs{TAR} ||= 'tar'; + $attribs{TARFLAGS} ||= 'cvf'; + $attribs{ZIP} ||= 'zip'; + $attribs{ZIPFLAGS} ||= '-r'; + $attribs{COMPRESS} ||= 'gzip --best'; + $attribs{SUFFIX} ||= '.gz'; + $attribs{SHAR} ||= 'shar'; + $attribs{PREOP} ||= "$self->{NOECHO}\$(NOOP)"; # eg update MANIFEST + $attribs{POSTOP} ||= "$self->{NOECHO}\$(NOOP)"; # eg remove the distdir + $attribs{TO_UNIX} ||= "$self->{NOECHO}\$(NOOP)"; - push @m, " -DISTVNAME = ${name}-$version -TAR = $tar -TARFLAGS = $tarflags -ZIP = $zip -ZIPFLAGS = $zipflags -COMPRESS = $compress -SUFFIX = $suffix -SHAR = $shar -PREOP = $preop -POSTOP = $postop -TO_UNIX = $to_unix -CI = $ci -RCS_LABEL = $rcs_label -DIST_CP = $dist_cp -DIST_DEFAULT = $dist_default -"; - join "", @m; + $attribs{CI} ||= 'ci -u'; + $attribs{RCS_LABEL}||= 'rcs -Nv$(VERSION_SYM): -q'; + $attribs{DIST_CP} ||= 'best'; + $attribs{DIST_DEFAULT} ||= 'tardist'; + + $attribs{DISTVNAME} ||= "$attribs{NAME}-$attribs{VERSION}"; + + # We've already printed out VERSION and NAME variables. + delete $attribs{VERSION}; + delete $attribs{NAME}; + + my $make = ''; + while(my($var, $value) = each %attribs) { + $make .= "$var = $value\n"; + } + + return $make; } =item dist_basics (o) @@ -818,34 +724,25 @@ Defines the targets distclean, distcheck, skipcheck, manifest, veryclean. sub dist_basics { my($self) = shift; - my @m; - push @m, q{ + + return <<'MAKE_FRAG'; distclean :: realclean distcheck -}; + $(NOECHO) $(NOOP) - push @m, q{ distcheck : - $(PERLRUN) -MExtUtils::Manifest=fullcheck \\ - -e fullcheck -}; + $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck - push @m, q{ skipcheck : - $(PERLRUN) -MExtUtils::Manifest=skipcheck \\ - -e skipcheck -}; + $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck - push @m, q{ manifest : - $(PERLRUN) -MExtUtils::Manifest=mkmanifest \\ - -e mkmanifest -}; + $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest - push @m, q{ veryclean : realclean $(RM_F) *~ *.orig */*~ */*.orig -}; - join "", @m; + +MAKE_FRAG + } =item dist_ci (o) @@ -859,7 +756,7 @@ sub dist_ci { my @m; push @m, q{ ci : - $(PERLRUN) -MExtUtils::Manifest=maniread \\ + $(PERLRUN) "-MExtUtils::Manifest=maniread" \\ -e "@all = keys %{ maniread() };" \\ -e 'print("Executing $(CI) @all\n"); system("$(CI) @all");' \\ -e 'print("Executing $(RCS_LABEL) ...\n"); system("$(RCS_LABEL) @all");' @@ -913,7 +810,7 @@ shdist : distdir join "", @m; } -=item dist_dir (o) +=item dist_dir Defines the scratch directory target that will hold the distribution before tar-ing (or shar-ing). @@ -922,17 +819,18 @@ before tar-ing (or shar-ing). sub dist_dir { my($self) = shift; - my @m; - push @m, q{ + + return <<'MAKE_FRAG'; distdir : $(RM_RF) $(DISTVNAME) - $(PERLRUN) -MExtUtils::Manifest=manicopy,maniread \\ + $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \ -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');" -}; - join "", @m; + +MAKE_FRAG + } -=item dist_test (o) +=item dist_test Defines a target that produces the distribution in the scratchdirectory, and runs 'perl Makefile.PL; make ;make test' in that @@ -1030,7 +928,7 @@ BOOTSTRAP = '."$self->{BASEEXT}.bs".' $(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)/.exists '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))" '.$self->{NOECHO}.'$(PERLRUN) \ - -MExtUtils::Mkbootstrap \ + "-MExtUtils::Mkbootstrap" \ -e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');" '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP) $(CHMOD) $(PERM_RW) $@ @@ -1140,17 +1038,6 @@ sub extliblist { $self->ext($libs, $Verbose); } -=item file_name_is_absolute - -Takes as argument a path and returns true, if it is an absolute path. - -=cut - -sub file_name_is_absolute { - shift; - return File::Spec->file_name_is_absolute(@_); -} - =item find_perl Finds the executables PERL and FULLPERL @@ -1176,7 +1063,7 @@ in these dirs: } elsif (File::Spec->canonpath($name) eq File::Spec->canonpath(basename($name))) { # foo $abs = File::Spec->catfile($dir, $name); } else { # foo/bar - $abs = File::Spec->canonpath(File::Spec->catfile(File::Spec->curdir, $name)); + $abs = File::Spec->canonpath(File::Spec->catfile($Curdir, $name)); } print "Checking $abs\n" if ($trace >= 2); next unless $self->maybe_command($abs); @@ -1359,60 +1246,10 @@ sub has_link_code { return $self->{HAS_LINK_CODE} = 0; } -=item htmlifypods (o) - -Defines targets and routines to translate the pods into HTML manpages -and put them into the INST_HTMLLIBDIR and INST_HTMLSCRIPTDIR -directories. - -=cut - -sub htmlifypods { - my($self, %attribs) = @_; - return "\nhtmlifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n" unless - %{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}}; - my($dist); - my($pod2html_exe); - if (defined $self->{PERL_SRC}) { - $pod2html_exe = File::Spec->catfile($self->{PERL_SRC},'pod','pod2html'); - } else { - $pod2html_exe = File::Spec->catfile($Config{scriptdirexp},'pod2html'); - } - unless ($pod2html_exe = $self->perl_script($pod2html_exe)) { - # No pod2html but some HTMLxxxPODS to be installed - print <{MAKEFILE}, q[";' \\ --e 'print "Htmlifying $$m{$$_}\n";' \\ --e '$$dir = dirname($$m{$$_}); mkpath($$dir) unless -d $$dir;' \\ --e 'system(q[$(PERLRUN) $(POD2HTML_EXE) ].qq[$$_>$$m{$$_}])==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\ --e 'chmod(oct($(PERM_RW))), $$m{$$_} or warn "chmod $(PERM_RW) $$m{$$_}: $$!\n";}' -]; - push @m, "\nhtmlifypods : pure_all "; - push @m, join " \\\n\t", keys %{$self->{HTMLLIBPODS}}, keys %{$self->{HTMLSCRIPTPODS}}; - - push(@m,"\n"); - if (%{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}}) { - push @m, "\t$self->{NOECHO}\$(POD2HTML) \\\n\t"; - push @m, join " \\\n\t", %{$self->{HTMLLIBPODS}}, %{$self->{HTMLSCRIPTPODS}}; - } - join('', @m); -} =item init_dirscan -Initializes DIR, XS, PM, C, O_FILES, H, PL_FILES, HTML*PODS, MAN*PODS, EXE_FILES. +Initializes DIR, XS, PM, C, O_FILES, H, PL_FILES, MAN*PODS, EXE_FILES. =cut @@ -1422,9 +1259,9 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) local(%pm); #the sub in find() has to see this hash @ignore{qw(Makefile.PL test.pl)} = (1,1); $ignore{'makefile.pl'} = 1 if $Is_VMS; - foreach $name ($self->lsdir(File::Spec->curdir)){ + foreach $name ($self->lsdir($Curdir)){ next if $name =~ /\#/; - next if $name eq File::Spec->curdir or $name eq File::Spec->updir or $ignore{$name}; + next if $name eq $Curdir or $name eq $Updir or $ignore{$name}; next unless $self->libscan($name); if (-d $name){ next if -l $name; # We do not support symlinks at all @@ -1447,7 +1284,9 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) if ($txt =~ /Extracting \S+ \(with variable substitutions/) { ($pl_files{$name} = $name) =~ s/[._]pl\z//i ; } - else { $pm{$name} = File::Spec->catfile($self->{INST_LIBDIR},$name); } + else { + $pm{$name} = File::Spec->catfile($self->{INST_LIBDIR},$name); + } } elsif ($name =~ /\.(p[ml]|pod)\z/){ $pm{$name} = File::Spec->catfile($self->{INST_LIBDIR},$name); } @@ -1505,11 +1344,16 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) return; } return if /\#/; - my($path, $prefix) = ($File::Find::name, $self->{INST_LIBDIR}); - my($striplibpath,$striplibname); - $prefix = $self->{INST_LIB} if (($striplibpath = $path) =~ s:^(\W*)lib\W:$1:i); - ($striplibname,$striplibpath) = fileparse($striplibpath); - my($inst) = File::Spec->catfile($prefix,$striplibpath,$striplibname); + return if /~$/; # emacs temp files + + my $path = $File::Find::name; + my $prefix = $self->{INST_LIBDIR}; + my $striplibpath; + + $prefix = $self->{INST_LIB} + if ($striplibpath = $path) =~ s:^(\W*)lib\W:$1:i; + + my($inst) = File::Spec->catfile($prefix,$striplibpath); local($_) = $inst; # for backwards compatibility $inst = $self->libscan($inst); print "libscan($path) => '$inst'\n" if ($Verbose >= 2); @@ -1529,14 +1373,14 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) # Set up names of manual pages to generate from pods my %pods; - foreach my $man (qw(MAN1 MAN3 HTMLLIB HTMLSCRIPT)) { + foreach my $man (qw(MAN1 MAN3)) { unless ($self->{"${man}PODS"}) { $self->{"${man}PODS"} = {}; $pods{$man} = 1 unless $self->{"INST_${man}DIR"} =~ /^(none|\s*)$/; } } - if ($pods{MAN1} || $pods{HTMLSCRIPT}) { + if ($pods{MAN1}) { if ( exists $self->{EXE_FILES} ) { foreach $name (@{$self->{EXE_FILES}}) { local *FH; @@ -1554,10 +1398,6 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) $ispod = 1; } next unless $ispod; - if ($pods{HTMLSCRIPT}) { - $self->{HTMLSCRIPTPODS}->{$name} = - File::Spec->catfile("\$(INST_HTMLSCRIPTDIR)", basename($name).".\$(HTMLEXT)"); - } if ($pods{MAN1}) { $self->{MAN1PODS}->{$name} = File::Spec->catfile("\$(INST_MAN1DIR)", basename($name).".\$(MAN1EXT)"); @@ -1565,7 +1405,7 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) } } } - if ($pods{MAN3} || $pods{HTMLLIB}) { + if ($pods{MAN3}) { my %manifypods = (); # we collect the keys first, i.e. the files # we have to convert to pod foreach $name (keys %{$self->{PM}}) { @@ -1600,10 +1440,6 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) } my($manpagename) = $name; $manpagename =~ s/\.p(od|m|l)\z//; - if ($pods{HTMLLIB}) { - $self->{HTMLLIBPODS}->{$name} = - File::Spec->catfile("\$(INST_HTMLLIBDIR)", "$manpagename.\$(HTMLEXT)"); - } unless ($manpagename =~ s!^\W*lib\W+!!s) { # everything below lib is ok $manpagename = File::Spec->catfile(split(/::/,$self->{PARENT_NAME}),$manpagename); } @@ -1634,7 +1470,6 @@ sub init_main { # NAME = Foo::Bar::Oracle # FULLEXT = Foo/Bar/Oracle # BASEEXT = Oracle - # ROOTEXT = Directory part of FULLEXT with leading /. !!! Deprecated from MM 5.32 !!! # PARENT_NAME = Foo::Bar ### Only UNIX: ### ($self->{FULLEXT} = @@ -1664,12 +1499,6 @@ sub init_main { } - ### ROOTEXT deprecated from MM 5.32 -### ($self->{ROOTEXT} = -### $self->{FULLEXT}) =~ s#/?\Q$self->{BASEEXT}\E$## ; #eg. /BSD/Foo -### $self->{ROOTEXT} = ($Is_VMS ? '' : '/') . $self->{ROOTEXT} if $self->{ROOTEXT}; - - # --- Initialize PERL_LIB, INST_LIB, PERL_SRC # *Real* information: where did we get these two from? ... @@ -1678,7 +1507,11 @@ sub init_main { unless ($self->{PERL_SRC}){ my($dir); - foreach $dir (File::Spec->updir(),File::Spec->catdir(File::Spec->updir(),File::Spec->updir()),File::Spec->catdir(File::Spec->updir(),File::Spec->updir(),File::Spec->updir()),File::Spec->catdir(File::Spec->updir(),File::Spec->updir(),File::Spec->updir(),File::Spec->updir())){ + foreach $dir ($Updir, + File::Spec->catdir($Updir,$Updir), + File::Spec->catdir($Updir,$Updir,$Updir), + File::Spec->catdir($Updir,$Updir,$Updir,$Updir)) + { if ( -f File::Spec->catfile($dir,"config.sh") && @@ -1753,7 +1586,8 @@ EOP } } - unless (-f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h"))){ + unless(-f ($perl_h = File::Spec->catfile($self->{PERL_INC},"perl.h"))) + { die qq{ Error: Unable to locate installed Perl libraries or Perl source code. @@ -1789,11 +1623,11 @@ usually solves this kind of problem. if (defined $self->{PERL_SRC} and $self->{INSTALLDIRS} eq "perl") { $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB}; } else { - $self->{INST_LIB} = File::Spec->catdir(File::Spec->curdir,"blib","lib"); + $self->{INST_LIB} = File::Spec->catdir($Curdir,"blib","lib"); } } - $self->{INST_ARCHLIB} ||= File::Spec->catdir(File::Spec->curdir,"blib","arch"); - $self->{INST_BIN} ||= File::Spec->catdir(File::Spec->curdir,'blib','bin'); + $self->{INST_ARCHLIB} ||= File::Spec->catdir($Curdir,"blib","arch"); + $self->{INST_BIN} ||= File::Spec->catdir($Curdir,'blib','bin'); # We need to set up INST_LIBDIR before init_libscan() for VMS my @parentdir = split(/::/, $self->{PARENT_NAME}); @@ -1803,8 +1637,8 @@ usually solves this kind of problem. $self->{INST_ARCHAUTODIR} = File::Spec->catdir($self->{INST_ARCHLIB},'auto',$self->{FULLEXT}); # INST_EXE is deprecated, should go away March '97 - $self->{INST_EXE} ||= File::Spec->catdir(File::Spec->curdir,'blib','script'); - $self->{INST_SCRIPT} ||= File::Spec->catdir(File::Spec->curdir,'blib','script'); + $self->{INST_EXE} ||= File::Spec->catdir($Curdir,'blib','script'); + $self->{INST_SCRIPT} ||= File::Spec->catdir($Curdir,'blib','script'); # The user who requests an installation directory explicitly # should not have to tell us an architecture installation directory @@ -1868,20 +1702,23 @@ usually solves this kind of problem. /) { $self->prefixify($install_variable,$configure_prefix,$replace_prefix); } - my $funkylibdir = $self->catdir($configure_prefix,"lib","perl5"); + my $funkylibdir = File::Spec->catdir($configure_prefix,"lib","perl5"); $funkylibdir = '' unless -d $funkylibdir; - $search_prefix = $funkylibdir || $self->catdir($configure_prefix,"lib"); + $search_prefix = $funkylibdir || + File::Spec->catdir($configure_prefix,"lib"); + if ($self->{LIB}) { $self->{INSTALLPRIVLIB} = $self->{INSTALLSITELIB} = $self->{LIB}; $self->{INSTALLARCHLIB} = $self->{INSTALLSITEARCH} = - $self->catdir($self->{LIB},$Config{'archname'}); + File::Spec->catdir($self->{LIB},$Config{'archname'}); } else { - if (-d $self->catdir($self->{PREFIX},"lib","perl5")) { - $replace_prefix = $self->catdir(qq[\$\(PREFIX\)],"lib", "perl5"); + if (-d File::Spec->catdir($self->{PREFIX},"lib","perl5")) { + $replace_prefix = File::Spec->catdir(qq[\$\(PREFIX\)],"lib", + "perl5"); } else { - $replace_prefix = $self->catdir(qq[\$\(PREFIX\)],"lib"); + $replace_prefix = File::Spec->catdir(qq[\$\(PREFIX\)],"lib"); } for $install_variable (qw/ INSTALLPRIVLIB @@ -1918,7 +1755,7 @@ usually solves this kind of problem. if ($self->{INSTALLMAN1DIR} =~ /^(none|\s*)$/){ $self->{INST_MAN1DIR} = $self->{INSTALLMAN1DIR}; } else { - $self->{INST_MAN1DIR} = File::Spec->catdir(File::Spec->curdir,'blib','man1'); + $self->{INST_MAN1DIR} = File::Spec->catdir($Curdir,'blib','man1'); } } $self->{MAN1EXT} ||= $Config::Config{man1ext}; @@ -1929,36 +1766,11 @@ usually solves this kind of problem. if ($self->{INSTALLMAN3DIR} =~ /^(none|\s*)$/){ $self->{INST_MAN3DIR} = $self->{INSTALLMAN3DIR}; } else { - $self->{INST_MAN3DIR} = File::Spec->catdir(File::Spec->curdir,'blib','man3'); + $self->{INST_MAN3DIR} = File::Spec->catdir($Curdir,'blib','man3'); } } $self->{MAN3EXT} ||= $Config::Config{man3ext}; - $self->{INSTALLHTMLPRIVLIBDIR} = $Config::Config{installhtmlprivlibdir} - unless defined $self->{INSTALLHTMLPRIVLIBDIR}; - $self->{INSTALLHTMLSITELIBDIR} = $Config::Config{installhtmlsitelibdir} - unless defined $self->{INSTALLHTMLSITELIBDIR}; - - unless (defined $self->{INST_HTMLLIBDIR}){ - if ($self->{INSTALLHTMLSITELIBDIR} =~ /^(none|\s*)$/){ - $self->{INST_HTMLLIBDIR} = $self->{INSTALLHTMLSITELIBDIR}; - } else { - $self->{INST_HTMLLIBDIR} = File::Spec->catdir(File::Spec->curdir,'blib','html','lib'); - } - } - - $self->{INSTALLHTMLSCRIPTDIR} = $Config::Config{installhtmlscriptdir} - unless defined $self->{INSTALLHTMLSCRIPTDIR}; - unless (defined $self->{INST_HTMLSCRIPTDIR}){ - if ($self->{INSTALLHTMLSCRIPTDIR} =~ /^(none|\s*)$/){ - $self->{INST_HTMLSCRIPTDIR} = $self->{INSTALLHTMLSCRIPTDIR}; - } else { - $self->{INST_HTMLSCRIPTDIR} = File::Spec->catdir(File::Spec->curdir,'blib','html','bin'); - } - } - $self->{HTMLEXT} ||= $Config::Config{htmlext} || 'html'; - - # Get some stuff out of %Config if we haven't yet done so print STDOUT "CONFIG must be an array ref\n" if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY'); @@ -2033,7 +1845,7 @@ usually solves this kind of problem. } # Build up a set of file names (not command names). - my $thisperl = $self->canonpath($^X); + my $thisperl = File::Spec->canonpath($^X); $thisperl .= $Config{exe_ext} unless $thisperl =~ m/$Config{exe_ext}$/i; my @perls = ('perl', 'perl5', "perl$Config{version}"); @perls = ($thisperl, (map $_.=$Config{exe_ext}, @perls)); @@ -2060,22 +1872,23 @@ usually solves this kind of problem. # Are we building the core? $self->{PERL_CORE} = 0 unless exists $self->{PERL_CORE}; - my $aq = ($^O eq 'VMS' ? '"' : ''); # command-line argument quoter - # How do we run perl? - $self->{PERLRUN} = $self->{PERL}; - $self->{PERLRUN} .= " -${aq}I\$(PERL_LIB)$aq" if $self->{UNINSTALLED_PERL}; + $self->{PERLRUN} = $self->{PERL_CORE} ? $self->{PERL} : $self->{FULLPERL}; + $self->{PERLRUN} .= qq{ "-I\$(PERL_LIB)"} if $self->{UNINSTALLED_PERL}; # How do we run perl when installing libraries? - $self->{PERLRUNINST} .= $self->{PERLRUN}. " -${aq}I\$(INST_ARCHLIB)$aq -${aq}I\$(INST_LIB)$aq"; + $self->{PERLRUNINST} = qq{$self->{PERLRUN} "-I\$(INST_ARCHLIB)" "-I\$(INST_LIB)"}; # What extra library dirs do we need when running the tests? - $self->{TEST_LIBS} .= " -${aq}I\$(INST_ARCHLIB)$aq -${aq}I\$(INST_LIB)$aq"; + # Make sure these are absolute paths in case the test chdirs. + $self->{TEST_LIBS} .= join '', + map { ' "-I'.File::Spec->rel2abs($_).'"' } + $self->{INST_ARCHLIB}, $self->{INST_LIB}; # When building the core, we need to add some helper libs since # perl's @INC won't work (we're not installed yet). foreach my $targ (qw(PERLRUN PERLRUNINST TEST_LIBS)) { - $self->{$targ} .= " -${aq}I\$(PERL_ARCHLIB)$aq -${aq}I\$(PERL_LIB)$aq" + $self->{$targ} .= ' "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)"' if $self->{PERL_CORE}; } } @@ -2189,8 +2002,6 @@ pure_perl_install :: $(INST_ARCHLIB) $(INSTALLARCHLIB) \ $(INST_BIN) $(INSTALLBIN) \ $(INST_SCRIPT) $(INSTALLSCRIPT) \ - $(INST_HTMLLIBDIR) $(INSTALLHTMLPRIVLIBDIR) \ - $(INST_HTMLSCRIPTDIR) $(INSTALLHTMLSCRIPTDIR) \ $(INST_MAN1DIR) $(INSTALLMAN1DIR) \ $(INST_MAN3DIR) $(INSTALLMAN3DIR) }.$self->{NOECHO}.q{$(WARN_IF_OLD_PACKLIST) \ @@ -2205,8 +2016,6 @@ pure_site_install :: $(INST_ARCHLIB) $(INSTALLSITEARCH) \ $(INST_BIN) $(INSTALLBIN) \ $(INST_SCRIPT) $(INSTALLSCRIPT) \ - $(INST_HTMLLIBDIR) $(INSTALLHTMLSITELIBDIR) \ - $(INST_HTMLSCRIPTDIR) $(INSTALLHTMLSCRIPTDIR) \ $(INST_MAN1DIR) $(INSTALLMAN1DIR) \ $(INST_MAN3DIR) $(INSTALLMAN3DIR) }.$self->{NOECHO}.q{$(WARN_IF_OLD_PACKLIST) \ @@ -2273,9 +2082,8 @@ sub installbin { EXE_FILES = @{$self->{EXE_FILES}} } . ($Is_Win32 - ? q{FIXIN = $(PERLRUN) \ - -e "system qq[pl2bat.bat ].shift" -} : q{FIXIN = $(PERLRUN) -MExtUtils::MakeMaker \ + ? q{FIXIN = pl2bat.bat +} : q{FIXIN = $(PERLRUN) "-MExtUtils::MY" \ -e "MY->fixin(shift)" }).qq{ pure_all :: @to @@ -2424,7 +2232,7 @@ $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) $cccmd = $self->const_cccmd($libperl); $cccmd =~ s/^CCCMD\s*=\s*//; - $cccmd =~ s/\$\(INC\)/ -I$self->{PERL_INC} /; + $cccmd =~ s/\$\(INC\)/ "-I$self->{PERL_INC}" /; $cccmd .= " $Config::Config{cccdlflags}" if ($Config::Config{useshrplib} eq 'true'); $cccmd =~ s/\(CC\)/\(PERLMAINCC\)/; @@ -2500,10 +2308,10 @@ $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) push @$extra, $_; } - grep(s/^/-I/, @{$perlinc || []}); + grep(s/^(.*)/"-I$1"/, @{$perlinc || []}); - $target = "perl" unless $target; - $tmp = "." unless $tmp; + $target ||= "perl"; + $tmp ||= "."; # MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we # regenerate the Makefiles, MAP_STATIC and the dependencies for @@ -2558,11 +2366,11 @@ MAP_LIBPERL = $libperl push @m, "\tcat $catfile >> \$\@\n"; } # SUNOS ld does not take the full path to a shared library - my $llibperl = ($libperl)?'$(MAP_LIBPERL)':'-lperl'; + $self->{LLIBPERL} = ($libperl)?'$(MAP_LIBPERL)':'-lperl'; push @m, " \$(MAP_TARGET) :: $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all - \$(MAP_LINKCMD) -o \$\@ \$(OPTIMIZE) $tmp/perlmain\$(OBJ_EXT) \$(LDFROM) \$(MAP_STATIC) $llibperl `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS) + \$(MAP_LINKCMD) -o \$\@ \$(OPTIMIZE) $tmp/perlmain\$(OBJ_EXT) \$(LDFROM) \$(MAP_STATIC) $self->{LLIBPERL} `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS) $self->{NOECHO}echo 'To install the new \"\$(MAP_TARGET)\" binary, call' $self->{NOECHO}echo ' make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)' $self->{NOECHO}echo 'To remove the intermediate files say' @@ -2570,12 +2378,12 @@ push @m, " $tmp/perlmain\$(OBJ_EXT): $tmp/perlmain.c "; - push @m, "\tcd $tmp && $cccmd -I\$(PERL_INC) perlmain.c\n"; + push @m, qq{\tcd $tmp && $cccmd "-I\$(PERL_INC)" perlmain.c\n}; push @m, qq{ $tmp/perlmain.c: $makefilename}, q{ }.$self->{NOECHO}.q{echo Writing $@ - }.$self->{NOECHO}.q{$(PERL) $(MAP_PERLINC) -MExtUtils::Miniperl \\ + }.$self->{NOECHO}.q{$(PERL) $(MAP_PERLINC) "-MExtUtils::Miniperl" \\ -e "writemain(grep s#.*/auto/##s, split(q| |, q|$(MAP_STATIC)|))" > $@t && $(MV) $@t $@ }; @@ -2734,7 +2542,7 @@ sub maybe_command_in_dirs { # $ver is optional argument if looking for perl } elsif (File::Spec->canonpath($name) eq File::Spec->canonpath(basename($name))) { # bar $abs = File::Spec->catfile($dir, $name); } else { # foo/bar - $abs = File::Spec->catfile(File::Spec->curdir, $name); + $abs = File::Spec->catfile($Curdir, $name); } print "Checking $abs for $name\n" if ($trace >= 2); next unless $tryabs = $self->maybe_command($abs); @@ -2892,16 +2700,6 @@ sub pasthru { join "", @m; } -=item path - -Takes no argument, returns the environment variable PATH as an array. - -=cut - -sub path { - return File::Spec->path(); -} - =item perl_script Takes one argument, a file name, and returns the file name, if the @@ -3092,7 +2890,7 @@ destination and autosplits them. See L sub _pm_to_blib_flush { my ($self, $autodir, $rr, $ra, $rl) = @_; $$rr .= -q{ }.$self->{NOECHO}.q[$(PERLRUNINST) -MExtUtils::Install \ +q{ }.$self->{NOECHO}.q[$(PERLRUNINST) "-MExtUtils::Install" \ -e "pm_to_blib({qw{].qq[@$ra].q[}},'].$autodir.q{','$(PM_FILTER)')" }; @$ra = (); @@ -3159,6 +2957,8 @@ sub postamble { =item prefixify + my $prefixed = $MM->prefixify($var, $search, $replace); + Check a path variable in $self from %Config, if it contains a prefix, and replace it with another one. @@ -3174,6 +2974,7 @@ sub prefixify { $self->{uc $var} =~ s,^\Q$sprefix\E(?=/|\z),$rprefix,s; } + =item processPL (o) Defines targets to run *.PL files. @@ -3228,7 +3029,7 @@ sub realclean { my($self, %attribs) = @_; my(@m); - push(@m,'LLIBPERL = '.$llibperl."\n"); + push(@m,'LLIBPERL = '.$self->{LLIBPERL}."\n"); push(@m,' # Delete temporary files (via clean) and also delete installed files @@ -3243,6 +3044,7 @@ realclean purge :: clean push(@m, sprintf($sub,$_,"$self->{MAKEFILE}",'')); } push(@m, " $self->{RM_RF} \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n"); + push(@m, " $self->{RM_RF} \$(DISTVNAME)\n"); if( $self->has_link_code ){ push(@m, " $self->{RM_F} \$(INST_DYNAMIC) \$(INST_BOOT)\n"); push(@m, " $self->{RM_F} \$(INST_STATIC)\n"); @@ -3273,21 +3075,19 @@ realclean purge :: clean =item replace_manpage_separator + my $man_name = $MM->replace_manpage_separator($file_path); + Takes the name of a package, which may be a nested package, in the -form Foo/Bar and replaces the slash with C<::>. Returns the replacement. +form 'Foo/Bar.pm' and replaces the slash with C<::> or something else +safe for a man page file name. Returns the replacement. =cut sub replace_manpage_separator { my($self,$man) = @_; - if ($^O eq 'uwin') { - $man =~ s,/+,.,g; - } elsif ($Is_Dos) { - $man =~ s,/+,__,g; - } else { - $man =~ s,/+,::,g; - } - $man; + + $man =~ s,/+,::,g; + return $man; } =item static (o) @@ -3524,29 +3324,27 @@ test :: \$(TEST_TYPE) join("", @m); } -=item test_via_harness (o) +=item test_via_harness (override) -Helper method to write the test targets +For some reason which I forget, Unix machines like to have +PERL_DL_NONLAZY set for tests. =cut sub test_via_harness { my($self, $perl, $tests) = @_; - $perl = "PERL_DL_NONLAZY=1 $perl" unless $Is_Win32; - "\t$perl".q! $(TEST_LIBS) -e 'use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;' !."$tests\n"; + return $self->SUPER::test_via_harness("PERL_DL_NONLAZY=1 $perl", $tests); } -=item test_via_script (o) +=item test_via_script (override) -Other helper method for test. +Again, the PERL_DL_NONLAZY thing. =cut sub test_via_script { my($self, $perl, $script) = @_; - $perl = "PERL_DL_NONLAZY=1 $perl" unless $Is_Win32; - qq{\t$perl}.q{ $(TEST_LIBS) }.qq{$script -}; + return $self->SUPER::test_via_script("PERL_DL_NONLAZY=1 $perl", $script); } =item tool_autosplit (o) @@ -3557,15 +3355,16 @@ pm_to_blib soon. =cut sub tool_autosplit { -# --- Tool Sections --- - my($self, %attribs) = @_; my($asl) = ""; - $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN}; - q{ + $asl = "\$\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN}; + + return sprintf <<'MAKE_FRAG', $asl; # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto -AUTOSPLITFILE = $(PERLRUN) -e 'use AutoSplit;}.$asl.q{autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;' -}; +AUTOSPLITFILE = $(PERLRUN) -e 'use AutoSplit; %s autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;' + +MAKE_FRAG + } =item tools_other (o) @@ -3591,13 +3390,13 @@ SHELL = $bin_sh push @m, q{ # The following is a portable way to say mkdir -p # To see which directories are created, change the if 0 to if 1 -MKPATH = $(PERLRUN) -MExtUtils::Command -e mkpath +MKPATH = $(PERLRUN) "-MExtUtils::Command" -e mkpath # This helps us to minimize the effect of the .exists files A yet # better solution would be to have a stable file in the perl # distribution with a timestamp of zero. But this solution doesn't # need any changes to the core distribution and works with older perls -EQUALIZE_TIMESTAMP = $(PERLRUN) -MExtUtils::Command -e eqtime +EQUALIZE_TIMESTAMP = $(PERLRUN) "-MExtUtils::Command" -e eqtime }; @@ -3614,7 +3413,7 @@ WARN_IF_OLD_PACKLIST = $(PERL) -we 'exit unless -f $$ARGV[0];' \\ UNINST=0 VERBINST=0 -MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \ +MOD_INSTALL = $(PERL) "-I$(INST_LIB)" "-I$(PERL_LIB)" "-MExtUtils::Install" \ -e "install({@ARGV},'$(VERBINST)',0,'$(UNINST)');" DOC_INSTALL = $(PERL) -e '$$\="\n\n";' \ @@ -3623,7 +3422,7 @@ DOC_INSTALL = $(PERL) -e '$$\="\n\n";' \ -e 'while (defined($$key = shift) and defined($$val = shift)){print "=item *";print "C<$$key: $$val>";}' \ -e 'print "=back";' -UNINSTALL = $(PERL) -MExtUtils::Install \ +UNINSTALL = $(PERLRUN) "-MExtUtils::Install" \ -e 'uninstall($$ARGV[0],1,1); print "\nUninstall is deprecated. Please check the";' \ -e 'print " packlist above carefully.\n There may be errors. Remove the";' \ -e 'print " appropriate files manually.\n Sorry for the inconveniences.\n"' @@ -3702,7 +3501,7 @@ sub xsubpp_version return "" unless $self->needs_linking; - my $command = "$self->{PERL} -I$self->{PERL_LIB} $xsubpp -v 2>&1"; + my $command = qq{$self->{PERL} "-I$self->{PERL_LIB}" $xsubpp -v 2>&1}; print "Running $command\n" if $Verbose >= 2; $version = `$command` ; warn "Running '$command' exits with status " . ($?>>8) if $?; @@ -3755,12 +3554,9 @@ sub top_targets { my($self) = shift; my(@m); - push @m, ' -#all :: config $(INST_PM) subdirs linkext manifypods -'; push @m, ' -all :: pure_all htmlifypods manifypods +all :: pure_all manifypods '.$self->{NOECHO}.'$(NOOP) ' unless $self->{SKIPHASH}{'all'}; @@ -3784,24 +3580,6 @@ config :: $(INST_AUTODIR)/.exists push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]); - if (%{$self->{HTMLLIBPODS}}) { - push @m, qq[ -config :: \$(INST_HTMLLIBDIR)/.exists - $self->{NOECHO}\$(NOOP) - -]; - push @m, $self->dir_target(qw[$(INST_HTMLLIBDIR)]); - } - - if (%{$self->{HTMLSCRIPTPODS}}) { - push @m, qq[ -config :: \$(INST_HTMLSCRIPTDIR)/.exists - $self->{NOECHO}\$(NOOP) - -]; - push @m, $self->dir_target(qw[$(INST_HTMLSCRIPTDIR)]); - } - if (%{$self->{MAN1PODS}}) { push @m, qq[ config :: \$(INST_MAN1DIR)/.exists @@ -3828,13 +3606,6 @@ help: perldoc ExtUtils::MakeMaker }; - push @m, q{ -Version_check: - }.$self->{NOECHO}.q{$(PERLRUN) \ - -MExtUtils::MakeMaker=Version_check \ - -e "Version_check('$(MM_VERSION)')" -}; - join('',@m); } @@ -3896,7 +3667,7 @@ sub xs_o { # many makes are too dumb to use xs_c then c_o ' .xs$(OBJ_EXT): $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c - $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(PASTHRU_DEFINE) $(DEFINE) $*.c + $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c '; } diff --git a/lib/ExtUtils/MM_VMS.pm b/lib/ExtUtils/MM_VMS.pm index b716ac0..6cbb652 100644 --- a/lib/ExtUtils/MM_VMS.pm +++ b/lib/ExtUtils/MM_VMS.pm @@ -1,7 +1,5 @@ # MM_VMS.pm # MakeMaker default methods for VMS -# This package is inserted into @ISA of MakeMaker's MM before the -# built-in ExtUtils::MM_Unix methods if MakeMaker.pm is run under VMS. # # Author: Charles Bailey bailey@newman.upenn.edu @@ -15,15 +13,15 @@ require Exporter; use VMS::Filespec; use File::Basename; use File::Spec; -our($Revision, @ISA, $VERSION, $Verbose); -# All on one line so MakeMaker can see it. -($VERSION) = ($Revision = '5.56 (27-Apr-1999)') =~ /^([\d.]+)/; +use vars qw($Revision @ISA $VERSION); +($VERSION) = $Revision = '5.61_01'; -@ISA = qw( File::Spec ); -unshift @MM::ISA, 'ExtUtils::MM_VMS'; +require ExtUtils::MM_Any; +require ExtUtils::MM_Unix; +@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix File::Spec ); + +use ExtUtils::MakeMaker qw($Verbose neatvalue); -require ExtUtils::MakeMaker; -ExtUtils::MakeMaker->import('$Verbose', '&neatvalue'); =head1 NAME @@ -31,7 +29,9 @@ ExtUtils::MM_VMS - methods to override UN*X behaviour in ExtUtils::MakeMaker =head1 SYNOPSIS - use ExtUtils::MM_VMS; # Done internally by ExtUtils::MakeMaker if needed + Do not use this directly. + Instead, use ExtUtils::MM and it will figure out which MM_* + class to use for you. =head1 DESCRIPTION @@ -67,105 +67,20 @@ sub wraplist { $line; } -=item rootdir (override) - -Returns a string representing of the root directory. - -=cut - -sub rootdir { - return File::Spec->rootdir(); -} - -package ExtUtils::MM_VMS; - -sub ExtUtils::MM_VMS::ext; -sub ExtUtils::MM_VMS::guess_name; -sub ExtUtils::MM_VMS::find_perl; -sub ExtUtils::MM_VMS::path; -sub ExtUtils::MM_VMS::maybe_command; -sub ExtUtils::MM_VMS::maybe_command_in_dirs; -sub ExtUtils::MM_VMS::perl_script; -sub ExtUtils::MM_VMS::file_name_is_absolute; -sub ExtUtils::MM_VMS::replace_manpage_separator; -sub ExtUtils::MM_VMS::init_others; -sub ExtUtils::MM_VMS::constants; -sub ExtUtils::MM_VMS::cflags; -sub ExtUtils::MM_VMS::const_cccmd; -sub ExtUtils::MM_VMS::pm_to_blib; -sub ExtUtils::MM_VMS::tool_autosplit; -sub ExtUtils::MM_VMS::tool_xsubpp; -sub ExtUtils::MM_VMS::xsubpp_version; -sub ExtUtils::MM_VMS::tools_other; -sub ExtUtils::MM_VMS::dist; -sub ExtUtils::MM_VMS::c_o; -sub ExtUtils::MM_VMS::xs_c; -sub ExtUtils::MM_VMS::xs_o; -sub ExtUtils::MM_VMS::top_targets; -sub ExtUtils::MM_VMS::dlsyms; -sub ExtUtils::MM_VMS::dynamic_lib; -sub ExtUtils::MM_VMS::dynamic_bs; -sub ExtUtils::MM_VMS::static_lib; -sub ExtUtils::MM_VMS::manifypods; -sub ExtUtils::MM_VMS::processPL; -sub ExtUtils::MM_VMS::installbin; -sub ExtUtils::MM_VMS::subdir_x; -sub ExtUtils::MM_VMS::clean; -sub ExtUtils::MM_VMS::realclean; -sub ExtUtils::MM_VMS::dist_basics; -sub ExtUtils::MM_VMS::dist_core; -sub ExtUtils::MM_VMS::dist_dir; -sub ExtUtils::MM_VMS::dist_test; -sub ExtUtils::MM_VMS::install; -sub ExtUtils::MM_VMS::perldepend; -sub ExtUtils::MM_VMS::makefile; -sub ExtUtils::MM_VMS::test; -sub ExtUtils::MM_VMS::test_via_harness; -sub ExtUtils::MM_VMS::test_via_script; -sub ExtUtils::MM_VMS::makeaperl; -sub ExtUtils::MM_VMS::ext; -sub ExtUtils::MM_VMS::nicetext; - -our $AUTOLOAD; -sub AUTOLOAD { - my $code; - if (defined fileno(DATA)) { - my $fh = select DATA; - my $o = $/; # For future reads from the file. - $/ = "\n__END__\n"; - $code = ; - $/ = $o; - select $fh; - close DATA; - eval $code; - if ($@) { - $@ =~ s/ at .*\n//; - Carp::croak $@; - } - } else { - warn "AUTOLOAD called unexpectedly for $AUTOLOAD"; - } - defined(&$AUTOLOAD) or die "Myloader inconsistency error"; - goto &$AUTOLOAD; -} - -1; - -#__DATA__ - # This isn't really an override. It's just here because ExtUtils::MM_VMS # appears in @MM::ISA before ExtUtils::Liblist::Kid, so if there isn't an ext() # in MM_VMS, then AUTOLOAD is called, and bad things happen. So, we just # mimic inheritance here and hand off to ExtUtils::Liblist::Kid. +# XXX This hackery will die soon. --Schwern sub ext { - require ExtUtils::Liblist; - ExtUtils::Liblist::Kid::ext(@_); + require ExtUtils::Liblist::Kid; + goto &ExtUtils::Liblist::Kid::ext; } =back -=head2 SelfLoaded methods +=head2 Methods Those methods which override default MM_Unix methods are marked "(override)", while methods unique to MM_VMS are marked "(specific)". @@ -203,7 +118,11 @@ sub guess_name { if (@pm == 1) { ($defpm = $pm[0]) =~ s/.pm$//; } elsif (@pm) { %xs = map { s/.xs$//; ($_,1) } glob('*.xs'); - if (%xs) { foreach $pm (@pm) { $defpm = $pm, last if exists $xs{$pm}; } } + if (keys %xs) { + foreach $pm (@pm) { + $defpm = $pm, last if exists $xs{$pm}; + } + } } } if (open(PM,"${defpm}.pm")){ @@ -314,17 +233,6 @@ sub find_perl { 0; # false and not empty } -=item path (override) - -Translate logical name DCL$PATH as a searchlist, rather than trying -to C string value of C<$ENV{'PATH'}>. - -=cut - -sub path { - return File::Spec->path(); -} - =item maybe_command (override) Follows VMS naming conventions for executable files. @@ -411,17 +319,6 @@ sub perl_script { return ''; } -=item file_name_is_absolute (override) - -Checks for VMS directory spec as well as Unix separators. - -=cut - -sub file_name_is_absolute { - shift; - return File::Spec->file_name_is_absolute(@_); -} - =item replace_manpage_separator Use as separator a character which is legal in a VMS-syntax file name. @@ -457,7 +354,8 @@ sub init_others { $self->{CP} = 'Copy/NoConfirm'; $self->{MV} = 'Rename/NoConfirm'; $self->{UMASK_NULL} = '! '; - &ExtUtils::MM_Unix::init_others; + + $self->SUPER::init_others; } =item constants (override) @@ -504,9 +402,6 @@ sub constants { $self->{LDFROM} = $self->wraplist(map($self->fixpath($_,0),split(/,?\s+/,$self->{LDFROM}))); - # Fix up directory specs - $self->{ROOTEXT} = $self->{ROOTEXT} ? $self->fixpath($self->{ROOTEXT},1) - : '[]'; foreach $macro ( qw [ INST_BIN INST_SCRIPT INST_LIB INST_ARCHLIB INST_EXE INSTALLPRIVLIB INSTALLARCHLIB INSTALLSCRIPT INSTALLBIN PERL_LIB PERL_ARCHLIB @@ -535,7 +430,7 @@ sub constants { PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC PERL_VMS PERL_INC PERL FULLPERL PERLRUN PERLRUNINST TEST_LIBS - PERL_CORE + PERL_CORE NOECHO NOOP / ) { next unless defined $self->{$macro}; push @m, "$macro = $self->{$macro}\n"; @@ -613,6 +508,7 @@ MAN3PODS = ',$self->wraplist(sort keys %{$self->{MAN3PODS}}),' push @m," makemakerdflt : all + \$(NOECHO) \$(NOOP) .SUFFIXES : .SUFFIXES : \$(OBJ_EXT) .c .cpp .cxx .xs @@ -846,13 +742,13 @@ Use VMS-style quoting on command line. =cut -sub tool_autosplit{ +sub tool_autosplit { my($self, %attribs) = @_; my($asl) = ""; $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN}; q{ # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto -AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use AutoSplit;}.$asl.q{ AutoSplit::autosplit($ARGV[0], $ARGV[1], 0, 1, 1) ;" +AUTOSPLITFILE = $(PERLRUN) -e "use AutoSplit;}.$asl.q{autosplit($ARGV[0], $ARGV[1], 0, 1, 1) ;" }; } @@ -909,7 +805,7 @@ sub tool_xsubpp { " XSUBPPDIR = $xsdir -XSUBPP = \$(PERL) \"-I\$(PERL_ARCHLIB)\" \"-I\$(PERL_LIB)\" \$(XSUBPPDIR)xsubpp +XSUBPP = \$(PERLRUN) \$(XSUBPPDIR)xsubpp XSPROTOARG = $self->{XSPROTOARG} XSUBPPDEPS = @tmdeps XSUBPPARGS = @tmargs @@ -1012,8 +908,6 @@ RM_F = $self->{RM_F} RM_RF = $self->{RM_RF} SAY = Write Sys\$Output UMASK_NULL = $self->{UMASK_NULL} -NOOP = $self->{NOOP} -NOECHO = $self->{NOECHO} MKPATH = Create/Directory EQUALIZE_TIMESTAMP = \$(PERL) -we "open F,qq{>\$ARGV[1]};close F;utime(0,(stat(\$ARGV[0]))[9]+1,\$ARGV[1])" !. ($self->{PARENT} ? '' : @@ -1045,7 +939,7 @@ sub dist { $attribs{VERSION} =~ s/[^\w\$]/_/g; $attribs{NAME} =~ s/[^\w\$]/-/g; - return ExtUtils::MM_Unix::dist($self,%attribs); + return $self->SUPER::dist(%attribs); } =item c_o (override) @@ -1104,7 +998,7 @@ sub xs_o { # many makes are too dumb to use xs_c then c_o =item top_targets (override) -Use VMS quoting on command line for Version_check. +Path seperator differences. =cut @@ -1156,12 +1050,6 @@ help : perldoc ExtUtils::MakeMaker }; - push @m, q{ -Version_check : - $(NOECHO) $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" - - "-MExtUtils::MakeMaker=Version_check" -e "&Version_check('$(MM_VERSION)')" -}; - join('',@m); } @@ -1200,7 +1088,7 @@ $(INST_ARCHAUTODIR)$(BASEEXT).opt : $(BASEEXT).opt $(CP) $(MMS$SOURCE) $(MMS$TARGET) $(BASEEXT).opt : Makefile.PL - $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Mksymlists;" - + $(PERLRUN) -e "use ExtUtils::Mksymlists;" - ',qq[-e "Mksymlists('NAME' => '$self->{NAME}', 'DL_FUNCS' => ], neatvalue($funcs),q[, 'DL_VARS' => ],neatvalue($vars), q[, 'FUNCLIST' => ],neatvalue($funclist),qq[)"\n]; @@ -1299,7 +1187,7 @@ BOOTSTRAP = '."$self->{BASEEXT}.bs".' # The DynaLoader only reads a non-empty file. $(BOOTSTRAP) : $(MAKEFILE) '."$self->{BOOTDEP}".' $(INST_ARCHAUTODIR).exists $(NOECHO) $(SAY) "Running mkbootstrap for $(NAME) ($(BSLOADLIBS))" - $(NOECHO) $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" - + $(NOECHO) $(PERLRUN) - -e "use ExtUtils::Mkbootstrap; Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');" $(NOECHO) $(TOUCH) $(MMS$TARGET) @@ -1427,7 +1315,7 @@ all :: $vmsfile \$(NOECHO) \$(NOOP) $vmsfile :: $vmsplfile -",' $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '," $vmsplfile $vmsfile +",' $(PERLRUNINST) '," $vmsplfile $vmsfile "; } } @@ -1459,9 +1347,6 @@ sub installbin { push @m, " EXE_FILES = @exefiles -all :: @to - \$(NOECHO) \$(NOOP) - realclean :: "; $line = ''; #avoid unitialized var warning @@ -1586,8 +1471,8 @@ realclean :: clean push(@m, ' If F$Search("'."$vmsdir".'$(MAKEFILE)").nes."" Then \\',"\n\t", '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS)$(MMSQUALIFIERS) realclean`;"',"\n"); } - push @m,' $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR) -'; + push @m, " \$(RM_RF) \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n"; + push @m, " \$(RM_RF) \$(DISTVNAME)\n"; # We can't expand several of the MMS macros here, since they don't have # corresponding %$self keys (i.e. they're defined in Descrip.MMS as a # combination of macros). In order to stay below DCL's 255 char limit, @@ -1638,28 +1523,6 @@ realclean :: clean join('', @m); } -=item dist_basics (override) - -Use VMS-style quoting on command line. - -=cut - -sub dist_basics { - my($self) = @_; -' -distclean :: realclean distcheck - $(NOECHO) $(NOOP) - -distcheck : - $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; fullcheck()" - -skipcheck : - $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&skipcheck\'; skipcheck()" - -manifest : - $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&mkmanifest\'; mkmanifest()" -'; -} =item dist_core (override) @@ -1702,22 +1565,6 @@ shdist : distdir ]; } -=item dist_dir (override) - -Use VMS-style quoting on command line. - -=cut - -sub dist_dir { - my($self) = @_; -q{ -distdir : - $(RM_RF) $(DISTVNAME) - $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest '/mani/';" \\ - -e "manicopy(maniread(),'$(DISTVNAME)','$(DIST_CP)');" -}; -} - =item dist_test (override) Use VMS commands to change default directory, and use VMS-style @@ -1731,7 +1578,7 @@ q{ disttest : distdir startdir = F$Environment("Default") Set Default [.$(DISTVNAME)] - $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL + $(PERLRUN) Makefile.PL $(MMS)$(MMSQUALIFIERS) $(MMS)$(MMSQUALIFIERS) test Set Default 'startdir' @@ -1756,11 +1603,11 @@ sub install { foreach $file (@{$self->{EXE_FILES}}) { $line .= "$file "; if (length($line) > 128) { - push(@docfiles,qq[\t\$(PERL) -e "print '$line'" >>.MM_tmp\n]); + push(@docfiles,qq[\t\$(NOECHO) \$(PERL) -e "print '$line'" >>.MM_tmp\n]); $line = ''; } } - push(@docfiles,qq[\t\$(PERL) -e "print '$line'" >>.MM_tmp\n]) if $line; + push(@docfiles,qq[\t\$(NOECHO) \$(PERL) -e "print '$line'" >>.MM_tmp\n]) if $line; } push @m, q[ @@ -1790,8 +1637,8 @@ doc__install : doc_site_install # This hack brought to you by DCL's 255-character command line limit pure_perl_install :: - $(NOECHO) $(PERL) -e "print 'read ].File::Spec->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[ '" >.MM_tmp - $(NOECHO) $(PERL) -e "print 'write ].File::Spec->catfile('$(INSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q[ '" >>.MM_tmp + $(NOECHO) $(PERL) "-MFile::Spec" -e "print 'read '.File::Spec->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist') " >.MM_tmp + $(NOECHO) $(PERL) "-MFile::Spec" -e "print 'write '.File::Spec->catfile('$(INSTALLARCHLIB)','auto','$(FULLEXT)','.packlist') " >>.MM_tmp $(NOECHO) $(PERL) -e "print '$(INST_LIB) $(INSTALLPRIVLIB) '" >>.MM_tmp $(NOECHO) $(PERL) -e "print '$(INST_ARCHLIB) $(INSTALLARCHLIB) '" >>.MM_tmp $(NOECHO) $(PERL) -e "print '$(INST_BIN) $(INSTALLBIN) '" >>.MM_tmp @@ -1800,12 +1647,12 @@ pure_perl_install :: $(NOECHO) $(PERL) -e "print '$(INST_MAN3DIR) $(INSTALLMAN3DIR) '" >>.MM_tmp $(MOD_INSTALL) <.MM_tmp $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp; - $(NOECHO) $(WARN_IF_OLD_PACKLIST) ].File::Spec->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q[ + $(NOECHO) $(WARN_IF_OLD_PACKLIST) ].File::Spec->catfile($self->{SITEARCHEXP},'auto',$self->{FULLEXT},'.packlist').q[ # Likewise pure_site_install :: - $(NOECHO) $(PERL) -e "print 'read ].File::Spec->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q[ '" >.MM_tmp - $(NOECHO) $(PERL) -e "print 'write ].File::Spec->catfile('$(INSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q[ '" >>.MM_tmp + $(NOECHO) $(PERL) "-MFile::Spec" -e "print 'read '.File::Spec->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist') " >.MM_tmp + $(NOECHO) $(PERL) "-MFile::Spec" -e "print 'write '.File::Spec->catfile('$(INSTALLSITEARCH)','auto','$(FULLEXT)','.packlist') " >>.MM_tmp $(NOECHO) $(PERL) -e "print '$(INST_LIB) $(INSTALLSITELIB) '" >>.MM_tmp $(NOECHO) $(PERL) -e "print '$(INST_ARCHLIB) $(INSTALLSITEARCH) '" >>.MM_tmp $(NOECHO) $(PERL) -e "print '$(INST_BIN) $(INSTALLBIN) '" >>.MM_tmp @@ -1814,7 +1661,7 @@ pure_site_install :: $(NOECHO) $(PERL) -e "print '$(INST_MAN3DIR) $(INSTALLMAN3DIR) '" >>.MM_tmp $(MOD_INSTALL) <.MM_tmp $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp; - $(NOECHO) $(WARN_IF_OLD_PACKLIST) ].File::Spec->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[ + $(NOECHO) $(WARN_IF_OLD_PACKLIST) ].File::Spec->catfile($self->{PERL_ARCHLIB},'auto',$self->{FULLEXT},'.packlist').q[ # Ditto doc_perl_install :: @@ -1825,7 +1672,7 @@ q% $(NOECHO) $(PERL) -e "print q[@ARGV=split(/\\|/,);]" >.MM2_tmp $(NOECHO) $(PERL) -e "print q[print '=head2 ',scalar(localtime),': C<',shift,qq[>\\n\\n=over 4\\n\\n];]" >>.MM2_tmp $(NOECHO) $(PERL) -e "print q[while(($key=shift) && ($val=shift)) ]" >>.MM2_tmp $(NOECHO) $(PERL) -e "print q[{print qq[=item *\\n\\nC<$key: $val>\\n\\n];}print qq[=back\\n\\n];]" >>.MM2_tmp - $(NOECHO) $(PERL) .MM2_tmp <.MM_tmp >>%.File::Spec->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[ + $(NOECHO) $(PERL) .MM2_tmp <.MM_tmp >>%.File::Spec->catfile($self->{INSTALLARCHLIB},'perllocal.pod').q[ $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;,.MM2_tmp; # And again @@ -1837,7 +1684,7 @@ q% $(NOECHO) $(PERL) -e "print q[@ARGV=split(/\\|/,);]" >.MM2_tmp $(NOECHO) $(PERL) -e "print q[print '=head2 ',scalar(localtime),': C<',shift,qq[>\\n\\n=over 4\\n\\n];]" >>.MM2_tmp $(NOECHO) $(PERL) -e "print q[while(($key=shift) && ($val=shift)) ]" >>.MM2_tmp $(NOECHO) $(PERL) -e "print q[{print qq[=item *\\n\\nC<$key: $val>\\n\\n];}print qq[=back\\n\\n];]" >>.MM2_tmp - $(NOECHO) $(PERL) .MM2_tmp <.MM_tmp >>%.File::Spec->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[ + $(NOECHO) $(PERL) .MM2_tmp <.MM_tmp >>%.File::Spec->catfile($self->{INSTALLARCHLIB},'perllocal.pod').q[ $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;,.MM2_tmp; ]; @@ -1847,13 +1694,13 @@ uninstall :: uninstall_from_$(INSTALLDIRS)dirs $(NOECHO) $(NOOP) uninstall_from_perldirs :: - $(NOECHO) $(UNINSTALL) ].File::Spec->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[ + $(NOECHO) $(UNINSTALL) ].File::Spec->catfile($self->{PERL_ARCHLIB},'auto',$self->{FULLEXT},'.packlist').q[ $(NOECHO) $(SAY) "Uninstall is now deprecated and makes no actual changes." $(NOECHO) $(SAY) "Please check the list above carefully for errors, and manually remove" $(NOECHO) $(SAY) "the appropriate files. Sorry for the inconvenience." uninstall_from_sitedirs :: - $(NOECHO) $(UNINSTALL) ],File::Spec->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist'),"\n",q[ + $(NOECHO) $(UNINSTALL) ],File::Spec->catfile($self->{SITEARCHEXP},'auto',$self->{FULLEXT},'.packlist'),"\n",q[ $(NOECHO) $(SAY) "Uninstall is now deprecated and makes no actual changes." $(NOECHO) $(SAY) "Please check the list above carefully for errors, and manually remove" $(NOECHO) $(SAY) "the appropriate files. Sorry for the inconvenience." @@ -1955,7 +1802,7 @@ $(MAKEFILE) : Makefile.PL $(CONFIGDEP) $(NOECHO) $(SAY) "Cleaning current config before rebuilding $(MAKEFILE) ..." - $(MV) $(MAKEFILE) $(MAKEFILE)_old - $(MMS)$(MMSQUALIFIERS) $(USEMAKEFILE)$(MAKEFILE)_old clean - $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL ],join(' ',map(qq["$_"],@ARGV)),q[ + $(PERLRUN) Makefile.PL ],join(' ',map(qq["$_"],@ARGV)),q[ $(NOECHO) $(SAY) "$(MAKEFILE) has been rebuilt." $(NOECHO) $(SAY) "Please run $(MMS) to build the extension." ]; @@ -1996,8 +1843,8 @@ testdb :: testdb_\$(LINKTYPE) push(@m, "\n"); push(@m, "test_dynamic :: pure_all\n"); - push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests; - push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl"; + push(@m, $self->test_via_harness('$(PERLRUN)', $tests)) if $tests; + push(@m, $self->test_via_script('$(PERLRUN)', 'test.pl')) if -f "test.pl"; push(@m, "\t\$(NOECHO) \$(NOOP)\n") if (!$tests && ! -f "test.pl"); push(@m, "\n"); @@ -2025,30 +1872,6 @@ testdb :: testdb_\$(LINKTYPE) join('',@m); } -=item test_via_harness (override) - -Use VMS-style quoting on command line. - -=cut - -sub test_via_harness { - my($self,$perl,$tests) = @_; - " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\'."\n\t". - '-e "use Test::Harness qw(&runtests $verbose); $verbose=$(TEST_VERBOSE); runtests @ARGV;" \\'."\n\t$tests\n"; -} - -=item test_via_script (override) - -Use VMS-style quoting on command line. - -=cut - -sub test_via_script { - my($self,$perl,$script) = @_; - " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '.$script.' -'; -} - =item makeaperl (override) Undertake to build a new set of Perl images using VMS commands. Since @@ -2077,7 +1900,7 @@ MAP_TARGET = $target push @m, q{ $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) $(NOECHO) $(SAY) "Writing ""$(MMS$TARGET)"" for this $(MAP_TARGET)" - $(NOECHO) $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \ + $(NOECHO) $(PERLRUNINST) \ Makefile.PL DIR=}, $dir, q{ \ MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \ MAKEAPERL=1 NORECURS=1 }; diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 76e1bd1..396cd11 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -1,6 +1,5 @@ package ExtUtils::MM_Win32; -our $VERSION = '1.00_02'; =head1 NAME @@ -21,16 +20,18 @@ the semantics. =cut use Config; -#use Cwd; use File::Basename; use File::Spec; -require Exporter; +use ExtUtils::MakeMaker qw( neatvalue ); -require ExtUtils::MakeMaker; -ExtUtils::MakeMaker->import(qw( $Verbose &neatvalue)); +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.03_01'; $ENV{EMXSHELL} = 'sh'; # to run `commands` -unshift @MM::ISA, 'ExtUtils::MM_Win32'; $BORLAND = 1 if $Config{'cc'} =~ /^bcc/i; $GCC = 1 if $Config{'cc'} =~ /^gcc/i; @@ -38,49 +39,6 @@ $DMAKE = 1 if $Config{'make'} =~ /^dmake/i; $NMAKE = 1 if $Config{'make'} =~ /^nmake/i; $PERLMAKE = 1 if $Config{'make'} =~ /^pmake/i; -# a few workarounds for command.com (very basic) -{ - package ExtUtils::MM_Win95; - - # the $^O test may be overkill, but we want to be sure Win32::IsWin95() - # exists before we try it - - unshift @MM::ISA, 'ExtUtils::MM_Win95' - if ($^O =~ /Win32/ && Win32::IsWin95()); - - sub xs_c { - my($self) = shift; - return '' unless $self->needs_linking(); - ' -.xs.c: - $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\ - $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c - ' - } - - sub xs_cpp { - my($self) = shift; - return '' unless $self->needs_linking(); - ' -.xs.cpp: - $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\ - $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp - '; - } - - # many makes are too dumb to use xs_c then c_o - sub xs_o { - my($self) = shift; - return '' unless $self->needs_linking(); - ' -.xs$(OBJ_EXT): - $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\ - $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c - $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c - '; - } -} # end of command.com workarounds - sub dlsyms { my($self,%attribs) = @_; @@ -95,7 +53,7 @@ sub dlsyms { push(@m," $self->{BASEEXT}.def: Makefile.PL ", - q! $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Mksymlists \\ + q! $(PERLRUN) -MExtUtils::Mksymlists \\ -e "Mksymlists('NAME'=>\"!, $self->{NAME}, q!\", 'DLBASE' => '!,$self->{DLBASE}, # The above two lines quoted differently to work around @@ -137,10 +95,6 @@ sub maybe_command { return; } -sub file_name_is_absolute { - shift; - return File::Spec->file_name_is_absolute(@_); -} sub find_perl { my($self, $ver, $names, $dirs, $trace) = @_; @@ -158,17 +112,22 @@ in these dirs: next unless defined $dir; # $self->{PERL_SRC} may be undefined foreach $name (@$names){ my ($abs, $val); - if (File::Spec->file_name_is_absolute($name)) { # /foo/bar + if (File::Spec->file_name_is_absolute($name)) { # /foo/bar $abs = $name; - } elsif (File::Spec->canonpath($name) eq File::Spec->canonpath(basename($name))) { # foo + } elsif (File::Spec->canonpath($name) eq + File::Spec->canonpath(basename($name))) # foo + { $abs = File::Spec->catfile($dir, $name); - } else { # foo/bar - $abs = File::Spec->canonpath(File::Spec->catfile(File::Spec->curdir, $name)); + } else { # foo/bar + $abs = File::Spec->canonpath( + File::Spec->catfile(File::Spec->curdir, $name) + ); } print "Checking $abs\n" if ($trace >= 2); next unless $self->maybe_command($abs); print "Executing $abs\n" if ($trace >= 2); - $val = `$abs -e "require $ver;" 2>&1`; + (my($safe_abs) = $abs) =~ s{(\s)}{\\$1}g; + $val = `$safe_abs -e "require $ver;" 2>&1`; if ($? == 0) { print "Using PERL=$abs\n" if $trace; return $abs; @@ -181,35 +140,18 @@ in these dirs: 0; # false and not empty } -sub catdir { - shift; - return File::Spec->catdir(@_); -} - -=item catfile - -Concatenate one or more directory names and a filename to form a -complete path ending with a filename - -=cut - -sub catfile { - shift; - return File::Spec->catfile(@_); -} - sub init_others { my ($self) = @_; - &ExtUtils::MM_Unix::init_others; - $self->{'TOUCH'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e touch'; - $self->{'CHMOD'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e chmod'; - $self->{'CP'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e cp'; - $self->{'RM_F'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_f'; - $self->{'RM_RF'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_rf'; - $self->{'MV'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mv'; + $self->SUPER::init_others; + $self->{'TOUCH'} = '$(PERLRUN) -MExtUtils::Command -e touch'; + $self->{'CHMOD'} = '$(PERLRUN) -MExtUtils::Command -e chmod'; + $self->{'CP'} = '$(PERLRUN) -MExtUtils::Command -e cp'; + $self->{'RM_F'} = '$(PERLRUN) -MExtUtils::Command -e rm_f'; + $self->{'RM_RF'} = '$(PERLRUN) -MExtUtils::Command -e rm_rf'; + $self->{'MV'} = '$(PERLRUN) -MExtUtils::Command -e mv'; $self->{'NOOP'} = 'rem'; - $self->{'TEST_F'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e test_f'; + $self->{'TEST_F'} = '$(PERLRUN) -MExtUtils::Command -e test_f'; $self->{'LD'} = $Config{'ld'} || 'link'; $self->{'AR'} = $Config{'ar'} || 'lib'; $self->{'LDLOADLIBS'} ||= $Config{'libs'}; @@ -226,7 +168,6 @@ sub init_others $self->{'LDDLFLAGS'} .= " $libpath"; } $self->{'DEV_NULL'} = '> NUL'; - # $self->{'NOECHO'} = ''; # till we have it working } @@ -272,7 +213,6 @@ MM_VERSION = $ExtUtils::MakeMaker::VERSION push @m, q{ # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle). # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle) -# ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) !!! Deprecated from MM 5.32 !!! # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) # DLBASE = Basename part of dynamic library. May be just equal BASEEXT. }; @@ -291,17 +231,11 @@ XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})." C_FILES = ".join(" \\\n\t", @{$self->{C}})." O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})." H_FILES = ".join(" \\\n\t", @{$self->{H}})." -HTMLLIBPODS = ".join(" \\\n\t", sort keys %{$self->{HTMLLIBPODS}})." -HTMLSCRIPTPODS = ".join(" \\\n\t", sort keys %{$self->{HTMLSCRIPTPODS}})." MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})." MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})." "; for $tmp (qw/ - INST_HTMLPRIVLIBDIR INSTALLHTMLPRIVLIBDIR - INST_HTMLSITELIBDIR INSTALLHTMLSITELIBDIR - INST_HTMLSCRIPTDIR INSTALLHTMLSCRIPTDIR - INST_HTMLLIBDIR HTMLEXT INST_MAN1DIR INSTALLMAN1DIR MAN1EXT INST_MAN3DIR INSTALLMAN3DIR MAN3EXT /) { @@ -369,12 +303,6 @@ EXPORT_LIST = $tmp PERL_ARCHIVE = $tmp "; -# push @m, q{ -#INST_PM = }.join(" \\\n\t", sort values %{$self->{PM}}).q{ -# -#PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{ -#}; - push @m, q{ TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{ @@ -385,10 +313,6 @@ PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{ } -sub path { - return File::Spec->path(); -} - =item static_lib (o) Defines how to produce the *.a (or equivalent) files. @@ -448,7 +372,7 @@ BOOTSTRAP = '."$self->{BASEEXT}.bs".' # The DynaLoader only reads a non-empty file. $(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)\.exists '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))" - '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \ + '.$self->{NOECHO}.'$(PERLRUN) \ -MExtUtils::Mkbootstrap \ -e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');" '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP) @@ -526,8 +450,8 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists sub clean { - my ($self) = @_; - my $s = &ExtUtils::MM_Unix::clean; + my ($self) = shift; + my $s = $self->SUPER::clean(@_); my $clean = $GCC ? 'dll.base dll.exp' : '*.pdb'; $s .= <catdir('$(INST_LIB)','auto'); return q{ pm_to_blib: $(TO_INST_PM) - }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \ - "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \ + }.$self->{NOECHO}.q{$(PERLRUNINST) -MExtUtils::Install \ -e "pm_to_blib(}. ($NMAKE ? 'qw[ <{NOECHO}.'$(NOOP) ' unless $self->{SKIPHASH}{'all'}; @@ -759,24 +668,6 @@ config :: $(INST_AUTODIR)\.exists push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]); - if (%{$self->{HTMLLIBPODS}}) { - push @m, qq[ -config :: \$(INST_HTMLLIBDIR)/.exists - $self->{NOECHO}\$(NOOP) - -]; - push @m, $self->dir_target(qw[$(INST_HTMLLIBDIR)]); - } - - if (%{$self->{HTMLSCRIPTPODS}}) { - push @m, qq[ -config :: \$(INST_HTMLSCRIPTDIR)/.exists - $self->{NOECHO}\$(NOOP) - -]; - push @m, $self->dir_target(qw[$(INST_HTMLSCRIPTDIR)]); - } - if (%{$self->{MAN1PODS}}) { push @m, qq[ config :: \$(INST_MAN1DIR)\\.exists @@ -803,69 +694,9 @@ help: perldoc ExtUtils::MakeMaker }; - push @m, q{ -Version_check: - }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \ - -MExtUtils::MakeMaker=Version_check \ - -e "Version_check('$(MM_VERSION)')" -}; - join('',@m); } -=item htmlifypods (o) - -Defines targets and routines to translate the pods into HTML manpages -and put them into the INST_HTMLLIBDIR and INST_HTMLSCRIPTDIR -directories. - -Same as MM_Unix version (changes command-line quoting). - -=cut - -sub htmlifypods { - my($self, %attribs) = @_; - return "\nhtmlifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n" unless - %{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}}; - my($dist); - my($pod2html_exe); - if (defined $self->{PERL_SRC}) { - $pod2html_exe = File::Spec->catfile($self->{PERL_SRC},'pod','pod2html'); - } else { - $pod2html_exe = File::Spec->catfile($Config{scriptdirexp},'pod2html'); - } - unless ($pod2html_exe = $self->perl_script($pod2html_exe)) { - # No pod2html but some HTMLxxxPODS to be installed - print <{MAKEFILE}, q[';" \\ --e "print qq(Htmlifying $$m{$$_}\n);" \\ --e "$$dir = dirname($$m{$$_}); mkpath($$dir) unless -d $$dir;" \\ --e "system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2HTML_EXE) ].qq[$$_>$$m{$$_}])==0 or warn qq(Couldn\\047t install $$m{$$_}\n);" \\ --e "chmod(oct($(PERM_RW))), $$m{$$_} or warn qq(chmod $(PERM_RW) $$m{$$_}: $$!\n);}" -]; - push @m, "\nhtmlifypods : pure_all "; - push @m, join " \\\n\t", keys %{$self->{HTMLLIBPODS}}, keys %{$self->{HTMLSCRIPTPODS}}; - - push(@m,"\n"); - if (%{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}}) { - push @m, "\t$self->{NOECHO}\$(POD2HTML) \\\n\t"; - push @m, join " \\\n\t", %{$self->{HTMLLIBPODS}}, %{$self->{HTMLSCRIPTPODS}}; - } - join('', @m); -} - =item manifypods (o) We don't want manpage process. @@ -888,7 +719,7 @@ sub dist_ci { my @m; push @m, q{ ci : - $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=maniread \\ + $(PERLRUN) -MExtUtils::Manifest=maniread \\ -e "@all = keys %{ maniread() };" \\ -e "print(\"Executing $(CI) @all\n\"); system(\"$(CI) @all\");" \\ -e "print(\"Executing $(RCS_LABEL) ...\n\"); system(\"$(RCS_LABEL) @all\");" diff --git a/lib/ExtUtils/MM_Win95.pm b/lib/ExtUtils/MM_Win95.pm new file mode 100644 index 0000000..af53336 --- /dev/null +++ b/lib/ExtUtils/MM_Win95.pm @@ -0,0 +1,42 @@ +package ExtUtils::MM_Win95; + +use vars qw($VERSION @ISA); +$VERSION = 0.01; + +require ExtUtils::MM_Win32; +@ISA = qw(ExtUtils::MM_Win32); + + +# a few workarounds for command.com (very basic) + +sub xs_c { + my($self) = shift; + return '' unless $self->needs_linking(); + ' +.xs.c: + $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\ + $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c + ' +} + +sub xs_cpp { + my($self) = shift; + return '' unless $self->needs_linking(); + ' +.xs.cpp: + $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\ + $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp + '; +} + +# many makes are too dumb to use xs_c then c_o +sub xs_o { + my($self) = shift; + return '' unless $self->needs_linking(); + ' +.xs$(OBJ_EXT): + $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\ + $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c + $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c + '; +} diff --git a/lib/ExtUtils/MY.pm b/lib/ExtUtils/MY.pm new file mode 100644 index 0000000..97ef42a --- /dev/null +++ b/lib/ExtUtils/MY.pm @@ -0,0 +1,42 @@ +package ExtUtils::MY; + +use strict; +require ExtUtils::MM; + +use vars qw(@ISA $VERSION); +$VERSION = 0.01; +@ISA = qw(ExtUtils::MM); + +{ + package MY; + use vars qw(@ISA); + @ISA = qw(ExtUtils::MY); +} + +sub DESTROY {} + + +=head1 NAME + +ExtUtils::MY - ExtUtils::MakeMaker subclass for customization + +=head1 SYNOPSIS + + # in your Makefile.PL + sub MY::whatever { + ... + } + +=head1 DESCRIPTION + +B + +ExtUtils::MY is a subclass of ExtUtils::MM. Its provided in your +Makefile.PL for you to add and override MakeMaker functionality. + +It also provides a convenient alias via the MY class. + +ExtUtils::MY might turn out to be a temporary solution, but MY won't +go away. + +=cut diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index 06ce258..a9c78f2 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -1,120 +1,38 @@ -BEGIN {require 5.002;} # MakeMaker 5.17 was the last MakeMaker that was compatible with perl5.001m +BEGIN {require 5.004;} package ExtUtils::MakeMaker; -$VERSION = "5.48_03"; -$Version_OK = "5.17"; # Makefiles older than $Version_OK will die - # (Will be checked from MakeMaker version 4.13 onwards) -($Revision = substr(q$Revision: 1.4 $, 10)) =~ s/\s+$//; - - +$VERSION = "5.53_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.19 $, 10)) =~ s/\s+$//; require Exporter; use Config; use Carp (); use vars qw( - @ISA @EXPORT @EXPORT_OK $AUTOLOAD - $ISA_TTY $Revision $VERSION $Verbose $Version_OK %Config - %Keep_after_flush %MM_Sections %Prepend_dot_dot + @ISA @EXPORT @EXPORT_OK + $ISA_TTY $Revision $VERSION $Verbose $Version_OK %Config + %Keep_after_flush %MM_Sections @Prepend_dot_dot %Recognized_Att_Keys @Get_from_Config @MM_Sections @Overridable @Parent $PACKNAME - ); + ); use strict; -# &DynaLoader::mod2fname should be available to miniperl, thus -# should be a pseudo-builtin (cmp. os2.c). -#eval {require DynaLoader;}; - -# -# Set up the inheritance before we pull in the MM_* packages, because they -# import variables and functions from here -# @ISA = qw(Exporter); @EXPORT = qw(&WriteMakefile &writeMakefile $Verbose &prompt); -@EXPORT_OK = qw($VERSION &Version_check &neatvalue &mkbootstrap &mksymlists); - -# -# Dummy package MM inherits actual methods from OS-specific -# default packages. We use this intermediate package so -# MY::XYZ->func() can call MM->func() and get the proper -# default routine without having to know under what OS -# it's running. -# -@MM::ISA = qw[ExtUtils::MM_Unix ExtUtils::Liblist::Kid ExtUtils::MakeMaker]; - -# -# Setup dummy package: -# MY exists for overriding methods to be defined within -# -{ - package MY; - @MY::ISA = qw(MM); -### sub AUTOLOAD { use Devel::Symdump; print Devel::Symdump->rnew->as_string; Carp::confess "hey why? $AUTOLOAD" } - package MM; - sub DESTROY {} -} +@EXPORT_OK = qw($VERSION &neatvalue &mkbootstrap &mksymlists); -# "predeclare the package: we only load it via AUTOLOAD -# but we have already mentioned it in @ISA -package ExtUtils::Liblist::Kid; - -package ExtUtils::MakeMaker; -# -# Now we can pull in the friends -# +# These will go away once the last of the Win32 & VMS specific code is +# purged. my $Is_VMS = $^O eq 'VMS'; -my $Is_OS2 = $^O eq 'os2'; -my $Is_Mac = $^O eq 'MacOS'; my $Is_Win32 = $^O eq 'MSWin32'; -my $Is_Cygwin = $^O eq 'cygwin'; -my $Is_NetWare = $Config{'osname'} eq 'NetWare'; # Config{'osname'} intentional -my $Is_BeOS = $^O =~ /beos/i; # XXX should this be that loose? - -require ExtUtils::MM_Unix; - -if ($Is_VMS) { - require ExtUtils::MM_VMS; - require VMS::Filespec; # is a noop as long as we require it within MM_VMS -} -if ($Is_OS2) { - require ExtUtils::MM_OS2; -} -if ($Is_Mac) { - require ExtUtils::MM_MacOS; -} -if ($Is_NetWare) { - $^O = 'NetWare'; - require ExtUtils::MM_NW5; - $Is_Win32=0; -} -if ($Is_Win32) { - require ExtUtils::MM_Win32; -} -if ($Is_Cygwin) { - require ExtUtils::MM_Cygwin; -} -if ($Is_BeOS) { - require ExtUtils::MM_BeOS; -} full_setup(); -# The use of the Version_check target has been dropped between perl -# 5.5.63 and 5.5.64. We must keep the subroutine for a while so that -# old Makefiles can satisfy the Version_check target. - -sub Version_check { - my($checkversion) = @_; - die "Your Makefile was built with ExtUtils::MakeMaker v $checkversion. -Current Version is $ExtUtils::MakeMaker::VERSION. There have been considerable -changes in the meantime. -Please rerun 'perl Makefile.PL' to regenerate the Makefile.\n" - if $checkversion < $Version_OK; - printf STDOUT "%s %s %s %s.\n", "Makefile built with ExtUtils::MakeMaker v", - $checkversion, "Current Version is", $VERSION - unless $checkversion == $VERSION; -} +require ExtUtils::MM; # Things like CPAN assume loading ExtUtils::MakeMaker + # will give them MM. sub warnhandler { $_[0] =~ /^Use of uninitialized value/ && return; @@ -127,25 +45,34 @@ sub WriteMakefile { Carp::croak "WriteMakefile: Need even number of args" if @_ % 2; local $SIG{__WARN__} = \&warnhandler; + require ExtUtils::MY; my %att = @_; MM->new(\%att)->flush; } sub prompt ($;$) { my($mess,$def)=@_; - $ISA_TTY = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; # Pipe? + $ISA_TTY = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; # Pipe? Carp::confess("prompt function called without an argument") unless defined $mess; my $dispdef = defined $def ? "[$def] " : " "; $def = defined $def ? $def : ""; my $ans; local $|=1; + local $\; print "$mess $dispdef"; if ($ISA_TTY && !$ENV{PERL_MM_USE_DEFAULT}) { - chomp($ans = ); - } else { - print "$def\n"; + $ans = ; + if( defined $ans ) { + chomp $ans; + } + else { # user hit ctrl-D + print "\n"; + } + } + else { + print "$def\n"; } - return ($ans ne '') ? $ans : $def; + return (!defined $ans || $ans eq '') ? $def : $ans; } sub eval_in_subdirs { @@ -153,27 +80,30 @@ sub eval_in_subdirs { use Cwd qw(cwd abs_path); my $pwd = cwd(); local @INC = map eval {abs_path($_) if -e} || $_, @INC; + push @INC, '.'; # '.' has to always be at the end of @INC foreach my $dir (@{$self->{DIR}}){ - my($abs) = $self->catdir($pwd,$dir); - $self->eval_in_x($abs); + my($abs) = $self->catdir($pwd,$dir); + $self->eval_in_x($abs); } chdir $pwd; } sub eval_in_x { my($self,$dir) = @_; - package main; chdir $dir or Carp::carp("Couldn't change to directory $dir: $!"); - eval { do './Makefile.PL' }; + { + package main; + do './Makefile.PL'; + }; if ($@) { -# if ($@ =~ /prerequisites/) { -# die "MakeMaker WARNING: $@"; -# } else { -# warn "WARNING from evaluation of $dir/Makefile.PL: $@"; -# } - warn "WARNING from evaluation of $dir/Makefile.PL: $@"; +# if ($@ =~ /prerequisites/) { +# die "MakeMaker WARNING: $@"; +# } else { +# warn "WARNING from evaluation of $dir/Makefile.PL: $@"; +# } + warn "WARNING from evaluation of $dir/Makefile.PL: $@"; } } @@ -188,12 +118,11 @@ sub full_setup { AUTHOR ABSTRACT ABSTRACT_FROM BINARY_LOCATION C CAPI CCFLAGS CONFIG CONFIGURE DEFINE DIR DISTNAME DL_FUNCS DL_VARS EXCLUDE_EXT EXE_FILES FIRST_MAKEFILE FULLPERL FUNCLIST H - HTMLLIBPODS HTMLSCRIPTPODS IMPORTS - INC INCLUDE_EXT INSTALLARCHLIB INSTALLBIN INSTALLDIRS INSTALLHTMLPRIVLIBDIR - INSTALLHTMLSCRIPTDIR INSTALLHTMLSITELIBDIR INSTALLMAN1DIR + IMPORTS + INC INCLUDE_EXT INSTALLARCHLIB INSTALLBIN INSTALLDIRS + INSTALLMAN1DIR INSTALLMAN3DIR INSTALLPRIVLIB INSTALLSCRIPT INSTALLSITEARCH INSTALLSITELIB INST_ARCHLIB INST_BIN INST_EXE INST_LIB - INST_HTMLLIBDIR INST_HTMLSCRIPTDIR INST_MAN1DIR INST_MAN3DIR INST_SCRIPT LDFROM LIB LIBPERL_A LIBS LINKTYPE MAKEAPERL MAKEFILE MAN1PODS MAN3PODS MAP_TARGET MYEXTLIB PERL_MALLOC_OK @@ -208,7 +137,7 @@ sub full_setup { tool_autosplit MACPERL_SRC MACPERL_LIB MACLIBS_68K MACLIBS_PPC MACLIBS_SC MACLIBS_MRC MACLIBS_ALL_68K MACLIBS_ALL_PPC MACLIBS_SHARED - /; + /; # IMPORTS is used under OS/2 and Win32 @@ -222,7 +151,7 @@ sub full_setup { @MM_Sections = - qw( + qw( post_initialize const_config constants tool_autosplit tool_xsubpp tools_other dist macro depend cflags const_loadlibs const_cccmd @@ -231,25 +160,25 @@ sub full_setup { pasthru c_o xs_c xs_o top_targets linkext dlsyms dynamic dynamic_bs - dynamic_lib static static_lib htmlifypods manifypods processPL + dynamic_lib static static_lib manifypods processPL installbin subdirs clean realclean dist_basics dist_core dist_dir dist_test dist_ci install force perldepend makefile staticmake test ppd - ); # loses section ordering + ); # loses section ordering @Overridable = @MM_Sections; push @Overridable, qw[ dir_target libscan makeaperl needs_linking perm_rw perm_rwx subdir_x test_via_harness test_via_script - ]; + ]; push @MM_Sections, qw[ pm_to_blib selfdocument - ]; + ]; # Postamble needs to be the last that was always the case push @MM_Sections, "postamble"; @@ -260,19 +189,19 @@ sub full_setup { # we will use all these variables in the Makefile @Get_from_Config = - qw( - ar cc cccdlflags ccdlflags dlext dlsrc ld lddlflags ldflags libc - lib_ext obj_ext osname osvers ranlib sitelibexp sitearchexp so - exe_ext full_ar - ); + qw( + ar cc cccdlflags ccdlflags dlext dlsrc ld lddlflags ldflags libc + lib_ext obj_ext osname osvers ranlib sitelibexp sitearchexp so + exe_ext full_ar + ); foreach my $item (@attrib_help){ - $Recognized_Att_Keys{$item} = 1; + $Recognized_Att_Keys{$item} = 1; } foreach my $item (@Get_from_Config) { - $Recognized_Att_Keys{uc $item} = $Config{$item}; - print "Attribute '\U$item\E' => '$Config{$item}'\n" - if ($Verbose >= 2); + $Recognized_Att_Keys{uc $item} = $Config{$item}; + print "Attribute '\U$item\E' => '$Config{$item}'\n" + if ($Verbose >= 2); } # @@ -280,18 +209,15 @@ sub full_setup { # us (the parent) for the values and will prepend "..", so that # all files to be installed end up below OUR ./blib # - %Prepend_dot_dot = - qw( - - INST_BIN 1 INST_EXE 1 INST_LIB 1 INST_ARCHLIB 1 INST_SCRIPT 1 - MAP_TARGET 1 INST_HTMLLIBDIR 1 INST_HTMLSCRIPTDIR 1 - INST_MAN1DIR 1 INST_MAN3DIR 1 PERL_SRC 1 PERL 1 FULLPERL 1 - - ); + @Prepend_dot_dot = qw( + INST_BIN INST_EXE INST_LIB INST_ARCHLIB INST_SCRIPT + MAP_TARGET INST_MAN1DIR INST_MAN3DIR PERL_SRC + PERL FULLPERL + ); my @keep = qw/ - NEEDS_LINKING HAS_LINK_CODE - /; + NEEDS_LINKING HAS_LINK_CODE + /; @Keep_after_flush{@keep} = (1) x @keep; } @@ -315,24 +241,24 @@ The MakeMaker team END } -sub ExtUtils::MakeMaker::new { +sub new { my($class,$self) = @_; my($key); if ("@ARGV" =~ /\bPREREQ_PRINT\b/) { - require Data::Dumper; + require Data::Dumper; print Data::Dumper->Dump([$self->{PREREQ_PM}], [qw(PREREQ_PM)]); - } + } # PRINT_PREREQ is RedHatism. if ("@ARGV" =~ /\bPRINT_PREREQ\b/) { - print join(" ", map { "perl($_)>=$self->{PREREQ_PM}->{$_} " } sort keys %{$self->{PREREQ_PM}}), "\n"; - exit 0; + print join(" ", map { "perl($_)>=$self->{PREREQ_PM}->{$_} " } sort keys %{$self->{PREREQ_PM}}), "\n"; + exit 0; } print STDOUT "MakeMaker (v$VERSION)\n" if $Verbose; if (-f "MANIFEST" && ! -f "Makefile"){ - check_manifest(); + check_manifest(); } $self = {} unless (defined $self); @@ -344,99 +270,91 @@ sub ExtUtils::MakeMaker::new { my(%unsatisfied) = (); foreach my $prereq (sort keys %{$self->{PREREQ_PM}}) { - eval "require $prereq"; - - if ($@) { - warn "Warning: prerequisite $prereq $self->{PREREQ_PM}->{$prereq} not found.\n" unless $self->{PREREQ_FATAL}; - $unsatisfied{$prereq} = 'not installed'; - } elsif ($prereq->VERSION < $self->{PREREQ_PM}->{$prereq} ){ - warn "Warning: prerequisite $prereq $self->{PREREQ_PM}->{$prereq} not found. We have " - . ($prereq->VERSION || 'unknown version') unless $self->{PREREQ_FATAL}; - $unsatisfied{$prereq} = $self->{PREREQ_PM}->{$prereq} ? $self->{PREREQ_PM}->{$prereq} : 'unknown version' ; - } + eval "require $prereq"; + + if ($@) { + warn sprintf "Warning: prerequisite %s %s not found.\n", + $prereq, $self->{PREREQ_PM}{$prereq} + unless $self->{PREREQ_FATAL}; + $unsatisfied{$prereq} = 'not installed'; + } elsif ($prereq->VERSION < $self->{PREREQ_PM}->{$prereq} ){ + warn "Warning: prerequisite %s %s not found. We have %s.\n", + $prereq, $self->{PREREQ_PM}{$prereq}, + ($prereq->VERSION || 'unknown version') + unless $self->{PREREQ_FATAL}; + $unsatisfied{$prereq} = $self->{PREREQ_PM}->{$prereq} ? + $self->{PREREQ_PM}->{$prereq} : 'unknown version' ; + } } if (%unsatisfied && $self->{PREREQ_FATAL}){ -# unless (defined $ExtUtils::MakeMaker::useCPAN) { - my $failedprereqs = join ', ', map {"$_ $unsatisfied{$_}"} keys %unsatisfied; - die qq{MakeMaker FATAL: prerequisites not found ($failedprereqs) - Please install these modules first and rerun 'perl Makefile.PL'.\n}; -# if ($ExtUtils::MakeMaker::hasCPAN) { -# $ExtUtils::MakeMaker::useCPAN = prompt(qq{Should I try to use the CPAN module to fetch them for you?},"yes"); -# } else { -# print qq{Hint: You may want to install the CPAN module to autofetch the needed modules\n}; -# $ExtUtils::MakeMaker::useCPAN=0; -# } -# } -# if ($ExtUtils::MakeMaker::useCPAN) { -# require CPAN; -# CPAN->import(@unsatisfied); -# } else { -# die qq{prerequisites not found (@unsatisfied)}; -# } -# warn qq{WARNING: prerequisites not found (@unsatisfied)}; + my $failedprereqs = join ', ', map {"$_ $unsatisfied{$_}"} + keys %unsatisfied; + die qq{MakeMaker FATAL: prerequisites not found ($failedprereqs)\n + Please install these modules first and rerun 'perl Makefile.PL'.\n}; } if (defined $self->{CONFIGURE}) { - if (ref $self->{CONFIGURE} eq 'CODE') { - %configure_att = %{&{$self->{CONFIGURE}}}; - $self = { %$self, %configure_att }; - } else { - Carp::croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n"; - } + if (ref $self->{CONFIGURE} eq 'CODE') { + %configure_att = %{&{$self->{CONFIGURE}}}; + $self = { %$self, %configure_att }; + } else { + Carp::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::carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n"); } my $newclass = ++$PACKNAME; - local @Parent = @Parent; # Protect against non-local exits + local @Parent = @Parent; # Protect against non-local exits { - no strict 'refs'; - print "Blessing Object into class [$newclass]\n" if $Verbose>=2; - mv_all_methods("MY",$newclass); - bless $self, $newclass; - push @Parent, $self; - @{"$newclass\:\:ISA"} = 'MM'; + no strict 'refs'; + print "Blessing Object into class [$newclass]\n" if $Verbose>=2; + mv_all_methods("MY",$newclass); + bless $self, $newclass; + push @Parent, $self; + require ExtUtils::MY; + @{"$newclass\:\: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}; - 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 (scalar(@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; - parse_args($self,@fm) if @fm; + $self->{PARENT} = $Parent[-2]; + my $key; + for $key (@Prepend_dot_dot) { + 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; + parse_args($self,@fm) if @fm; } else { - parse_args($self,split(' ', $ENV{PERL_MM_OPT} || ''),@ARGV); + parse_args($self,split(' ', $ENV{PERL_MM_OPT} || ''),@ARGV); } $self->{NAME} ||= $self->guess_name; @@ -446,27 +364,28 @@ sub ExtUtils::MakeMaker::new { $self->init_main(); if (! $self->{PERL_SRC} ) { - my($pthinks) = $self->canonpath($INC{'Config.pm'}); - my($cthinks) = $self->catfile($Config{'archlibexp'},'Config.pm'); - $pthinks = VMS::Filespec::vmsify($pthinks) if $Is_VMS; - if ($pthinks ne $cthinks && - !($Is_Win32 and lc($pthinks) eq lc($cthinks))) { + require VMS::Filespec if $Is_VMS; + my($pthinks) = $self->canonpath($INC{'Config.pm'}); + my($cthinks) = $self->catfile($Config{'archlibexp'},'Config.pm'); + $pthinks = VMS::Filespec::vmsify($pthinks) if $Is_VMS; + if ($pthinks ne $cthinks && + !($Is_Win32 and lc($pthinks) eq lc($cthinks))) { print "Have $pthinks expected $cthinks\n"; - if ($Is_Win32) { - $pthinks =~ s![/\\]Config\.pm$!!i; $pthinks =~ s!.*[/\\]!!; - } - else { - $pthinks =~ s!/Config\.pm$!!; $pthinks =~ s!.*/!!; - } - print STDOUT <{UNINSTALLED_PERL}; -Your perl and your Config.pm seem to have different ideas about the architecture -they are running on. + if ($Is_Win32) { + $pthinks =~ s![/\\]Config\.pm$!!i; $pthinks =~ s!.*[/\\]!!; + } + else { + $pthinks =~ s!/Config\.pm$!!; $pthinks =~ s!.*/!!; + } + print STDOUT <{UNINSTALLED_PERL}; +Your perl and your Config.pm seem to have different ideas about the +architecture they are running on. Perl thinks: [$pthinks] Config says: [$Config{archname}] -This may or may not cause problems. Please check your installation of perl if you -have problems building this extension. +This may or may not cause problems. Please check your installation of perl +if you have problems building this extension. END - } + } } $self->init_dirscan(); @@ -482,7 +401,7 @@ END # $VERSION (Revision: $Revision) from the contents of # Makefile.PL. Don't edit this file, edit Makefile.PL instead. # -# ANY CHANGES MADE HERE WILL BE LOST! +# ANY CHANGES MADE HERE WILL BE LOST! # # MakeMaker ARGV: $argv # @@ -490,10 +409,10 @@ END END foreach my $key (sort keys %initial_att){ - my($v) = neatvalue($initial_att{$key}); - $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; - $v =~ tr/\n/ /s; - push @{$self->{RESULT}}, "# $key => $v"; + my($v) = neatvalue($initial_att{$key}); + $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; + $v =~ tr/\n/ /s; + push @{$self->{RESULT}}, "# $key => $v"; } undef %initial_att; # free memory @@ -520,33 +439,33 @@ END # turn the SKIP array into a SKIPHASH hash my (%skip,$skip); for $skip (@{$self->{SKIP} || []}) { - $self->{SKIPHASH}{$skip} = 1; + $self->{SKIPHASH}{$skip} = 1; } delete $self->{SKIP}; # free memory if ($self->{PARENT}) { - for (qw/install dist dist_basics dist_core dist_dir dist_test dist_ci/) { - $self->{SKIPHASH}{$_} = 1; - } + for (qw/install dist dist_basics dist_core dist_dir dist_test dist_ci/) { + $self->{SKIPHASH}{$_} = 1; + } } # We run all the subdirectories now. They don't have much to query # from the parent, but the parent has to query them: if they need linking! unless ($self->{NORECURS}) { - $self->eval_in_subdirs if @{$self->{DIR}}; + $self->eval_in_subdirs if @{$self->{DIR}}; } foreach my $section ( @MM_Sections ){ - print "Processing Makefile '$section' section\n" if ($Verbose >= 2); - my($skipit) = $self->skipcheck($section); - if ($skipit){ - push @{$self->{RESULT}}, "\n# --- MakeMaker $section section $skipit."; - } else { - my(%a) = %{$self->{$section} || {}}; - push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:"; - push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a; - push @{$self->{RESULT}}, $self->nicetext($self->$section( %a )); - } + print "Processing Makefile '$section' section\n" if ($Verbose >= 2); + my($skipit) = $self->skipcheck($section); + if ($skipit){ + push @{$self->{RESULT}}, "\n# --- MakeMaker $section section $skipit."; + } else { + my(%a) = %{$self->{$section} || {}}; + push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:"; + push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a; + push @{$self->{RESULT}}, $self->nicetext($self->$section( %a )); + } } push @{$self->{RESULT}}, "\n# End."; @@ -590,79 +509,79 @@ sub check_manifest { $ExtUtils::Manifest::Quiet = $ExtUtils::Manifest::Quiet = 1; my(@missed) = ExtUtils::Manifest::manicheck(); if (@missed) { - print STDOUT "Warning: the following files are missing in your kit:\n"; - print "\t", join "\n\t", @missed; - print STDOUT "\n"; - print STDOUT "Please inform the author.\n"; + print STDOUT "Warning: the following files are missing in your kit:\n"; + print "\t", join "\n\t", @missed; + print STDOUT "\n"; + print STDOUT "Please inform the author.\n"; } else { - print STDOUT "Looks good\n"; + print STDOUT "Looks good\n"; } } sub parse_args{ my($self, @args) = @_; foreach (@args) { - unless (m/(.*?)=(.*)/) { - help(),exit 1 if m/^help$/; - ++$Verbose if m/^verb/; - next; - } - my($name, $value) = ($1, $2); - if ($value =~ m/^~(\w+)?/) { # tilde with optional username - $value =~ s [^~(\w*)] - [$1 ? - ((getpwnam($1))[7] || "~$1") : - (getpwuid($>))[7] - ]ex; - } - $self->{uc($name)} = $value; + unless (m/(.*?)=(.*)/) { + help(),exit 1 if m/^help$/; + ++$Verbose if m/^verb/; + next; + } + my($name, $value) = ($1, $2); + if ($value =~ m/^~(\w+)?/) { # tilde with optional username + $value =~ s [^~(\w*)] + [$1 ? + ((getpwnam($1))[7] || "~$1") : + (getpwuid($>))[7] + ]ex; + } + $self->{uc($name)} = $value; } # catch old-style 'potential_libs' and inform user how to 'upgrade' if (defined $self->{potential_libs}){ - my($msg)="'potential_libs' => '$self->{potential_libs}' should be"; - if ($self->{potential_libs}){ - print STDOUT "$msg changed to:\n\t'LIBS' => ['$self->{potential_libs}']\n"; - } else { - print STDOUT "$msg deleted.\n"; - } - $self->{LIBS} = [$self->{potential_libs}]; - delete $self->{potential_libs}; + my($msg)="'potential_libs' => '$self->{potential_libs}' should be"; + if ($self->{potential_libs}){ + print STDOUT "$msg changed to:\n\t'LIBS' => ['$self->{potential_libs}']\n"; + } else { + print STDOUT "$msg deleted.\n"; + } + $self->{LIBS} = [$self->{potential_libs}]; + delete $self->{potential_libs}; } # catch old-style 'ARMAYBE' and inform user how to 'upgrade' if (defined $self->{ARMAYBE}){ - my($armaybe) = $self->{ARMAYBE}; - print STDOUT "ARMAYBE => '$armaybe' should be changed to:\n", - "\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n"; - my(%dl) = %{$self->{dynamic_lib} || {}}; - $self->{dynamic_lib} = { %dl, ARMAYBE => $armaybe}; - delete $self->{ARMAYBE}; + my($armaybe) = $self->{ARMAYBE}; + print STDOUT "ARMAYBE => '$armaybe' should be changed to:\n", + "\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n"; + my(%dl) = %{$self->{dynamic_lib} || {}}; + $self->{dynamic_lib} = { %dl, ARMAYBE => $armaybe}; + delete $self->{ARMAYBE}; } if (defined $self->{LDTARGET}){ - print STDOUT "LDTARGET should be changed to LDFROM\n"; - $self->{LDFROM} = $self->{LDTARGET}; - delete $self->{LDTARGET}; + print STDOUT "LDTARGET should be changed to LDFROM\n"; + $self->{LDFROM} = $self->{LDTARGET}; + delete $self->{LDTARGET}; } # Turn a DIR argument on the command line into an array if (defined $self->{DIR} && ref \$self->{DIR} eq 'SCALAR') { - # So they can choose from the command line, which extensions they want - # the grep enables them to have some colons too much in case they - # have to build a list with the shell - $self->{DIR} = [grep $_, split ":", $self->{DIR}]; + # So they can choose from the command line, which extensions they want + # the grep enables them to have some colons too much in case they + # have to build a list with the shell + $self->{DIR} = [grep $_, split ":", $self->{DIR}]; } # Turn a INCLUDE_EXT argument on the command line into an array if (defined $self->{INCLUDE_EXT} && ref \$self->{INCLUDE_EXT} eq 'SCALAR') { - $self->{INCLUDE_EXT} = [grep $_, split '\s+', $self->{INCLUDE_EXT}]; + $self->{INCLUDE_EXT} = [grep $_, split '\s+', $self->{INCLUDE_EXT}]; } # Turn a EXCLUDE_EXT argument on the command line into an array if (defined $self->{EXCLUDE_EXT} && ref \$self->{EXCLUDE_EXT} eq 'SCALAR') { - $self->{EXCLUDE_EXT} = [grep $_, split '\s+', $self->{EXCLUDE_EXT}]; + $self->{EXCLUDE_EXT} = [grep $_, split '\s+', $self->{EXCLUDE_EXT}]; } foreach my $mmkey (sort keys %$self){ - print STDOUT " $mmkey => ", neatvalue($self->{$mmkey}), "\n" if $Verbose; - print STDOUT "'$mmkey' is not a known MakeMaker parameter name.\n" - unless exists $Recognized_Att_Keys{$mmkey}; + print STDOUT " $mmkey => ", neatvalue($self->{$mmkey}), "\n" if $Verbose; + print STDOUT "'$mmkey' is not a known MakeMaker parameter name.\n" + unless exists $Recognized_Att_Keys{$mmkey}; } $| = 1 if $Verbose; } @@ -681,22 +600,26 @@ sub check_hints { # Also try without trailing minor version numbers. while (1) { - last if -f "hints/$hint.pl"; # found + last if -f "hints/$hint.pl"; # found } continue { - last unless $hint =~ s/_[^_]*$//; # nothing to cut off + last unless $hint =~ s/_[^_]*$//; # nothing to cut off } my $hint_file = "hints/$hint.pl"; return unless -f $hint_file; # really there - # execute the hintsfile: + _run_hintfile($self, $hint_file); +} + +sub _run_hintfile { + our $self; + local($self) = shift; # make $self available to the hint file. + my($hint_file) = shift; + print STDERR "Processing hints file $hint_file\n"; - { - local *HINT; - open(HINT, $hint_file) || die "Can't open $hint_file: $!"; - eval join '', ; - close HINT; - } + local($!, $@); + do "./$hint_file"; + print STDERR "Couldn't open hint file: $!" if $!; print STDERR $@ if $@; } @@ -712,29 +635,29 @@ sub mv_all_methods { foreach my $method (@Overridable) { - # We cannot say "next" here. Nick might call MY->makeaperl - # which isn't defined right now + # We cannot say "next" here. Nick might call MY->makeaperl + # which isn't defined right now + + # Above statement was written at 4.23 time when Tk-b8 was + # around. As Tk-b9 only builds with 5.002something and MM 5 is + # standard, we try to enable the next line again. It was + # commented out until MM 5.23 + + next unless defined &{"${from}::$method"}; - # Above statement was written at 4.23 time when Tk-b8 was - # around. As Tk-b9 only builds with 5.002something and MM 5 is - # standard, we try to enable the next line again. It was - # commented out until MM 5.23 + *{"${to}::$method"} = \&{"${from}::$method"}; - next unless defined &{"${from}::$method"}; + # delete would do, if we were sure, nobody ever called + # MY->makeaperl directly - *{"${to}::$method"} = \&{"${from}::$method"}; + # delete $symtab->{$method}; - # delete would do, if we were sure, nobody ever called - # MY->makeaperl directly - - # delete $symtab->{$method}; - - # If we delete a method, then it will be undefined and cannot - # be called. But as long as we have Makefile.PLs that rely on - # %MY:: being intact, we have to fill the hole with an - # inheriting method: + # If we delete a method, then it will be undefined and cannot + # be called. But as long as we have Makefile.PLs that rely on + # %MY:: being intact, we have to fill the hole with an + # inheriting method: - eval "package MY; sub $method { shift->SUPER::$method(\@_); }"; + eval "package MY; sub $method { shift->SUPER::$method(\@_); }"; } # We have to clean out %INC also, because the current directory is @@ -751,8 +674,8 @@ sub mv_all_methods { # my $inc; # foreach $inc (keys %INC) { -# #warn "***$inc*** deleted"; -# delete $INC{$inc}; +# #warn "***$inc*** deleted"; +# delete $INC{$inc}; # } } @@ -760,21 +683,21 @@ sub skipcheck { my($self) = shift; my($section) = @_; if ($section eq 'dynamic') { - print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets ", - "in skipped section 'dynamic_bs'\n" + print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets ", + "in skipped section 'dynamic_bs'\n" if $self->{SKIPHASH}{dynamic_bs} && $Verbose; print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets ", - "in skipped section 'dynamic_lib'\n" + "in skipped section 'dynamic_lib'\n" if $self->{SKIPHASH}{dynamic_lib} && $Verbose; } if ($section eq 'dynamic_lib') { print STDOUT "Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on ", - "targets in skipped section 'dynamic_bs'\n" + "targets in skipped section 'dynamic_bs'\n" if $self->{SKIPHASH}{dynamic_bs} && $Verbose; } if ($section eq 'static') { print STDOUT "Warning (non-fatal): Target 'static' depends on targets ", - "in skipped section 'static_lib'\n" + "in skipped section 'static_lib'\n" if $self->{SKIPHASH}{static_lib} && $Verbose; } return 'skipped' if $self->{SKIPHASH}{$section}; @@ -794,8 +717,8 @@ sub flush { open(FH,">MakeMaker.tmp") or die "Unable to open MakeMaker.tmp: $!"; for $chunk (@{$self->{RESULT}}) { -# print $fh "$chunk\n"; - print FH "$chunk\n"; +# print $fh "$chunk\n"; + print FH "$chunk\n"; } # $fh->close; @@ -805,9 +728,9 @@ sub flush { chmod 0644, $finalname unless $Is_VMS; if ($self->{PARENT}) { - foreach (keys %$self) { # safe memory - delete $self->{$_} unless $Keep_after_flush{$_}; - } + foreach (keys %$self) { # safe memory + delete $self->{$_} unless $Keep_after_flush{$_}; + } } system("$Config::Config{eunicefix} $finalname") unless $Config::Config{eunicefix} eq ":"; @@ -839,20 +762,20 @@ sub neatvalue { my($t) = ref $v; return "q[$v]" unless $t; if ($t eq 'ARRAY') { - my(@m, @neat); - push @m, "["; - foreach my $elem (@$v) { - push @neat, "q[$elem]"; - } - push @m, join ", ", @neat; - push @m, "]"; - return join "", @m; + my(@m, @neat); + push @m, "["; + foreach my $elem (@$v) { + push @neat, "q[$elem]"; + } + push @m, join ", ", @neat; + push @m, "]"; + return join "", @m; } return "$v" unless $t eq 'HASH'; my(@m, $key, $val); while (($key,$val) = each %$v){ - last unless defined $key; # cautious programming in case (undef,undef) is true - push(@m,"$key=>".neatvalue($val)) ; + last unless defined $key; # cautious programming in case (undef,undef) is true + push(@m,"$key=>".neatvalue($val)) ; } return "{ ".join(', ',@m)." }"; } @@ -861,19 +784,18 @@ sub selfdocument { my($self) = @_; my(@m); if ($Verbose){ - push @m, "\n# Full list of MakeMaker attribute values:"; - foreach my $key (sort keys %$self){ - next if $key eq 'RESULT' || $key =~ /^[A-Z][a-z]/; - my($v) = neatvalue($self->{$key}); - $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; - $v =~ tr/\n/ /s; - push @m, "# $key => $v"; - } + push @m, "\n# Full list of MakeMaker attribute values:"; + foreach my $key (sort keys %$self){ + next if $key eq 'RESULT' || $key =~ /^[A-Z][a-z]/; + my($v) = neatvalue($self->{$key}); + $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; + $v =~ tr/\n/ /s; + push @m, "# $key => $v"; + } } join "\n", @m; } -package ExtUtils::MakeMaker; 1; __END__ @@ -983,26 +905,23 @@ want to specify some other option, set C variable: =head2 make install make alone puts all relevant files into directories that are named by -the macros INST_LIB, INST_ARCHLIB, INST_SCRIPT, INST_HTMLLIBDIR, -INST_HTMLSCRIPTDIR, INST_MAN1DIR, and INST_MAN3DIR. All these default -to something below ./blib if you are I building below the perl -source directory. If you I building below the perl source, -INST_LIB and INST_ARCHLIB default to ../../lib, and INST_SCRIPT is not -defined. +the macros INST_LIB, INST_ARCHLIB, INST_SCRIPT, INST_MAN1DIR and +INST_MAN3DIR. All these default to something below ./blib if you are +I building below the perl source directory. If you I +building below the perl source, INST_LIB and INST_ARCHLIB default to +../../lib, and INST_SCRIPT is not defined. The I target of the generated Makefile copies the files found below each of the INST_* directories to their INSTALL* counterparts. Which counterparts are chosen depends on the setting of INSTALLDIRS according to the following table: - INSTALLDIRS set to - perl site + INSTALLDIRS set to + perl site - INST_ARCHLIB INSTALLARCHLIB INSTALLSITEARCH - INST_LIB INSTALLPRIVLIB INSTALLSITELIB - INST_HTMLLIBDIR INSTALLHTMLPRIVLIBDIR INSTALLHTMLSITELIBDIR - INST_HTMLSCRIPTDIR INSTALLHTMLSCRIPTDIR - INST_BIN INSTALLBIN + INST_ARCHLIB INSTALLARCHLIB INSTALLSITEARCH + INST_LIB INSTALLPRIVLIB INSTALLSITELIB + INST_BIN INSTALLBIN INST_SCRIPT INSTALLSCRIPT INST_MAN1DIR INSTALLMAN1DIR INST_MAN3DIR INSTALLMAN3DIR @@ -1026,24 +945,25 @@ PREFIX and LIB can be used to set several INSTALL* attributes in one go. The quickest way to install a module in a non-standard place might be - perl Makefile.PL LIB=~/lib + perl Makefile.PL PREFIX=~ -This will install the module's architecture-independent files into -~/lib, the architecture-dependent files into ~/lib/$archname. +This will install all files in the module under your home directory, +with man pages and libraries going into an appropriate place (usually +~/man and ~/lib). Another way to specify many INSTALL directories with a single -parameter is PREFIX. +parameter is LIB. - perl Makefile.PL PREFIX=~ + perl Makefile.PL LIB=~/lib -This will replace the string specified by C<$Config{prefix}> in all -C<$Config{install*}> values. +This will install the module's architecture-independent files into +~/lib, the architecture-dependent files into ~/lib/$archname. Note, that in both cases the tilde expansion is done by MakeMaker, not by perl by default, nor by make. -Conflicts between parameters LIB, -PREFIX and the various INSTALL* arguments are resolved so that: +Conflicts between parameters LIB, PREFIX and the various INSTALL* +arguments are resolved so that: =over 4 @@ -1060,10 +980,10 @@ set (but are set to still start with C<$Config{prefix}>). =back -If the user has superuser privileges, and is not working on AFS -or relatives, then the defaults for -INSTALLPRIVLIB, INSTALLARCHLIB, INSTALLSCRIPT, etc. will be appropriate, -and this incantation will be the best: +If the user has superuser privileges, and is not working on AFS or +relatives, then the defaults for INSTALLPRIVLIB, INSTALLARCHLIB, +INSTALLSCRIPT, etc. will be appropriate, and this incantation will be +the best: perl Makefile.PL; make; make test make install @@ -1079,7 +999,7 @@ probably have changed since perl itself has been installed. They will have to do this by calling perl Makefile.PL INSTALLSITELIB=/afs/here/today \ - INSTALLSCRIPT=/afs/there/now INSTALLMAN3DIR=/afs/for/manpages + INSTALLSCRIPT=/afs/there/now INSTALLMAN3DIR=/afs/for/manpages make Be careful to repeat this procedure every time you recompile an @@ -1229,7 +1149,7 @@ Used when creating PPD files for binary packages. It can be set to a full or relative path or URL to the binary archive for a particular architecture. For example: - perl Makefile.PL BINARY_LOCATION=x86/Agent.tar.gz + perl Makefile.PL BINARY_LOCATION=x86/Agent.tar.gz builds a PPD package that references a binary of the C package, located in the C directory relative to the PPD itself. @@ -1347,20 +1267,6 @@ names are passed through unaltered to the linker options file. Ref to array of *.h file names. Similar to C. -=item HTMLLIBPODS - -Hashref of .pm and .pod files. MakeMaker will default this to all - .pod and any .pm files that include POD directives. The files listed -here will be converted to HTML format and installed as was requested -at Configure time. - -=item HTMLSCRIPTPODS - -Hashref of pod-containing files. MakeMaker will default this to all -EXE_FILES files that include POD directives. The files listed -here will be converted to HTML format and installed as was requested -at Configure time. - =item IMPORTS This attribute is used to specify names to be imported into the @@ -1401,22 +1307,6 @@ choose: installprivlib and installarchlib versus installsitelib and installsitearch. The first pair is chosen with INSTALLDIRS=perl, the second with INSTALLDIRS=site. Default is site. -=item INSTALLHTMLPRIVLIBDIR - -This directory gets the HTML pages at 'make install' time. Defaults to -$Config{installhtmlprivlibdir}. - -=item INSTALLHTMLSCRIPTDIR - -This directory gets the HTML pages at 'make install' time. Defaults to -$Config{installhtmlscriptdir}. - -=item INSTALLHTMLSITELIBDIR - -This directory gets the HTML pages at 'make install' time. Defaults to -$Config{installhtmlsitelibdir}. - - =item INSTALLMAN1DIR This directory gets the man pages at 'make install' time. Defaults to @@ -1461,14 +1351,6 @@ to INSTALLBIN during 'make install' Old name for INST_SCRIPT. Deprecated. Please use INST_SCRIPT if you need to use it. -=item INST_HTMLLIBDIR - -Directory to hold the man pages in HTML format at 'make' time - -=item INST_HTMLSCRIPTDIR - -Directory to hold the man pages in HTML format at 'make' time - =item INST_LIB Directory where we put library files of this extension while building @@ -1498,11 +1380,10 @@ specify ld flags) =item LIB LIB should only be set at C time but is allowed as a -MakeMaker argument. It has the effect of -setting both INSTALLPRIVLIB and INSTALLSITELIB to that value regardless any -explicit setting of those arguments (or of PREFIX). -INSTALLARCHLIB and INSTALLSITEARCH are set to the corresponding -architecture subdirectory. +MakeMaker argument. It has the effect of setting both INSTALLPRIVLIB +and INSTALLSITELIB to that value regardless any explicit setting of +those arguments (or of PREFIX). INSTALLARCHLIB and INSTALLSITEARCH +are set to the corresponding architecture subdirectory. =item LIBPERL_A @@ -1676,13 +1557,13 @@ of memory allocations, etc. Use this instead of $(PERL) or $(FULLPERL) when you wish to run perl. It will set up extra necessary flags for you. - + =item PERLRUNINST - + Use this instead of $(PERL) or $(FULLPERL) when you wish to run perl to work with modules. It will add things like -I$(INST_ARCH) and other necessary flags. - + =item PERL_SRC Directory containing the Perl source code (use of this should be @@ -1779,12 +1660,14 @@ the installation of a package. =item PREFIX -Can be used to set the three INSTALL* attributes in one go (except for -probably INSTALLMAN1DIR, if it is not below PREFIX according to -%Config). They will have PREFIX as a common directory node and will -branch from that node into lib/, lib/ARCHNAME or whatever Configure -decided at the build time of your perl (unless you override one of -them, of course). +This overrides all the default install locations. Man pages, +libraries, scripts, etc... MakeMaker will try to make an educated +guess about where to place things under the new PREFIX based on your +Config defaults. Failing that, it will fall back to a structure +which should be sensible for your platform. + +If you specify LIB or any INSTALL* variables they will not be effected +by the PREFIX. =item PREREQ_PM @@ -1835,7 +1718,9 @@ if you really need it. The set of -I's necessary to run a "make test". Use as: $(PERL) $(TEST_LIBS) -e '...' for example. - + +The paths will be absolute. + =item TYPEMAPS Ref to array of typemap file names. Use this when the typemaps are @@ -1866,10 +1751,10 @@ MakeMaker object. The following lines will be parsed o.k.: $VERSION = '1.00'; *VERSION = \'1.01'; - ( $VERSION ) = '$Revision: 1.4 $ ' =~ /\$Revision:\s+([^\s]+)/; + ( $VERSION ) = '$Revision: 1.19 $ ' =~ /\$Revision:\s+([^\s]+)/; $FOO::VERSION = '1.10'; *FOO::VERSION = \'1.11'; - our $VERSION = 1.2.3; # new for perl5.6.0 + our $VERSION = 1.2.3; # new for perl5.6.0 but these will fail: @@ -1990,16 +1875,16 @@ Each subroutines returns the text it wishes to have written to the Makefile. To override a section of the Makefile you can either say: - sub MY::c_o { "new literal text" } + sub MY::c_o { "new literal text" } or you can edit the default by saying something like: - sub MY::c_o { - package MY; # so that "SUPER" works right - my $inherited = shift->SUPER::c_o(@_); - $inherited =~ s/old text/new text/; - $inherited; - } + sub MY::c_o { + package MY; # so that "SUPER" works right + my $inherited = shift->SUPER::c_o(@_); + $inherited =~ s/old text/new text/; + $inherited; + } If you are running experiments with embedding perl as a library into other applications, you might find MakeMaker is not sufficient. You'd @@ -2016,9 +1901,9 @@ Here is a simple example of how to add a new target to the generated Makefile: sub MY::postamble { - ' + ' $(MYEXTLIB): sdbm/Makefile - cd sdbm && $(MAKE) all + cd sdbm && $(MAKE) all '; } @@ -2078,7 +1963,7 @@ 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. -=item make disttest +=item make disttest Makes a distdir first, and runs a C, a make, and a make test in that directory. @@ -2178,8 +2063,8 @@ always return the default without waiting for user input. =head1 SEE ALSO -ExtUtils::MM_Unix, ExtUtils::Manifest, ExtUtils::testlib, -ExtUtils::Install, ExtUtils::Embed +ExtUtils::MM_Unix, ExtUtils::Manifest ExtUtils::Install, +ExtUtils::Embed =head1 AUTHORS @@ -2188,9 +2073,10 @@ Andy Dougherty >, Andreas KEnig support by Charles Bailey >. OS/2 support by Ilya Zakharevich >. -Contact the MakeMaker mailing list > if you have -any questions. +Currently maintained by Michael G Schwern > + +Send patches and ideas to >. -Send patches and bug reports to >. +Send bug reports via http://rt.cpan.org/. =cut diff --git a/lib/ExtUtils/Manifest.pm b/lib/ExtUtils/Manifest.pm index 4d9a5de..f276a1f 100644 --- a/lib/ExtUtils/Manifest.pm +++ b/lib/ExtUtils/Manifest.pm @@ -10,16 +10,16 @@ use strict; our ($VERSION,@ISA,@EXPORT_OK, $Is_MacOS,$Is_VMS, - $Debug,$Verbose,$Quiet,$MANIFEST,$found,$DEFAULT_MSKIP); + $Debug,$Verbose,$Quiet,$MANIFEST,$DEFAULT_MSKIP); -$VERSION = 1.35_00; +$VERSION = 1.37_01; @ISA=('Exporter'); @EXPORT_OK = ('mkmanifest', 'manicheck', 'fullcheck', 'filecheck', 'skipcheck', 'maniread', 'manicopy'); $Is_MacOS = $^O eq 'MacOS'; $Is_VMS = $^O eq 'VMS'; -if ($Is_VMS) { require File::Basename } +require VMS::Filespec if $Is_VMS; $Debug = $ENV{PERL_MM_MANIFEST_DEBUG} || 0; $Verbose = 1; @@ -40,14 +40,19 @@ sub mkmanifest { local *M; rename $MANIFEST, "$MANIFEST.bak" unless $manimiss; open M, ">$MANIFEST" or die "Could not open $MANIFEST: $!"; - my $matches = _maniskip(); + my $skip = _maniskip(); my $found = manifind(); my($key,$val,$file,%all); %all = (%$found, %$read); $all{$MANIFEST} = ($Is_VMS ? "$MANIFEST\t\t" : '') . 'This list of files' if $manimiss; # add new MANIFEST to known file list foreach $file (sort keys %all) { - next if &$matches($file); + if ($skip->($file)) { + # Policy: only remove files if they're listed in MANIFEST.SKIP. + # Don't remove files just because they don't exist. + warn "Removed from $MANIFEST: $file\n" if $Verbose and exists $read->{$file}; + next; + } if ($Verbose){ warn "Added to $MANIFEST: $file\n" unless exists $read->{$file}; } @@ -62,16 +67,44 @@ sub mkmanifest { close M; } +# Geez, shouldn't this use File::Spec or File::Basename or something? +# Why so careful about dependencies? +sub clean_up_filename { + my $filename = shift; + $filename =~ s|^\./||; + $filename =~ s/^:([^:]+)$/$1/ if $Is_MacOS; + return $filename; +} + sub manifind { - local $found = {}; - find(sub {return if -d $_; - (my $name = $File::Find::name) =~ s|^\./||; - $name =~ s/^:([^:]+)$/$1/ if $Is_MacOS; - warn "Debug: diskfile $name\n" if $Debug; - $name =~ s#(.*)\.$#\L$1# if $Is_VMS; - $name = uc($name) if /^MANIFEST/i && $Is_VMS; - $found->{$name} = "";}, $Is_MacOS ? ":" : "."); - $found; + my $p = shift || {}; + my $skip = _maniskip(warn => $p->{warn_on_skip}); + my $found = {}; + + my $wanted = sub { + my $name = clean_up_filename($File::Find::name); + warn "Debug: diskfile $name\n" if $Debug; + return if $skip->($name) or -d $name; + + if( $Is_VMS ) { + $name =~ s#(.*)\.$#\L$1#; + $name = uc($name) if $name =~ /^MANIFEST(\.SKIP)?$/i; + } + $found->{$name} = ""; + }; + + # We have to use "$File::Find::dir/$_" in preprocess, because + # $File::Find::name is unavailable. + # Also, it's okay to use / here, because MANIFEST files use Unix-style + # paths. + find({wanted => $wanted, + preprocess => + sub {grep {!$skip->( clean_up_filename("$File::Find::dir/$_") )} @_}, + no_chdir => 1, + }, + $Is_MacOS ? ":" : "."); + + return $found; } sub fullcheck { @@ -93,7 +126,8 @@ sub skipcheck { sub _manicheck { my($p) = @_; my $read = maniread(); - my $found = manifind(); + my $found = manifind($p); + my $file; my $dosnames=(defined(&Dos::UseLFN) && Dos::UseLFN()==0); my(@missfile,@missentry); @@ -151,6 +185,7 @@ sub maniread { $file =~ s/\\([0-3][0-7][0-7])/sprintf("%c", oct($1))/ge; } elsif ($Is_VMS) { + require File::Basename; my($base,$dir) = File::Basename::fileparse($file); # Resolve illegal file specifications in the same way as tar $dir =~ tr/./_/; @@ -159,7 +194,7 @@ sub maniread { my $okfile = "$dir$base"; warn "Debug: Illegal name $file changed to $okfile\n" if $Debug; $file = $okfile; - $file = lc($file) unless $file =~ /^MANIFEST/i; + $file = lc($file) unless $file =~ /^MANIFEST(\.SKIP)?$/; } $read->{$file} = $comment; @@ -170,12 +205,12 @@ sub maniread { # returns an anonymous sub that decides if an argument matches sub _maniskip { - my ($mfile) = @_; - my $matches = sub {0}; + my (%args) = @_; + my @skip ; - $mfile ||= "$MANIFEST.SKIP"; + my $mfile ||= "$MANIFEST.SKIP"; local *M; - open M, $mfile or open M, $DEFAULT_MSKIP or return $matches; + open M, $mfile or open M, $DEFAULT_MSKIP or return sub {0}; while (){ chomp; next if /^#/; @@ -183,14 +218,16 @@ sub _maniskip { push @skip, _macify($_); } close M; - my $opts = $Is_VMS ? 'oi ' : 'o '; - my $sub = "\$matches = " - . "sub { my(\$arg)=\@_; return 1 if " - . join (" || ", (map {s!/!\\/!g; "\$arg =~ m/$_/$opts"} @skip), 0) - . " }"; - eval $sub; - print "Debug: $sub\n" if $Debug; - $matches; + my $opts = $Is_VMS ? '(?i)' : ''; + + # Make sure each entry is isolated in its own parentheses, in case + # any of them contain alternations + my $regex = join '|', map "(?:$_)", @skip; + + return ($args{warn} + ? sub { $_[0] =~ qr{$opts$regex} && warn "Skipping $_[0]\n" } + : sub { $_[0] =~ qr{$opts$regex} } + ); } sub manicopy { diff --git a/lib/ExtUtils/Mksymlists.pm b/lib/ExtUtils/Mksymlists.pm index 4159b94..2455072 100644 --- a/lib/ExtUtils/Mksymlists.pm +++ b/lib/ExtUtils/Mksymlists.pm @@ -1,6 +1,6 @@ package ExtUtils::Mksymlists; -use 5.006_001; +use 5.006; use strict qw[ subs refs ]; # no strict 'vars'; # until filehandles are exempted @@ -82,11 +82,9 @@ sub _write_os2 { } my $distname = $data->{DISTNAME} || $data->{NAME}; $distname = "Distribution $distname"; - my $patchlevel = $Config{perl_patchlevel} || ''; - $patchlevel = " pl$patchlevel" if $patchlevel; - my $comment = <{NAME} -EOC + my $patchlevel = " pl$Config{perl_patchlevel}" || ''; + my $comment = sprintf "Perl (v%s%s%s) module %s", + $Config::Config{version}, $threaded, $patchlevel, $data->{NAME}; chomp $comment; if ($data->{INSTALLDIRS} and $data->{INSTALLDIRS} eq 'perl') { $distname = 'perl5-porters@perl.org'; diff --git a/lib/ExtUtils/Packlist.pm b/lib/ExtUtils/Packlist.pm index ea4ec5e..ace8c49 100644 --- a/lib/ExtUtils/Packlist.pm +++ b/lib/ExtUtils/Packlist.pm @@ -1,6 +1,6 @@ package ExtUtils::Packlist; -use 5.006_001; +use 5.006; use strict; use Carp qw(); our $VERSION = '0.04'; diff --git a/lib/ExtUtils/t/Big-Fat-Dummy/Makefile.PL b/lib/ExtUtils/t/Big-Fat-Dummy/Makefile.PL new file mode 100644 index 0000000..27ba6b5 --- /dev/null +++ b/lib/ExtUtils/t/Big-Fat-Dummy/Makefile.PL @@ -0,0 +1,9 @@ +use ExtUtils::MakeMaker; + +printf "Current package is: %s\n", __PACKAGE__; + +WriteMakefile( + NAME => 'Big::Fat::Dummy', + VERSION_FROM => 'lib/Big/Fat/Dummy.pm', + PREREQ_PM => {}, +); diff --git a/lib/ExtUtils/t/Big-Fat-Dummy/lib/Big/Fat/Dummy.pm b/lib/ExtUtils/t/Big-Fat-Dummy/lib/Big/Fat/Dummy.pm new file mode 100644 index 0000000..925d553 --- /dev/null +++ b/lib/ExtUtils/t/Big-Fat-Dummy/lib/Big/Fat/Dummy.pm @@ -0,0 +1,5 @@ +package Big::Fat::Dummy; + +$VERSION = 0.01; + +1; diff --git a/lib/ExtUtils/t/Big-Fat-Dummy/t/compile.t b/lib/ExtUtils/t/Big-Fat-Dummy/t/compile.t new file mode 100644 index 0000000..0f3b90d --- /dev/null +++ b/lib/ExtUtils/t/Big-Fat-Dummy/t/compile.t @@ -0,0 +1,8 @@ +BEGIN { + @INC = '../lib/ExtUtils/t/Big-Fat-Dummy/lib' +} + +print "1..2\n"; + +print eval "use Big::Fat::Dummy; 1;" ? "ok 1\n" : "not ok 1\n"; +print "ok 2 - TEST_VERBOSE\n"; diff --git a/lib/ExtUtils/t/Command.t b/lib/ExtUtils/t/Command.t index c4f9fd2..01d0186 100644 --- a/lib/ExtUtils/t/Command.t +++ b/lib/ExtUtils/t/Command.t @@ -100,40 +100,40 @@ BEGIN { ok( abs($now - $stamp) <= 1, 'checking modify time stamp' ) || print "# mtime == $stamp, should be $now\n"; -SKIP: { - if ($^O eq 'amigaos' || $^O eq 'os2' || $^O eq 'MSWin32' || - $^O eq 'NetWare' || $^O eq 'dos' || $^O eq 'cygwin') { - skip( "different file permission semantics on $^O", 3); - } + SKIP: { + if ($^O eq 'amigaos' || $^O eq 'os2' || $^O eq 'MSWin32' || + $^O eq 'NetWare' || $^O eq 'dos' || $^O eq 'cygwin') { + skip( "different file permission semantics on $^O", 3); + } - # change a file to execute-only - @ARGV = ( 0100, 'ecmdfile' ); - ExtUtils::Command::chmod(); + # change a file to execute-only + @ARGV = ( 0100, 'ecmdfile' ); + ExtUtils::Command::chmod(); - is( ((stat('ecmdfile'))[2] & 07777) & 0700, - 0100, 'change a file to execute-only' ); + is( ((stat('ecmdfile'))[2] & 07777) & 0700, + 0100, 'change a file to execute-only' ); - # change a file to read-only - @ARGV = ( 0400, 'ecmdfile' ); - ExtUtils::Command::chmod(); + # change a file to read-only + @ARGV = ( 0400, 'ecmdfile' ); + ExtUtils::Command::chmod(); - is( ((stat('ecmdfile'))[2] & 07777) & 0700, - ($^O eq 'vos' ? 0500 : 0400), 'change a file to read-only' ); + is( ((stat('ecmdfile'))[2] & 07777) & 0700, + ($^O eq 'vos' ? 0500 : 0400), 'change a file to read-only' ); - # change a file to write-only - @ARGV = ( 0200, 'ecmdfile' ); - ExtUtils::Command::chmod(); + # change a file to write-only + @ARGV = ( 0200, 'ecmdfile' ); + ExtUtils::Command::chmod(); - is( ((stat('ecmdfile'))[2] & 07777) & 0700, - ($^O eq 'vos' ? 0700 : 0200), 'change a file to write-only' ); - } + is( ((stat('ecmdfile'))[2] & 07777) & 0700, + ($^O eq 'vos' ? 0700 : 0200), 'change a file to write-only' ); + } - # change a file to read-write + # change a file to read-write @ARGV = ( 0600, 'ecmdfile' ); ExtUtils::Command::chmod(); - is( ((stat('ecmdfile'))[2] & 07777) & 0700, - ($^O eq 'vos' ? 0700 : 0600), 'change a file to read-write' ); + is( ((stat('ecmdfile'))[2] & 07777) & 0700, + ($^O eq 'vos' ? 0700 : 0600), 'change a file to read-write' ); # mkpath @ARGV = ( File::Spec->join( 'ecmddir', 'temp2' ) ); diff --git a/lib/ExtUtils/t/Installed.t b/lib/ExtUtils/t/Installed.t index 1a7eaa1..cb6d3bb 100644 --- a/lib/ExtUtils/t/Installed.t +++ b/lib/ExtUtils/t/Installed.t @@ -5,6 +5,9 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; } + else { + unshift @INC, 't/lib/'; + } } chdir 't'; @@ -12,17 +15,13 @@ chdir 't'; use strict; use warnings; -# for _is_type() tests use Config; - -# for new() tests use Cwd; use File::Path; - -# for directories() tests use File::Basename; +use File::Spec; -use Test::More tests => 43; +use Test::More tests => 42; BEGIN { use_ok( 'ExtUtils::Installed' ) } @@ -32,13 +31,13 @@ my $mandirs = !!$Config{man1direxp} + !!$Config{man3direxp}; my $ei = bless( {}, 'ExtUtils::Installed' ); # _is_prefix -is( $ei->_is_prefix('foo/bar', 'foo'), 1, +ok( $ei->_is_prefix('foo/bar', 'foo'), '_is_prefix() should match valid path prefix' ); -is( $ei->_is_prefix('\foo\bar', '\bar'), 0, +ok( !$ei->_is_prefix('\foo\bar', '\bar'), '... should not match wrong prefix' ); # _is_type -is( $ei->_is_type(0, 'all'), 1, '_is_type() should be true for type of "all"' ); +ok( $ei->_is_type(0, 'all'), '_is_type() should be true for type of "all"' ); foreach my $path (qw( man1dir man3dir )) { SKIP: { @@ -46,13 +45,23 @@ SKIP: { skip("no man directory $path on this system", 2 ) unless $dir; my $file = $dir . '/foo'; - is( $ei->_is_type($file, 'doc'), 1, "... should find doc file in $path" ); - is( $ei->_is_type($file, 'prog'), 0, "... but not prog file in $path" ); + ok( $ei->_is_type($file, 'doc'), "... should find doc file in $path" ); + ok( !$ei->_is_type($file, 'prog'), "... but not prog file in $path" ); } } -is( $ei->_is_type($Config{prefixexp} . '/bar', 'prog'), 1, - "... should find prog file under $Config{prefixexp}" ); +# VMS 5.6.1 doesn't seem to have $Config{prefixexp} +my $prefix = $Config{prefix} || $Config{prefixexp}; + +# You can concatenate /foo but not foo:, which defaults in the current +# directory +$prefix = VMS::Filespec::unixify($prefix) if $^O eq 'VMS'; + +# ActivePerl 5.6.1/631 has $Config{prefixexp} as 'p:' for some reason +$prefix = $Config{prefix} if $prefix eq 'p:' && $^O eq 'MSWin32'; + +ok( $ei->_is_type( File::Spec->catfile($prefix, 'bar'), 'prog'), + "... should find prog file under $prefix" ); SKIP: { skip('no man directories on this system', 1) unless $mandirs; @@ -60,27 +69,19 @@ SKIP: { '... should not find doc file outside path' ); } -is( $ei->_is_type('bar', 'prog'), 0, +ok( !$ei->_is_type('bar', 'prog'), '... nor prog file outside path' ); -is( $ei->_is_type('whocares', 'someother'), 0, '... nor other type anywhere' ); +ok( !$ei->_is_type('whocares', 'someother'), '... nor other type anywhere' ); # _is_under ok( $ei->_is_under('foo'), '_is_under() should return true with no dirs' ); my @under = qw( boo bar baz ); -is( $ei->_is_under('foo', @under), 0, '... should find no file not under dirs'); -is( $ei->_is_under('baz', @under), 1, '... should find file under dir' ); +ok( !$ei->_is_under('foo', @under), '... should find no file not under dirs'); +ok( $ei->_is_under('baz', @under), '... should find file under dir' ); # new -my $realei; -{ - # We're going to get warnings about not being able to find install - # directories if we're not installed. - local $SIG{__WARN__} = sub { - warn @_ unless $ENV{PERL_CORE} && $_[0] =~ /^Can't stat/; - }; - $realei = ExtUtils::Installed->new(); -} +my $realei = ExtUtils::Installed->new(); isa_ok( $realei, 'ExtUtils::Installed' ); isa_ok( $realei->{Perl}{packlist}, 'ExtUtils::Packlist' ); @@ -108,12 +109,8 @@ FAKE SKIP: { - TODO: { skip("could not write packlist: $!", 3 ) unless $wrotelist; - local $TODO = "new() attempts to derive package name from filename" - if $^O eq 'VMS'; - # avoid warning and death by localizing glob local *ExtUtils::Installed::Config; my $fake_mod_dir = File::Spec->catdir(cwd(), 'auto', 'FakeMod'); @@ -130,7 +127,6 @@ SKIP: { isa_ok( $realei->{FakeMod}{packlist}, 'ExtUtils::Packlist' ); is( $realei->{FakeMod}{version}, '1.1.1', '... should find version in modules' ); - } } # modules @@ -147,7 +143,7 @@ $ei->{goodmod} = { ($Config{man3direxp} ? (File::Spec->catdir($Config{man3direxp}, 'bar') => 1) : ()), - File::Spec->catdir($Config{prefixexp}, 'foobar') => 1, + File::Spec->catdir($prefix, 'foobar') => 1, foobaz => 1, }, }; @@ -159,7 +155,8 @@ like( $@, qr/type must be/,'files() should croak given bad type' ); my @files; SKIP: { - skip('no man directory man1dir on this system', 2) unless $Config{man1direxp}; + skip('no man directory man1dir on this system', 2) + unless $Config{man1direxp}; @files = $ei->files('goodmod', 'doc', $Config{man1direxp}); is( scalar @files, 1, '... should find doc file under given dir' ); is( grep({ /foo$/ } @files), 1, '... checking file name' ); @@ -233,9 +230,6 @@ is( ${ $ei->packlist('yesmod') }, 102, is( $ei->version('yesmod'), 101, 'version() should report installed mod version' ); -# needs a DESTROY, for some reason -can_ok( $ei, 'DESTROY' ); - END { if ($wrotelist) { for my $file (qw( .packlist FakePak.pm )) { diff --git a/lib/ExtUtils/t/MM_BeOS.t b/lib/ExtUtils/t/MM_BeOS.t index 6fea269..870e8d4 100644 --- a/lib/ExtUtils/t/MM_BeOS.t +++ b/lib/ExtUtils/t/MM_BeOS.t @@ -5,6 +5,9 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; } + else { + unshift @INC, 't/lib'; + } } chdir 't'; diff --git a/lib/ExtUtils/t/MM_Cygwin.t b/lib/ExtUtils/t/MM_Cygwin.t index df29ae2..3c995b7 100644 --- a/lib/ExtUtils/t/MM_Cygwin.t +++ b/lib/ExtUtils/t/MM_Cygwin.t @@ -5,6 +5,9 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; } + else { + unshift @INC, 't/lib'; + } } chdir 't'; @@ -12,7 +15,7 @@ use Test::More; BEGIN { if ($^O =~ /cygwin/i) { - plan tests => 17; + plan tests => 15; } else { plan skip_all => "This is not cygwin"; } @@ -20,9 +23,7 @@ BEGIN { use Config; use File::Spec; - -# MM package faked up by messy MI entanglement -@MM::ISA = qw( ExtUtils::MM_Unix ExtUtils::Liblist::Kid ExtUtils::MakeMaker ); +require ExtUtils::MM; use_ok( 'ExtUtils::MM_Cygwin' ); @@ -44,7 +45,10 @@ is( $args->cflags(), 'fakeflags', delete $args->{CFLAGS}; # ExtUtils::MM_Cygwin::cflags() calls this, fake the output -*ExtUtils::MM_Unix::cflags = sub { return $_[1] }; +{ + no warnings 'redefine'; + sub ExtUtils::MM_Unix::cflags { return $_[1] }; +} # respects the config setting, should ignore whitespace around equal sign my $ccflags = $Config{useshrplib} eq 'true' ? ' -DUSEIMPORTLIB' : ''; @@ -66,6 +70,7 @@ $args = bless({ NOECHO => 'noecho', MAN3PODS => {}, MAN1PODS => {}, + MAKEFILE => 'Makefile', }, 'MM'); like( $args->manifypods(), qr/pure_all\n\tnoecho/, 'manifypods() should return without PODS values set' ); @@ -73,31 +78,33 @@ like( $args->manifypods(), qr/pure_all\n\tnoecho/, $args->{MAN3PODS} = { foo => 1 }; my $out = tie *STDOUT, 'FakeOut'; { - local *MM::perl_script = sub { return }; - my $res = $args->manifypods(); - like( $$out, qr/could not locate your pod2man/, - '... should warn if pod2man cannot be located' ); - like( $res, qr/POD2MAN_EXE = -S pod2man/, - '... should use default pod2man target' ); - like( $res, qr/pure_all.+foo/, '... should add MAN3PODS targets' ); + no warnings 'once'; + local *MM::perl_script = sub { return }; + my $res = $args->manifypods(); + like( $$out, qr/could not locate your pod2man/, + '... should warn if pod2man cannot be located' ); + like( $res, qr/POD2MAN_EXE = -S pod2man/, + '... should use default pod2man target' ); + like( $res, qr/pure_all.+foo/, '... should add MAN3PODS targets' ); +} + +SKIP: { + skip "Only relevent in the core", 2 unless $ENV{PERL_CORE}; + $args->{PERL_SRC} = File::Spec->updir; + $args->{MAN1PODS} = { bar => 1 }; + $$out = ''; + $res = $args->manifypods(); + is( $$out, '', '... should not warn if PERL_SRC provided' ); + like( $res, qr/bar \\\n\t1 \\\n\tfoo/, + '... should join MAN1PODS and MAN3PODS'); } -$args->{PERL_SRC} = File::Spec->updir; -$args->{MAN1PODS} = { bar => 1 }; -$$out = ''; -$res = $args->manifypods(); -is( $$out, '', '... should not warn if PERL_SRC provided' ); -like( $res, qr/bar \\\n\t1 \\\n\tfoo/, '... should join MAN1PODS and MAN3PODS'); # test perl_archive my $libperl = $Config{libperl} || 'libperl.a'; -$libperl =~ s/.a/.dll.a/; +$libperl =~ s/\.a/.dll.a/; is( $args->perl_archive(), "\$(PERL_INC)/$libperl", 'perl_archive() should respect libperl setting' ); -# test import of $Verbose and &neatvalue -can_ok( 'ExtUtils::MM_Cygwin', 'neatvalue' ); -is( $ExtUtils::MM_Cygwin::Verbose, $ExtUtils::MakeMaker::Verbose, - 'ExtUtils::MM_Cygwin should import $Verbose from ExtUtils::MakeMaker' ); package FakeOut; diff --git a/lib/ExtUtils/t/MM_OS2.t b/lib/ExtUtils/t/MM_OS2.t index ad7d4b5..53b83f3 100644 --- a/lib/ExtUtils/t/MM_OS2.t +++ b/lib/ExtUtils/t/MM_OS2.t @@ -1,15 +1,17 @@ #!/usr/bin/perl -w -use strict; - BEGIN { if( $ENV{PERL_CORE} ) { chdir 't' if -d 't'; @INC = '../lib'; } + else { + unshift @INC, 't/lib'; + } } chdir 't'; +use strict; use Test::More; if ($^O =~ /os2/i) { plan( tests => 32 ); diff --git a/lib/ExtUtils/t/MM_Unix.t b/lib/ExtUtils/t/MM_Unix.t index 29b5b0a..994eca3 100644 --- a/lib/ExtUtils/t/MM_Unix.t +++ b/lib/ExtUtils/t/MM_Unix.t @@ -5,6 +5,9 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; } + else { + unshift @INC, 't/lib'; + } } chdir 't'; @@ -15,7 +18,7 @@ BEGIN { plan skip_all => 'Non-Unix platform'; } else { - plan tests => 108; + plan tests => 107; } } @@ -88,7 +91,6 @@ foreach ( qw / fixin force guess_name - htmlifypods init_dirscan init_main init_others @@ -129,7 +131,7 @@ foreach ( qw / xsubpp_version / ) { - ok ($class->can ($_), "can $_"); + can_ok($class, $_); } ############################################################################### diff --git a/lib/ExtUtils/t/MM_VMS.t b/lib/ExtUtils/t/MM_VMS.t index 7768e8d..303a599 100644 --- a/lib/ExtUtils/t/MM_VMS.t +++ b/lib/ExtUtils/t/MM_VMS.t @@ -5,79 +5,75 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; } + else { + unshift @INC, 't/lib'; + } } chdir 't'; BEGIN { + @Methods = (qw(wraplist + rootdir + ext + guess_name + find_perl + path + maybe_command + maybe_command_in_dirs + perl_script + file_name_is_absolute + replace_manpage_separator + init_others + constants + cflags + const_cccmd + pm_to_blib + tool_autosplit + tool_xsubpp + xsubpp_version + tools_other + dist + c_o + xs_c + xs_o + top_targets + dlsyms + dynamic_lib + dynamic_bs + static_lib + manifypods + processPL + installbin + subdir_x + clean + realclean + dist_basics + dist_core + dist_dir + dist_test + install + perldepend + makefile + test + test_via_harness + test_via_script + makeaperl + nicetext + )); +} + +BEGIN { use Test::More; if ($^O eq 'VMS') { - plan( tests => 13 ); # 49 or more some day... + plan( tests => @Methods + 1 ); } - # MM_VMS does a C but that module - # is unlikely to be installed on non VMS machines - # (although not impossible: no xs, no sys$parse(), pure perl). else { plan( skip_all => "This is not VMS" ); } } -BEGIN { - use_ok( 'ExtUtils::MM_VMS' ); -} - -# Those methods that can be ascertained to be defined(), albeit with -# no passed arguments, are so "tested". Unfortunately, we omit -# testing of methods that need non-trivial arguments. -# Thus leaving test coverage at far less than 100% (patches welcome). -# The lines '#' commented out below are tests that failed with -# the empty arguments. - -ok(defined(ExtUtils::MM_VMS::wraplist()),'wraplist defined'); -ok(defined(ExtUtils::MM_VMS::rootdir()),'rootdir defined'); -ok(!defined(ExtUtils::MM_VMS::ext()),'ext() not defined'); -ok(defined(ExtUtils::MM_VMS::guess_name()),'guess_name defined'); -#ok(!defined(ExtUtils::MM_VMS::find_perl()),' defined'); -ok(defined(ExtUtils::MM_VMS::path()),'path defined'); -#ok(defined(ExtUtils::MM_VMS::maybe_command()),' defined'); -#ok(defined(ExtUtils::MM_VMS::maybe_command_in_dirs()),' defined'); -#ok(defined(ExtUtils::MM_VMS::perl_script()),'perl_script defined'); -#ok(defined(ExtUtils::MM_VMS::file_name_is_absolute()),'file_name_is_absolute defined'); -#ok(defined(ExtUtils::MM_VMS::replace_manpage_separator()),'replace_manpage_separator defined'); -#ok(defined(ExtUtils::MM_VMS::init_others()),'init_others defined'); -#ok(defined(ExtUtils::MM_VMS::constants()),'constants defined'); -#ok(defined(ExtUtils::MM_VMS::cflags()),'cflags defined'); -#ok(defined(ExtUtils::MM_VMS::const_cccmd()),'const_cccmd defined'); -#ok(defined(ExtUtils::MM_VMS::pm_to_blib()),'pm_to_blib defined'); -ok(defined(ExtUtils::MM_VMS::tool_autosplit()),'tool_autosplit defined'); -#ok(defined(ExtUtils::MM_VMS::tool_xsubpp()),'tool_xsubpp defined'); -#ok(defined(ExtUtils::MM_VMS::xsubpp_version()),'xsubpp_version defined'); -#ok(defined(ExtUtils::MM_VMS::tools_other()),'tools_other defined'); -#ok(defined(ExtUtils::MM_VMS::dist()),'dist defined'); -#ok(defined(ExtUtils::MM_VMS::c_o()),'c_o defined'); -#ok(defined(ExtUtils::MM_VMS::xs_c()),'xs_c defined'); -#ok(defined(ExtUtils::MM_VMS::xs_o()),'xs_o defined'); -#ok(defined(ExtUtils::MM_VMS::top_targets()),'top_targets defined'); -#ok(defined(ExtUtils::MM_VMS::dlsyms()),'dlsyms defined'); -#ok(defined(ExtUtils::MM_VMS::dynamic_lib()),'dynamic_lib defined'); -#ok(defined(ExtUtils::MM_VMS::dynamic_bs()),'dynamic_bs defined'); -#ok(defined(ExtUtils::MM_VMS::static_lib()),'static_lib defined'); -#ok(defined(ExtUtils::MM_VMS::manifypods({})),'manifypods defined'); -#ok(defined(ExtUtils::MM_VMS::processPL()),'processPL defined'); -ok(defined(ExtUtils::MM_VMS::installbin()),'installbin defined'); -#ok(defined(ExtUtils::MM_VMS::subdir_x()),'subdir_x defined'); -#ok(defined(ExtUtils::MM_VMS::clean()),'clean defined'); -#ok(defined(ExtUtils::MM_VMS::realclean()),'realclean defined'); -ok(defined(ExtUtils::MM_VMS::dist_basics()),'dist_basics defined'); -ok(defined(ExtUtils::MM_VMS::dist_core()),'dist_core defined'); -ok(defined(ExtUtils::MM_VMS::dist_dir()),'dist_dir defined'); -ok(defined(ExtUtils::MM_VMS::dist_test()),'dist_test defined'); -#ok(defined(ExtUtils::MM_VMS::install()),'install defined'); -#ok(defined(ExtUtils::MM_VMS::perldepend()),'perldepend defined'); -ok(defined(ExtUtils::MM_VMS::makefile()),'makefile defined'); -#ok(defined(ExtUtils::MM_VMS::test()),'test defined'); -#ok(defined(ExtUtils::MM_VMS::test_via_harness()),'test_via_harness defined'); -#ok(defined(ExtUtils::MM_VMS::test_via_script()),'test_via_script defined'); -#ok(defined(ExtUtils::MM_VMS::makeaperl()),'makeaperl defined'); -#ok(!defined(ExtUtils::MM_VMS::nicetext()),'nicetext() not defined'); - +use_ok( 'ExtUtils::MM_VMS' ); +foreach my $meth (@Methods) { + can_ok( 'ExtUtils::MM_VMS', $meth); +} diff --git a/lib/ExtUtils/t/MM_Win32.t b/lib/ExtUtils/t/MM_Win32.t index 899fd18..01fb849 100644 --- a/lib/ExtUtils/t/MM_Win32.t +++ b/lib/ExtUtils/t/MM_Win32.t @@ -1,19 +1,22 @@ #!/usr/bin/perl -use strict; BEGIN { if( $ENV{PERL_CORE} ) { chdir 't' if -d 't'; @INC = '../lib'; } + else { + unshift @INC, 't/lib'; + } } chdir 't'; +use strict; use Test::More; BEGIN { if ($^O =~ /MSWin32/i) { - plan tests => 44; + plan tests => 40; } else { plan skip_all => 'This is not Win32'; } @@ -22,25 +25,26 @@ BEGIN { use Config; use File::Spec; use File::Basename; -use ExtUtils::MakeMaker; +use ExtUtils::MM; require_ok( 'ExtUtils::MM_Win32' ); -# test import of $Verbose and &neatvalue -can_ok( 'MM', 'neatvalue' ); -() = $ExtUtils::MM_Win32::Verbose; -() = $ExtUtils::MakeMaker::Verbose; -is( $ExtUtils::MM_Win32::Verbose, $ExtUtils::MakeMaker::Verbose, - 'ExtUtils::MM_Win32 should import $Verbose from ExtUtils::MakeMaker' ); - +# Dummy MM object until we have a real MM init method. +my $MM = bless { + DIR => [], + NOECHO => '@', + XS => '', + MAKEFILE => 'Makefile', + RM_RF => 'rm -rf', + MV => 'mv', + }, 'MM'; -##### Start new tests at the top of MM_Win32 # replace_manpage_separator() => tr|/|.|s ? { my $man = 'a/path/to//something'; ( my $replaced = $man ) =~ tr|/|.|s; - is( MM->replace_manpage_separator( $man ), + is( $MM->replace_manpage_separator( $man ), $replaced, 'replace_manpage_separator()' ); } @@ -49,24 +53,28 @@ SKIP: { skip( '$ENV{COMSPEC} not set', 2 ) unless $ENV{COMSPEC} =~ m!((?:[a-z]:)?[^|<>]+)!i; my $comspec = $1; - is( MM->maybe_command( $comspec ), + is( $MM->maybe_command( $comspec ), $comspec, 'COMSPEC is a maybe_command()' ); ( my $comspec2 = $comspec ) =~ s|\..{3}$||; - like( MM->maybe_command( $comspec2 ), + like( $MM->maybe_command( $comspec2 ), qr/\Q$comspec/i, 'maybe_command() without extension' ); } + +my $had_pathext = exists $ENV{PATHEXT}; { local $ENV{PATHEXT} = '.exe'; - ok( ! MM->maybe_command( 'not_a_command.com' ), + ok( ! $MM->maybe_command( 'not_a_command.com' ), 'not a maybe_command()' ); } +# Bug in Perl. local $ENV{FOO} won't delete the key afterward. +delete $ENV{PATHEXT} unless $had_pathext; # file_name_is_absolute() [Does not support UNC-paths] { - ok( MM->file_name_is_absolute( 'C:/' ), + ok( $MM->file_name_is_absolute( 'C:/' ), 'file_name_is_absolute()' ); - ok( ! MM->file_name_is_absolute( 'some/path/' ), + ok( ! $MM->file_name_is_absolute( 'some/path/' ), 'not file_name_is_absolute()' ); } @@ -76,7 +84,7 @@ SKIP: { { my $my_perl = $1 if $^X =~ /(.*)/; # are we in -T or -t? my( $perl, $path ) = fileparse( $my_perl ); - like( MM->find_perl( $], [ $perl ], [ $path ] ), + like( $MM->find_perl( $], [ $perl ], [ $path ] ), qr/^\Q$my_perl\E$/i, 'find_perl() finds this perl' ); } @@ -84,19 +92,19 @@ SKIP: { { my @path_eg = qw( c: trick dir/now_OK ); - is( MM->catdir( @path_eg ), + is( $MM->catdir( @path_eg ), 'C:\\trick\\dir\\now_OK', 'catdir()' ); - is( MM->catdir( @path_eg ), + is( $MM->catdir( @path_eg ), File::Spec->catdir( @path_eg ), 'catdir() eq File::Spec->catdir()' ); # catfile() (calls MM_Win32->catdir) push @path_eg, 'file.ext'; - is( MM->catfile( @path_eg ), + is( $MM->catfile( @path_eg ), 'C:\\trick\\dir\\now_OK\\file.ext', 'catfile()' ); - is( MM->catfile( @path_eg ), + is( $MM->catfile( @path_eg ), File::Spec->catfile( @path_eg ), 'catfile() eq File::Spec->catfile()' ); } @@ -132,23 +140,26 @@ SKIP: { my $k_PM = join( " \\\n\t", %{$mm_w32->{PM}} ); like( $mm_w32->constants(), - qr!^NAME\ =\ TestMM_Win32\s+VERSION\ =\ 1\.00.+ + qr|^NAME\ =\ TestMM_Win32\s+VERSION\ =\ 1\.00.+ MAKEMAKER\ =\ \Q$INC{'ExtUtils/MakeMaker.pm'}\E\s+ MM_VERSION\ =\ \Q$ExtUtils::MakeMaker::VERSION\E.+ VERSION_FROM\ =\ TestMM_Win32.+ TO_INST_PM\ =\ \Q$s_PM\E\s+ PM_TO_BLIB\ =\ \Q$k_PM\E - !xs, 'constants()' ); + |xs, 'constants()' ); } # path() +my $had_path = exists $ENV{PATH}; { my @path_eg = ( qw( . .. ), 'C:\\Program Files' ); local $ENV{PATH} = join ';', @path_eg; - ok( eq_array( [ MM->path() ], [ @path_eg ] ), + ok( eq_array( [ $MM->path() ], [ @path_eg ] ), 'path() [preset]' ); } +# Bug in Perl. local $ENV{FOO} will not delete key afterwards. +delete $ENV{PATH} unless $had_path; # static_lib() should look into that # dynamic_bs() should look into that @@ -157,27 +168,27 @@ SKIP: { # clean() { my $clean = $Config{cc} =~ /^gcc/i ? 'dll.base dll.exp' : '*.pdb'; - like( MM->clean(), qr/^clean ::\s+\Q-$(RM_F) $clean\E\s+$/m, + like( $MM->clean(), qr/^clean ::\s+\Q-$(RM_F) $clean\E\s+$/m, 'clean() Makefile target' ); } # perl_archive() { my $libperl = $Config{libperl} || 'libperl.a'; - is( MM->perl_archive(), File::Spec->catfile('$(PERL_INC)', $libperl ), + is( $MM->perl_archive(), File::Spec->catfile('$(PERL_INC)', $libperl ), 'perl_archive() should respect libperl setting' ); } # export_list { - my $mm_w32 = bless { BASEEXT => 'someext' }, 'ExtUtils::MM_Win32'; + my $mm_w32 = bless { BASEEXT => 'someext' }, 'MM'; is( $mm_w32->export_list(), 'someext.def', 'export_list()' ); } # canonpath() { my $path = 'c:\\Program Files/SomeApp\\Progje.exe'; - is( MM->canonpath( $path ), File::Spec->canonpath( $path ), + is( $MM->canonpath( $path ), File::Spec->canonpath( $path ), 'canonpath() eq File::Spec->canonpath' ); } @@ -195,29 +206,29 @@ EOSCRIPT skip( "Can't write to temp file: $!", 4 ) unless close SCRIPT; # now start tests: - is( MM->perl_script( $script_name ), + is( $MM->perl_script( $script_name ), "${script_name}$script_ext", "perl_script ($script_ext)" ); skip( "Can't rename temp file: $!", 3 ) unless rename $script_name, "${script_name}.pl"; $script_ext = '.pl'; - is( MM->perl_script( $script_name ), + is( $MM->perl_script( $script_name ), "${script_name}$script_ext", "perl_script ($script_ext)" ); skip( "Can't rename temp file: $!", 2 ) unless rename "${script_name}$script_ext", "${script_name}.bat"; $script_ext = '.bat'; - is( MM->perl_script( $script_name ), + is( $MM->perl_script( $script_name ), "${script_name}$script_ext", "perl_script ($script_ext)" ); skip( "Can't rename temp file: $!", 1 ) unless rename "${script_name}$script_ext", "${script_name}.noscript"; $script_ext = '.noscript'; - isnt( MM->perl_script( $script_name ), + isnt( $MM->perl_script( $script_name ), "${script_name}$script_ext", "not a perl_script anymore ($script_ext)" ); - is( MM->perl_script( $script_name ), undef, + is( $MM->perl_script( $script_name ), undef, "perl_script ($script_ext) returns empty" ); } unlink "${script_name}$script_ext" if -f "${script_name}$script_ext"; @@ -225,26 +236,18 @@ unlink "${script_name}$script_ext" if -f "${script_name}$script_ext"; # pm_to_blib() { - like( MM->pm_to_blib(), + like( $MM->pm_to_blib(), qr/^pm_to_blib: \Q$(TO_INST_PM)\E.+\Q$(TOUCH) \E\$@\s+$/ms, 'pm_to_blib' ); } -# test_via_harness() -{ - like( MM->test_via_harness( $^X, 'MM_Win32.t' ), - qr/^\t\Q$^X\E \-Mblib.+"use Test::Harness.+MM_Win32.t\n$/, - 'test_via_harness()' ); -} - # tool_autosplit() { my %attribs = ( MAXLEN => 255 ); - like( MM->tool_autosplit( %attribs ), + like( $MM->tool_autosplit( %attribs ), qr/^\#\ Usage:\ \$\(AUTOSPLITFILE\) \ FileToSplit\ AutoDirToSplitInto.+ - AUTOSPLITFILE\ =\ \$\(PERL\)\ - "\-I\$\(PERL_ARCHLIB\)"\ "\-I\$\(PERL_LIB\)".+ + AUTOSPLITFILE\ =\ \$\(PERLRUN\)\ .+ \$AutoSplit::Maxlen=$attribs{MAXLEN}; /xms, 'tool_autosplit()' ); @@ -269,29 +272,6 @@ unlink "${script_name}$script_ext" if -f "${script_name}$script_ext"; # xs_o() should look into that # top_targets() should look into that -# htmlify_pods() -{ - my $mm_w32 = bless { - HTMLLIBPODS => { 'MM_Win32.pm' => 1 }, - HTMLSCRIPTPODS => { 'MM_Win32.t' => 1 }, - PERL_SRC => undef, - }, 'MM'; - my $pods = join " \\\n\t", keys %{$mm_w32->{HTMLLIBPODS}}, - keys %{$mm_w32->{HTMLSCRIPTPODS}}; - - my $pod2html_exe = $mm_w32->catfile($Config{scriptdirexp},'pod2html'); - unless ( $pod2html_exe = $mm_w32->perl_script( $pod2html_exe ) ) { - $pod2html_exe = '-S pod2html'; - } - - like( $mm_w32->htmlifypods(), - qr/^POD2HTML_EXE\ =\ \Q$pod2html_exe\E\n - POD2HTML\ =.+\n - htmlifypods\ :\ pure_all\ \Q$pods\E - /xs, - 'htmlifypods() Makefile target' ); -} - # manifypods() { my $mm_w32 = bless { NOECHO => '' }, 'MM'; @@ -306,7 +286,7 @@ unlink "${script_name}$script_ext" if -f "${script_name}$script_ext"; # pasthru() { my $pastru = "PASTHRU = " . ($Config{make} =~ /^nmake/i ? "-nologo" : ""); - is( MM->pasthru(), $pastru, 'pasthru()' ); + is( $MM->pasthru(), $pastru, 'pasthru()' ); } package FakeOut; diff --git a/lib/ExtUtils/t/Manifest.t b/lib/ExtUtils/t/Manifest.t index a0e84e0..4929c43 100644 --- a/lib/ExtUtils/t/Manifest.t +++ b/lib/ExtUtils/t/Manifest.t @@ -1,15 +1,20 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w BEGIN { if( $ENV{PERL_CORE} ) { chdir 't' if -d 't'; unshift @INC, '../lib'; } + else { + unshift @INC, 't/lib'; + } } chdir 't'; +use strict; + # these files help the test run -use Test::More tests => 31; +use Test::More tests => 32; use Cwd; # these files are needed for the module itself @@ -18,13 +23,14 @@ use File::Path; use Carp::Heavy; # keep track of everything added so it can all be deleted -my @files; +my %files; sub add_file { my ($file, $data) = @_; $data ||= 'foo'; + unlink $file; # or else we'll get multiple versions on VMS open( my $T, '>', $file) or return; print $T $data; - push @files, $file; + ++$files{$file}; } sub read_manifest { @@ -44,8 +50,11 @@ sub remove_dir { } # use module, import functions -BEGIN { use_ok( 'ExtUtils::Manifest', - qw( mkmanifest manicheck filecheck fullcheck maniread manicopy) ); } +BEGIN { + use_ok( 'ExtUtils::Manifest', + qw( mkmanifest manicheck filecheck fullcheck + maniread manicopy skipcheck ) ); +} my $cwd = Cwd::getcwd(); @@ -59,9 +68,10 @@ ok( add_file('foo'), 'add a temporary file' ); # there shouldn't be a MANIFEST there my ($res, $warn) = catch_warning( \&mkmanifest ); # Canonize the order. -$warn = join("", map { "$_|" } sort { lc $a cmp lc $b } split /\r?\n/, $warn); +$warn = join("", map { "$_|" } + sort { lc($a) cmp lc($b) } split /\r?\n/, $warn); is( $warn, "Added to MANIFEST: foo|Added to MANIFEST: MANIFEST|", - "mkmanifest() displayed it's additions" ); + "mkmanifest() displayed its additions" ); # and now you see it ok( -e 'MANIFEST', 'create MANIFEST file' ); @@ -81,45 +91,49 @@ like( $warn, qr/^Not in MANIFEST: bar/, 'warning that bar has been added' ); is( $res, 'bar', 'bar reported as new' ); # now quiet the warning that bar was added and test again -{ package ExtUtils::Manifest; use vars qw($Quiet); $Quiet = 1; } -($res, $warn) = catch_warning( \&ExtUtils::Manifest::skipcheck ); -cmp_ok( $warn, ,'eq', '', 'disabled warnings' ); +($res, $warn) = do { local $ExtUtils::Manifest::Quiet = 1; + catch_warning( \&skipcheck ) + }; +cmp_ok( $warn, 'eq', '', 'disabled warnings' ); -# add a skip file with a rule to skip itself +# add a skip file with a rule to skip itself (and the nonexistent glob '*baz*') add_file( 'MANIFEST.SKIP', "baz\n.SKIP" ); # this'll skip the new file -($res, $warn) = catch_warning( \&ExtUtils::Manifest::skipcheck ); -like( $warn, qr/^Skipping MANIFEST\.SKIP/, 'got skipping warning' ); +($res, $warn) = catch_warning( \&skipcheck ); +like( $warn, qr/^Skipping MANIFEST\.SKIP/i, 'got skipping warning' ); # I'm not sure why this should be... shouldn't $missing be the only one? my ($found, $missing ); catch_warning( sub { - ( $found, $missing ) = ExtUtils::Manifest::skipcheck() + ( $found, $missing ) = skipcheck() }); # nothing new should be found, bar should be skipped is( @$found, 0, 'no output here' ); is( join( ' ', @$missing ), 'bar', 'listed skipped files' ); -is( join(' ', filecheck() ), 'bar', 'listing skipped with filecheck()' ); +{ + local $ExtUtils::Manifest::Quiet = 1; + is( join(' ', filecheck() ), 'bar', 'listing skipped with filecheck()' ); +} # add a subdirectory and a file there that should be found ok( mkdir( 'moretest', 0777 ), 'created moretest directory' ); -my $quux = File::Spec->catfile( 'moretest', 'quux' ); -$quux =~ s#\\#/#g; -$quux = VMS::Filespec::unixify($quux) if $^O eq 'VMS'; -add_file( $quux, 'quux' ); -ok( exists( ExtUtils::Manifest::manifind()->{$quux} ), "manifind found $quux" ); +add_file( File::Spec->catfile('moretest', 'quux'), 'quux' ); +ok( exists( ExtUtils::Manifest::manifind()->{'moretest/quux'} ), + "manifind found moretest/quux" ); # only MANIFEST and foo are in the manifest my $files = maniread(); is( keys %$files, 2, 'two files found' ); -is( join(' ', sort { lc($a) cmp lc($b) } keys %$files), 'foo MANIFEST', 'both files found' ); +is( join(' ', sort { lc($a) cmp lc($b) } keys %$files), 'foo MANIFEST', + 'both files found' ); # poison the manifest, and add a comment that should be reported add_file( 'MANIFEST', 'none #none' ); -is( ExtUtils::Manifest::maniread()->{none}, '#none', 'maniread found comment' ); +is( ExtUtils::Manifest::maniread()->{none}, '#none', + 'maniread found comment' ); ok( mkdir( 'copy', 0777 ), 'made copy directory' ); @@ -127,30 +141,36 @@ $files = maniread(); eval { (undef, $warn) = catch_warning( sub { manicopy( $files, 'copy', 'cp' ) }) }; +like( $@, qr/^Can't read none: /, 'carped about none' ); # a newline comes through, so get rid of it chomp($warn); # the copy should have given one warning and one error -is($warn, 'Skipping MANIFEST.SKIP', 'warned about MANIFEST.SKIP' ); -like( $@, qr/^Can't read none: /, - 'carped about none' ); +like($warn, qr/^Skipping MANIFEST.SKIP/i, 'warned about MANIFEST.SKIP' ); # tell ExtUtils::Manifest to use a different file -{ package ExtUtils::Manifest; - use vars qw($MANIFEST); - $MANIFEST = 'albatross'; +{ + local $ExtUtils::Manifest::MANIFEST = 'albatross'; + ($res, $warn) = catch_warning( \&mkmanifest ); + like( $warn, qr/Added to albatross: /, 'using a new manifest file' ); + + # add the new file to the list of files to be deleted + $files{'albatross'}++; } -($res, $warn) = catch_warning( \&mkmanifest ); -like( $warn, qr/Added to albatross: /, 'using a new manifest file' ); -# add the new file to the list of files to be deleted -push @files, 'albatross'; +# Make sure MANIFEST.SKIP is using complete relative paths +add_file( 'MANIFEST.SKIP' => "^moretest/q\n" ); + +# This'll skip moretest/quux +($res, $warn) = catch_warning( \&skipcheck ); +like( $warn, qr{^Skipping moretest/quux}i, 'got skipping warning again' ); + END { - # the arrays are evaluated in scalar context - is( unlink( @files ), @files, 'remove all added files' ); + # the args are evaluated in scalar context + is( unlink( keys %files ), keys %files, 'remove all added files' ); remove_dir( 'moretest', 'copy' ); # now get rid of the parent directory diff --git a/lib/ExtUtils/t/Packlist.t b/lib/ExtUtils/t/Packlist.t index db8ed59..66fbea5 100644 --- a/lib/ExtUtils/t/Packlist.t +++ b/lib/ExtUtils/t/Packlist.t @@ -5,6 +5,9 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; } + else { + unshift @INC, 't/lib'; + } } chdir 't'; diff --git a/lib/ExtUtils/t/Problem-Module/Makefile.PL b/lib/ExtUtils/t/Problem-Module/Makefile.PL new file mode 100644 index 0000000..fa14ba0 --- /dev/null +++ b/lib/ExtUtils/t/Problem-Module/Makefile.PL @@ -0,0 +1,5 @@ +use ExtUtils::MakeMaker; + +WriteMakefile( + NAME => 'Problem::Module', +); diff --git a/lib/ExtUtils/t/Problem-Module/subdir/Makefile.PL b/lib/ExtUtils/t/Problem-Module/subdir/Makefile.PL new file mode 100644 index 0000000..3863bf0 --- /dev/null +++ b/lib/ExtUtils/t/Problem-Module/subdir/Makefile.PL @@ -0,0 +1,4 @@ +printf "\@INC %s .\n", (grep { $_ eq '.' } @INC) ? "has" : "doesn't have"; + +warn "I think I'm going to be sick\n"; +die "YYYAaaaakkk\n"; diff --git a/lib/ExtUtils/t/basic.t b/lib/ExtUtils/t/basic.t new file mode 100644 index 0000000..95280ed --- /dev/null +++ b/lib/ExtUtils/t/basic.t @@ -0,0 +1,81 @@ +#!/usr/bin/perl -w + +# This test puts MakeMaker through the paces of a basic perl module +# build, test and installation of the Big::Fat::Dummy module. + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} +$ENV{PERL_CORE} ? chdir '../lib/ExtUtils/t' : chdir 't'; + +use strict; +use Test::More tests => 15; +use MakeMaker::Test::Utils; +use File::Spec; +use TieOut; + +my $perl = which_perl; +perl_lib; + +$| = 1; + +ok( chdir 'Big-Fat-Dummy', "chdir'd to Big-Fat-Dummy" ) || + diag("chdir failed: $!"); + +my @mpl_out = `$perl Makefile.PL PREFIX=dummy-install`; + +cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || + diag(@mpl_out); + +my $makefile = makefile_name(); +ok( grep(/^Writing $makefile for Big::Fat::Dummy/, + @mpl_out) == 1, + 'Makefile.PL output looks right'); + +ok( grep(/^Current package is: main$/, + @mpl_out) == 1, + 'Makefile.PL run in package main'); + +ok( -e $makefile, 'Makefile exists' ); + +# -M is flakey on VMS. +my $mtime = (stat($makefile))[9]; +ok( ($^T - $mtime) <= 0, ' its been touched' ); + +END { unlink makefile_name(), makefile_backup() } + +# Supress 'make manifest' noise +open(SAVERR, ">&STDERR") || die $!; +close(STDERR); +my $make = make_run(); +my $manifest_out = `$make manifest`; +ok( -e 'MANIFEST', 'make manifest created a MANIFEST' ); +ok( -s 'MANIFEST', ' its not empty' ); +open(STDERR, ">&SAVERR") || die $!; + +END { unlink 'MANIFEST'; } + +my $test_out = `$make test`; +like( $test_out, qr/All tests successful/, 'make test' ); +is( $?, 0 ); + +# Test 'make test TEST_VERBOSE=1' +my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1); +$test_out = `$make_test_verbose`; +like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' ); +like( $test_out, qr/All tests successful/, ' successful' ); +is( $?, 0 ); + +my $dist_test_out = `$make disttest`; +is( $?, 0, 'disttest' ) || diag($dist_test_out); + +my $realclean_out = `$make realclean`; +is( $?, 0, 'realclean' ) || diag($realclean_out); + +close SAVERR; diff --git a/lib/ExtUtils/t/hints.t b/lib/ExtUtils/t/hints.t index 391b9f7..23315ed 100644 --- a/lib/ExtUtils/t/hints.t +++ b/lib/ExtUtils/t/hints.t @@ -9,9 +9,9 @@ BEGIN { unshift @INC, 't/lib/'; } } -chdir 't'; +$ENV{PERL_CORE} ? chdir '../lib/ExtUtils/t' : chdir 't'; -use Test::More tests => 2; +use Test::More tests => 3; mkdir 'hints'; my $hint_file = "hints/$^O.pl"; @@ -30,8 +30,17 @@ $mm->check_hints; is( $mm->{CCFLAGS}, 'basset hounds got long ears' ); is( $out->read, "Processing hints file $hint_file\n" ); -package Catch; +open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!"; +print HINT <<'CLOO'; +die "Argh!\n"; +CLOO +close HINT; +$mm->check_hints; +is( $out->read, < 3; +use ExtUtils::MM; +use TieOut; + +my $MM = bless { DIR => ['subdir'] }, 'MM'; + +ok( chdir 'Problem-Module', "chdir'd to Problem-Module" ) || + diag("chdir failed: $!"); + + +# Make sure when Makefile.PL's break, they issue a warning. +# Also make sure Makefile.PL's in subdirs still have '.' in @INC. +my $stdout; +$stdout = tie *STDOUT, 'TieOut' or die; +{ + my $warning = ''; + local $SIG{__WARN__} = sub { $warning = join '', @_ }; + $MM->eval_in_subdirs; + + is( $stdout->read, qq{\@INC has .\n}, 'cwd in @INC' ); + like( $warning, + qr{^WARNING from evaluation of .*subdir.*Makefile.PL: YYYAaaaakkk}, + 'Makefile.PL death in subdir warns' ); + + untie *STDOUT; +} diff --git a/lib/ExtUtils/t/testlib.t b/lib/ExtUtils/t/testlib.t index 8c1ae11..be4d15a 100644 --- a/lib/ExtUtils/t/testlib.t +++ b/lib/ExtUtils/t/testlib.t @@ -5,6 +5,9 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; } + else { + unshift @INC, 't/lib'; + } } chdir 't'; diff --git a/lib/ExtUtils/testlib.pm b/lib/ExtUtils/testlib.pm index 93edfd3..6ea13ca 100644 --- a/lib/ExtUtils/testlib.pm +++ b/lib/ExtUtils/testlib.pm @@ -1,7 +1,9 @@ package ExtUtils::testlib; $VERSION = 1.12_01; -use lib qw(blib/arch blib/lib); +# So the tests can chdir around and not break @INC. +use File::Spec; +use lib map File::Spec->rel2abs($_), qw(blib/arch blib/lib); 1; __END__ @@ -15,8 +17,6 @@ ExtUtils::testlib - add blib/* directories to @INC =head1 DESCRIPTION -B Use blib instead. - After an extension has been built and before it is installed it may be desirable to test it bypassing C. By adding diff --git a/t/lib/MakeMaker/Test/Utils.pm b/t/lib/MakeMaker/Test/Utils.pm new file mode 100644 index 0000000..b1de088 --- /dev/null +++ b/t/lib/MakeMaker/Test/Utils.pm @@ -0,0 +1,212 @@ +package MakeMaker::Test::Utils; + +use File::Spec; +use strict; +use Config; + +use vars qw($VERSION @ISA @EXPORT); + +require Exporter; +@ISA = qw(Exporter); + +$VERSION = 0.01; + +@EXPORT = qw(which_perl perl_lib makefile_name makefile_backup + make make_run make_macro + ); + +my $Is_VMS = $^O eq 'VMS'; + + +=head1 NAME + +MakeMaker::Test::Utils - Utility routines for testing MakeMaker + +=head1 SYNOPSIS + + use MakeMaker::Test::Utils; + + my $perl = which_perl; + perl_lib; + + my $makefile = makefile_name; + my $makefile_back = makefile_backup; + + my $make = make; + my $make_run = make_run; + make_macro($make, $targ, %macros); + +=head1 DESCRIPTION + +A consolidation of little utility functions used through out the +MakeMaker test suite. + +=head2 Functions + +The following are exported by default. + +=over 4 + +=item B + + my $perl = which_perl; + +Returns a path to perl which is safe to use in a command line, no +matter where you chdir to. + +=cut + +sub which_perl { + my $perl = $^X; + $perl ||= 'perl'; + + # VMS should have 'perl' aliased properly + return $perl if $Is_VMS; + + $perl = File::Spec->rel2abs( $perl ); + + unless( -x $perl ) { + # $^X was probably 'perl' + foreach my $path (File::Spec->path) { + $perl = File::Spec->catfile($path, $^X); + last if -x $perl; + } + } + + return $perl; +} + +=item B + + perl_lib; + +Sets up environment variables so perl can find its libraries. + +=cut + +my $old5lib = $ENV{PERL5LIB}; +my $had5lib = exists $ENV{PERL5LIB}; +sub perl_lib { + # perl-src/lib/ExtUtils/t/Foo + my $lib = $ENV{PERL_CORE} ? qq{../../../lib} + # ExtUtils-MakeMaker/t/Foo + : qq{../blib/lib}; + $lib = File::Spec->rel2abs($lib); + my @libs = ($lib); + push @libs, $ENV{PERL5LIB} if exists $ENV{PERL5LIB}; + $ENV{PERL5LIB} = join($Config{path_sep}, @libs); + unshift @INC, $lib; +} + +END { + if( $had5lib ) { + $ENV{PERL5LIB} = $old5lib; + } + else { + delete $ENV{PERL5LIB}; + } +} + + +=item B + + my $makefile = makefile_name; + +MakeMaker doesn't always generate 'Makefile'. It returns what it +should generate. + +=cut + +sub makefile_name { + return $Is_VMS ? 'Descrip.MMS' : 'Makefile'; +} + +=item B + + my $makefile_old = makefile_backup; + +Returns the name MakeMaker will use for a backup of the current +Makefile. + +=cut + +sub makefile_backup { + my $makefile = makefile_name; + return $Is_VMS ? $makefile : "$makefile.old"; +} + +=item B + + my $make = make; + +Returns a good guess at the make to run. + +=cut + +sub make { + my $make = $Config{make}; + $make = $ENV{MAKE} if exists $ENV{MAKE}; + + return $make; +} + +=item B + + my $make_run = make_run; + +Returns the make to run as with make() plus any necessary switches. + +=cut + +sub make_run { + my $make = make; + $make .= ' -nologo' if $make eq 'nmake'; + + return $make; +} + +=item B + + my $make_cmd = make_macro($make, $target, %macros); + +Returns the command necessary to run $make on the given $target using +the given %macros. + + my $make_test_verbose = make_macro(make_run(), 'test', + TEST_VERBOSE => 1); + +This is important because VMS's make utilities have a completely +different calling convention than Unix or Windows. + +%macros is actually a list of tuples, so the order will be preserved. + +=cut + +sub make_macro { + my($make, $target) = (shift, shift); + + my $is_mms = $make =~ /^MM(K|S)/i; + + my $cmd = $make; + my $macros = ''; + while( my($key,$val) = splice(@_, 0, 2) ) { + if( $is_mms ) { + $macros .= qq{/macro="$key=$val"}; + } + else { + $macros .= qq{ $key=$val}; + } + } + + return $is_mms ? "$make$macros $target" : "$make $target $macros"; +} + +=back + +=head1 AUTHOR + +Michael G Schwern + +=cut + +1; diff --git a/t/lib/TieOut.pm b/t/lib/TieOut.pm index 0da80cb..072e8fd 100644 --- a/t/lib/TieOut.pm +++ b/t/lib/TieOut.pm @@ -9,6 +9,12 @@ sub PRINT { $$self .= join('', @_); } +sub PRINTF { + my $self = shift; + my $fmt = shift; + $$self .= sprintf $fmt, @_; +} + sub read { my $self = shift; return substr($$self, 0, length($$self), '');