diff options
author | 2003-12-03 02:43:04 +0000 | |
---|---|---|
committer | 2003-12-03 02:43:04 +0000 | |
commit | 8500990981f885cbe5e6a4958549cacc238b5ae6 (patch) | |
tree | 459d709ffae0599d6d549087d270bfb6d2fcf5e6 /gnu/usr.bin/perl/lib/ExtUtils | |
parent | sync (diff) | |
download | wireguard-openbsd-8500990981f885cbe5e6a4958549cacc238b5ae6.tar.xz wireguard-openbsd-8500990981f885cbe5e6a4958549cacc238b5ae6.zip |
perl 5.8.2 from CPAN
Diffstat (limited to 'gnu/usr.bin/perl/lib/ExtUtils')
54 files changed, 5079 insertions, 1350 deletions
diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Changes b/gnu/usr.bin/perl/lib/ExtUtils/Changes index 39bd0c8555f..3cbeddb84b2 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/Changes +++ b/gnu/usr.bin/perl/lib/ExtUtils/Changes @@ -1,3 +1,474 @@ +6.17 Sun Sep 14 20:52:45 PDT 2003 + - Fixing LD so it can be set properly on Win32. (Orton Yves) + * Fixing the init_PERL() "tack $Config{exe_ext} onto $^X" logic so + it works on VMS allowing $^X to be found. + * Fixing make install UNINST=1 on Windows so it can search PERL5LIB + (Orton Yves) + - Fixing "could not open MANIFEST" test for OS/2 (and probably others) + where a read-only file cannot be deleted. + - Hacking around the fact that when built for debugging, VMS creates + ndbgperl.exe. + - Eliminating the never implemented "help" argument. + +6.16 Mon Aug 18 01:39:51 PDT 2003 + * Fixing the max exec length for Windows to account for old + versions of nmake (the one you can download for free from MS). + - Hack to normalize //foo//bar paths in ExtUtils::Installed. + [Sreeji K Das] + * Adding Module::Build utility files to MANIFEST.SKIP + - PREREQ_PRINT is supposed to exit after dumping. (Wolfgang Friebel + bleadperl@20530) + - maniadd() was trying to open the MANIFEST even if it didn't need to + causing unnecessary errors for read-only MANIFESTs (rt.cpan.org 3180) + +6.15 Sun Aug 3 16:41:05 PDT 2003 + - Make FIXIN on Win32 use the new pl2bat rather than an already + installed one when building the core (Mattia Barbon) + +6.14 Sun Aug 3 16:23:27 PDT 2003 + - Adding a reference to the Module::Build META.yml spec in the META.yml + itself and the metafile documentation. + - Removed Begin/End comments from manifypods that were getting in the + way of users adding code to the manifypods target. + - Putting a POD2MAN macro back as an alias to POD2MAN_EXE and using + it instead of POD2MAN. This allows people to generate their own man + installation targets in a backwards compatible way. + * Adding reference to the Module::Build META file spec in the docs. + +6.13 Thu Jul 31 16:48:01 PDT 2003 + - Generated META.yml now has the prereqs in sorted order (Andy Lester) + - Arguments to child Makefile.PLs were still having .. prepended. This + was exposed by the earlier fix of rt.perl.org 4345. + - extralibs.ld (for static builds) wasn't being cleaned up. + +6.12 Tue Jul 29 22:19:38 PDT 2003 + - Should any of your prefixes be /, MakeMaker might lose this and + prepend your prefix as "prefixyour/directory" rather than + "prefix/your/directory" (Ed Moy bleadperl 20283) + - Reversing "realclean was duplicating work already done by clean" + (CVS 1.124 MM_Unix.pm). Turns out it wasn't a duplication and this + was causing INST_* files to be left behind if your INST_LIB wasn't + blib/* as in the perl core. realclean now removes the files copied + to INST_*. + - Eliminating xsubpp_version(). No longer relevant. It was checking + for a feature added to xsubpp before 5.003_07 and doing it in a + really bizarre way. + +6.11 Thu Jul 24 01:24:37 PDT 2003 + - Small grammatical doc touch up by Sean Burke + - Making basic.t clean up better after itself so it can be run + twice without setting up and cleaning up Big-Dummy again. + * Noting where to find make in the README + * Noting that MakeMaker does not produce a GNU make compatible Makefile + on Windows. + +6.10_08 Mon Jul 21 18:17:06 PDT 2003 + * $Config{installvendorman*dir} was being ignored and our default + always used. [rt.cpan.org #2949] + * Setting NORECURS to true was still resulting in a Makefile which + tried to recurse into subdirectories which contained a Makefile.PL + (it simply wouldn't have run them to generate Makefile's). + This appears to be a rather old bug. + [rt.cpan.org #2951] + * [rt.perl.org #4345] Arguments passed to WriteMakefile() would get + stopped upon by $self->{PARENT} in recursive builds in the process + of prepending a .. onto it. + - Command.t now using its own temp directory when testing + expand_wildcards() so no stray files confuse it. + * No longer warning about 'postamble' attribute. + - Added installvars() to list INSTALL* variables so we don't keep + repeating the list all over the code. + - Added init_DEST() to create DESTINSTALL* variables for installing + with DESTDIR set. + * DESTDIR + PREFIX now does not duplicate DESTDIR. [Redhat #91892 + and part of rt.cpan.org #2954] + * DESTDIR is now not directly prepended to the INSTALL* variables. + installation targets now use DESTINSTALL* instead. This prevents + the DESTDIR from showing up in places it shouldn't like perllocal.pod. + DESTDIR is still appearing in .packlist (bug). [rt.cpan.org #2954] + - MM_VMS->prefixify() wasn't honoring the %Config_Override causing + some MakeMaker generated config variables to be ignored. + - MM_VMS->prefixify() was only VMSifying part of its filepaths causing + internal comparisions to get confused and think it had to prefixify + when it didn't. + +6.10_07 Sat Jul 5 16:12:52 PDT 2003 + * Fixing location of perllocal.pod so its always in INSTALLARCHLIB + instead of one for each perl, site and vendor. + - Sun's make treats escaped newlines oddly. Switching oneliner() back + to using multiple -e's. + * Bug in libscan() meant that any .pm containing RCS or CVS or SCCS + in its name (for example, RCS.pm) would be skipped. + - Command.t was getting confused in the core because it was reading + files from the core t/ directory, not MakeMaker's t/ directry. + - MM_OS2 PERL_ARCHIVE_AFTER test wrong for a.out systems (Ilya) + - Fixing perllocal.pod and XS installation on VMS. An extraneous + newline was introduced when changing the install macros over to + $(ECHO). + - Added $(ECHO_N) macro to emulate 'echo -n' + +6.10_06 Sat Jun 7 00:55:29 PDT 2003 + - Whoops, Liblist.t busted on VMS after I turned strict on in + ExtUtils::Liblist::Kid. Merely a test bug, not a real bug. + - Fixed metafile_addtomanifest failure so the proper error shows. + - Fixed metafile_addtomanifest failure diagnostic leaking out during + the basic.t test on Windows. + +6.10_05 Fri Jun 6 18:15:30 PDT 2003 + * Documenting META.yml, NO_META + * Documenting the fact that distdir will auto generate META.yml and + alter your manifest. + * Adding META.yml autogeneration to the FAQ + - Recognizing comments with leading whitespace in MANIFESTs better. + - Small ExtUtils::Liblist::Kid problem on VMS (Craig Berry) + * Fixed "make install UNINST=1". Appears to have been broken somewhere + around 6.06_01. + - Documented the fourth argument to ExtUtils::Install::install() + - install() will now honor a PERL5LIB change between ExtUtils::Install + loading and install() running when uninstalling shadows. + - META.yml generation deals gracefully when the MANIFEST is read-only + (Slaven rt.cpan.org 2723) + - Fixing tests on limited dir depth VMS systems by moving the + dummy-install dir one level up (Craig Berry rt.cpan.org 2747) + +6.10_04 Fri May 23 01:13:04 PDT 2003 + - Working around BSD threaading bug in version check. [from bleadperl] + - Added the Makefile to the dist dependencies. (Slaven Rezic) + - Reversing the find_perl() version check failure warning introced in + 6.10_03. Too talkative, warned when nothing was wrong. + * Fixing META.yml auto-addition when there's no newline at the end + of the MANIFEST [rt.cpan.org 2444] + * Making it a bit more obvious in the MANIFEST where META.yml comes from. + - Fixed $_ clobbering in ExtUtils::Manifest functions. + - [rt.cpan.org 2591] some LD_RUN_PATH thing (Marek Rouchal) + - Added core.\d+ files to 'make clean' [rt.cpan.org 2543] (Slaven Rezic) + - INST_* targets were expanded too early (Stas Bekman) + - Adding ExtUtils::MakeMaker::bytes (bytes.pm backwards compat wrapper) + - Fixing MM_MacOS so it will compile on 5.5.x machines (use bytes wrapper) + * Reducing perldepend set of CORE/*.h dependencies to what 5.5.3 has. + 5.5.3 should be able to compile XS again. + * Eliminating fakethr.h and perlsfio.h from VMS's perldepend as they + sometimes don't get installed. + - ExtUtils::Install was making a few directories even with the + "don't really do it" switch on (Slaven Rezic) + * can build static linked perl binaries again. Probably damaged in + 6.06_01 when $self->{MAKEFILE} became FIRST_MAKEFILE. (Nick Clark) + +6.10_03 Fri Apr 11 00:21:25 PDT 2003 + * Added NO_META WriteMakefile() option to suppress generation of + META.yml. (Spoon, rt.cpan.org 2359) + - Spurious linebreak in uninstall_from_sitedirs on VMS (Craig Berry) + * A bit after 6.05 man page names would come out as lib::Foo::Bar + if the module name didn't contain a ::. Found with podulators. + Fixed. + * Skipping installation of RCS ,v files. + * 'make ci' was busted between 6.05 and 6.06_01. Fixed. (Andreas) + - 'make test' was broken when there's no tests. Introduced in 6.06_03. + (Stas Bekman) + - Solving some directory depth problems in tests on oldish VMS systems. + (Craig Berry) + - Fixing MM_MacOS so it compiles on UTF-8 systems. (Jarkko) + - Making find_perl() more talkative when the version check fails + miserably. + - Fixing PERL_ARCHIVE on VMS so XS can compile again (Craig Berry) + +6.10_02 Mon Apr 7 00:57:15 PDT 2003 + * Removed 2>&1 experiment introduced in 6.10_01 for all non-Unixen + except for OS/2. Thought Perl might emulate `... 2>&1`. It doesn't. + Just on OS/2. + +6.10_01 Sun Apr 6 19:31:42 PDT 2003 + - Making install "Skip ... (unchanged)" message happen consistently + - Checking file sizes as well as modification times when deciding + to skip installing a file. + - OS/2 was using $(RM) instead of $(RM_F) (Ilya) + - OS/2 needs .dll removed on failed build (Ilya) + - fixin() was assuming that rename() can overwrite the target (Ilya) + - manifypods target was empty if there are no pods to manify. Put in + at least $(NOECHO) $(NOOP) + - Cygwin test to check for finding pod2man when building the perl core + removed. No longer relevent. + - Small fixes for dmake (Mattia Barbon) + * Added "Reporting bugs" section to the PATCHING doc. + - Minor bug in compile test missed ExtUtils::Liblist::Kid + - Removing $(VERSION_FROM) from Makefile dependency. It was too + annoying to rebuild the Makefile every time the module changed. + Mentioned it in the FAQ instead. + - Fixing PERL_ARCHIVE macro on VMS. Apparently it never appeared + properly before. (Craig Berry) + - Fixing ECHO on dmake. + - Adding os_flavor() and os_flavor_is() + - Making basic.t error output combine STDOUT & STDERR for easier + reading. + * ExtUtils::Manifest will now work case insensitively. + - Fixed 'subroutine redefined' warnings in 00compile.t + - Fixed it so typemaps are only looked for in the perl core library. + * Hacking around VMS filesystem problems reconstructing package names + from filenames in ExtUtils::Installed. (Jesper Naur) + +# There was no 6.06, I jumped straight to 6.10_XX because there's been +# so much change between 6.05 and now. + +6.06_05 Mon Mar 31 02:44:11 PST 2003 + - Syncing into bleadperl. Minor nits revealed... + - AutoSplit open filehandle bug was fixed in bleadperl. Averted a + warning because of this. + - hint files were only being loaded if . happened to be in @INC. + A bug/feature of File::Spec was stripping off the current dir from + the front of hintfile paths causing Perl to look for them in @INC. + Worked around. + - Now checking $! for errors if a hint file returns undef + - compile test was testing all of perl! Scaling back to just ExtUtils/ + +6.06_04 Sun Mar 30 20:34:39 PST 2003 + - Now looking for ExtUtils::xsubpp through @INC rather than just + the perl core directories. This helps ExtUtils::ParseXS. + - Systems which don't put their libraries under their $Config{prefix} + (OS X, Debian) weren't putting their libraries in the spot declared + in Config. It was going under $Config{prefix}. + - Prerequisites check now deals better with X.Y_Z style alpha versions + - ExtUtils::Liblist->ext() was using $Config{perllibs} which is a 5.6.1 + thing. Falling back to $Config{libs} if perllibs isn't there. + - ExtUtils::Command::MM now reads from @ARGV if called with no + args. Makes the one liner a bit simpler. + * Restored ExtUtils::Liblist::ext() for backwards compatibility. + Missing since 5.6.1. + - Switching to relative dirs for self-building to shorten + command line lengths. + - Fixing minor test warning on VMS when compiling ExtUtils::Manifest + - Skipping STDIN read prompt() tests on 5.5.3. Can't test due to + eof() not honor tied handles. + - Config.pm on 5.5.3 doesn't have any concept of vendor*. This was + causing warnings when generating the Makefile. + +6.06_03 Sat Mar 29 19:44:53 PST 2003 + - Added AUTHOR and ABSTRACT_FROM info for ppd generation. + - Added echo() method to portably echo text to a file. + - Worked around 5.8.0 eval 'require Foo::Bar' bug causing MakeMaker + to think modules weren't installed. + - Modernized VMS doc_*_install targets + - Changed some $(PERL) -e "print ..." code to use $(ECHO). + - Replaced uses of Delete/NoLog/NoConfirm with $(RM_F) in MM_VMS + - Fixed some duplicate macros making MMS happy. + - Fixed $ExtUtils::MM_VMS::Revision. It was just the $VERSION before. + - Fixed ExtUtils::Command::MM::perllocal_install(), uninstall(), + warn_if_old_packlist(). + * Pulling File::Spec::VMS::fixpath() and eliminate_macros() into MM_VMS + as the new cannonical location. They never should have been in F::S + in the first place. + * ExtUtils::Command::eqtime() would truncate the file being equalized! + Holdover from exclusive .exists usage. + - Cleaned up hard coded 'echo' and '@' to $(ECHO) and $(NOECHO) + - $(SAY) is now $(ECHO) on VMS + - Moved rogue initializations from tools_other() to init_others() + - Normalized MM_VMS's tools_other() to mostly use its superclass. + - split_command() was off-by-one when calculating max command line + lengths causing it to run over on VMS + - made split_command() a bit smarter, taking into account some macro + expansion + - Fixed initialization of OBJECT, DISTNAME and LDFROM on VMS + - Fixed *_install target uses of File::Spec. + - Added ExtUtils::MakeMaker::vmsish wrapper around vmsish so MM_VMS + can be compiled on non-VMS machines. For testing. + * Added ExtUtils::MakeMaker::Tutorial about writing modules with + MakeMaker. + - Removed "always use h2xs" dogma. + - Added compile & POD test + * 'make distdir' now generates META.yml module meta-data file. + Proof of concept. Have to syncronize with Module::Build. + * Added maniadd() to ExtUtils::Manifest to add entries to the MANIFEST + * ExtUtils::Command::chmod was not interpreting file permissions as + octal. Also, docs & tests slightly wrong (thanks Stas Bekman). + - ExtUtils::Install was hard coding blib/lib and blib/arch, unportable + [perl #21526] + +6.06_02 Mon Dec 23 20:39:57 PST 2002 + * Lots of Win32 fixes busted between 6.05 and 6.06_01. + * split_command() tests still not happy on Win32. Problems with + shell vs Makefile escaping makes testing difficult. + * VMS still broken. Need to convert File::Spec method calls back to + object method calls so the weird FS::VMS->eliminate_macros() and + fixpath() work again. + +6.06_01 Thu Dec 19 00:14:49 PST 2002 + - Andreas found that when building the core it is desirable for + MakeMaker to use a relative path to perl. + - File::Spec->catfile() has a bug where the resulting file may not be + canonicalized. This was causing problems when generating manpaths. + MakeMaker now uses its own fixed override for catfile(). + - Fixed the POD recognition regex to properly catch /=head\d/ tags. + * Added a PATCHING guideline document. + - Updated the class hierarchy in NOTES. + - Installed.t now cleans up after itself better. + - Steve Purkis rewrote the manifypods system to use Pod::Man + rather than pod2man. Its now portable and manifypods() moved from + MM_Unix to MM_Any. As a result, lots of icky and redudant code went + away. This also removes the POD2MAN macro, but noone should be + using that. + - "make manifypods" now works on Win32 + - "make manifypods" is now be faster + - Made MM_Unix->find_perl more portable. Eliminated MM_Win32->find_perl + override. MM_VMS->find_perl remains. + * find_perl() can now handle filenames with spaces in them (RT448) + * find_perl() on Win32 no longer produces spurious "File Creation error" + messages (perlbug ID 20020709.001) + - Removed unfinished and unused maybe_command_in_dirs() + - Removed dead SelfLoader cruft from MM_Unix. + - Fixed PPD generation when the ppd contains quotes (RT1473) + - Fixed PPD generation on VMS + - Moved Win9x specific subdir_x() code from MM_Unix to MM_Win95 + * Craig Berry fixed hint files on VMS + - Added the perl_onliner() method to generate portable, safe one-liners + - Changing hardcoded $self->{MAKEFILE} to $(FIRST_MAKEFILE). + * Rafael Garcia-Suarez made MakeMaker ignore Subversion control files + by default. + - Added MAKEFILE_OLD macro. + * No longer generating man pages by default on VMS. + - Improved DISTNAME docs + * Documented DISTVNAME and VERSION_SYM + * Documented dist() + - Seperated dist_core() into dist, tardist, uutardist, tarfile, + zipdist, zipfile and shdist_target methods. Allows elimination + of redundant code in MM_VMS. + - Replaced WARN_IF_OLD_PACKLIST, DOC_INSTALL and UNINSTALL + one-liners with ExtUtils::Command::MM functions + - Replaced VMS hand-rolled perl code for TOUCH, CHMOD, RM_F and RM_RF + with ExtUtils::Command functions. Added TEST_F. + - Adding clean_subdirs target and clean_subdirs_target() method to + generate same. This allows easier overriding of an unportable part + of the clean target. + - Defined DEV_NULL for MacOS + - Removed ROOTEXT from MM_MacOS, apparently unused + - Added $(DIRFILESEP) macro and init_DIRFILESEP to avoid + hardcoding / or \. Reduces code duplication in the MM_* modules. + - Added init_platform() and platform_constants() for OS specific + macros. Moved OS specific macros from constants() overrides there. + - Added init_VERSION() to setup various *VERSION* macros. + - Added default wraplist() to make porting easier. + - Added makemakerdflt_target() to guarantee 'all' is the default + target. + - Added special_targets() to handle things like .PHONY and make sure + they come first. + - Added init_linker() to initialize linker relatied macros. + - MM_MacOS constants() disolves + Moved MACPERL_SRC, MACPERL_LIB, MACPERL_INC from init_main() to + init_platform(). + Moved DEFINE and INC tweaking from constants() to init_main() + Moved DEFINE_VERSION & XS_DEFINE_VERSION from constants() to + init_VERSION(). + Eliminated MODULES. Unused and its the same as TO_INST_PM + Moved .INCLUDE from constants() to special_targets() + + - MM_NW5 constants() & init_others() disolves + Moved LIBPTH, BASE_IMPORT, NLM_VERSION, MPKTOOL, TOOLPATH from + init_others() to init_platform() + Moved INCLUDE and PATH definitions from constants() to + init_platform() + Moved BOOT_SYMBOL, NLM_SHORT_NAME, PATH and INCLUDE from + constants() to init_platform() + + - MM_Unix constants() goes on a diet + Moved all macro definitions to init_* methods. + Added MM_REVISION for completeness + Using wraplist() instead of manual joining + Moved .NO_CONFIG_REC, .SUFFIXES and .PHONY to special_targets() + Moved makemakerdflt: to makemakerdeflt_target() + Moved INST_{STATIC,DYNAMIC,BOOT} to init_INST() + Moved EXPORT_LIST, PERL_ARCHIVE & PERL_ARCHIVE_AFTER to init_linker(). + Moved PERL_MALLOC_DEF to init_platform() + + - MM_VMS constants() goes on a diet + Moved DEFINE from constants() to init_main() + Moved OBJECT & LDFROM from constants() to init_others() + Moved MM_VMS_REVISION and PERL_VMS to init_platform + Added MM_VMS_VERSION + Moved DEFINE_VERSION, XS_DEFINE_VERSION and MAKEMAKER changes to + init_VERSION + Moved .SUFFIXES changes to special_targets() override. + Eliminated $self->{PM_TO_BLIB}. Its redundant with $self->{PM}. + constants() now consists only of fixpath() calls. + + - MM_Win32 constants() goes away + Moved .USESHELL to special_targets() override. + Everything else was redundant. + + - Added $(VERSION_FROM) to $(MAKEFILE) dependencies. Helpful for + XS builds where the version number is very sensitive. + - export_list(), perl_archive() and perl_archive_after() consolodated + into init_linker(). + - Added MM_NW5_VERSION, MM_Unix_VERSION, MM_Win32_VERSION, + MM_VMS_VERSION. + - Eliminated duplicate code in constants() overrides + - Added all_target() for easier customization of what's run by default + - Eliminated duplicate top_targets() overrides + - Made tool_autosplit() method portable. Moved to MM_Any. Eliminated + overrides. + - Adding realclean_subdirs target and realclean_subdirs_target() + method to generate same. This allows easier overriding of an + unportable part of the realclean target. + - Added oneliner() to create portable perl one-liners. + - Craig Berry found some typos in ExtUtils::Liblist::Kid's VMS part + * ExtUtils::Install did not work on MacPerl due to a hardcoded '.' + * prompt() will now read from STDIN. + - Craig Berry made sure extliblist() is always called even if LIBS + is explicitly set to empty. + * Added DESTDIR to make repacking easier. + * $(*PREFIX) are returned to the INSTALL* variables. + * Split $(PREFIX) into $(PERLPREFIX) and $(PREFIX). The former + holds the location of the core libraries. The latter is the + optional override prefix supplied by the user. + * PREFIX overrides all other *PREFIXes when set in the Makefile.PL. + This restores "make install PREFIX=foo". + - Added quote_literal() to handle some shell quoting. + - ExtUtils::MM_VMS now compilable on non-VMS platforms. + - J. D. Laub made MakeMaker honor $Config{installstyle} + - Renaming on OS/2 requires the target file to be removed. + Partially fixed by Ilya, should be applied universally later. + - Default MANIFEST.SKIP not catching files in subdirs. Fixed by Ilya. + - Ilya fixed ExtUtils::Liblist->ext when called outside MakeMaker. + - realclean was duplicating work already done by clean + - Adding an explicit LICENSE + - Cleaning up ExtUtils::Install docs. + - ExtUtils::Install::uninstall() now has default verbose and + dont_execute arguments. + - Added some basic ExtUtils::Install tests + - Fixed ExtUtils::Install::install() for relative dirs + - Added split_command() and max_exec_len() to deal with long + commands. + - Seperated escape_newlines() from quote_literal(). This may + be pointless. + - pm_to_blib() now generated with split_command(). 3x speedup. + - added init_dist() to initialize distribution constants + - ExtUtils::Install::pm_to_blib() working around open filehandle + bug in AutoSplit for systems with mandatory file locking. + +6.05 Tue Aug 27 16:09:51 PDT 2002 + - Output format of the hint file verbose diagnostic is now in + a format native to the OS, so it broke a test on non-Unixen. + +6.04 Mon Aug 26 18:31:11 PDT 2002 + - Little fix for pre-5.8 Cygwin test to get the shared library names + right. + * disttest on Win9X broken because of forgotten tabs + * WriteMakefile argument verification should now be accurate + - Documented the LD flag. + * Documented prompt() + * vendor install was not adding to packlist or updating perllocal. + - Supporting $Config{vendorarchexp} and $Config{vendorlibexp}. + - Fixed conflict on VMS between logical names and directories + (bleadperl 17488) + - Fixed space-vs-tab bug on Netware (bleadperl 17579) + - Mysterious NetWare fix from Ananth (bleadperl 17376) + - Support OPTIMIZE in MacOS (bleadperl 17347) + - Support hints in MacOS (mutation of bleadperl 17347) + * Default man installation directories were using $(MAN*EXT) to + generate the directory name. This turned out to be wrong more + often than right, so we'll use man1 and man3 hard-coded. + - Debian folks fixed the doc_install targets so the Appending + diagnostic gives the correct directory for perllocal.pod + * Added ExtUtils::MakeMaker::FAQ + - Quieted some warnings on MacOS (bleadperl 17669) + 6.03 Wed Jun 19 17:06:14 EDT 2002 - Documented that we're clamping down on cargo-cult MakeMaker programming. @@ -289,7 +760,7 @@ 5.50_01 Mon Mar 4 23:44:48 EST 2002 [[ API Changes ]] - htmlifypods and all HTML targets have been removed. It didn't + - 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 diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Command/MM.pm b/gnu/usr.bin/perl/lib/ExtUtils/Command/MM.pm index 9eb7d292993..a597cc48a96 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/Command/MM.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/Command/MM.pm @@ -7,8 +7,11 @@ require Exporter; use vars qw($VERSION @ISA @EXPORT); @ISA = qw(Exporter); -@EXPORT = qw(test_harness); -$VERSION = '0.01'; +@EXPORT = qw(test_harness pod2man perllocal_install uninstall + warn_if_old_packlist); +$VERSION = '0.03'; + +my $Is_VMS = $^O eq 'VMS'; =head1 NAME @@ -16,7 +19,7 @@ ExtUtils::Command::MM - Commands for the MM's to use in Makefiles =head1 SYNOPSIS - perl -MExtUtils::Command::MM -e "function" files... + perl "-MExtUtils::Command::MM" -e "function" "--" arguments... =head1 DESCRIPTION @@ -26,8 +29,6 @@ B<FOR INTERNAL USE ONLY!> 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 @@ -54,6 +55,203 @@ sub test_harness { Test::Harness::runtests(sort { lc $a cmp lc $b } @ARGV); } + + +=item B<pod2man> + + pod2man( '--option=value', + $podfile1 => $manpage1, + $podfile2 => $manpage2, + ... + ); + + # or args on @ARGV + +pod2man() is a function performing most of the duties of the pod2man +program. Its arguments are exactly the same as pod2man as of 5.8.0 +with the addition of: + + --perm_rw octal permission to set the resulting manpage to + +And the removal of: + + --verbose/-v + --help/-h + +If no arguments are given to pod2man it will read from @ARGV. + +=cut + +sub pod2man { + require Pod::Man; + require Getopt::Long; + + my %options = (); + + # We will cheat and just use Getopt::Long. We fool it by putting + # our arguments into @ARGV. Should be safe. + local @ARGV = @_ ? @_ : @ARGV; + Getopt::Long::config ('bundling_override'); + Getopt::Long::GetOptions (\%options, + 'section|s=s', 'release|r=s', 'center|c=s', + 'date|d=s', 'fixed=s', 'fixedbold=s', 'fixeditalic=s', + 'fixedbolditalic=s', 'official|o', 'quotes|q=s', 'lax|l', + 'name|n=s', 'perm_rw:i' + ); + + # If there's no files, don't bother going further. + return 0 unless @ARGV; + + # Official sets --center, but don't override things explicitly set. + if ($options{official} && !defined $options{center}) { + $options{center} = 'Perl Programmers Reference Guide'; + } + + # This isn't a valid Pod::Man option and is only accepted for backwards + # compatibility. + delete $options{lax}; + + my $parser = Pod::Man->new(%options); + + do {{ # so 'next' works + my ($pod, $man) = splice(@ARGV, 0, 2); + + next if ((-e $man) && + (-M $man < -M $pod) && + (-M $man < -M "Makefile")); + + print "Manifying $man\n"; + + $parser->parse_from_file($pod, $man) + or do { warn("Could not install $man\n"); next }; + + if (length $options{perm_rw}) { + chmod(oct($options{perm_rw}), $man) + or do { warn("chmod $options{perm_rw} $man: $!\n"); next }; + } + }} while @ARGV; + + return 1; +} + + +=item B<warn_if_old_packlist> + + perl "-MExtUtils::Command::MM" -e warn_if_old_packlist <somefile> + +Displays a warning that an old packlist file was found. Reads the +filename from @ARGV. + +=cut + +sub warn_if_old_packlist { + my $packlist = $ARGV[0]; + + return unless -f $packlist; + print <<"PACKLIST_WARNING"; +WARNING: I have found an old package in + $packlist. +Please make sure the two installations are not conflicting +PACKLIST_WARNING + +} + + +=item B<perllocal_install> + + perl "-MExtUtils::Command::MM" -e perllocal_install + <type> <module name> <key> <value> ... + + # VMS only, key/value pairs come on STDIN + perl "-MExtUtils::Command::MM" -e perllocal_install + <type> <module name> < <key> <value> ... + +Prints a fragment of POD suitable for appending to perllocal.pod. +Arguments are read from @ARGV. + +'type' is the type of what you're installing. Usually 'Module'. + +'module name' is simply the name of your module. (Foo::Bar) + +Key/value pairs are extra information about the module. Fields include: + + installed into which directory your module was out into + LINKTYPE dynamic or static linking + VERSION module version number + EXE_FILES any executables installed in a space seperated + list + +=cut + +sub perllocal_install { + my($type, $name) = splice(@ARGV, 0, 2); + + # VMS feeds args as a piped file on STDIN since it usually can't + # fit all the args on a single command line. + @ARGV = split /\|/, <STDIN> if $Is_VMS; + + my $pod; + $pod = sprintf <<POD, scalar localtime; + =head2 %s: C<$type> L<$name|$name> + + =over 4 + +POD + + do { + my($key, $val) = splice(@ARGV, 0, 2); + + $pod .= <<POD + =item * + + C<$key: $val> + +POD + + } while(@ARGV); + + $pod .= "=back\n\n"; + $pod =~ s/^ //mg; + print $pod; + + return 1; +} + +=item B<uninstall> + + perl "-MExtUtils::Command::MM" -e uninstall <packlist> + +A wrapper around ExtUtils::Install::uninstall(). Warns that +uninstallation is deprecated and doesn't actually perform the +uninstallation. + +=cut + +sub uninstall { + my($packlist) = shift; + + require ExtUtils::Install; + + print <<'WARNING'; + +Uninstall is unsafe and deprecated, the uninstallation was not performed. +We will show what would have been done. + +WARNING + + ExtUtils::Install::uninstall($packlist, 1, 1); + + print <<'WARNING'; + +Uninstall is unsafe and deprecated, the uninstallation was not performed. +Please check the list above carefully, there may be errors. +Remove the appropriate files manually. +Sorry for the inconvenience. + +WARNING + +} + =back =cut diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Constant.pm b/gnu/usr.bin/perl/lib/ExtUtils/Constant.pm index 1268ce02ba9..9730d910735 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/Constant.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/Constant.pm @@ -1,6 +1,6 @@ package ExtUtils::Constant; use vars qw (@ISA $VERSION %XS_Constant %XS_TypeSet @EXPORT_OK %EXPORT_TAGS); -$VERSION = '0.12'; +$VERSION = '0.14'; =head1 NAME @@ -94,8 +94,11 @@ if ($] >= 5.006) { eval "use warnings; 1" or die $@; } use strict; +use vars '$is_perl56'; use Carp; +$is_perl56 = ($] < 5.007 && $] > 5.005_50); + use Exporter; use Text::Wrap; $Text::Wrap::huge = 'overflow'; @@ -150,7 +153,12 @@ characters. sub C_stringify { local $_ = shift; return unless defined $_; - confess "Wide character in '$_' intended as a C identifier" if tr/\0-\377//c; + # grr 5.6.1 + confess "Wide character in '$_' intended as a C identifier" + if tr/\0-\377// != length; + # grr 5.6.1 moreso because its regexps will break on data that happens to + # be utf8, which includes my 8 bit test cases. + $_ = pack 'C*', unpack 'U*', $_ . pack 'U*' if $is_perl56; s/\\/\\\\/g; s/([\"\'])/\\$1/g; # Grr. fix perl mode. s/\n/\\n/g; # Ensure newlines don't end up in octal @@ -189,13 +197,27 @@ sub perl_stringify { s/\t/\\t/g; s/\f/\\f/g; s/\a/\\a/g; - s/([^\0-\177])/sprintf "\\x{%X}", ord $1/ge; unless ($] < 5.006) { + if ($] > 5.007) { + s/([^\0-\177])/sprintf "\\x{%X}", ord $1/ge; + } else { + # Grr 5.6.1. And I don't think I can use utf8; to force the regexp + # because 5.005_03 will fail. + # This is grim, but I also can't split on // + my $copy; + foreach my $index (0 .. length ($_) - 1) { + my $char = substr ($_, $index, 1); + $copy .= ($char le "\177") ? $char : sprintf "\\x{%X}", ord $char; + } + $_ = $copy; + } # This will elicit a warning on 5.005_03 about [: :] being reserved unless # I cheat my $cheat = '([[:^print:]])'; s/$cheat/sprintf "\\%03o", ord $1/ge; } else { + # Turns out "\x{}" notation only arrived with 5.6 + s/([^\0-\177])/sprintf "\\x%02X", ord $1/ge; require POSIX; s/([^A-Za-z0-9_])/POSIX::isprint($1) ? $1 : sprintf "\\%03o", ord $1/ge; } @@ -241,6 +263,11 @@ is equal to the C variable C<name>. If I<CHECKED_AT> is defined, then it is used to avoid C<memEQ> for short names, or to generate a comment to highlight the position of the character in the C<switch> statement. +If I<CHECKED_AT> is a reference to a scalar, then instead it gives +the characters pre-checked at the beginning, (and the number of chars by +which the C variable name has been advanced. These need to be chopped from +the front of I<NAME>). + =cut sub memEQ_clause { @@ -248,6 +275,14 @@ sub memEQ_clause { # Which could actually be a character comparison or even "" my ($name, $checked_at, $indent) = @_; $indent = ' ' x ($indent || 4); + my $front_chop; + if (ref $checked_at) { + # regexp won't work on 5.6.1 without use utf8; in turn that won't work + # on 5.005_03. + substr ($name, 0, length $$checked_at,) = ''; + $front_chop = C_stringify ($$checked_at); + undef $checked_at; + } my $len = length $name; if ($len < 2) { @@ -267,12 +302,38 @@ sub memEQ_clause { return $indent . "if (name[$check] == '$char') {\n"; } } - # Could optimise a memEQ on 3 to 2 single character checks here + if (($len == 2 and !defined $checked_at) + or ($len == 3 and defined ($checked_at) and $checked_at == 2)) { + my $char1 = C_stringify (substr $name, 0, 1); + my $char2 = C_stringify (substr $name, 1, 1); + return $indent . "if (name[0] == '$char1' && name[1] == '$char2') {\n"; + } + if (($len == 3 and defined ($checked_at) and $checked_at == 1)) { + my $char1 = C_stringify (substr $name, 0, 1); + my $char2 = C_stringify (substr $name, 2, 1); + return $indent . "if (name[0] == '$char1' && name[2] == '$char2') {\n"; + } + + my $pointer = '^'; + my $have_checked_last = defined ($checked_at) && $len == $checked_at + 1; + if ($have_checked_last) { + # Checked at the last character, so no need to memEQ it. + $pointer = C_stringify (chop $name); + $len--; + } + $name = C_stringify ($name); my $body = $indent . "if (memEQ(name, \"$name\", $len)) {\n"; - $body .= $indent . "/* ". (' ' x $checked_at) . '^' - . (' ' x ($len - $checked_at + length $len)) . " */\n" - if defined $checked_at; + # Put a little ^ under the letter we checked at + # Screws up for non printable and non-7 bit stuff, but that's too hard to + # get right. + if (defined $checked_at) { + $body .= $indent . "/* ". (' ' x $checked_at) . $pointer + . (' ' x ($len - $checked_at + length $len)) . " */\n"; + } elsif (defined $front_chop) { + $body .= $indent . "/* $front_chop" + . (' ' x ($len + 1 + length $len)) . " */\n"; + } return $body; } @@ -433,7 +494,7 @@ sub match_clause { $body .= $indent . " } else {\n"; $body .= return_clause ($no, 4 + length $indent); } - $body .= $indent . " }"; + $body .= $indent . " }\n"; } else { $body .= return_clause ($item, 2 + length $indent); } @@ -466,7 +527,11 @@ sub switch_clause { } my @safe_names = @names; foreach (@safe_names) { - next unless tr/A-Za-z0-9_//c; + confess sprintf "Name '$_' is length %d, not $namelen", length + unless length == $namelen; + # Argh. 5.6.1 + # next unless tr/A-Za-z0-9_//c; + next if tr/A-Za-z0-9_// == length; $_ = '"' . perl_stringify ($_) . '"'; # Ensure that the enclosing C comment doesn't end # by turning */ into *" . "/ @@ -478,12 +543,20 @@ sub switch_clause { # Figure out what to switch on. # (RMS, Spread of jump table, Position, Hashref) my @best = (1e38, ~0); - foreach my $i (0 .. ($namelen - 1)) { + # Prefer the last character over the others. (As it lets us shortern the + # memEQ clause at no cost). + foreach my $i ($namelen - 1, 0 .. ($namelen - 2)) { my ($min, $max) = (~0, 0); my %spread; + if ($is_perl56) { + # Need proper Unicode preserving hash keys for bytes in range 128-255 + # here too, for some reason. grr 5.6.1 yet again. + tie %spread, 'ExtUtils::Constant::Aaargh56Hash'; + } foreach (@names) { my $char = substr $_, $i, 1; my $ord = ord $char; + confess "char $ord is out of range" if $ord > 255; $max = $ord if $ord > $max; $min = $ord if $ord < $min; push @{$spread{$char}}, $_; @@ -501,6 +574,8 @@ sub switch_clause { # the string wins. Because if that passes but the memEQ fails, it may # only need the start of the string to bin the choice. # I think. But I'm micro-optimising. :-) + # OK. Trump that. Now favour the last character of the string, before the + # rest. my $ss; $ss += @$_ * @$_ foreach values %spread; my $rms = sqrt ($ss / keys %spread); @@ -508,18 +583,31 @@ sub switch_clause { @best = ($rms, $max - $min, $i, \%spread); } } - die "Internal error. Failed to pick a switch point for @names" + confess "Internal error. Failed to pick a switch point for @names" unless defined $best[2]; # use Data::Dumper; print Dumper (@best); my ($offset, $best) = @best[2,3]; $body .= $indent . "/* Offset $offset gives the best switch position. */\n"; - $body .= $indent . "switch (name[$offset]) {\n"; + + my $do_front_chop = $offset == 0 && $namelen > 2; + if ($do_front_chop) { + $body .= $indent . "switch (*name++) {\n"; + } else { + $body .= $indent . "switch (name[$offset]) {\n"; + } foreach my $char (sort keys %$best) { + confess sprintf "'$char' is %d bytes long, not 1", length $char + if length ($char) != 1; + confess sprintf "char %#X is out of range", ord $char if ord ($char) > 255; $body .= $indent . "case '" . C_stringify ($char) . "':\n"; foreach my $name (sort @{$best->{$char}}) { my $thisone = $items->{$name}; # warn "You are here"; - $body .= match_clause ($thisone, $offset, 2 + length $indent); + if ($do_front_chop) { + $body .= match_clause ($thisone, \$char, 2 + length $indent); + } else { + $body .= match_clause ($thisone, $offset, 2 + length $indent); + } } $body .= $indent . " break;\n"; } @@ -581,7 +669,11 @@ sub dump_names { next if $_->{utf8} eq 'no'; # Copy the hashref, as we don't want to mess with the caller's hashref. $_ = {%$_}; - utf8::decode ($_->{name}); + unless ($is_perl56) { + utf8::decode ($_->{name}); + } else { + $_->{name} = pack 'U*', unpack 'U0U*', $_->{name}; + } delete $_->{utf8}; } } else { @@ -589,7 +681,9 @@ sub dump_names { $type = $default_type; } $used_types{$type}++; - if ($type eq $default_type and 0 == ($_->{name} =~ tr/A-Za-z0-9_//c) + if ($type eq $default_type + # grr 5.6.1 + and length $_->{name} == ($_->{name} =~ tr/A-Za-z0-9_//) and !defined ($_->{macro}) and !defined ($_->{value}) and !defined ($_->{default}) and !defined ($_->{pre}) and !defined ($_->{post}) and !defined ($_->{def_pre}) @@ -836,6 +930,11 @@ sub C_constant { # be a hashref, and pinch %$items from our parent to save recalculation. ($namelen, $items) = @$breakout; } else { + if ($is_perl56) { + # Need proper Unicode preserving hash keys. + $items = {}; + tie %$items, 'ExtUtils::Constant::Aaargh56Hash'; + } $breakout ||= 3; $default_type ||= 'IV'; if (!ref $what) { @@ -870,7 +969,10 @@ sub C_constant { $what->{$default_type} = 1; } warn "ExtUtils::Constant doesn't know how to handle values of type $_ used in macro $name" unless defined $XS_Constant{$item->{type}}; - if ($name !~ tr/\0-\177//c) { + # tr///c is broken on 5.6.1 for utf8, so my original tr/\0-\177//c + # doesn't work. Upgrade to 5.8 + # if ($name !~ tr/\0-\177//c || $] < 5.005_50) { + if ($name =~ tr/\0-\177// == length $name || $] < 5.005_50) { # No characters outside 7 bit ASCII. if (exists $items->{$name}) { die "Multiple definitions for macro $name"; @@ -881,7 +983,12 @@ sub C_constant { if (exists $items->{$name} and ref $items->{$name} ne 'ARRAY') { confess "Unexpected ASCII definition for macro $name"; } - if ($name !~ tr/\0-\377//c) { + # Again, 5.6.1 tr broken, so s/5\.6.*/5\.8\.0/; + # if ($name !~ tr/\0-\377//c) { + if ($name =~ tr/\0-\377// == length $name) { +# if ($] < 5.007) { +# $name = pack "C*", unpack "U*", $name; +# } $item->{utf8} = 'no'; $items->{$name}[1] = $item; push @new_items, $item; @@ -889,7 +996,13 @@ sub C_constant { $item = {%$item}; } # Encode the name as utf8 bytes. - utf8::encode($name); + unless ($is_perl56) { + utf8::encode($name); + } else { +# warn "Was >$name< " . length ${name}; + $name = pack 'C*', unpack 'C*', $name . pack 'U*'; +# warn "Now '${name}' " . length ${name}; + } if ($items->{$name}[0]) { die "Multiple definitions for macro $name"; } @@ -936,7 +1049,18 @@ sub C_constant { next unless $by_length[$i]; # None of this length $body .= " case $i:\n"; if (@{$by_length[$i]} == 1) { - $body .= match_clause ($by_length[$i]->[0]); + my $only_thing = $by_length[$i]->[0]; + if ($only_thing->{utf8}) { + if ($only_thing->{utf8} eq 'yes') { + # With utf8 on flag item is passed in element 0 + $body .= match_clause ([$only_thing]); + } else { + # With utf8 off flag item is passed in element 1 + $body .= match_clause ([undef, $only_thing]); + } + } else { + $body .= match_clause ($only_thing); + } } elsif (@{$by_length[$i]} < $breakout) { $body .= switch_clause (4, '', $i, $items, @{$by_length[$i]}); } else { @@ -1224,7 +1348,7 @@ EOT Writes a file of C code and a file of XS code which you should C<#include> and C<INCLUDE> in the C and XS sections respectively of your module's XS -code. You probaby want to do this in your C<Makefile.PL>, so that you can +code. You probably want to do this in your C<Makefile.PL>, so that you can easily edit the list of constants without touching the rest of your module. The attributes supported are @@ -1301,7 +1425,7 @@ sub WriteConstants { print $c_fh constant_types(); # macro defs print $c_fh "\n"; - # indent is still undef. Until anyone implents indent style rules with it. + # indent is still undef. Until anyone implements indent style rules with it. foreach (C_constant ($ARGS{NAME}, $ARGS{C_SUBNAME}, $ARGS{DEFAULT_TYPE}, $types, undef, $ARGS{BREAKOUT_AT}, @{$ARGS{NAMES}})) { print $c_fh $_, "\n"; # C constant subs @@ -1313,6 +1437,28 @@ sub WriteConstants { close $xs_fh or warn "Error closing $ARGS{XS_FILE}: $!"; } +package ExtUtils::Constant::Aaargh56Hash; +# A support module (hack) to provide sane Unicode hash keys on 5.6.x perl +use strict; +require Tie::Hash if $ExtUtils::Constant::is_perl56; +use vars '@ISA'; +@ISA = 'Tie::StdHash'; + +#my $a; +# Storing the values as concatenated BER encoded numbers is actually going to +# be terser than using UTF8 :-) +# And the tests are slightly faster. Ops are bad, m'kay +sub to_key {pack "w*", unpack "U*", ($_[0] . pack "U*")}; +sub from_key {defined $_[0] ? pack "U*", unpack 'w*', $_[0] : undef}; + +sub STORE { $_[0]->{to_key($_[1])} = $_[2] } +sub FETCH { $_[0]->{to_key($_[1])} } +sub FIRSTKEY { my $a = scalar keys %{$_[0]}; from_key (each %{$_[0]}) } +sub NEXTKEY { from_key (each %{$_[0]}) } +sub EXISTS { exists $_[0]->{to_key($_[1])} } +sub DELETE { delete $_[0]->{to_key($_[1])} } + +#END {warn "$a accesses";} 1; __END__ diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Installed.pm b/gnu/usr.bin/perl/lib/ExtUtils/Installed.pm index 1375a8299fd..8b0c53c4811 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/Installed.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/Installed.pm @@ -9,21 +9,28 @@ use Config; use File::Find; use File::Basename; use File::Spec; -require VMS::Filespec if $^O eq 'VMS'; - -use vars qw($VERSION); -$VERSION = '0.06'; +my $Is_VMS = $^O eq 'VMS'; my $DOSISH = ($^O =~ /^(MSWin\d\d|os2|dos|mint)$/); +require VMS::Filespec if $Is_VMS; + +use vars qw($VERSION); +$VERSION = '0.08'; + sub _is_prefix { my ($self, $path, $prefix) = @_; return unless defined $prefix && defined $path; - if( $^O eq 'VMS' ) { + if( $Is_VMS ) { $prefix = VMS::Filespec::unixify($prefix); $path = VMS::Filespec::unixify($path); } + + # Sloppy Unix path normalization. + $prefix =~ s{/+}{/}g; + $path =~ s{/+}{/}g; + return 1 if substr($path, 0, length($prefix)) eq $prefix; if ($DOSISH) { @@ -78,7 +85,7 @@ sub new { my $sitearch = $Config{sitearchexp}; # File::Find does not know how to deal with VMS filepaths. - if( $^O eq 'VMS' ) { + if( $Is_VMS ) { $archlib = VMS::Filespec::unixify($archlib); $sitearch = VMS::Filespec::unixify($sitearch); } @@ -96,7 +103,7 @@ sub new { # Read the module packlists my $sub = sub { # Only process module .packlists - return if ($_) ne ".packlist" || $File::Find::dir eq $archlib; + return if $_ ne ".packlist" || $File::Find::dir eq $archlib; # Hack of the leading bits of the paths & convert to a module name my $module = $File::Find::name; @@ -110,7 +117,9 @@ sub new { $self->{$module}{version} = ''; foreach my $dir (@INC) { my $p = File::Spec->catfile($dir, $modfile); - if (-f $p) { + if (-r $p) { + $module = _module_name($p, $module) if $Is_VMS; + require ExtUtils::MM; $self->{$module}{version} = MM->parse_version($p); last; @@ -128,6 +137,36 @@ sub new { return(bless($self, $class)); } +# VMS's non-case preserving file-system means the package name can't +# be reconstructed from the filename. +sub _module_name { + my($file, $orig_module) = @_; + + my $module = ''; + if (open PACKFH, $file) { + while (<PACKFH>) { + if (/package\s+(\S+)\s*;/) { + my $pack = $1; + # Make a sanity check, that lower case $module + # is identical to lowercase $pack before + # accepting it + if (lc($pack) eq lc($orig_module)) { + $module = $pack; + last; + } + } + } + close PACKFH; + } + + print STDERR "Couldn't figure out the package name for $file\n" + unless $module; + + return $module; +} + + + sub modules { my ($self) = @_; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/Liblist/Kid.pm b/gnu/usr.bin/perl/lib/ExtUtils/Liblist/Kid.pm index a7e4c2d6f65..65445092509 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/Liblist/Kid.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/Liblist/Kid.pm @@ -8,8 +8,9 @@ package ExtUtils::Liblist::Kid; use 5.00503; # Broken out of MakeMaker from version 4.11 +use strict; use vars qw($VERSION); -$VERSION = 1.29; +$VERSION = 1.30; use Config; use Cwd 'cwd'; @@ -24,6 +25,8 @@ sub ext { sub _unix_os2_ext { my($self,$potential_libs, $verbose, $give_libs) = @_; + $verbose ||= 0; + if ($^O =~ 'os2' and $Config{perllibs}) { # Dynamic libraries are not transitive, so we may need including # the libraries linked against perl.dll again. @@ -34,8 +37,8 @@ sub _unix_os2_ext { return ("", "", "", "", ($give_libs ? [] : ())) unless $potential_libs; warn "Potential libraries are '$potential_libs':\n" if $verbose; - my($so) = $Config{'so'}; - my($libs) = $Config{'perllibs'}; + my($so) = $Config{so}; + my($libs) = defined $Config{perllibs} ? $Config{perllibs} : $Config{libs}; my $Config_libext = $Config{lib_ext} || ".a"; @@ -146,9 +149,6 @@ sub _unix_os2_ext { 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++; @@ -157,7 +157,14 @@ sub _unix_os2_ext { # what do we know about this library... my $is_dyna = ($fullname !~ /\Q$Config_libext\E\z/); - my $in_perl = ($libs =~ /\B-l\Q$ {thislib}\E\b/s); + my $in_perl = ($libs =~ /\B-l\Q${thislib}\E\b/s); + + # include the path to the lib once in the dynamic linker path + # but only if it is a dynamic lib and not in Perl itself + my($fullnamedir) = dirname($fullname); + push @ld_run_path, $fullnamedir + if $is_dyna && !$in_perl && + !$ld_run_path_seen{$fullnamedir}++; # Do not add it into the list if it is already linked in # with the main perl executable. @@ -212,6 +219,7 @@ sub _win32_ext { require Text::ParseWords; my($self, $potential_libs, $verbose, $give_libs) = @_; + $verbose ||= 0; # If user did not supply a list, we punt. # (caller should probably use the list in $Config{libs}) @@ -340,7 +348,7 @@ sub _win32_ext { # give up warn "Note (probably harmless): " - ."No library found for '$thislib'\n" + ."No library found for $thislib\n" unless $found_lib>0; } @@ -364,9 +372,11 @@ sub _win32_ext { sub _vms_ext { my($self, $potential_libs,$verbose,$give_libs) = @_; + $verbose ||= 0; + my(@crtls,$crtlstr); my($dbgqual) = $self->{OPTIMIZE} || $Config{'optimize'} || - $self->{CCFLAS} || $Config{'ccflags'}; + $self->{CCFLAGS} || $Config{'ccflags'}; @crtls = ( ($dbgqual =~ m-/Debug-i ? $Config{'dbgprefix'} : '') . 'PerlShr/Share' ); push(@crtls, grep { not /\(/ } split /\s+/, $Config{'perllibs'}); @@ -398,8 +408,8 @@ sub _vms_ext { 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 + # List of common Unix library names and their VMS equivalents + # (VMS equivalent of '' indicates that the library is automatically # searched by the linker, and should be skipped here.) my(@flibs, %libs_seen); my %libmap = ( 'm' => '', 'f77' => '', 'F77' => '', 'V77' => '', 'c' => '', @@ -447,7 +457,7 @@ sub _vms_ext { $lib = $libmap{$lib}; } - my(@variants,$variant,$name,$test,$cand); + my(@variants,$variant,$cand); my($ctype) = ''; # If we don't have a file type, consider it a possibly abbreviated name and @@ -461,44 +471,49 @@ sub _vms_ext { push(@variants,$lib); warn "Looking for $lib\n" if $verbose; foreach $variant (@variants) { + my($fullname, $name); + foreach $dir (@dirs) { my($type); $name = "$dir$variant"; warn "\tChecking $name\n" if $verbose > 2; - if (-f ($test = VMS::Filespec::rmsexpand($name))) { + $fullname = VMS::Filespec::rmsexpand($name); + if (defined $fullname and -f $fullname) { # It's got its own suffix, so we'll have to figure out the type - if ($test =~ /(?:$so|exe)$/i) { $type = 'SHR'; } - elsif ($test =~ /(?:$lib_ext|olb)$/i) { $type = 'OLB'; } - elsif ($test =~ /(?:$obj_ext|obj)$/i) { + if ($fullname =~ /(?:$so|exe)$/i) { $type = 'SHR'; } + elsif ($fullname =~ /(?:$lib_ext|olb)$/i) { $type = 'OLB'; } + elsif ($fullname =~ /(?:$obj_ext|obj)$/i) { warn "Note (probably harmless): " - ."Plain object file $test found in library list\n"; + ."Plain object file $fullname found in library list\n"; $type = 'OBJ'; } else { warn "Note (probably harmless): " - ."Unknown library type for $test; assuming shared\n"; + ."Unknown library type for $fullname; assuming shared\n"; $type = 'SHR'; } } - elsif (-f ($test = VMS::Filespec::rmsexpand($name,$so)) or - -f ($test = VMS::Filespec::rmsexpand($name,'.exe'))) { + elsif (-f ($fullname = VMS::Filespec::rmsexpand($name,$so)) or + -f ($fullname = VMS::Filespec::rmsexpand($name,'.exe'))) { $type = 'SHR'; - $name = $test unless $test =~ /exe;?\d*$/i; + $name = $fullname unless $fullname =~ /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')))) { + elsif (not length($ctype) and # If we've got a lib already, + # don't bother + ( -f ($fullname = VMS::Filespec::rmsexpand($name,$lib_ext)) or + -f ($fullname = VMS::Filespec::rmsexpand($name,'.olb')))) { $type = 'OLB'; - $name = $test unless $test =~ /olb;?\d*$/i; + $name = $fullname unless $fullname =~ /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')))) { + elsif (not length($ctype) and # If we've got a lib already, + # don't bother + ( -f ($fullname = VMS::Filespec::rmsexpand($name,$obj_ext)) or + -f ($fullname = VMS::Filespec::rmsexpand($name,'.obj')))) { warn "Note (probably harmless): " - ."Plain object file $test found in library list\n"; + ."Plain object file $fullname found in library list\n"; $type = 'OBJ'; - $name = $test unless $test =~ /obj;?\d*$/i; + $name = $fullname unless $fullname =~ /obj;?\d*$/i; } if (defined $type) { $ctype = $type; $cand = $name; @@ -509,7 +524,8 @@ sub _vms_ext { # 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; + warn "\tFound as $cand (really $fullname), type $ctype\n" + if $verbose > 1; push @flibs, $name unless $libs_seen{$fullname}++; next LIB; } diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MANIFEST.SKIP b/gnu/usr.bin/perl/lib/ExtUtils/MANIFEST.SKIP index 61dde53cedb..62b78eea268 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MANIFEST.SKIP +++ b/gnu/usr.bin/perl/lib/ExtUtils/MANIFEST.SKIP @@ -1,17 +1,17 @@ -# Avoid version control files. -\bRCS\b +\.ppd$ \bCVS\b -,v$ - -# Avoid Makemaker generated and utility files. -^MANIFEST\.bak -^Makefile$ -^blib/ -^MakeMaker-\d -^pm_to_blib$ - -# Avoid temp and backup files. ~$ +t/lib/File/ +t/Big-Dummy +t/Problem-Module +.gz$ +.bak$ +Makefile$ +MANIFEST.perl$ \.old$ -\#$ -^\.# +merge_bleadperl$ +^blib/ +^pm_to_blib +.DS_Store +\# +^bleadperl\.patch$ diff --git a/gnu/usr.bin/perl/lib/ExtUtils/META.yml b/gnu/usr.bin/perl/lib/ExtUtils/META.yml new file mode 100644 index 00000000000..c8515482daa --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/META.yml @@ -0,0 +1,14 @@ +# http://module-build.sourceforge.net/META-spec.html +#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# +name: ExtUtils-MakeMaker +version: 6.17 +version_from: lib/ExtUtils/MakeMaker.pm +installdirs: perl +requires: + DirHandle: 0 + File::Basename: 0 + File::Spec: 0.8 + Pod::Man: 0 + +distribution_type: module +generated_by: ExtUtils::MakeMaker version 6.17 diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_Any.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_Any.pm index fb48ae2831a..5d8d640b682 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_Any.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_Any.pm @@ -2,7 +2,8 @@ package ExtUtils::MM_Any; use strict; use vars qw($VERSION @ISA); -$VERSION = 0.04; +$VERSION = 0.07; +@ISA = qw(File::Spec); use Config; use File::Spec; @@ -10,7 +11,7 @@ use File::Spec; =head1 NAME -ExtUtils::MM_Any - Platform agnostic MM methods +ExtUtils::MM_Any - Platform-agnostic MM methods =head1 SYNOPSIS @@ -41,95 +42,418 @@ B<THIS MAY BE TEMPORARY!> These are methods which are by their nature cross-platform and should always be cross-platform. -=head2 File::Spec wrappers B<DEPRECATED> - -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. +=over 4 -They are all deprecated. Please use File::Spec directly. +=item installvars -=over 4 + my @installvars = $mm->installvars; -=item canonpath +A list of all the INSTALL* variables without the INSTALL prefix. Useful +for iteration or building related variable sets. =cut -sub canonpath { - shift; - return File::Spec->canonpath(@_);; +sub installvars { + return qw(PRIVLIB SITELIB VENDORLIB + ARCHLIB SITEARCH VENDORARCH + BIN SITEBIN VENDORBIN + SCRIPT + MAN1DIR SITEMAN1DIR VENDORMAN1DIR + MAN3DIR SITEMAN3DIR VENDORMAN3DIR + ); } -=item catdir +=item os_flavor_is + + $mm->os_flavor_is($this_flavor); + $mm->os_flavor_is(@one_of_these_flavors); + +Checks to see if the current operating system is one of the given flavors. + +This is useful for code like: + + if( $mm->os_flavor_is('Unix') ) { + $out = `foo 2>&1`; + } + else { + $out = `foo`; + } =cut -sub catdir { - shift; - return File::Spec->catdir(@_); +sub os_flavor_is { + my $self = shift; + my %flavors = map { ($_ => 1) } $self->os_flavor; + return (grep { $flavors{$_} } @_) ? 1 : 0; } +=back + +=head2 File::Spec wrappers + +ExtUtils::MM_Any is a subclass of File::Spec. The methods noted here +override File::Spec. + +=over 4 + =item catfile +File::Spec <= 0.83 has a bug where the file part of catfile is not +canonicalized. This override fixes that bug. + =cut sub catfile { - shift; - return File::Spec->catfile(@_); + my $self = shift; + return $self->canonpath($self->SUPER::catfile(@_)); +} + +=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. They may +require partial overrides. + +=over 4 + +=item B<split_command> + + my @cmds = $MM->split_command($cmd, @args); + +Most OS have a maximum command length they can execute at once. Large +modules can easily generate commands well past that limit. Its +necessary to split long commands up into a series of shorter commands. + +split_command() will return a series of @cmds each processing part of +the args. Collectively they will process all the arguments. Each +individual line in @cmds will not be longer than the +$self->max_exec_len being careful to take into account macro expansion. + +$cmd should include any switches and repeated initial arguments. + +If no @args are given, no @cmds will be returned. + +Pairs of arguments will always be preserved in a single command, this +is a heuristic for things like pm_to_blib and pod2man which work on +pairs of arguments. This makes things like this safe: + + $self->split_command($cmd, %pod2man); + + +=cut + +sub split_command { + my($self, $cmd, @args) = @_; + + my @cmds = (); + return(@cmds) unless @args; + + # If the command was given as a here-doc, there's probably a trailing + # newline. + chomp $cmd; + + # set aside 20% for macro expansion. + my $len_left = int($self->max_exec_len * 0.80); + $len_left -= length $self->_expand_macros($cmd); + + do { + my $arg_str = ''; + my @next_args; + while( @next_args = splice(@args, 0, 2) ) { + # Two at a time to preserve pairs. + my $next_arg_str = "\t ". join ' ', @next_args, "\n"; + + if( !length $arg_str ) { + $arg_str .= $next_arg_str + } + elsif( length($arg_str) + length($next_arg_str) > $len_left ) { + unshift @args, @next_args; + last; + } + else { + $arg_str .= $next_arg_str; + } + } + chop $arg_str; + + push @cmds, $self->escape_newlines("$cmd\n$arg_str"); + } while @args; + + return @cmds; +} + + +sub _expand_macros { + my($self, $cmd) = @_; + + $cmd =~ s{\$\((\w+)\)}{ + defined $self->{$1} ? $self->{$1} : "\$($1)" + }e; + return $cmd; +} + + +=item B<echo> + + my @commands = $MM->echo($text); + my @commands = $MM->echo($text, $file); + my @commands = $MM->echo($text, $file, $appending); + +Generates a set of @commands which print the $text to a $file. + +If $file is not given, output goes to STDOUT. + +If $appending is true the $file will be appended to rather than +overwritten. + +=cut + +sub echo { + my($self, $text, $file, $appending) = @_; + $appending ||= 0; + + my @cmds = map { '$(NOECHO) $(ECHO) '.$self->quote_literal($_) } + split /\n/, $text; + if( $file ) { + my $redirect = $appending ? '>>' : '>'; + $cmds[0] .= " $redirect $file"; + $_ .= " >> $file" foreach @cmds[1..$#cmds]; + } + + return @cmds; +} + + +=item init_VERSION + + $mm->init_VERSION + +Initialize macros representing versions of MakeMaker and other tools + +MAKEMAKER: path to the MakeMaker module. + +MM_VERSION: ExtUtils::MakeMaker Version + +MM_REVISION: ExtUtils::MakeMaker version control revision (for backwards + compat) + +VERSION: version of your module + +VERSION_MACRO: which macro represents the version (usually 'VERSION') + +VERSION_SYM: like version but safe for use as an RCS revision number + +DEFINE_VERSION: -D line to set the module version when compiling + +XS_VERSION: version in your .xs file. Defaults to $(VERSION) + +XS_VERSION_MACRO: which macro represents the XS version. + +XS_DEFINE_VERSION: -D line to set the xs version when compiling. + +Called by init_main. + +=cut + +sub init_VERSION { + my($self) = shift; + + $self->{MAKEMAKER} = $ExtUtils::MakeMaker::Filename; + $self->{MM_VERSION} = $ExtUtils::MakeMaker::VERSION; + $self->{MM_REVISION}= $ExtUtils::MakeMaker::Revision; + $self->{VERSION_FROM} ||= ''; + + if ($self->{VERSION_FROM}){ + $self->{VERSION} = $self->parse_version($self->{VERSION_FROM}); + if( $self->{VERSION} eq 'undef' ) { + require Carp; + Carp::carp("WARNING: Setting VERSION via file ". + "'$self->{VERSION_FROM}' failed\n"); + } + } + + # strip blanks + if (defined $self->{VERSION}) { + $self->{VERSION} =~ s/^\s+//; + $self->{VERSION} =~ s/\s+$//; + } + else { + $self->{VERSION} = ''; + } + + + $self->{VERSION_MACRO} = 'VERSION'; + ($self->{VERSION_SYM} = $self->{VERSION}) =~ s/\W/_/g; + $self->{DEFINE_VERSION} = '-D$(VERSION_MACRO)=\"$(VERSION)\"'; + + + # Graham Barr and Paul Marquess had some ideas how to ensure + # version compatibility between the *.pm file and the + # corresponding *.xs file. The bottomline was, that we need an + # XS_VERSION macro that defaults to VERSION: + $self->{XS_VERSION} ||= $self->{VERSION}; + + $self->{XS_VERSION_MACRO} = 'XS_VERSION'; + $self->{XS_DEFINE_VERSION} = '-D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"'; + } -=item curdir +=item wraplist + +Takes an array of items and turns them into a well-formatted list of +arguments. In most cases this is simply something like: + + FOO \ + BAR \ + BAZ =cut -my $Curdir = File::Spec->curdir; -sub curdir { - return $Curdir; +sub wraplist { + my $self = shift; + return join " \\\n\t", @_; } -=item file_name_is_absolute +=item manifypods + +Defines targets and routines to translate the pods into manpages and +put them into the INST_* directories. =cut -sub file_name_is_absolute { - shift; - return File::Spec->file_name_is_absolute(@_); +sub manifypods { + my $self = shift; + + my $POD2MAN_macro = $self->POD2MAN_macro(); + my $manifypods_target = $self->manifypods_target(); + + return <<END_OF_TARGET; + +$POD2MAN_macro + +$manifypods_target + +END_OF_TARGET + } -=item path + +=item manifypods_target + + my $manifypods_target = $self->manifypods_target; + +Generates the manifypods target. This target generates man pages from +all POD files in MAN1PODS and MAN3PODS. =cut -sub path { - return File::Spec->path(); +sub manifypods_target { + my($self) = shift; + + my $man1pods = ''; + my $man3pods = ''; + my $dependencies = ''; + + # populate manXpods & dependencies: + foreach my $name (keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}}) { + $dependencies .= " \\\n\t$name"; + } + + foreach my $name (keys %{$self->{MAN3PODS}}) { + $dependencies .= " \\\n\t$name" + } + + my $manify = <<END; +manifypods : pure_all $dependencies +END + + my @man_cmds; + foreach my $section (qw(1 3)) { + my $pods = $self->{"MAN${section}PODS"}; + push @man_cmds, $self->split_command(<<CMD, %$pods); + \$(NOECHO) \$(POD2MAN) --section=$section --perm_rw=\$(PERM_RW) +CMD + } + + $manify .= "\t\$(NOECHO) \$(NOOP)\n" unless @man_cmds; + $manify .= join '', map { "$_\n" } @man_cmds; + + return $manify; } -=item rootdir + +=item makemakerdflt_target + + my $make_frag = $mm->makemakerdflt_target + +Returns a make fragment with the makemakerdeflt_target specified. +This target is the first target in the Makefile, is the default target +and simply points off to 'all' just in case any make variant gets +confused or something gets snuck in before the real 'all' target. =cut -my $Rootdir = File::Spec->rootdir; -sub rootdir { - return $Rootdir; +sub makemakerdflt_target { + return <<'MAKE_FRAG'; +makemakerdflt: all + $(NOECHO) $(NOOP) +MAKE_FRAG + } -=item updir + +=item special_targets + + my $make_frag = $mm->special_targets + +Returns a make fragment containing any targets which have special +meaning to make. For example, .SUFFIXES and .PHONY. =cut -my $Updir = File::Spec->updir; -sub updir { - return $Updir; +sub special_targets { + my $make_frag = <<'MAKE_FRAG'; +.SUFFIXES: .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT) + +.PHONY: all config static dynamic test linkext manifest + +MAKE_FRAG + + $make_frag .= <<'MAKE_FRAG' if $ENV{CLEARCASE_ROOT}; +.NO_CONFIG_REC: Makefile + +MAKE_FRAG + + return $make_frag; } -=back +=item POD2MAN_macro -=head1 Thought To Be Cross-Platform Methods + my $pod2man_macro = $self->POD2MAN_macro -These are methods which are thought to be cross-platform by virtue of -having been written in a way to avoid incompatibilities. +Returns a definition for the POD2MAN macro. This is a program +which emulates the pod2man utility. You can add more switches to the +command by simply appending them on the macro. + +Typical usage: + + $(POD2MAN) --section=3 --perm_rw=$(PERM_RW) podfile1 man_page1 ... + +=cut + +sub POD2MAN_macro { + my $self = shift; + +# Need the trailing '--' so perl stops gobbling arguments and - happens +# to be an alternative end of line seperator on VMS so we quote it + return <<'END_OF_DEF'; +POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--" +POD2MAN = $(POD2MAN_EXE) +END_OF_DEF +} -=over 4 =item test_via_harness @@ -167,12 +491,361 @@ sub test_via_script { return qq{\t$perl "-I\$(INST_LIB)" "-I\$(INST_ARCHLIB)" $script\n}; } +=item libscan + + my $wanted = $self->libscan($path); + +Takes a path to a file or dir and returns an empty string if we don't +want to include this file in the library. Otherwise it returns the +the $path unchanged. + +Mainly used to exclude RCS, CVS, and SCCS directories from +installation. + +=cut + +sub libscan { + my($self,$path) = @_; + my($dirs,$file) = ($self->splitpath($path))[1,2]; + return '' if grep /^(?:RCS|CVS|SCCS|\.svn)$/, + $self->splitdir($dirs), $file; + + return $path; +} + +=item tool_autosplit + +Defines a simple perl call that runs autosplit. May be deprecated by +pm_to_blib soon. + +=cut + +sub tool_autosplit { + my($self, %attribs) = @_; + + my $maxlen = $attribs{MAXLEN} ? '$$AutoSplit::Maxlen=$attribs{MAXLEN};' + : ''; + + my $asplit = $self->oneliner(sprintf <<'PERL_CODE', $maxlen); +use AutoSplit; %s autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) +PERL_CODE + + return sprintf <<'MAKE_FRAG', $asplit; +# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto +AUTOSPLITFILE = %s + +MAKE_FRAG + +} + + +=item all_target + +Generate the default target 'all'. + +=cut + +sub all_target { + my $self = shift; + + return <<'MAKE_EXT'; +all :: pure_all + $(NOECHO) $(NOOP) +MAKE_EXT + +} + + +=item metafile_target + + my $target = $mm->metafile_target; + +Generate the metafile target. + +Writes the file META.yml, YAML encoded meta-data about the module. The +format follows Module::Build's as closely as possible. Additionally, we +include: + + version_from + installdirs + +=cut + +sub metafile_target { + my $self = shift; + + return <<'MAKE_FRAG' if $self->{NO_META}; +metafile: + $(NOECHO) $(NOOP) +MAKE_FRAG + + my $prereq_pm = ''; + foreach my $mod ( sort { lc $a cmp lc $b } keys %{$self->{PREREQ_PM}} ) { + my $ver = $self->{PREREQ_PM}{$mod}; + $prereq_pm .= sprintf " %-30s %s\n", "$mod:", $ver; + } + + my $meta = <<YAML; +# http://module-build.sourceforge.net/META-spec.html +#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# +name: $self->{DISTNAME} +version: $self->{VERSION} +version_from: $self->{VERSION_FROM} +installdirs: $self->{INSTALLDIRS} +requires: +$prereq_pm +distribution_type: module +generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION +YAML + + my @write_meta = $self->echo($meta, 'META.yml'); + return sprintf <<'MAKE_FRAG', join "\n\t", @write_meta; +metafile : + %s +MAKE_FRAG + +} + + +=item metafile_addtomanifest_target + + my $target = $mm->metafile_addtomanifest_target + +Adds the META.yml file to the MANIFEST. + +=cut + +sub metafile_addtomanifest_target { + my $self = shift; + + return <<'MAKE_FRAG' if $self->{NO_META}; +metafile_addtomanifest: + $(NOECHO) $(NOOP) +MAKE_FRAG + + my $add_meta = $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']); +eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) } + or print "Could not add META.yml to MANIFEST: $${'@'}\n" +CODE + + return sprintf <<'MAKE_FRAG', $add_meta; +metafile_addtomanifest: + $(NOECHO) %s +MAKE_FRAG + +} + + +=back + +=head2 Abstract methods + +Methods which cannot be made cross-platform and each subclass will +have to do their own implementation. + +=over 4 + +=item oneliner + + my $oneliner = $MM->oneliner($perl_code); + my $oneliner = $MM->oneliner($perl_code, \@switches); + +This will generate a perl one-liner safe for the particular platform +you're on based on the given $perl_code and @switches (a -e is +assumed) suitable for using in a make target. It will use the proper +shell quoting and escapes. + +$(PERLRUN) will be used as perl. + +Any newlines in $perl_code will be escaped. Leading and trailing +newlines will be stripped. Makes this idiom much easier: + + my $code = $MM->oneliner(<<'CODE', [...switches...]); +some code here +another line here +CODE + +Usage might be something like: + + # an echo emulation + $oneliner = $MM->oneliner('print "Foo\n"'); + $make = '$oneliner > somefile'; + +All dollar signs must be doubled in the $perl_code if you expect them +to be interpreted normally, otherwise it will be considered a make +macro. Also remember to quote make macros else it might be used as a +bareword. For example: + + # Assign the value of the $(VERSION_FROM) make macro to $vf. + $oneliner = $MM->oneliner('$$vf = "$(VERSION_FROM)"'); + +Its currently very simple and may be expanded sometime in the figure +to include more flexible code and switches. + + +=item B<quote_literal> + + my $safe_text = $MM->quote_literal($text); + +This will quote $text so it is interpreted literally in the shell. + +For example, on Unix this would escape any single-quotes in $text and +put single-quotes around the whole thing. + + +=item B<escape_newlines> + + my $escaped_text = $MM->escape_newlines($text); + +Shell escapes newlines in $text. + + +=item max_exec_len + + my $max_exec_len = $MM->max_exec_len; + +Calculates the maximum command size the OS can exec. Effectively, +this is the max size of a shell command line. + +=for _private +$self->{_MAX_EXEC_LEN} is set by this method, but only for testing purposes. + +=item B<init_others> + + $MM->init_others(); + +Initializes the macro definitions used by tools_other() and places them +in the $MM object. + +If there is no description, its the same as the parameter to +WriteMakefile() documented in ExtUtils::MakeMaker. + +Defines at least these macros. + + Macro Description + + NOOP Do nothing + NOECHO Tell make not to display the command itself + + MAKEFILE + FIRST_MAKEFILE + MAKEFILE_OLD + MAKE_APERL_FILE File used by MAKE_APERL + + SHELL Program used to run + shell commands + + ECHO Print text adding a newline on the end + RM_F Remove a file + RM_RF Remove a directory + TOUCH Update a file's timestamp + TEST_F Test for a file's existence + CP Copy a file + MV Move a file + CHMOD Change permissions on a + file + + UMASK_NULL Nullify umask + DEV_NULL Supress all command output + +=item init_DIRFILESEP + + $MM->init_DIRFILESEP; + my $dirfilesep = $MM->{DIRFILESEP}; + +Initializes the DIRFILESEP macro which is the seperator between the +directory and filename in a filepath. ie. / on Unix, \ on Win32 and +nothing on VMS. + +For example: + + # instead of $(INST_ARCHAUTODIR)/extralibs.ld + $(INST_ARCHAUTODIR)$(DIRFILESEP)extralibs.ld + +Something of a hack but it prevents a lot of code duplication between +MM_* variants. + +Do not use this as a seperator between directories. Some operating +systems use different seperators between subdirectories as between +directories and filenames (for example: VOLUME:[dir1.dir2]file on VMS). + +=item init_linker + + $mm->init_linker; + +Initialize macros which have to do with linking. + +PERL_ARCHIVE: path to libperl.a equivalent to be linked to dynamic +extensions. + +PERL_ARCHIVE_AFTER: path to a library which should be put on the +linker command line I<after> the external libraries to be linked to +dynamic extensions. This may be needed if the linker is one-pass, and +Perl includes some overrides for C RTL functions, such as malloc(). + +EXPORT_LIST: name of a file that is passed to linker to define symbols +to be exported. + +Some OSes do not need these in which case leave it blank. + + +=item init_platform + + $mm->init_platform + +Initialize any macros which are for platform specific use only. + +A typical one is the version number of your OS specific mocule. +(ie. MM_Unix_VERSION or MM_VMS_VERSION). + +=item platform_constants + + my $make_frag = $mm->platform_constants + +Returns a make fragment defining all the macros initialized in +init_platform() rather than put them in constants(). + +=cut + +sub init_platform { + return ''; +} + +sub platform_constants { + return ''; +} + +=item os_flavor + + my @os_flavor = $mm->os_flavor; + +@os_flavor is the style of operating system this is, usually +corresponding to the MM_*.pm file we're using. + +The first element of @os_flavor is the major family (ie. Unix, +Windows, VMS, OS/2, MacOS, etc...) and the rest are sub families. + +Some examples: + + Cygwin98 ('Unix', 'Cygwin', 'Cygwin9x') + Windows NT ('Win32', 'WinNT') + Win98 ('Win32', 'Win9x') + Linux ('Unix', 'Linux') + MacOS Classic ('MacOS', 'MacOS Classic') + MacOS X ('Unix', 'Darwin', 'MacOS', 'MacOS X') + OS/2 ('OS/2') + +This is used to write code for styles of operating system. +See os_flavor_is() for use. + + =back =head1 AUTHOR -Michael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix -and ExtUtils::MM_Win32. +Michael G Schwern <schwern@pobox.com> and the denizens of +makemaker@perl.org with code from ExtUtils::MM_Unix and +ExtUtils::MM_Win32. =cut diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_BeOS.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_BeOS.pm index 5118747bae7..e0b3390b0f0 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_BeOS.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_BeOS.pm @@ -25,21 +25,33 @@ require ExtUtils::MM_Unix; use vars qw(@ISA $VERSION); @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -$VERSION = 1.03; +$VERSION = 1.04; -=item perl_archive +=item os_flavor (o) -This is internal method that returns path to libperl.a equivalent -to be linked to dynamic extensions. UNIX does not have one, but at -least BeOS has one. +BeOS is BeOS. =cut -sub perl_archive - { - return File::Spec->catdir('$(PERL_INC)',$Config{libperl}); - } +sub os_flavor { + return('BeOS'); +} + +=item init_linker + +libperl.a equivalent to be linked to dynamic extensions. + +=cut + +sub init_linker { + my($self) = shift; + + $self->{PERL_ARCHIVE} ||= + File::Spec->catdir('$(PERL_INC)',$Config{libperl}); + $self->{PERL_ARCHIVE_AFTER} ||= ''; + $self->{EXPORT_LIST} ||= ''; +} =back diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_Cygwin.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_Cygwin.pm index 3c37ffd9f7e..4529895fa0a 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_Cygwin.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_Cygwin.pm @@ -10,7 +10,38 @@ require ExtUtils::MM_Any; require ExtUtils::MM_Unix; @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -$VERSION = 1.04; +$VERSION = 1.06; + + +=head1 NAME + +ExtUtils::MM_Cygwin - methods to override UN*X behaviour in ExtUtils::MakeMaker + +=head1 SYNOPSIS + + use ExtUtils::MM_Cygwin; # Done internally by ExtUtils::MakeMaker if needed + +=head1 DESCRIPTION + +See ExtUtils::MM_Unix for a documentation of the methods provided there. + +=over 4 + +=item os_flavor (o) + +We're Unix and Cygwin. + +=cut + +sub os_flavor { + return('Unix', 'Cygwin'); +} + +=item cflags (o) + +if configured for dynamic loading, triggers #define EXT in EXTERN.h + +=cut sub cflags { my($self,$libperl)=@_; @@ -31,97 +62,45 @@ PERLTYPE = $self->{PERLTYPE} } -sub manifypods { - my($self, %attribs) = @_; - return "\nmanifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n" unless - %{$self->{MAN3PODS}} or %{$self->{MAN1PODS}}; - my($dist); - my($pod2man_exe); - if (defined $self->{PERL_SRC}) { - $pod2man_exe = File::Spec->catfile($self->{PERL_SRC},'pod','pod2man'); - } else { - $pod2man_exe = File::Spec->catfile($Config{scriptdirexp},'pod2man'); - } - unless ($self->perl_script($pod2man_exe)) { - # No pod2man but some MAN3PODS to be installed - print <<END; -Warning: I could not locate your pod2man program. Please make sure, - your pod2man program is in your PATH before you execute 'make' +=item replace_manpage_separator (o) -END - $pod2man_exe = "-S pod2man"; - } - my(@m) = (); - push @m, -qq[POD2MAN_EXE = $pod2man_exe\n], -qq[POD2MAN = \$(PERL) -we '%m=\@ARGV;for (keys %m){' \\\n], -q[-e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "], - $self->{MAKEFILE}, q[";' \\ --e 'print "Manifying $$m{$$_}\n"; $$m{$$_} =~ s/::/./g;' \\ --e 'system(qq[$(PERLRUN) $(POD2MAN_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, "\nmanifypods : pure_all "; - push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, - keys %{$self->{MAN3PODS}}; - - push(@m,"\n"); - if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) { - grep { $self->{MAN1PODS}{$_} =~ s/::/./g } keys %{$self->{MAN1PODS}}; - grep { $self->{MAN3PODS}{$_} =~ s/::/./g } keys %{$self->{MAN3PODS}}; - push @m, "\t$self->{NOECHO}\$(POD2MAN) \\\n\t"; - push @m, join " \\\n\t", %{$self->{MAN1PODS}}, %{$self->{MAN3PODS}}; - } - join('', @m); +replaces strings '::' with '.' in MAN*POD man page names + +=cut + +sub replace_manpage_separator { + my($self, $man) = @_; + $man =~ s{/+}{.}g; + return $man; } -sub perl_archive { +=item init_linker + +points to libperl.a + +=cut + +sub init_linker { + my $self = shift; + if ($Config{useshrplib} eq 'true') { my $libperl = '$(PERL_INC)' .'/'. "$Config{libperl}"; if( $] >= 5.007 ) { $libperl =~ s/a$/dll.a/; } - return $libperl; + $self->{PERL_ARCHIVE} = $libperl; } else { - return '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a"); + $self->{PERL_ARCHIVE} = + '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a"); } -} - -1; -__END__ -=head1 NAME - -ExtUtils::MM_Cygwin - methods to override UN*X behaviour in ExtUtils::MakeMaker - -=head1 SYNOPSIS - - use ExtUtils::MM_Cygwin; # Done internally by ExtUtils::MakeMaker if needed - -=head1 DESCRIPTION - -See ExtUtils::MM_Unix for a documentation of the methods provided there. - -=over 4 - -=item canonpath - -replaces backslashes with forward ones. then acts as *nixish. - -=item cflags - -if configured for dynamic loading, triggers #define EXT in EXTERN.h - -=item manifypods - -replaces strings '::' with '.' in man page names - -=item perl_archive - -points to libperl.a + $self->{PERL_ARCHIVE_AFTER} ||= ''; + $self->{EXPORT_LIST} ||= ''; +} =back =cut +1; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_DOS.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_DOS.pm index 7af868eeca4..b985d00ca69 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_DOS.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_DOS.pm @@ -3,7 +3,7 @@ package ExtUtils::MM_DOS; use strict; use vars qw($VERSION @ISA); -$VERSION = 0.01; +$VERSION = 0.02; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; @@ -30,8 +30,18 @@ Unless otherwise stated, it works just like ExtUtils::MM_Unix =over 4 +=item os_flavor + +=cut + +sub os_flavor { + return('DOS'); +} + =item B<replace_manpage_separator> +Generates Foo__Bar.3 style man page names + =cut sub replace_manpage_separator { @@ -52,4 +62,5 @@ Michael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix L<ExtUtils::MM_Unix>, L<ExtUtils::MakeMaker> =cut + 1; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_MacOS.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_MacOS.pm index 576d7447303..6dcf8206247 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_MacOS.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_MacOS.pm @@ -12,13 +12,12 @@ require ExtUtils::MM_Unix; @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); use vars qw($VERSION); -$VERSION = '1.03'; +$VERSION = '1.07'; use Config; use Cwd 'cwd'; require Exporter; use File::Basename; -use File::Spec; use vars qw(%make_data); my $Mac_FS = eval { require Mac::FileSpec::Unixish }; @@ -37,6 +36,8 @@ ExtUtils::MM_MacOS - methods to override UN*X behaviour in ExtUtils::MakeMaker MM_MacOS currently only produces an approximation to the correct Makefile. +=over 4 + =cut sub new { @@ -51,7 +52,7 @@ sub new { mkdir("Obj", 0777) unless -d "Obj"; - $self = {} unless (defined $self); + $self = {} unless defined $self; check_hints($self); @@ -61,7 +62,8 @@ sub new { if (ref $self->{CONFIGURE} eq 'CODE') { $self = { %$self, %{&{$self->{CONFIGURE}}}}; } else { - Carp::croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n"; + require Carp; + Carp::croak("Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n"); } } @@ -78,7 +80,7 @@ sub new { } $ExtUtils::MakeMaker::Recognized_Att_Keys{$_} = 1 - for map { $_ . 'Optimize' } qw(MWC MWCPPC MWC68K MPW MRC MRC SC); + for map { $_ . 'Optimize' } qw(MWC MWCPPC MWC68K MPW MRC MRC SC); if (defined $ExtUtils::MakeMaker::Parent[-2]){ $self->{PARENT} = $ExtUtils::MakeMaker::Parent[-2]; @@ -86,7 +88,7 @@ sub new { for $key (@ExtUtils::MakeMaker::Prepend_parent) { next unless defined $self->{PARENT}{$key}; $self->{$key} = $self->{PARENT}{$key}; - unless ($^O eq 'VMS' && $key =~ /PERL$/) { + if ($key !~ /PERL$/) { $self->{$key} = $self->catdir("..",$self->{$key}) unless $self->file_name_is_absolute($self->{$key}); } else { @@ -130,7 +132,7 @@ sub new { # This Makefile is for the $self->{NAME} extension to perl. # # It was generated automatically by MakeMaker version -# $VERSION (Revision: $Revision) from the contents of +# $ExtUtils::MakeMaker::VERSION (Revision: $ExtUtils::MakeMaker::Revision) from the contents of # Makefile.PL. Don't edit this file, edit Makefile.PL instead. # # ANY CHANGES MADE HERE WILL BE LOST! @@ -158,10 +160,10 @@ END pasthru c_o xs_c xs_o top_targets linkext dynamic_bs dynamic_lib static_lib manifypods installbin subdirs dist_basics dist_core - dist_dir dist_test dist_ci install force perldepend makefile - staticmake test pm_to_blib selfdocument + distdir dist_test dist_ci install force perldepend makefile + staticmake test pm_to_blib selfdocument const_loadlibs const_cccmd - /) + /) { $self->{SKIPHASH}{$_} = 2; } @@ -169,7 +171,7 @@ END unless grep /rulez/, @ExtUtils::MakeMaker::MM_Sections; if ($self->{PARENT}) { - for (qw/install dist dist_basics dist_core dist_dir dist_test dist_ci/) { + for (qw/install dist dist_basics dist_core distdir dist_test dist_ci/) { $self->{SKIPHASH}{$_} = 1; } } @@ -182,7 +184,8 @@ END my $section; foreach $section ( @ExtUtils::MakeMaker::MM_Sections ){ - next if ($self->{SKIPHASH}{$section} == 2); + next if defined $self->{SKIPHASH}{$section} && + $self->{SKIPHASH}{$section} == 2; print "Processing Makefile '$section' section\n" if ($Verbose >= 2); $self->{ABSTRACT_FROM} = macify($self->{ABSTRACT_FROM}) if $self->{ABSTRACT_FROM}; @@ -242,7 +245,7 @@ sub guess_name { =item macify -Translate relative path names into Mac names. +Translate relative Unix filepaths into Mac names. =cut @@ -262,20 +265,21 @@ sub macify { } push(@mac, $_); } - + return "@mac"; } =item patternify -Translate to Mac names & patterns +Translate Unix filepaths and shell globs to Mac style. =cut sub patternify { my($unix) = @_; my(@mac); - + use ExtUtils::MakeMaker::bytes; # Non-UTF-8 high bytes below. + foreach (split(/[ \t\n]+/, $unix)) { if (m|/|) { $_ = ":$_"; @@ -285,13 +289,13 @@ sub patternify { push(@mac, $_); } } - + return "@mac"; } =item init_main -Initializes some of NAME, FULLEXT, BASEEXT, ROOTEXT, DLBASE, PERL_SRC, +Initializes some of NAME, FULLEXT, BASEEXT, DLBASE, PERL_SRC, PERL_LIB, PERL_ARCHLIB, PERL_INC, INSTALLDIRS, INST_*, INSTALL*, PREFIX, CONFIG, AR, AR_STATIC_ARGS, LD, OBJ_EXT, LIB_EXT, MAP_TARGET, LIBPERL_A, VERSION_FROM, VERSION, DISTNAME, VERSION_SYM. @@ -306,14 +310,10 @@ sub init_main { # NAME = The perl module name for this extension (eg DBD::Oracle). # FULLEXT = Pathname for extension directory (eg DBD/Oracle). # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. - # ROOTEXT = Directory part of FULLEXT with trailing :. ($self->{FULLEXT} = $self->{NAME}) =~ s!::!:!g ; #eg. BSD:Foo:Socket ($self->{BASEEXT} = $self->{NAME}) =~ s!.*::!! ; #eg. Socket - ($self->{ROOTEXT} = - $self->{FULLEXT}) =~ s#:?\Q$self->{BASEEXT}\E$## ; #eg. BSD:Foo - $self->{ROOTEXT} .= ":" if ($self->{ROOTEXT}); # --- Initialize PERL_LIB, INST_LIB, PERL_SRC @@ -339,21 +339,15 @@ sub init_main { } } if ($self->{PERL_SRC}){ - $self->{MACPERL_SRC} = File::Spec->catdir("$self->{PERL_SRC}","macos:"); - $self->{MACPERL_LIB} ||= File::Spec->catdir("$self->{MACPERL_SRC}","lib"); - $self->{PERL_LIB} ||= File::Spec->catdir("$self->{PERL_SRC}","lib"); + $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib"); $self->{PERL_ARCHLIB} = $self->{PERL_LIB}; $self->{PERL_INC} = $self->{PERL_SRC}; - $self->{MACPERL_INC} = $self->{MACPERL_SRC}; } else { # hmmmmmmm ... ? - $self->{PERL_LIB} ||= "$ENV{MACPERL}site_perl"; - $self->{PERL_ARCHLIB} = $self->{PERL_LIB}; - $self->{PERL_INC} = $ENV{MACPERL}; -# die <<END; -#On MacOS, we need to build under the Perl source directory or have the MacPerl SDK -#installed in the MacPerl folder. -#END + $self->{PERL_LIB} ||= "$ENV{MACPERL}site_perl"; + $self->{PERL_ARCHLIB} = $self->{PERL_LIB}; + $self->{PERL_INC} = $ENV{MACPERL}; + $self->{PERL_SRC} = ''; } $self->{INSTALLDIRS} = "perl"; @@ -368,12 +362,13 @@ sub init_main { # hm ... do we really care? at all? # warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory # (Exporter.pm not found)" -# unless -f File::Spec->catfile("$self->{PERL_LIB}","Exporter.pm") || +# unless -f $self->catfile("$self->{PERL_LIB}","Exporter.pm") || # $self->{NAME} eq "ExtUtils::MakeMaker"; # Determine VERSION and VERSION_FROM ($self->{DISTNAME}=$self->{NAME}) =~ s#(::)#-#g unless $self->{DISTNAME}; if ($self->{VERSION_FROM}){ + # XXX replace with parse_version() override local *FH; open(FH,macify($self->{VERSION_FROM})) or die "Could not open '$self->{VERSION_FROM}' (attribute VERSION_FROM): $!"; @@ -410,18 +405,32 @@ sub init_main { # XS_VERSION macro that defaults to VERSION: $self->{XS_VERSION} ||= $self->{VERSION}; + + $self->{DEFINE} .= " \$(XS_DEFINE_VERSION) \$(DEFINE_VERSION)"; + + # Preprocessor definitions may be useful + $self->{DEFINE} =~ s/-D/-d /g; + + # UN*X includes probably are not useful + $self->{DEFINE} =~ s/-I\S+/_include($1)/eg; + + + if ($self->{INC}) { + # UN*X includes probably are not useful + $self->{INC} =~ s/-I(\S+)/_include($1)/eg; + } + + # --- Initialize Perl Binary Locations # Find Perl 5. The only contract here is that both 'PERL' and 'FULLPERL' # will be working versions of perl 5. miniperl has priority over perl # for PERL to ensure that $(PERL) is usable while building ./ext/* my ($component,@defpath); - foreach $component ($self->{PERL_SRC}, File::Spec->path(), $Config::Config{binexp}) { + foreach $component ($self->{PERL_SRC}, $self->path(), $Config::Config{binexp}) { push @defpath, $component if defined $component; } $self->{PERL} = "$self->{PERL_SRC}miniperl"; - $self->{FULLPERL} = "$self->{PERL_SRC}perl"; - $self->{MAKEFILE} = "Makefile.mk"; } =item init_others @@ -457,6 +466,51 @@ sub init_others { # --- Initialize Other Attributes } } $self->{SOURCE} = $src; + $self->{FULLPERL} = "$self->{PERL_SRC}perl"; + $self->{MAKEFILE} = "Makefile.mk"; + $self->{FIRST_MAKEFILE} = $self->{MAKEFILE}; + $self->{MAKEFILE_OLD} = $self->{MAKEFILE}.'.old'; + + $self->{'DEV_NULL'} ||= ' \xB3 Dev:Null'; + + return 1; +} + +=item init_platform + +Add MACPERL_SRC MACPERL_LIB + +=item platform_constants + +Add MACPERL_SRC MACPERL_LIB MACLIBS_68K MACLIBS_PPC MACLIBS_SC MACLIBS_MRC +MACLIBS_ALL_68K MACLIBS_ALL_PPC MACLIBS_SHARED + +XXX Few are initialized. How many of these are ever used? + +=cut + +sub init_platform { + my $self = shift; + + $self->{MACPERL_SRC} = $self->catdir("$self->{PERL_SRC}","macos:"); + $self->{MACPERL_LIB} ||= $self->catdir("$self->{MACPERL_SRC}","lib"); + $self->{MACPERL_INC} = $self->{MACPERL_SRC}; +} + + + +sub platform_constants { + my $self = shift; + + foreach my $macro (qw(MACPERL_SRC MACPERL_LIB MACLIBS_68K MACLIBS_PPC + MACLIBS_SC MACLIBS_MRC MACLIBS_ALL_68K + MACLIBS_ALL_PPC MACLIBS_SHARED)) + { + next unless defined $self->{$macro}; + $make_frag .= "$macro = $self->{$macro}\n"; + } + + return $make_frag; } @@ -474,7 +528,7 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) # in case we don't find it below! if ($self->{VERSION_FROM}) { my $version_from = macify($self->{VERSION_FROM}); - $pm{$version_from} = File::Spec->catfile('$(INST_LIBDIR)', + $pm{$version_from} = $self->catfile('$(INST_LIBDIR)', $version_from); } @@ -483,6 +537,7 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) next if ($name =~ /^\./ or $ignore{$name}); next unless $self->libscan($name); if (-d $name){ + next if $self->{NORECURS}; $dir{$name} = $name if (-f ":$name:Makefile.PL"); } elsif ($name =~ /\.xs$/){ my($c); ($c = $name) =~ s/\.xs$/.c/; @@ -494,7 +549,7 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) } elsif ($name =~ /\.h$/i){ $h{$name} = 1; } elsif ($name =~ /\.(p[ml]|pod)$/){ - $pm{$name} = File::Spec->catfile('$(INST_LIBDIR)',$name); + $pm{$name} = $self->catfile('$(INST_LIBDIR)',$name); } elsif ($name =~ /\.PL$/ && $name ne "Makefile.PL") { ($pl_files{$name} = $name) =~ s/\.PL$// ; } @@ -523,8 +578,8 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) # # In this way the 'lib' directory is seen as the root of the actual # perl library whereas the others are relative to INST_LIBDIR - # (which includes ROOTEXT). This is a subtle distinction but one - # that's important for nested modules. + # This is a subtle distinction but one that's important for nested + # modules. $self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}] unless $self->{PMLIBDIRS}; @@ -544,7 +599,7 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) require File::Find; File::Find::find(sub { if (-d $_){ - if ($_ eq "CVS" || $_ eq "RCS"){ + unless ($self->libscan($_)){ $File::Find::prune = 1; } return; @@ -553,7 +608,7 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) my($striplibpath,$striplibname); $prefix = '$(INST_LIB)' if (($striplibpath = $path) =~ s:^(\W*)lib\W:$1:); ($striplibname,$striplibpath) = fileparse($striplibpath); - my($inst) = File::Spec->catfile($prefix,$striplibpath,$striplibname); + my($inst) = $self->catfile($prefix,$striplibpath,$striplibname); local($_) = $inst; # for backwards compatibility $inst = $self->libscan($inst); print "libscan($path) => '$inst'\n" if ($Verbose >= 2); @@ -578,103 +633,39 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) } } -=item libscan (o) -Takes a path to a file that is found by init_dirscan and returns false -if we don't want to include this file in the library. Mainly used to -exclude RCS, CVS, and SCCS directories from installation. +=item init_VERSION (o) -=cut - -# '; - -sub libscan { - my($self,$path) = @_; - return '' if $path =~ m/:(RCS|CVS|SCCS):/ ; - $path; -} - -=item constants (o) - -Initializes lots of constants and .SUFFIXES and .PHONY +Change DEFINE_VERSION and XS_DEFINE_VERSION =cut -sub constants { - my($self) = @_; - my(@m,$tmp); - - for $tmp (qw/ - NAME DISTNAME NAME_SYM VERSION VERSION_SYM XS_VERSION - INST_LIB INST_ARCHLIB PERL_LIB PERL_SRC MACPERL_SRC MACPERL_LIB PERL FULLPERL - XSPROTOARG MACLIBS_68K MACLIBS_PPC MACLIBS_SC MACLIBS_MRC MACLIBS_ALL_68K MACLIBS_ALL_PPC MACLIBS_SHARED SOURCE TYPEMAPS - / ) { - next unless defined $self->{$tmp}; - if ($tmp eq 'TYPEMAPS' && ref $self->{$tmp}) { - push @m, sprintf "$tmp = %s\n", join " ", @{$self->{$tmp}}; - } else { - push @m, "$tmp = $self->{$tmp}\n"; - } - } +sub init_VERSION { + my $self = shift; - push @m, q{ -MODULES = }.join(" \\\n\t", sort keys %{$self->{PM}})."\n"; - push @m, "PMLIBDIRS = @{$self->{PMLIBDIRS}}\n" if @{$self->{PMLIBDIRS}}; + $self->SUPER::init_VERSION; - push @m, ' + $self->{DEFINE_VERSION} = '-d $(VERSION_MACRO)="¶"$(VERSION)¶""'; + $self->{XS_DEFINE_VERSION} = '-d $(XS_VERSION_MACRO)="¶"$(XS_VERSION)¶""'; +} -.INCLUDE : $(MACPERL_SRC)BuildRules.mk -'; +=item special_targets (o) - push @m, qq{ -VERSION_MACRO = VERSION -DEFINE_VERSION = -d \$(VERSION_MACRO)="¶"\$(VERSION)¶"" -XS_VERSION_MACRO = XS_VERSION -XS_DEFINE_VERSION = -d \$(XS_VERSION_MACRO)="¶"\$(XS_VERSION)¶"" -}; +Add .INCLUDE - $self->{DEFINE} .= " \$(XS_DEFINE_VERSION) \$(DEFINE_VERSION)"; +=cut - push @m, qq{ -MAKEMAKER = $INC{'ExtUtils/MakeMaker.pm'} -MM_VERSION = $ExtUtils::MakeMaker::VERSION -}; - - push @m, q{ -# FULLEXT = Pathname for extension directory (eg DBD:Oracle). -# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. -# ROOTEXT = Directory part of FULLEXT (eg DBD) -# DLBASE = Basename part of dynamic library. May be just equal BASEEXT. -}; - - if ($self->{DEFINE}) { - $self->{DEFINE} =~ s/-D/-d /g; # Preprocessor definitions may be useful - $self->{DEFINE} =~ s/-I\S+/_include($1)/eg; # UN*X includes probably are not useful - } - if ($self->{INC}) { - $self->{INC} =~ s/-I(\S+)/_include($1)/eg; # UN*X includes probably are not useful - } - for $tmp (qw/ - FULLEXT BASEEXT ROOTEXT DEFINE INC - / ) { - next unless defined $self->{$tmp}; - push @m, "$tmp = $self->{$tmp}\n"; - } +sub special_targets { + my $self = shift; - push @m, " -# Handy lists of source code files: -XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})." -C_FILES = ".join(" \\\n\t", @{$self->{C}})." -H_FILES = ".join(" \\\n\t", @{$self->{H}})." -"; + my $make_frag = $self->SUPER::special_targets; - push @m, ' + return $make_frag . <<'MAKE_FRAG'; +.INCLUDE : $(MACPERL_SRC)BuildRules.mk $(MACPERL_SRC)ExtBuildRules.mk -.INCLUDE : $(MACPERL_SRC)ExtBuildRules.mk -'; +MAKE_FRAG - join('',@m); } =item static (o) @@ -765,32 +756,56 @@ sub clean { # Delete temporary files but do not touch installed files. We don\'t delete # the Makefile here so a later make realclean still has a makefile to use. -clean :: +clean :: clean_subdirs '); - # clean subdirectories first - for $dir (@{$self->{DIR}}) { - push @m, -" Set OldEcho \{Echo\} - Set Echo 0 - Directory $dir - If \"\`Exists -f $self->{MAKEFILE}\`\" != \"\" - \$(MAKE) clean - End - Set Echo \{OldEcho\} - "; - } my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files push(@otherfiles, patternify($attribs{FILES})) if $attribs{FILES}; push @m, "\t\$(RM_RF) @otherfiles\n"; # See realclean and ext/utils/make_ext for usage of Makefile.old push(@m, - "\t\$(MV) $self->{MAKEFILE} $self->{MAKEFILE}.old\n"); + "\t\$(MV) \$(FIRST_MAKEFILE) \$(MAKEFILE_OLD)\n"); push(@m, "\t$attribs{POSTOP}\n") if $attribs{POSTOP}; join("", @m); } +=item clean_subdirs_target + +MacOS semantics for changing directories and checking for existence +very different than everyone else. + +=cut + +sub clean_subdirs_target { + my($self) = shift; + + # No subdirectories, no cleaning. + return <<'NOOP_FRAG' unless @{$self->{DIR}}; +clean_subdirs : + $(NOECHO)$(NOOP) +NOOP_FRAG + + + my $clean = "clean_subdirs :\n"; + + for my $dir (@{$self->{DIR}}) { + $clean .= sprintf <<'MAKE_FRAG', $dir; + Set OldEcho {Echo} + Set Echo 0 + Directory %s + If "`Exists -f $(FIRST_MAKEFILE)`" != "" + $(MAKE) clean + End + Set Echo {OldEcho} + +MAKE_FRAG + } + + return $clean; +} + + =item realclean (o) Defines the realclean target. @@ -804,28 +819,50 @@ sub realclean { # Delete temporary files (via clean) and also delete installed files realclean purge :: clean '); - # realclean subdirectories first (already cleaned) - my $sub = -" Set OldEcho \{Echo\} + + my(@otherfiles) = ('$(FIRST_MAKEFILE)', '$(MAKEFILE_OLD)'); # Makefiles last + push(@otherfiles, patternify($attribs{FILES})) if $attribs{FILES}; + push(@m, "\t\$(RM_RF) @otherfiles\n") if @otherfiles; + push(@m, "\t$attribs{POSTOP}\n") if $attribs{POSTOP}; + join("", @m); +} + + +=item realclean_subdirs_target + +MacOS semantics for changing directories and checking for existence +very different than everyone else. + +=cut + +sub realclean_subdirs_target { + my $self = shift; + + return <<'NOOP_FRAG' unless @{$self->{DIR}}; +realclean_subdirs : + $(NOECHO)$(NOOP) +NOOP_FRAG + + my $rclean = "realclean_subdirs :\n"; + + foreach my $dir (@{$self->{DIR}}){ + $rclean .= sprintf <<'RCLEAN', $dir, + Set OldEcho \{Echo\} Set Echo 0 Directory %s - If \"\`Exists -f %s\`\" != \"\" + If \"\`Exists -f $(FIRST_MAKEFILE)\`\" != \"\" \$(MAKE) realclean End Set Echo \{OldEcho\} - "; - foreach(@{$self->{DIR}}){ - push(@m, sprintf($sub,$_,"$self->{MAKEFILE}.old","-f $self->{MAKEFILE}.old")); - push(@m, sprintf($sub,$_,"$self->{MAKEFILE}",'')); + +RCLEAN + } - my(@otherfiles) = ($self->{MAKEFILE}, - "$self->{MAKEFILE}.old"); # Makefiles last - push(@otherfiles, patternify($attribs{FILES})) if $attribs{FILES}; - push(@m, "\t\$(RM_RF) @otherfiles\n") if @otherfiles; - push(@m, "\t$attribs{POSTOP}\n") if $attribs{POSTOP}; - join("", @m); + + return $rclean; } + =item rulez (o) =cut @@ -840,11 +877,6 @@ install install_static install_dynamic :: '; } -sub xsubpp_version -{ - return $ExtUtils::MakeMaker::Version; -} - =item processPL (o) @@ -863,7 +895,7 @@ sub processPL { foreach $target (@$list) { push @m, " ProcessPL :: $target -\t$self->{NOECHO}\$(NOOP) +\t$(NOECHO)\$(NOOP) $target :: $plfile \t\$(PERL) -I\$(MACPERL_LIB) -I\$(PERL_LIB) $plfile $target @@ -875,15 +907,16 @@ $target :: $plfile sub cflags { my($self,$libperl) = @_; - my $optimize; + my $optimize = ''; for (map { $_ . "Optimize" } qw(MWC MWCPPC MWC68K MPW MRC MRC SC)) { - $optimize .= "$_ = $self->{$_}" if exists $self->{$_}; + $optimize .= "$_ = $self->{$_}" if exists $self->{$_}; } return $self->{CFLAGS} = $optimize; } + sub _include { # for Unix-style includes, with -I instead of -i my($inc) = @_; require File::Spec::Unix; @@ -896,45 +929,18 @@ sub _include { # for Unix-style includes, with -I instead of -i } } -# yes, these are just copies of the same routines in -# MakeMaker.pm, but with paths changed. -sub check_hints { - my($self) = @_; - # We allow extension-specific hints files. - - return unless -d ":hints"; - - # First we look for the best hintsfile we have - my($hint)="${^O}_$Config{osvers}"; - $hint =~ s/\./_/g; - $hint =~ s/_$//; - return unless $hint; +=item os_flavor - # Also try without trailing minor version numbers. - while (1) { - last if -f ":hints:$hint.pl"; # found - } continue { - last unless $hint =~ s/_[^_]*$//; # nothing to cut off - } - my $hint_file = ":hints:$hint.pl"; +MacOS Classic is MacOS and MacOS Classic. - return unless -f $hint_file; # really there +=cut - _run_hintfile($self, $hint_file); +sub os_flavor { + return('MacOS', 'MacOS Classic'); } -sub _run_hintfile { - no strict 'vars'; - local($self) = shift; # make $self available to the hint file. - my($hint_file) = shift; +=back - local $@; - print STDERR "Processing hints file $hint_file\n"; - my $ret = do $hint_file; - unless( defined $ret ) { - print STDERR $@ if $@; - } -} -1; +=cut -__END__ +1; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_NW5.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_NW5.pm index 7f13dd0ee70..82c2d66dbc9 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_NW5.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_NW5.pm @@ -23,7 +23,7 @@ use Config; use File::Basename; use vars qw(@ISA $VERSION); -$VERSION = '2.05'; +$VERSION = '2.06'; require ExtUtils::MM_Win32; @ISA = qw(ExtUtils::MM_Win32); @@ -37,17 +37,45 @@ my $GCC = 1 if $Config{'cc'} =~ /^gcc/i; my $DMAKE = 1 if $Config{'make'} =~ /^dmake/i; -sub init_others { - my ($self) = @_; - $self->SUPER::init_others(@_); +=item os_flavor + +We're Netware in addition to being Windows. + +=cut + +sub os_flavor { + my $self = shift; + return ($self->SUPER::os_flavor, 'Netware'); +} + +=item init_platform (o) + +Add Netware macros. + +LIBPTH, BASE_IMPORT, NLM_VERSION, MPKTOOL, TOOLPATH, BOOT_SYMBOL, +NLM_SHORT_NAME, INCLUDE, PATH, MM_NW5_REVISION + + +=item platform_constants + +Add Netware macros initialized above to the Makefile. + +=cut + +sub init_platform { + my($self) = shift; + + # To get Win32's setup. + $self->SUPER::init_platform; # incpath is copied to makefile var INCLUDE in constants sub, here just # make it empty my $libpth = $Config{'libpth'}; $libpth =~ s( )(;); $self->{'LIBPTH'} = $libpth; + $self->{'BASE_IMPORT'} = $Config{'base_import'}; - + # Additional import file specified from Makefile.pl if($self->{'base_import'}) { $self->{'BASE_IMPORT'} .= ', ' . $self->{'base_import'}; @@ -56,188 +84,61 @@ sub init_others { $self->{'NLM_VERSION'} = $Config{'nlm_version'}; $self->{'MPKTOOL'} = $Config{'mpktool'}; $self->{'TOOLPATH'} = $Config{'toolpath'}; -} - - -=item constants (o) - -Initializes lots of constants and .SUFFIXES and .PHONY - -=cut - -sub const_cccmd { - my($self,$libperl)=@_; - return $self->{CONST_CCCMD} if $self->{CONST_CCCMD}; - return '' unless $self->needs_linking(); - return $self->{CONST_CCCMD} = <<'MAKE_FRAG'; -CCCMD = $(CC) $(CCFLAGS) $(INC) $(OPTIMIZE) \ - $(PERLTYPE) $(MPOLLUTE) -o $@ \ - -DVERSION=\"$(VERSION)\" -DXS_VERSION=\"$(XS_VERSION)\" -MAKE_FRAG - -} - -sub constants { - my($self) = @_; - my(@m,$tmp); - -# Added LIBPTH, BASE_IMPORT, ABSTRACT, NLM_VERSION BOOT_SYMBOL, NLM_SHORT_NAME -# for NETWARE - - for $tmp (qw/ - - AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION - VERSION_SYM XS_VERSION INST_BIN INST_LIB - INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS - INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB - INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB - PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB - FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC - PERL_INC PERL FULLPERL LIBPTH BASE_IMPORT PERLRUN - FULLPERLRUN PERLRUNINST FULLPERLRUNINST - FULL_AR PERL_CORE NLM_VERSION MPKTOOL TOOLPATH - - / ) { - next unless defined $self->{$tmp}; - push @m, "$tmp = $self->{$tmp}\n"; - } (my $boot = $self->{'NAME'}) =~ s/:/_/g; $self->{'BOOT_SYMBOL'}=$boot; - push @m, "BOOT_SYMBOL = $self->{'BOOT_SYMBOL'}\n"; # If the final binary name is greater than 8 chars, # truncate it here. if(length($self->{'BASEEXT'}) > 8) { $self->{'NLM_SHORT_NAME'} = substr($self->{'BASEEXT'},0,8); - push @m, "NLM_SHORT_NAME = $self->{'NLM_SHORT_NAME'}\n"; } - push @m, qq{ -VERSION_MACRO = VERSION -DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\" -XS_VERSION_MACRO = XS_VERSION -XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\" -}; - # Get the include path and replace the spaces with ; # Copy this to makefile as INCLUDE = d:\...;d:\; - (my $inc = $Config{'incpath'}) =~ s/([ ]*)-I/;/g; - - # Get the additional include path from the user through the command prompt - # and append to INCLUDE -# $self->{INC} = ''; - push @m, "INC = $self->{'INC'}\n"; - - push @m, qq{ -INCLUDE = $inc; -}; + ($self->{INCLUDE} = $Config{'incpath'}) =~ s/([ ]*)-I/;/g; # Set the path to CodeWarrior binaries which might not have been set in # any other place - push @m, qq{ -PATH = \$(PATH);\$(TOOLPATH) -}; - - push @m, qq{ -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) -# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) -# DLBASE = Basename part of dynamic library. May be just equal BASEEXT. -}; - - for $tmp (qw/ - FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT - LDFROM LINKTYPE - / ) { - next unless defined $self->{$tmp}; - push @m, "$tmp = $self->{$tmp}\n"; - } - - push @m, " -# Handy lists of source code files: -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}})." -MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})." -MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})." -"; - - for $tmp (qw/ - INST_MAN1DIR INSTALLMAN1DIR MAN1EXT - INST_MAN3DIR INSTALLMAN3DIR MAN3EXT - /) { - next unless defined $self->{$tmp}; - push @m, "$tmp = $self->{$tmp}\n"; - } - - push @m, qq{ -.USESHELL : -} if $DMAKE; - - push @m, q{ -.NO_CONFIG_REC: Makefile -} if $ENV{CLEARCASE_ROOT}; - - # why not q{} ? -- emacs - push @m, qq{ -# work around a famous dec-osf make(1) feature(?): -makemakerdflt: all + $self->{PATH} = '$(PATH);$(TOOLPATH)'; -.SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT) + $self->{MM_NW5_VERSION} = $VERSION; +} -.PHONY: all config static dynamic test linkext manifest +sub platform_constants { + my($self) = shift; + my $make_frag = ''; -# Where is the Config information that we are using/depend on -CONFIGDEP = \$(PERL_ARCHLIB)\\Config.pm \$(PERL_INC)\\config.h -}; + # Setup Win32's constants. + $make_frag .= $self->SUPER::platform_constants; - my @parentdir = split(/::/, $self->{PARENT_NAME}); - push @m, q{ -# Where to put things: -INST_LIBDIR = }. File::Spec->catdir('$(INST_LIB)',@parentdir) .q{ -INST_ARCHLIBDIR = }. File::Spec->catdir('$(INST_ARCHLIB)',@parentdir) .q{ + foreach my $macro (qw(LIBPTH BASE_IMPORT NLM_VERSION MPKTOOL + TOOLPATH BOOT_SYMBOL NLM_SHORT_NAME INCLUDE PATH + MM_NW5_VERSION + )) + { + next unless defined $self->{$macro}; + $make_frag .= "$macro = $self->{$macro}\n"; + } -INST_AUTODIR = }. File::Spec->catdir('$(INST_LIB)','auto','$(FULLEXT)') .q{ -INST_ARCHAUTODIR = }. File::Spec->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)') .q{ -}; + return $make_frag; +} - if ($self->has_link_code()) { - push @m, ' -INST_STATIC = $(INST_ARCHAUTODIR)\$(BASEEXT)$(LIB_EXT) -INST_DYNAMIC = $(INST_ARCHAUTODIR)\$(DLBASE).$(DLEXT) -INST_BOOT = $(INST_ARCHAUTODIR)\$(BASEEXT).bs -'; - } else { - push @m, ' -INST_STATIC = -INST_DYNAMIC = -INST_BOOT = -'; - } - $tmp = $self->export_list; - push @m, " -EXPORT_LIST = $tmp -"; - $tmp = $self->perl_archive; - push @m, " -PERL_ARCHIVE = $tmp -"; +=item const_cccmd (o) - push @m, q{ -TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{ +=cut -PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{ -}; +sub const_cccmd { + my($self,$libperl)=@_; + return $self->{CONST_CCCMD} if $self->{CONST_CCCMD}; + return '' unless $self->needs_linking(); + return $self->{CONST_CCCMD} = <<'MAKE_FRAG'; +CCCMD = $(CC) $(CCFLAGS) $(INC) $(OPTIMIZE) \ + $(PERLTYPE) $(MPOLLUTE) -o $@ \ + -DVERSION=\"$(VERSION)\" -DXS_VERSION=\"$(XS_VERSION)\" +MAKE_FRAG - join('',@m); } @@ -251,7 +152,7 @@ sub static_lib { return '' unless $self->has_link_code; my $m = <<'END'; -$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)\.exists +$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists $(RM_RF) $@ END @@ -274,12 +175,12 @@ END $m .= sprintf <<'END', $ar_arg; $(AR) %s - $(NOECHO)echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld + $(NOECHO) $(ECHO) "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld $(CHMOD) 755 $@ END $m .= <<'END' if $self->{PERL_SRC}; - $(NOECHO)echo "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs + $(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs END @@ -313,16 +214,16 @@ INST_DYNAMIC_DEP = '.$inst_dynamic_dep.' # Create xdc data for an MT safe NLM in case of mpk build $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) - @echo Export boot_$(BOOT_SYMBOL) > $(BASEEXT).def - @echo $(BASE_IMPORT) >> $(BASEEXT).def - @echo Import @$(PERL_INC)\perl.imp >> $(BASEEXT).def + $(NOECHO) $(ECHO) Export boot_$(BOOT_SYMBOL) > $(BASEEXT).def + $(NOECHO) $(ECHO) $(BASE_IMPORT) >> $(BASEEXT).def + $(NOECHO) $(ECHO) Import @$(PERL_INC)\perl.imp >> $(BASEEXT).def MAKE_FRAG if ( $self->{CCFLAGS} =~ m/ -DMPK_ON /) { $m .= <<'MAKE_FRAG'; $(MPKTOOL) $(XDCFLAGS) $(BASEEXT).xdc - @echo xdcdata $(BASEEXT).xdc >> $(BASEEXT).def + $(NOECHO) $(ECHO) xdcdata $(BASEEXT).xdc >> $(BASEEXT).def MAKE_FRAG } diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_UWIN.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_UWIN.pm index 59384a22841..1667d552c8f 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_UWIN.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_UWIN.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_UWIN; use strict; use vars qw($VERSION @ISA); -$VERSION = 0.01; +$VERSION = 0.02; require ExtUtils::MM_Unix; @ISA = qw(ExtUtils::MM_Unix); @@ -28,6 +28,17 @@ Unless otherwise stated it works just like ExtUtils::MM_Unix =over 4 +=item os_flavor + +In addition to being Unix, we're U/WIN. + +=cut + +sub os_flavor { + return('Unix', 'U/WIN'); +} + + =item B<replace_manpage_separator> =cut @@ -49,4 +60,6 @@ Michael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix L<ExtUtils::MM_Win32>, L<ExtUtils::MakeMaker> +=cut + 1; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MM_Win95.pm b/gnu/usr.bin/perl/lib/ExtUtils/MM_Win95.pm index 010900f5c36..68c2ac85881 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/MM_Win95.pm +++ b/gnu/usr.bin/perl/lib/ExtUtils/MM_Win95.pm @@ -1,11 +1,15 @@ package ExtUtils::MM_Win95; use vars qw($VERSION @ISA); -$VERSION = 0.02; +$VERSION = 0.03; require ExtUtils::MM_Win32; @ISA = qw(ExtUtils::MM_Win32); + use Config; +my $DMAKE = 1 if $Config{'make'} =~ /^dmake/i; +my $NMAKE = 1 if $Config{'make'} =~ /^nmake/i; + =head1 NAME @@ -20,6 +24,18 @@ ExtUtils::MM_Win95 - method to customize MakeMaker for Win9X This is a subclass of ExtUtils::MM_Win32 containing changes necessary to get MakeMaker playing nice with command.com and other Win9Xisms. +=head2 Overriden methods + +Most of these make up for limitations in the Win9x command shell. +Namely the lack of && and that a chdir is global, so you have to chdir +back at the end. + +=over 4 + +=item dist_test + +&& and chdir problem. + =cut sub dist_test { @@ -34,38 +50,176 @@ disttest : distdir }; } +=item subdir_x + +&& and chdir problem. + +Also, dmake has an odd way of making a command series silent. + +=cut + +sub subdir_x { + my($self, $subdir) = @_; + + # Win-9x has nasty problem in command.com that can't cope with + # &&. Also, Dmake has an odd way of making a commandseries silent: + if ($DMAKE) { + return sprintf <<'EOT', $subdir; + +subdirs :: +@[ + cd %s + $(MAKE) all $(PASTHRU) + cd .. +] +EOT + } + else { + return sprintf <<'EOT', $subdir; + +subdirs :: + $(NOECHO)cd %s + $(NOECHO)$(MAKE) all $(PASTHRU) + $(NOECHO)cd .. +EOT + } +} + +=item xs_c + +The && problem. + +=cut + 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 + $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c ' } + +=item xs_cpp + +The && problem + +=cut + 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 + $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp '; } -# many makes are too dumb to use xs_c then c_o +=item xs_o + +The && problem. + +=cut + sub xs_o { my($self) = shift; return '' unless $self->needs_linking(); - # having to choose between .xs -> .c -> .o and .xs -> .o confuses dmake - return '' if $Config{make} eq 'dmake'; + # Having to choose between .xs -> .c -> .o and .xs -> .o confuses dmake. + return '' if $DMAKE; ' .xs$(OBJ_EXT): - $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\ - $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c + $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c '; } +=item clean_subdirs_target + +&& and chdir problem. + +=cut + +sub clean_subdirs_target { + my($self) = shift; + + # No subdirectories, no cleaning. + return <<'NOOP_FRAG' unless @{$self->{DIR}}; +clean_subdirs : + $(NOECHO)$(NOOP) +NOOP_FRAG + + + my $clean = "clean_subdirs :\n"; + + for my $dir (@{$self->{DIR}}) { + $clean .= sprintf <<'MAKE_FRAG', $dir; + cd %s + $(TEST_F) $(FIRST_MAKEFILE) + $(MAKE) clean + cd .. +MAKE_FRAG + } + + return $clean; +} + + +=item realclean_subdirs_target + +&& and chdir problem. + +=cut + +sub realclean_subdirs_target { + my $self = shift; + + return <<'NOOP_FRAG' unless @{$self->{DIR}}; +realclean_subdirs : + $(NOECHO)$(NOOP) +NOOP_FRAG + + my $rclean = "realclean_subdirs :\n"; + + foreach my $dir (@{$self->{DIR}}){ + $rclean .= sprintf <<'RCLEAN', $dir; + -cd %s + -$(PERLRUN) -e "exit unless -f shift; system q{$(MAKE) realclean}" $(FIRST_MAKEFILE) + -cd .. +RCLEAN + + } + + return $rclean; +} + + +=item os_flavor + +Win95 and Win98 and WinME are collectively Win9x and Win32 + +=cut + +sub os_flavor { + my $self = shift; + return ($self->SUPER::os_flavor, 'Win9x'); +} + + +=back + + +=head1 AUTHOR + +Code originally inside MM_Win32. Original author unknown. + +Currently maintained by Michael G Schwern <schwern@pobox.com>. + +Send patches and ideas to <F<makemaker@perl.org>>. + +See http://www.makemaker.org. + +=cut + + 1; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/FAQ.pod b/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/FAQ.pod new file mode 100644 index 00000000000..a8e9bf2e997 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/FAQ.pod @@ -0,0 +1,257 @@ +package ExtUtils::MakeMaker::FAQ; + +(our $VERSION) = sprintf "%03d", q$Revision: 1.1.1.1 $ =~ /Revision:\s+(\S+)/; + +1; +__END__ + +=head1 NAME + +ExtUtils::MakeMaker::FAQ - Frequently Asked Questions About MakeMaker + +=head1 DESCRIPTION + +FAQs, tricks and tips for C<ExtUtils::MakeMaker>. + +=head2 Philosophy and History + +=over 4 + +=item Why not just use <insert other build config tool here>? + +Why did MakeMaker reinvent the build configuration wheel? Why not +just use autoconf or automake or ppm or Ant or ... + +There are many reasons, but the major one is cross-platform +compatibility. + +Perl is one of the most ported pieces of software ever. It works on +operating systems I've never even heard of (see perlport for details). +It needs a build tool that can work on all those platforms and with +any wacky C compilers they might have. + +No such build tool existed at the time and I only know of one now +(Module::Build). + + +=item What's Module::Build and how does it relate to MakeMaker? + +Module::Build is a project by Ken Williams to supplant MakeMaker. +Its primary advantages are: + +=over 8 + +=item * pure perl. no make, no shell commands + +=item * easier to customize + +=item * cleaner internals + +=item * less cruft + +=back + +Module::Build is the official heir apparent to MakeMaker and we +encourage people to work on M::B rather than spending time improving +MakeMaker. + +=back + +=head2 Module Writing + +=over 4 + +=item How do I keep my $VERSION up to date without resetting it manually? + +Often you want to manually set the $VERSION in the main module +distribution because this is the version that everybody sees on CPAN +and maybe you want to customize it a bit. But for all the other +modules in your dist, $VERSION is really just bookkeeping and all that's +important is it goes up every time the module is changed. Doing this +by hand is a pain and you often forget. + +Simplest way to do it automatically is to use your version control +system's revision number (you are using version control, right?). + +In CVS and RCS you use $Z<>Revision$ writing it like so: + + $VERSION = sprintf "%d.%03d", q$Revision: 1.1.1.1 $ =~ /(\d+)/g; + +Every time the file is checked in the $Z<>Revision$ will be updated, +updating your $VERSION. + +In CVS version 1.9 is followed by 1.10. Since CPAN compares version +numbers numerically we use a sprintf() to convert 1.9 to 1.009 and +1.10 to 1.010 which compare properly. + +If branches are involved (ie. $Z<>Revision: 1.5.3.4) its a little more +complicated. + + # must be all on one line or MakeMaker will get confused. + $VERSION = do { my @r = (q$Revision: 1.1.1.1 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; + +=item What's this F<META.yml> thing and how did it get in my F<MANIFEST>?! + +F<META.yml> is a module meta-data file pioneered by Module::Build and +automatically generated as part of the 'distdir' target (and thus +'dist'). See L<ExtUtils::MakeMaker/"Module Meta-Data">. + +To shut off its generation, pass the C<NO_META> flag to C<WriteMakefile()>. + +=back + +=head2 XS + +=over 4 + +=item How to I prevent "object version X.XX does not match bootstrap parameter Y.YY" errors? + +XS code is very sensitive to the module version number and will +complain if the version number in your Perl module doesn't match. If +you change your module's version # without reruning Makefile.PL the old +version number will remain in the Makefile causing the XS code to be built +with the wrong number. + +To avoid this, you can force the Makefile to be rebuilt whenever you +change the module containing the version number by adding this to your +WriteMakefile() arguments. + + depend => { '$(FIRST_MAKEFILE)' => '$(VERSION_FROM)' } + + +=item How do I make two or more XS files coexist in the same directory? + +Sometimes you need to have two and more XS files in the same package. +One way to go is to put them into separate directories, but sometimes +this is not the most suitable solution. The following technique allows +you to put two (and more) XS files in the same directory. + +Let's assume that we have a package C<Cool::Foo>, which includes +C<Cool::Foo> and C<Cool::Bar> modules each having a separate XS +file. First we use the following I<Makefile.PL>: + + use ExtUtils::MakeMaker; + + WriteMakefile( + NAME => 'Cool::Foo', + VERSION_FROM => 'Foo.pm', + OBJECT => q/$(O_FILES)/, + # ... other attrs ... + ); + +Notice the C<OBJECT> attribute. MakeMaker generates the following +variables in I<Makefile>: + + # Handy lists of source code files: + XS_FILES= Bar.xs \ + Foo.xs + C_FILES = Bar.c \ + Foo.c + O_FILES = Bar.o \ + Foo.o + +Therefore we can use the C<O_FILES> variable to tell MakeMaker to use +these objects into the shared library. + +That's pretty much it. Now write I<Foo.pm> and I<Foo.xs>, I<Bar.pm> +and I<Bar.xs>, where I<Foo.pm> bootstraps the shared library and +I<Bar.pm> simply loading I<Foo.pm>. + +The only issue left is to how to bootstrap I<Bar.xs>. This is done +from I<Foo.xs>: + + MODULE = Cool::Foo PACKAGE = Cool::Foo + + BOOT: + # boot the second XS file + boot_Cool__Bar(aTHX_ cv); + +If you have more than two files, this is the place where you should +boot extra XS files from. + +The following four files sum up all the details discussed so far. + + Foo.pm: + ------- + package Cool::Foo; + + require DynaLoader; + + our @ISA = qw(DynaLoader); + our $VERSION = '0.01'; + bootstrap Cool::Foo $VERSION; + + 1; + + Bar.pm: + ------- + package Cool::Bar; + + use Cool::Foo; # bootstraps Bar.xs + + 1; + + Foo.xs: + ------- + #include "EXTERN.h" + #include "perl.h" + #include "XSUB.h" + + MODULE = Cool::Foo PACKAGE = Cool::Foo + + BOOT: + # boot the second XS file + boot_Cool__Bar(aTHX_ cv); + + MODULE = Cool::Foo PACKAGE = Cool::Foo PREFIX = cool_foo_ + + void + cool_foo_perl_rules() + + CODE: + fprintf(stderr, "Cool::Foo says: Perl Rules\n"); + + Bar.xs: + ------- + #include "EXTERN.h" + #include "perl.h" + #include "XSUB.h" + + MODULE = Cool::Bar PACKAGE = Cool::Bar PREFIX = cool_bar_ + + void + cool_bar_perl_rules() + + CODE: + fprintf(stderr, "Cool::Bar says: Perl Rules\n"); + +And of course a very basic test: + + test.pl: + -------- + use Test; + BEGIN { plan tests => 1 }; + use Cool::Foo; + use Cool::Bar; + Cool::Foo::perl_rules(); + Cool::Bar::perl_rules(); + ok 1; + +This tip has been brought to you by Nick Ing-Simmons and Stas Bekman. + +=back + +=head1 PATCHING + +If you have a question you'd like to see added to the FAQ (whether or +not you have the answer) please send it to makemaker@perl.org. + +=head1 AUTHOR + +The denizens of makemaker@perl.org. + +=head1 SEE ALSO + +L<ExtUtils::MakeMaker> + +=cut diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/Tutorial.pod b/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/Tutorial.pod new file mode 100644 index 00000000000..fbfcf8abcc4 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/Tutorial.pod @@ -0,0 +1,179 @@ +package ExtUtils::MakeMaker::Tutorial; + +use vars qw($VERSION); +$VERSION = 0.01; + + +=head1 NAME + +ExtUtils::MakeMaker::Tutorial - Writing a module with MakeMaker + +=head1 SYNOPSIS + + use ExtUtils::MakeMaker; + + WriteMakefile( + NAME => 'Your::Module', + VERSION_FROM => 'lib/Your/Module.pm' + ); + +=head1 DESCRIPTION + +This is a short tutorial on writing a simple module with MakeMaker. +Its really not that hard. + + +=head2 The Mantra + +MakeMaker modules are installed using this simple mantra + + perl Makefile.PL + make + make test + make install + +There are lots more commands and options, but the above will do it. + + +=head2 The Layout + +The basic files in a module look something like this. + + Makefile.PL + MANIFEST + lib/Your/Module.pm + +That's all that's strictly necessary. There's additional files you might +want: + + lib/Your/Other/Module.pm + t/some_test.t + t/some_other_test.t + Changes + README + INSTALL + MANIFEST.SKIP + bin/some_program + +=over 4 + +=item Makefile.PL + +When you run Makefile.PL, it makes a Makefile. That's the whole point of +MakeMaker. The Makefile.PL is a simple module which loads +ExtUtils::MakeMaker and runs the WriteMakefile() function with a few +simple arguments. + +Here's an example of what you need for a simple module: + + use ExtUtils::MakeMaker; + + WriteMakefile( + NAME => 'Your::Module', + VERSION_FROM => 'lib/Your/Module.pm' + ); + +NAME is the top-level namespace of your module. VERSION_FROM is the file +which contains the $VERSION variable for the entire distribution. Typically +this is the same as your top-level module. + + +=item MANIFEST + +A simple listing of all the files in your distribution. + + Makefile.PL + MANIFEST + lib/Your/Module.pm + +Filepaths in a MANIFEST always use Unix conventions (ie. /) even if you're +not on Unix. + +You can write this by hand or generate it with 'make manifest'. + + +=item lib/ + +This is the directory where your .pm and .pod files you wish to have +installed go. They are layed out according to namespace. So Foo::Bar +is lib/Foo/Bar.pm. + + +=item t/ + +Tests for your modules go here. Each test filename ends with a .t. +So t/foo.t. 'make test' will run these tests. The directory is flat, +you cannot, for example, have t/foo/bar.t run by 'make test'. + +Tests are run from the top level of your distribution. So inside a test +you would refer to ./lib to enter the lib directory, for example. + + +=item Changes + +A log of changes you've made to this module. The layout is free-form. +Here's an example: + + 1.01 Fri Apr 11 00:21:25 PDT 2003 + - thing() does some stuff now + - fixed the wiggy bug in withit() + + 1.00 Mon Apr 7 00:57:15 PDT 2003 + - "Rain of Frogs" now supported + + +=item README + +A short description of your module, what it does, why someone would use it +and its limitations. CPAN automatically pulls your README file out of +the archive and makes it available to CPAN users, it is the first thing +they will read to decide if your module is right for them. + + +=item INSTALL + +Instructions on how to install your module along with any dependencies. +Suggested information to include here: + + any extra modules required for use + the minimum version of Perl required + if only works on certain operating systems + + +=item MANIFEST.SKIP + +A file full of regular expressions to exclude when using 'make +manifest' to generate the MANIFEST. These regular expressions +are checked against each filepath found in the distribution (so +you're matching against "t/foo.t" not "foo.t"). + +Here's a sample: + + ~$ # ignore emacs and vim backup files + .bak$ # ignore manual backups + \# # ignore CVS old revision files and emacs temp files + +Since # can be used for comments, # must be escaped. + +MakeMaker comes with a default MANIFEST.SKIP to avoid things like +version control directories and backup files. Specifying your own +will override this default. + + +=item bin/ + + +=back + +=head1 SEE ALSO + +L<perlmodstyle> gives stylistic help writing a module. + +L<perlnewmod> gives more information about how to write a module. + +There are modules to help you through the process of writing a module: +L<ExtUtils::ModuleMaker>, L<Module::Install>, L<PAR> + +=cut + +1; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/bytes.pm b/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/bytes.pm new file mode 100644 index 00000000000..7b7e8544201 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/bytes.pm @@ -0,0 +1,39 @@ +package ExtUtils::MakeMaker::bytes; + +use vars qw($VERSION); +$VERSION = 0.01; + +my $Have_Bytes = eval q{require bytes; 1;}; + +sub import { + return unless $Have_Bytes; + + shift; + unshift @_, 'bytes'; + + goto &bytes::import; +} + +1; + + +=head1 NAME + +ExtUtils::MakeMaker::bytes - Version agnostic bytes.pm + +=head1 SYNOPSIS + + use just like bytes.pm + +=head1 DESCRIPTION + +bytes.pm was introduced with 5.6. This means any code which has 'use +bytes' in it won't even compile on 5.5.X. Since bytes is a lexical +pragma and must be used at compile time we can't simply wrap it in +a BEGIN { eval 'use bytes' } block. + +ExtUtils::MakeMaker::bytes is just a very thin wrapper around bytes +which works just like it when bytes.pm exists and everywhere else it +does nothing. + +=cut diff --git a/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/vmsish.pm b/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/vmsish.pm new file mode 100644 index 00000000000..5380ba569a3 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/MakeMaker/vmsish.pm @@ -0,0 +1,40 @@ +package ExtUtils::MakeMaker::vmsish; + +use vars qw($VERSION); +$VERSION = 0.01; + +my $IsVMS = $^O eq 'VMS'; + +require vmsish if $IsVMS; + + +sub import { + return unless $IsVMS; + + shift; + unshift @_, 'vmsish'; + + goto &vmsish::import; +} + +1; + + +=head1 NAME + +ExtUtils::MakeMaker::vmsish - Platform agnostic vmsish.pm + +=head1 SYNOPSIS + + use just like vmsish.pm + +=head1 DESCRIPTION + +Until 5.8.0, vmsish.pm is only installed on VMS. This means any code +which has 'use vmsish' in it won't even compile outside VMS. This +makes ExtUtils::MM_VMS very hard to test. + +ExtUtils::MakeMaker::vmsish is just a very thin wrapper around vmsish +which works just like it on VMS and everywhere else it does nothing. + +=cut diff --git a/gnu/usr.bin/perl/lib/ExtUtils/NOTES b/gnu/usr.bin/perl/lib/ExtUtils/NOTES new file mode 100644 index 00000000000..837167c026d --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/NOTES @@ -0,0 +1,102 @@ +The Simplified MakeMaker class hierarchy +**************************************** + +What most people need to know. + +(Subclasses on top.) + + MY + | + ExtUtils::MakeMaker + | + ExtUtils::MM_{Current OS} + | + ExtUtils::MM_Unix + | + ExtUtils::MM_Any + +The object actually used is of the class MY which allows you to +override bits of MakeMaker inside your Makefile.PL by declaring +MY::foo() methods. + + +The Real MakeMaker class hierarchy +********************************** + +You wish it was that simple. + +Here's how it really works. + + PACK### (created each call to ExtUtils::MakeMaker->new) + . | + (mixin) | + . | + MY (created by ExtUtils::MY) | + | | + ExtUtils::MY MM (created by ExtUtils::MM) + | | | + ExtUtils::MM ExtUtils::MM_{Current OS} + | | . + | | + ExtUtils::Liblist ExtUtils::MakeMaker . + | + ExtUtils::Liblist::Kid . + + (variable subclass) + + . + + ExtUtils::MM_{NonUnix}. . . . . . . . . . . . . . . . + | + ExtUtils::MM_Unix . . . . . . . . . . . . . . . . . . + | + ExtUtils::MM_Any + + +NOTE: Yes, this is a mess. See +http://archive.develooper.com/makemaker@perl.org/msg00134.html +for some history. + +NOTE: When ExtUtils::MM is loaded it chooses a superclass for MM from +amongst the ExtUtils::MM_* modules based on the current operating +system. + +NOTE: ExtUtils::MM_{Current OS} represents one of the ExtUtils::MM_* +modules except ExtUtils::MM_Any. + +NOTE: ExtUtils::MM_{NonUnix} represents all of the ExtUtils::MM_* +modules except ExtUtils::MM_Any and ExtUtils::MM_Unix. + +NOTE: The main object used by MakeMaker is a PACK### object, *not* +ExtUtils::MakeMaker. It is, effectively, a subclass of MY, +ExtUtils::Makemaker, ExtUtils::Liblist and an ExtUtils::MM_* class +appropriate for your operating system. + +NOTE: The methods in MY are simply copied into PACK### rather than +MY being a superclass of PACK###. I don't remember the rationale. + +NOTE: ExtUtils::Liblist should be removed from the inheritence hiearchy +and simply be called as functions. + +NOTE: Modules like File::Spec and Exporter have been omitted for clarity. + + +The MM_* hierarchy +****************** + + MM_Win95 MM_NW5 + \ / +MM_BeOS MM_Cygwin MM_OS2 MM_VMS MM_Win32 MM_DOS MM_MacOS MM_UWIN + \ | | | / / / / + --------------------------------------------------------- + | | + MM_Unix | + | | + MM_Any + +NOTE: Each direct MM_Unix subclass is also an MM_Any subclass. This +is a temporary hack because MM_Unix overrides some MM_Any methods with +Unix specific code. It allows the non-Unix modules to see the +original MM_Any implementations. + +NOTE: Modules like File::Spec and Exporter have been omitted for clarity. diff --git a/gnu/usr.bin/perl/lib/ExtUtils/PATCHING b/gnu/usr.bin/perl/lib/ExtUtils/PATCHING new file mode 100644 index 00000000000..9c3da45d26c --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/PATCHING @@ -0,0 +1,180 @@ +This is a short set of guidelines for those patching +ExtUtils::MakeMaker. Its not an iron-clad set of rules, but just +things which make life easier when reading and integrating a patch. + +Lots of information can be found in makemaker.org. + +MakerMaker is being maintained until something else can replace it. +Bugs will be fixed and compatibility improved, but I would like to +avoid new features. If you want to add something to MakeMaker, +consider instead working on Module::Build, MakeMaker's heir apparent. + + +Reporting bugs + +- Often the only information we have for fixing a bug is contained in your + report. So... + +- Please report your bugs via http://rt.cpan.org or by mailing to + makemaker@perl.org. RT is preferred. + +- Please report your bug immediately upon encountering it. Do not wait + until you have a patch to fix the bug. Patches are good, but not at + the expense of timely bug reports. + +- Please be as verbose as possible. Include the complete output of + your 'make test' or even 'make test TEST_VERBOSE=1' and a copy of the + generated Makefile. Err on the side of verbosity. The more data we + have to work with, the faster we can diagnose the problem. + +- If you find an undocumented feature, or if a feature has changed/been + added which causes a problem, report it. Do not assume it was done + deliberately. Even if it was done deliberately, we still want to hear + if it caused problems. + +- If you're testing MakeMaker against a development version of Perl, + please also check it against the latest stable version. This makes it + easier to figure out if its MakeMaker or Perl at fault. + + +Patching details + +- Please use unified diffs. (diff -u) + +- Patches against the latest development snapshot from makemaker.org are + preferred. Patches against the latest CPAN version are ok, too. + +- Post your patch to makemaker@perl.org. + + +Code formatting + +- No literal tabs (except where necessary inside Makefile code, obviously). + +- 4 character indentation. + +- this_style is prefered instead of studlyCaps. + +- Private subroutine names (ie. those used only in the same package + they're declared in) should start with an underscore (_sekret_method). + +- Protected subroutines (ie. ones intended to be used by other modules in + ExtUtils::*) should be named normally (no leading underscore) but + documented as protected (see Documentation below). + +- Do not use indirect object syntax (ie. new Foo::Bar (@args)) + +- make variables use dollar signs like Perl scalars. This causes problems + when you have to mix them both in a string. If you find yourself + backwacking lots of dollar signs because you have one interpolated + perl variable, like this: + + return <<'EOT' + +subdirs :: + \$(NOECHO)cd $subdir && \$(MAKE) -f \$(FIRST_MAKEFILE) all \$(PASTHRU) +EOT + + or are switching quoting contexts: + + return <<q{ +subdirs :: + $(NOECHO)cd }.$subdir.q{ && $(MAKE) -f $(FIRST_MAKEFILE) all $(PASTHRU) +}; + + consider using sprintf instead. + + return sprintf <<'EOT', $subdir; + +subdirs :: + $(NOECHO)cd %s && $(MAKE) -f $(FIRST_MAKEFILE) all $(PASTHRU) +EOT + + +Refactoring and Cleanup + +- MakeMaker is a mess. We like patches which clean things up. + + +Backwards Compatibility + +- MakeMaker must be backwards compatible to 5.5.3 (5.005_03). Avoid any + obvious 5.6-isms (threads, warnings.pm, Unicode, our, v1.2.3, attributes + open my $fh, lvalue subroutines, any new core modules, etc...). + +- MakeMaker should avoid having module dependencies. Avoid using modules + which didn't come with 5.5.3 and avoid using features from newer + versions. Sometimes this is unavoidable. + + +Cross-Platform Compatibility + +- MakeMaker must work on all architectures Perl works on (see perlport.pod) + and with many different versions of make. This means all Unixen + (including Cygwin and MacOS X), Windows (including DOS), MacOS Classic + and VMS. + +- Often when you patch ExtUtils::MM_Unix, similar patches must be done + to the other MM_* modules. If you can, please do this extra work + otherwise I have to. If you can't, that's ok. We can help. + +- If possible, please test your patch on two Very Different architectures. + Unix, Windows, MacOS Classic and VMS being Very Different. Note: Cygwin + and OS X are Unixen for our purposes. + +- If nothing else, at least try it on two different Unixen or Windows + machines (ie. Linux and IRIX or WinNT and Win95). + +- HP's TestDrive (www.testdrive.compaq.com) and SourceForge's + compile farm (www.sourceforge.net) are good sources of testing + machines of many different architectures and platforms. Accounts are + free. + +- If you find yourself writing "do_this if $^O eq 'That'" (ie. checks on + the OS type) perhaps your code belongs in one of the non-Unix MM_* + modules (ie. MM_Win32, MM_VMS, etc...). If one does not exist, consider + creating one. Its ok to have an MM_* module with only one method. + +- Some shells have very small buffers. This means command lines must + be as small as possible. If your command is just too long, consider + making it an ExtUtils::Command::MM function. If your command might + receive many arguments (such as pod2man or pm_to_blib) consider + using split_command() to split it into several, shorter calls. + +- Most shells quote differently. If you need to put a perl one-liner + in the Makefile, please use oneliner() to generate it. + + +Tests + +- Tests would be nice, but I'm not going to pretend testing MakeMaker + is easy. If nothing else, let us know how you tested your patch by + hand. + + +Documentation + +- Documentation would be nice. + +- If the new feature/method is private, please document it with POD + wrapped in "=begin/end private" tags. That way it will be documented, + but won't be displayed (future versions of perldoc may have options + to display). + + =begin private + + =item _foo_bar + + $mm->_foo_bar + + Blah blah blah + + =end private + + =cut + + sub _foo_bar { + ... + +- If you're overriding a method, document that its an override and + *why* its being overridden. Don't repeat the original documentation. diff --git a/gnu/usr.bin/perl/lib/ExtUtils/README b/gnu/usr.bin/perl/lib/ExtUtils/README new file mode 100644 index 00000000000..4d6eed77c5f --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/README @@ -0,0 +1,57 @@ +This is a CPAN distribution of the venerable MakeMaker module. It has been +backported to work with Perl 5.005_03 and up. + +If you do not have a make program, several can be found... + +Most Unixen: The make utility which comes with your operating system +should work fine. If you don't have one, GNU make is recommended, +most others (Sun, BSD, etc...) will work fine as well. + +Windows: nmake or dmake will work. GNU make will *not*. +ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe +http://search.cpan.org/author/GSAR/dmake-4.1pl1-win32/ + +VMS: MMS or the free MadGoat MaKe utility (MMK) will work. +http://www.madgoat.com/mmk.html + +If all else fails there is a pure Perl version of make available on +CPAN which should work on most Unixen. +http://search.cpan.org/author/NI-S/Make-1.00/ + + +PLEASE NOTE: This distribution does not include the xsubpp or typemap +programs. They are extremely specific to your version or Perl, so +MakeMaker will simply use the one which came with your copy of Perl. +Do not delete your old ExtUtils/ directory. An upgraded version of xsubpp +can be found in the ExtUtils::ParseXS module. + +Known Good Systems: + +Every stable MakeMaker release is tested at least on: + +MacOS X +Linux/x86 +ActivePerl on Windows 98 +Cygwin on Windows 98 +OpenVMS + +Covering the major portability flavors MakeMaker has to cover. +(I'm always on the lookout for DJGPP, Solaris, *BSD and OS/2 users) + + +Known Problems: + +(See http://rt.cpan.org for a full list of open problems.) + +ActivePerl likely broken if installed in C:\Program Files or other +prefix with a space in the name. + +Using the MMS utility on VMS causes lots of extra newlines. Unknown +why this is so, might be a bug in MMS. Problem not seen with MMK. + +MacOS Classic is likely broken. + + +See TODO for details. + +Please report any bugs via http://rt.cpan.org or to makemaker@perl.org. diff --git a/gnu/usr.bin/perl/lib/ExtUtils/TODO b/gnu/usr.bin/perl/lib/ExtUtils/TODO new file mode 100644 index 00000000000..3ff020c79a1 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/TODO @@ -0,0 +1,76 @@ +Rethink MM_Win32 tests. + +Investigate one method per make target. + +Test MM_Any and pull some redundant tests out of MM_*.t + +Create a way to init MM objects. (XXX What's wrong with MakeMaker->new?) + +Move instmodsh to utils/ in the core. + +Handle config files (ie. /etc) and their special PREFIX needs +(ie. PREFIX=/usr, INSTALLCONFIGDIR=/etc). + +Make sure PDL builds + +Fix find_perl on Amiga trg@privat.utfors.se + +Fix appending of .. when DIRS contains directories not immediately +below the cwd. + +Fill in the IMPORTS docs. + +Document "make install UNINST=1" + +Remove tar -I Sun-ism from instmodsh. + +Consider adding a timeout option to prompt() and env variable. + +Unify VMS->find_perl + +Consider if VMS->find_perl needs to have pieces put into maybe_command() + +Add a MM_Any->init_others() using ExtUtils::Command. + +Figure out and document the 4th arg to ExtUtils::Install::install() + +Consider if adding a nativize() routine to replace macify() and +fixpath() is useful. + +Eliminate eliminate_macros() from inside FS::VMS->catfile and catdir. +Make into MM_VMS wrappers. + +Test ExtUtils::Command::MM + +Finish ExtUtils::MakeMaker::Tutorial + +Add 'how to install additional files' to ExtUtils::MakeMaker::FAQ. + +Fix NORECUSE bug continuing to set DIR + +Give typemap location its own macro. + +Merge MM_VMS->tool_xsubpp + +Initialize PERL_SRC to '' instead of leaving undef when outside the source +tree + +Reinstate HTMLification to use the new HTML Config info. + +split manifypods target into more generic docifypods target which depends on +manifypods + +Add target to generate native Win32 help files (or whatever Win32 likes +to use for help files these days) + +Add target to generate native VMS help files. + +On VMS, write PM_FILTERs to a temp file and run from there avoiding command +line lengths. Worth the trouble given the Unixy nature of PM_FILTER? + +Move oneliner() and friends into a seperate module for general consumption. + +Make out of date check on 'make dist' more useful +http://archive.develooper.com/makemaker@perl.org/msg01075.html + +Make maniadd() return a tied, case-insensitive hash on VMS. diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/00compile.t b/gnu/usr.bin/perl/lib/ExtUtils/t/00compile.t new file mode 100644 index 00000000000..5eb015b13dd --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/00compile.t @@ -0,0 +1,42 @@ +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} +chdir 't'; + +use File::Find; +use File::Spec; +use Test::More; + +my $Has_Test_Pod; +BEGIN { + $Has_Test_Pod = eval 'use Test::Pod 0.95; 1'; +} + +chdir File::Spec->updir; +my $manifest = File::Spec->catfile('MANIFEST'); +open(MANIFEST, $manifest) or die "Can't open $manifest: $!"; +my @modules = map { m{^lib/(\S+)}; $1 } + grep { m{^lib/ExtUtils/\S*\.pm} } <MANIFEST>; +chomp @modules; +close MANIFEST; + +chdir 'lib'; +plan tests => scalar @modules * 2; +foreach my $file (@modules) { + # 5.8.0 has a bug about require alone in an eval. Thus the extra + # statement. + eval { require($file); 1 }; + is( $@, '', "require $file" ); + + SKIP: { + skip "Test::Pod not installed", 1 unless $Has_Test_Pod; + pod_file_ok($file); + } +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/00setup_dummy.t b/gnu/usr.bin/perl/lib/ExtUtils/t/00setup_dummy.t index 2d5b1ee5c1b..0b9e58d056a 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/00setup_dummy.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/00setup_dummy.t @@ -16,24 +16,50 @@ use File::Basename; use File::Path; use File::Spec; +if( $^O eq 'VMS' ) { + # On older systems we might exceed the 8-level directory depth limit + # imposed by RMS. We get around this with a rooted logical, but we + # can't create logical names with attributes in Perl, so we do it + # in a DCL subprocess and put it in the job table so the parent sees it. + open( BFDTMP, '>bfdtesttmp.com' ) || die "Error creating command file; $!"; + print BFDTMP <<'COMMAND'; +$ BFD_TEST_ROOT = F$PARSE("SYS$DISK:[-]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]" +$ DEFINE/JOB/NOLOG/TRANSLATION=CONCEALED BFD_TEST_ROOT 'BFD_TEST_ROOT' +COMMAND + close BFDTMP; + + system '@bfdtesttmp.com'; + 1 while unlink 'bfdtesttmp.com'; +} + + my %Files = ( 'Big-Dummy/lib/Big/Dummy.pm' => <<'END', package Big::Dummy; $VERSION = 0.01; +=head1 NAME + +Big::Dummy - Try "our" hot dog's + +=cut + 1; END 'Big-Dummy/Makefile.PL' => <<'END', use ExtUtils::MakeMaker; -printf "Current package is: %s\n", __PACKAGE__; +# This will interfere with the PREREQ_PRINT tests. +printf "Current package is: %s\n", __PACKAGE__ unless "@ARGV" =~ /PREREQ/; WriteMakefile( NAME => 'Big::Dummy', VERSION_FROM => 'lib/Big/Dummy.pm', - PREREQ_PM => {}, + PREREQ_PM => { strict => 0 }, + ABSTRACT_FROM => 'lib/Big/Dummy.pm', + AUTHOR => 'Michael G Schwern <schwern@pobox.com>', ); END diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Command.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Command.t index ff9eec1da42..bf7d177889f 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/Command.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Command.t @@ -12,98 +12,96 @@ BEGIN { chdir 't'; BEGIN { - 1 while unlink 'ecmdfile'; - # forcibly remove ecmddir/temp2, but don't import mkpath - use File::Path (); - File::Path::rmtree( 'ecmddir' ); + $Testfile = 'testfile.foo'; } BEGIN { - use Test::More tests => 24; - use File::Spec; + 1 while unlink $Testfile, 'newfile'; + # forcibly remove ecmddir/temp2, but don't import mkpath + use File::Path (); + File::Path::rmtree( 'ecmddir' ); } -{ - # bad neighbor, but test_f() uses exit() - *CORE::GLOBAL::exit = ''; # quiet 'only once' warning. - *CORE::GLOBAL::exit = sub { return @_ }; +BEGIN { + use Test::More tests => 26; + use File::Spec; +} - use_ok( 'ExtUtils::Command' ); +BEGIN { + # bad neighbor, but test_f() uses exit() + *CORE::GLOBAL::exit = ''; # quiet 'only once' warning. + *CORE::GLOBAL::exit = sub { return @_ }; + use_ok( 'ExtUtils::Command' ); +} - # get a file in the current directory, replace last char with wildcard - my $file; - { - local *DIR; - opendir(DIR, File::Spec->curdir()); - while ($file = readdir(DIR)) { - $file =~ s/\.\z// if $^O eq 'VMS'; - last if $file =~ /^\w/; - } - } +{ + # concatenate this file with itself + # be extra careful the regex doesn't match itself + use TieOut; + my $out = tie *STDOUT, 'TieOut'; + my $self = $0; + unless (-f $self) { + my ($vol, $dirs, $file) = File::Spec->splitpath($self); + my @dirs = File::Spec->splitdir($dirs); + unshift(@dirs, File::Spec->updir); + $dirs = File::Spec->catdir(@dirs); + $self = File::Spec->catpath($vol, $dirs, $file); + } + @ARGV = ($self, $self); + cat(); + is( scalar( $$out =~ s/use_ok\( 'ExtUtils::Command'//g), 2, + 'concatenation worked' ); - # % means 'match one character' on VMS. Everything else is ? - my $match_char = $^O eq 'VMS' ? '%' : '?'; - ($ARGV[0] = $file) =~ s/.\z/$match_char/; + # the truth value here is reversed -- Perl true is C false + @ARGV = ( $Testfile ); + ok( test_f(), 'testing non-existent file' ); - # this should find the file - ExtUtils::Command::expand_wildcards(); + @ARGV = ( $Testfile ); + cmp_ok( ! test_f(), '==', (-f $Testfile), 'testing non-existent file' ); - is( scalar @ARGV, 1, 'found one file' ); - like( $ARGV[0], qr/$file/, 'expanded wildcard ? successfully' ); + # these are destructive, have to keep setting @ARGV + @ARGV = ( $Testfile ); + touch(); - # try it with the asterisk now - ($ARGV[0] = $file) =~ s/.{3}\z/\*/; - ExtUtils::Command::expand_wildcards(); + @ARGV = ( $Testfile ); + ok( test_f(), 'now creating that file' ); - ok( (grep { qr/$file/ } @ARGV), 'expanded wildcard * successfully' ); + @ARGV = ( $Testfile ); + ok( -e $ARGV[0], 'created!' ); - # concatenate this file with itself - # be extra careful the regex doesn't match itself - use TieOut; - my $out = tie *STDOUT, 'TieOut'; - my $self = $0; - unless (-f $self) { - my ($vol, $dirs, $file) = File::Spec->splitpath($self); - my @dirs = File::Spec->splitdir($dirs); - unshift(@dirs, File::Spec->updir); - $dirs = File::Spec->catdir(@dirs); - $self = File::Spec->catpath($vol, $dirs, $file); - } - @ARGV = ($self, $self); - - cat(); - is( scalar( $$out =~ s/use_ok\( 'ExtUtils::Command'//g), 2, - 'concatenation worked' ); - - # the truth value here is reversed -- Perl true is C false - @ARGV = ( 'ecmdfile' ); - ok( test_f(), 'testing non-existent file' ); - - @ARGV = ( 'ecmdfile' ); - cmp_ok( ! test_f(), '==', (-f 'ecmdfile'), 'testing non-existent file' ); - - # these are destructive, have to keep setting @ARGV - @ARGV = ( 'ecmdfile' ); - touch(); - - @ARGV = ( 'ecmdfile' ); - ok( test_f(), 'now creating that file' ); - - @ARGV = ( 'ecmdfile' ); - ok( -e $ARGV[0], 'created!' ); - - my ($now) = time; - utime ($now, $now, $ARGV[0]); + my ($now) = time; + utime ($now, $now, $ARGV[0]); sleep 2; - # Just checking modify time stamp, access time stamp is set - # to the beginning of the day in Win95. + # Just checking modify time stamp, access time stamp is set + # to the beginning of the day in Win95. # There's a small chance of a 1 second flutter here. my $stamp = (stat($ARGV[0]))[9]; - cmp_ok( abs($now - $stamp), '<=', 1, 'checking modify time stamp' ) || + cmp_ok( abs($now - $stamp), '<=', 1, 'checking modify time stamp' ) || diag "mtime == $stamp, should be $now"; + @ARGV = qw(newfile); + touch(); + + my $new_stamp = (stat('newfile'))[9]; + cmp_ok( abs($new_stamp - $stamp), '>=', 2, 'newer file created' ); + + @ARGV = ('newfile', $Testfile); + eqtime(); + + $stamp = (stat($Testfile))[9]; + cmp_ok( abs($new_stamp - $stamp), '<=', 1, 'eqtime' ); + + # eqtime use to clear the contents of the file being equalized! + open(FILE, ">>$Testfile") || die $!; + print FILE "Foo"; + close FILE; + + @ARGV = ('newfile', $Testfile); + eqtime(); + ok( -s $Testfile, "eqtime doesn't clear the file being equalized" ); + SKIP: { if ($^O eq 'amigaos' || $^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'dos' || $^O eq 'cygwin' || @@ -113,80 +111,104 @@ BEGIN { } # change a file to execute-only - @ARGV = ( 0100, 'ecmdfile' ); + @ARGV = ( '0100', $Testfile ); ExtUtils::Command::chmod(); - is( ((stat('ecmdfile'))[2] & 07777) & 0700, + is( ((stat($Testfile))[2] & 07777) & 0700, 0100, 'change a file to execute-only' ); # change a file to read-only - @ARGV = ( 0400, 'ecmdfile' ); + @ARGV = ( '0400', $Testfile ); ExtUtils::Command::chmod(); - is( ((stat('ecmdfile'))[2] & 07777) & 0700, + is( ((stat($Testfile))[2] & 07777) & 0700, ($^O eq 'vos' ? 0500 : 0400), 'change a file to read-only' ); # change a file to write-only - @ARGV = ( 0200, 'ecmdfile' ); + @ARGV = ( '0200', $Testfile ); ExtUtils::Command::chmod(); - is( ((stat('ecmdfile'))[2] & 07777) & 0700, + is( ((stat($Testfile))[2] & 07777) & 0700, ($^O eq 'vos' ? 0700 : 0200), 'change a file to write-only' ); } # change a file to read-write - @ARGV = ( 0600, 'ecmdfile' ); - ExtUtils::Command::chmod(); + @ARGV = ( '0600', $Testfile ); + ExtUtils::Command::chmod(); - is( ((stat('ecmdfile'))[2] & 07777) & 0700, + is( ((stat($Testfile))[2] & 07777) & 0700, ($^O eq 'vos' ? 0700 : 0600), 'change a file to read-write' ); - # mkpath - @ARGV = ( File::Spec->join( 'ecmddir', 'temp2' ) ); - ok( ! -e $ARGV[0], 'temp directory not there yet' ); + # mkpath + @ARGV = ( File::Spec->join( 'ecmddir', 'temp2' ) ); + ok( ! -e $ARGV[0], 'temp directory not there yet' ); + + mkpath(); + ok( -e $ARGV[0], 'temp directory created' ); + + # copy a file to a nested subdirectory + unshift @ARGV, $Testfile; + cp(); + + ok( -e File::Spec->join( 'ecmddir', 'temp2', $Testfile ), 'copied okay' ); - mkpath(); - ok( -e $ARGV[0], 'temp directory created' ); + # cp should croak if destination isn't directory (not a great warning) + @ARGV = ( $Testfile ) x 3; + eval { cp() }; - # copy a file to a nested subdirectory - unshift @ARGV, 'ecmdfile'; - cp(); + like( $@, qr/Too many arguments/, 'cp croaks on error' ); - ok( -e File::Spec->join( 'ecmddir', 'temp2', 'ecmdfile' ), 'copied okay' ); + # move a file to a subdirectory + @ARGV = ( $Testfile, 'ecmddir' ); + mv(); - # cp should croak if destination isn't directory (not a great warning) - @ARGV = ( 'ecmdfile' ) x 3; - eval { cp() }; + ok( ! -e $Testfile, 'moved file away' ); + ok( -e File::Spec->join( 'ecmddir', $Testfile ), 'file in new location' ); - like( $@, qr/Too many arguments/, 'cp croaks on error' ); + # mv should also croak with the same wacky warning + @ARGV = ( $Testfile ) x 3; - # move a file to a subdirectory - @ARGV = ( 'ecmdfile', 'ecmddir' ); - mv(); + eval { mv() }; + like( $@, qr/Too many arguments/, 'mv croaks on error' ); - ok( ! -e 'ecmdfile', 'moved file away' ); - ok( -e File::Spec->join( 'ecmddir', 'ecmdfile' ), 'file in new location' ); + # Test expand_wildcards() + { + my $file = $Testfile; + @ARGV = (); + chdir 'ecmddir'; - # mv should also croak with the same wacky warning - @ARGV = ( 'ecmdfile' ) x 3; + # % means 'match one character' on VMS. Everything else is ? + my $match_char = $^O eq 'VMS' ? '%' : '?'; + ($ARGV[0] = $file) =~ s/.\z/$match_char/; - eval { mv() }; - like( $@, qr/Too many arguments/, 'mv croaks on error' ); + # this should find the file + ExtUtils::Command::expand_wildcards(); + + is_deeply( \@ARGV, [$file], 'expanded wildcard ? successfully' ); + + # try it with the asterisk now + ($ARGV[0] = $file) =~ s/.{3}\z/\*/; + ExtUtils::Command::expand_wildcards(); + + is_deeply( \@ARGV, [$file], 'expanded wildcard * successfully' ); + + chdir File::Spec->updir; + } - # remove some files - my @files = @ARGV = ( File::Spec->catfile( 'ecmddir', 'ecmdfile' ), - File::Spec->catfile( 'ecmddir', 'temp2', 'ecmdfile' ) ); - rm_f(); + # remove some files + my @files = @ARGV = ( File::Spec->catfile( 'ecmddir', $Testfile ), + File::Spec->catfile( 'ecmddir', 'temp2', $Testfile ) ); + rm_f(); - ok( ! -e $_, "removed $_ successfully" ) for (@ARGV); + ok( ! -e $_, "removed $_ successfully" ) for (@ARGV); - # rm_f dir - @ARGV = my $dir = File::Spec->catfile( 'ecmddir' ); - rm_rf(); - ok( ! -e $dir, "removed $dir successfully" ); + # rm_f dir + @ARGV = my $dir = File::Spec->catfile( 'ecmddir' ); + rm_rf(); + ok( ! -e $dir, "removed $dir successfully" ); } END { - 1 while unlink 'ecmdfile'; - File::Path::rmtree( 'ecmddir' ); + 1 while unlink $Testfile, 'newfile'; + File::Path::rmtree( 'ecmddir' ); } diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t index 25d705585e2..af637673fb7 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Constant.t @@ -1,191 +1,349 @@ #!/usr/bin/perl -w -print "1..51\n"; - BEGIN { if( $ENV{PERL_CORE} ) { chdir 't' if -d 't'; @INC = '../lib'; } + use Config; + unless ($Config{usedl}) { + print "1..0 # no usedl, skipping\n"; + exit 0; + } } # use warnings; use strict; use ExtUtils::MakeMaker; use ExtUtils::Constant qw (constant_types C_constant XS_constant autoload); -use Config; -use File::Spec::Functions qw(catfile rel2abs); +use File::Spec; +use Cwd; + +my $do_utf_tests = $] > 5.006; +my $better_than_56 = $] > 5.007; +# For debugging set this to 1. +my $keep_files = 0; +$| = 1; + # Because were are going to be changing directory before running Makefile.PL -my $perl; -$perl = rel2abs( $^X ) unless $] < 5.006; # Hack. Until 5.00503 has rel2abs +my $perl = $^X; +# 5.005 doesn't have new enough File::Spec to have rel2abs. But actually we +# only need it when $^X isn't absolute, which is going to be 5.8.0 or later +# (where ExtUtils::Constant is in the core, and tests against the uninstalled +# perl) +$perl = File::Spec->rel2abs ($perl) unless $] < 5.006; # ExtUtils::Constant::C_constant uses $^X inside a comment, and we want to # compare output to ensure that it is the same. We were probably run as ./perl # whereas we will run the child with the full path in $perl. So make $^X for # us the same as our child will see. $^X = $perl; - +my $lib = $ENV{PERL_CORE} ? '../../../lib' : '../../blib/lib'; +my $runperl = "$perl \"-I$lib\""; print "# perl=$perl\n"; -my $runperl = "$perl \"-I../../lib\""; -$| = 1; +my $make = $Config{make}; +$make = $ENV{MAKE} if exists $ENV{MAKE}; +if ($^O eq 'MSWin32' && $make eq 'nmake') { $make .= " -nologo"; } + +# Renamed by make clean +my $makefile = ($^O eq 'VMS' ? 'descrip' : 'Makefile'); +my $makefile_ext = ($^O eq 'VMS' ? '.mms' : ''); +my $makefile_rename = $makefile . ($^O eq 'VMS' ? '.mms' : '.old'); +my $output = "output"; +my $package = "ExtTest"; my $dir = "ext-$$"; -my @files; +my $subdir = 0; +# The real test counter. +my $realtest = 1; + +my $orig_cwd = cwd; +my $updir = File::Spec->updir; +die "Can't get current directory: $!" unless defined $orig_cwd; print "# $dir being created...\n"; mkdir $dir, 0777 or die "mkdir: $!\n"; -my $output = "output"; - -# For debugging set this to 1. -my $keep_files = 0; - END { + if (defined $orig_cwd and length $orig_cwd) { + chdir $orig_cwd or die "Can't chdir back to '$orig_cwd': $!"; use File::Path; print "# $dir being removed...\n"; rmtree($dir) unless $keep_files; + } else { + # Can't get here. + die "cwd at start was empty, but directory '$dir' was created" if $dir; + } } -my $package = "ExtTest"; +chdir $dir or die $!; +push @INC, '../../lib', '../../../lib'; -# Test the code that generates 1 and 2 letter name comparisons. -my %compass = ( -N => 0, 'NE' => 45, E => 90, SE => 135, S => 180, SW => 225, W => 270, NW => 315 -); +sub check_for_bonus_files { + my $dir = shift; + my %expect = map {($^O eq 'VMS' ? lc($_) : $_), 1} @_; -my $parent_rfc1149 = - 'A Standard for the Transmission of IP Datagrams on Avian Carriers'; -# Check that 8 bit and unicode names don't cause problems. -my $pound; -if (ord('A') == 193) { # EBCDIC platform - $pound = chr 177; # A pound sign. (Currency) -} else { # ASCII platform - $pound = chr 163; # A pound sign. (Currency) -} -my $inf = chr 0x221E; -# Check that we can distiguish the pathological case of a string, and the -# utf8 representation of that string. -my $pound_bytes = my $pound_utf8 = $pound . '1'; -utf8::encode ($pound_bytes); - -my @names = ("FIVE", {name=>"OK6", type=>"PV",}, - {name=>"OK7", type=>"PVN", - value=>['"not ok 7\\n\\0ok 7\\n"', 15]}, - {name => "FARTHING", type=>"NV"}, - {name => "NOT_ZERO", type=>"UV", value=>"~(UV)0"}, - {name => "OPEN", type=>"PV", value=>'"/*"', macro=>1}, - {name => "CLOSE", type=>"PV", value=>'"*/"', - macro=>["#if 1\n", "#endif\n"]}, - {name => "ANSWER", default=>["UV", 42]}, "NOTDEF", - {name => "Yes", type=>"YES"}, - {name => "No", type=>"NO"}, - {name => "Undef", type=>"UNDEF"}, -# OK. It wasn't really designed to allow the creation of dual valued constants. -# It was more for INADDR_ANY INADDR_BROADCAST INADDR_LOOPBACK INADDR_NONE - {name=>"RFC1149", type=>"SV", value=>"sv_2mortal(temp_sv)", - pre=>"SV *temp_sv = newSVpv(RFC1149, 0); " - . "(void) SvUPGRADE(temp_sv,SVt_PVIV); SvIOK_on(temp_sv); " - . "SvIVX(temp_sv) = 1149;"}, - {name=>"perl", type=>"PV",}, -); + my $fail; + opendir DIR, $dir or die "opendir '$dir': $!"; + while (defined (my $entry = readdir DIR)) { + $entry =~ s/\.$// if $^O eq 'VMS'; # delete trailing dot that indicates no extension + next if $expect{$entry}; + print "# Extra file '$entry'\n"; + $fail = 1; + } -push @names, $_ foreach keys %compass; + closedir DIR or warn "closedir '.': $!"; + if ($fail) { + print "not ok $realtest\n"; + } else { + print "ok $realtest\n"; + } + $realtest++; +} -# Automatically compile the list of all the macro names, and make them -# exported constants. -my @names_only = map {(ref $_) ? $_->{name} : $_} @names; +sub build_and_run { + my ($tests, $expect, $files) = @_; + my $core = $ENV{PERL_CORE} ? ' PERL_CORE=1' : ''; + my @perlout = `$runperl Makefile.PL $core`; + if ($?) { + print "not ok $realtest # $runperl Makefile.PL failed: $?\n"; + print "# $_" foreach @perlout; + exit($?); + } else { + print "ok $realtest\n"; + } + $realtest++; -# Exporter::Heavy (currently) isn't able to export these names: -push @names, ({name=>"*/", type=>"PV", value=>'"CLOSE"', macro=>1}, - {name=>"/*", type=>"PV", value=>'"OPEN"', macro=>1}, - {name=>$pound, type=>"PV", value=>'"Sterling"', macro=>1}, - {name=>$inf, type=>"PV", value=>'"Infinity"', macro=>1}, - {name=>$pound_utf8, type=>"PV", value=>'"1 Pound"', macro=>1}, - {name=>$pound_bytes, type=>"PV", value=>'"1 Pound (as bytes)"', - macro=>1}, - ); + if (-f "$makefile$makefile_ext") { + print "ok $realtest\n"; + } else { + print "not ok $realtest\n"; + } + $realtest++; -=pod + my @makeout; -The above set of names seems to produce a suitably bad set of compile -problems on a Unicode naive version of ExtUtils::Constant (ie 0.11): + if ($^O eq 'VMS') { $make .= ' all'; } -nick@thinking-cap 15439-32-utf$ PERL_CORE=1 ./perl lib/ExtUtils/t/Constant.t -1..33 -# perl=/stuff/perl5/15439-32-utf/perl -# ext-30370 being created... -Wide character in print at lib/ExtUtils/t/Constant.t line 140. -ok 1 -ok 2 -# make = 'make' -ExtTest.xs: In function `constant_1': -ExtTest.xs:80: warning: multi-character character constant -ExtTest.xs:80: warning: case value out of range -ok 3 + print "# make = '$make'\n"; + @makeout = `$make`; + if ($?) { + print "not ok $realtest # $make failed: $?\n"; + print "# $_" foreach @makeout; + exit($?); + } else { + print "ok $realtest\n"; + } + $realtest++; -=cut + if ($^O eq 'VMS') { $make =~ s{ all}{}; } -my $types = {}; -my $constant_types = constant_types(); # macro defs -my $C_constant = join "\n", - C_constant ($package, undef, "IV", $types, undef, undef, @names); -my $XS_constant = XS_constant ($package, $types); # XS for ExtTest::constant - -################ Header -my $header = catfile($dir, "test.h"); -push @files, "test.h"; -open FH, ">$header" or die "open >$header: $!\n"; -print FH <<"EOT"; -#define FIVE 5 -#define OK6 "ok 6\\n" -#define OK7 1 -#define FARTHING 0.25 -#define NOT_ZERO 1 -#define Yes 0 -#define No 1 -#define Undef 1 -#define RFC1149 "$parent_rfc1149" -#undef NOTDEF -#define perl "rules" -EOT + if ($Config{usedl}) { + print "ok $realtest # This is dynamic linking, so no need to make perl\n"; + } else { + my $makeperl = "$make perl"; + print "# make = '$makeperl'\n"; + @makeout = `$makeperl`; + if ($?) { + print "not ok $realtest # $makeperl failed: $?\n"; + print "# $_" foreach @makeout; + exit($?); + } else { + print "ok $realtest\n"; + } + } + $realtest++; -while (my ($point, $bearing) = each %compass) { - print FH "#define $point $bearing\n" + my $maketest = "$make test"; + print "# make = '$maketest'\n"; + + @makeout = `$maketest`; + + if (open OUTPUT, "<$output") { + local $/; # Slurp it - faster. + print <OUTPUT>; + close OUTPUT or print "# Close $output failed: $!\n"; + } else { + # Harness will report missing test results at this point. + print "# Open <$output failed: $!\n"; + } + + $realtest += $tests; + if ($?) { + print "not ok $realtest # $maketest failed: $?\n"; + print "# $_" foreach @makeout; + } else { + print "ok $realtest - maketest\n"; + } + $realtest++; + + # -x is busted on Win32 < 5.6.1, so we emulate it. + my $regen; + if( $^O eq 'MSWin32' && $] <= 5.006001 ) { + open(REGENTMP, ">regentmp") or die $!; + open(XS, "$package.xs") or die $!; + my $saw_shebang; + while(<XS>) { + $saw_shebang++ if /^#!.*/i ; + print REGENTMP $_ if $saw_shebang; + } + close XS; close REGENTMP; + $regen = `$runperl regentmp`; + unlink 'regentmp'; + } + else { + $regen = `$runperl -x $package.xs`; + } + if ($?) { + print "not ok $realtest # $runperl -x $package.xs failed: $?\n"; + } else { + print "ok $realtest - regen\n"; + } + $realtest++; + + if ($expect eq $regen) { + print "ok $realtest - regen worked\n"; + } else { + print "not ok $realtest - regen worked\n"; + # open FOO, ">expect"; print FOO $expect; + # open FOO, ">regen"; print FOO $regen; close FOO; + } + $realtest++; + + my $makeclean = "$make clean"; + print "# make = '$makeclean'\n"; + @makeout = `$makeclean`; + if ($?) { + print "not ok $realtest # $make failed: $?\n"; + print "# $_" foreach @makeout; + } else { + print "ok $realtest\n"; + } + $realtest++; + + check_for_bonus_files ('.', @$files, $output, $makefile_rename, '.', '..'); + + rename $makefile_rename, $makefile + or die "Can't rename '$makefile_rename' to '$makefile': $!"; + + unlink $output or warn "Can't unlink '$output': $!"; + + # Need to make distclean to remove ../../lib/ExtTest.pm + my $makedistclean = "$make distclean"; + print "# make = '$makedistclean'\n"; + @makeout = `$makedistclean`; + if ($?) { + print "not ok $realtest # $make failed: $?\n"; + print "# $_" foreach @makeout; + } else { + print "ok $realtest\n"; + } + $realtest++; + + check_for_bonus_files ('.', @$files, '.', '..'); + + unless ($keep_files) { + foreach (@$files) { + unlink $_ or warn "unlink $_: $!"; + } + } + + check_for_bonus_files ('.', '.', '..'); } -close FH or die "close $header: $!\n"; -################ XS -my $xs = catfile($dir, "$package.xs"); -push @files, "$package.xs"; -open FH, ">$xs" or die "open >$xs: $!\n"; +sub Makefile_PL { + my $package = shift; + ################ Makefile.PL + # We really need a Makefile.PL because make test for a no dynamic linking perl + # will run Makefile.PL again as part of the "make perl" target. + my $makefilePL = "Makefile.PL"; + open FH, ">$makefilePL" or die "open >$makefilePL: $!\n"; + print FH <<"EOT"; +#!$perl -w +use ExtUtils::MakeMaker; +WriteMakefile( + 'NAME' => "$package", + 'VERSION_FROM' => "$package.pm", # finds \$VERSION + (\$] >= 5.005 ? + (#ABSTRACT_FROM => "$package.pm", # XXX add this + AUTHOR => "$0") : ()) + ); +EOT -print FH <<'EOT'; + close FH or die "close $makefilePL: $!\n"; + return $makefilePL; +} + +sub MANIFEST { + my (@files) = @_; + ################ MANIFEST + # We really need a MANIFEST because make distclean checks it. + my $manifest = "MANIFEST"; + push @files, $manifest; + open FH, ">$manifest" or die "open >$manifest: $!\n"; + print FH "$_\n" foreach @files; + close FH or die "close $manifest: $!\n"; + return @files; +} + +sub write_and_run_extension { + my ($name, $items, $export_names, $package, $header, $testfile, $num_tests) + = @_; + my $types = {}; + my $constant_types = constant_types(); # macro defs + my $C_constant = join "\n", + C_constant ($package, undef, "IV", $types, undef, undef, @$items); + my $XS_constant = XS_constant ($package, $types); # XS for ExtTest::constant + + my $expect = $constant_types . $C_constant . + "\n#### XS Section:\n" . $XS_constant; + + print "# $name\n# $dir/$subdir being created...\n"; + mkdir $subdir, 0777 or die "mkdir: $!\n"; + chdir $subdir or die $!; + + my @files; + + ################ Header + my $header_name = "test.h"; + push @files, $header_name; + open FH, ">$header_name" or die "open >$header_name: $!\n"; + print FH $header or die $!; + close FH or die "close $header_name: $!\n"; + + ################ XS + my $xs = "$package.xs"; + push @files, $xs; + open FH, ">$xs" or die "open >$xs: $!\n"; + + print FH <<'EOT'; #include "EXTERN.h" #include "perl.h" #include "XSUB.h" EOT -print FH "#include \"test.h\"\n\n"; -print FH $constant_types; -print FH $C_constant, "\n"; -print FH "MODULE = $package PACKAGE = $package\n"; -print FH "PROTOTYPES: ENABLE\n"; -print FH $XS_constant; -close FH or die "close $xs: $!\n"; + # XXX Here doc these: + print FH "#include \"$header_name\"\n\n"; + print FH $constant_types; + print FH $C_constant, "\n"; + print FH "MODULE = $package PACKAGE = $package\n"; + print FH "PROTOTYPES: ENABLE\n"; + print FH $XS_constant; + close FH or die "close $xs: $!\n"; -################ PM -my $pm = catfile($dir, "$package.pm"); -push @files, "$package.pm"; -open FH, ">$pm" or die "open >$pm: $!\n"; -print FH "package $package;\n"; -print FH "use $];\n"; + ################ PM + my $pm = "$package.pm"; + push @files, $pm; + open FH, ">$pm" or die "open >$pm: $!\n"; + print FH "package $package;\n"; + print FH "use $];\n"; -print FH <<'EOT'; + print FH <<'EOT'; use strict; EOT -printf FH "use warnings;\n" unless $] < 5.006; -print FH <<'EOT'; + printf FH "use warnings;\n" unless $] < 5.006; + print FH <<'EOT'; use Carp; require Exporter; @@ -194,47 +352,156 @@ use vars qw ($VERSION @ISA @EXPORT_OK $AUTOLOAD); $VERSION = '0.01'; @ISA = qw(Exporter DynaLoader); -@EXPORT_OK = qw( EOT + # Having this qw( in the here doc confuses cperl mode far too much to be + # helpful. And I'm using cperl mode to edit this, even if you're not :-) + print FH "\@EXPORT_OK = qw(\n"; + + # Print the names of all our autoloaded constants + print FH "\t$_\n" foreach (@$export_names); + print FH ");\n"; + # Print the AUTOLOAD subroutine ExtUtils::Constant generated for us + print FH autoload ($package, $]); + print FH "bootstrap $package \$VERSION;\n1;\n__END__\n"; + close FH or die "close $pm: $!\n"; + + ################ test.pl + my $testpl = "test.pl"; + push @files, $testpl; + open FH, ">$testpl" or die "open >$testpl: $!\n"; + # Standard test header (need an option to suppress this?) + print FH <<"EOT" or die $!; +use strict; +use $package qw(@$export_names); -# Print the names of all our autoloaded constants -print FH "\t$_\n" foreach (@names_only); -print FH ");\n"; -# Print the AUTOLOAD subroutine ExtUtils::Constant generated for us -print FH autoload ($package, $]); -print FH "bootstrap $package \$VERSION;\n1;\n__END__\n"; -close FH or die "close $pm: $!\n"; - -################ test.pl -my $testpl = catfile($dir, "test.pl"); -push @files, "test.pl"; -open FH, ">$testpl" or die "open >$testpl: $!\n"; - -print FH "use strict;\n"; -print FH "use $package qw(@names_only);\n"; -print FH <<"EOT"; - -use utf8; - -print "1..1\n"; +print "1..2\n"; if (open OUTPUT, ">$output") { print "ok 1\n"; select OUTPUT; } else { - print "not ok 1 # Failed to open '$output': $!\n"; + print "not ok 1 # Failed to open '$output': \$!\n"; exit 1; } EOT + print FH $testfile or die $!; + print FH <<"EOT" or die $!; +select STDOUT; +if (close OUTPUT) { + print "ok 2\n"; +} else { + print "not ok 2 # Failed to close '$output': \$!\n"; +} +EOT + close FH or die "close $testpl: $!\n"; + + push @files, Makefile_PL($package); + @files = MANIFEST (@files); + + build_and_run ($num_tests, $expect, \@files); + + chdir $updir or die "chdir '$updir': $!"; + ++$subdir; +} +# Tests are arrayrefs of the form +# $name, [items], [export_names], $package, $header, $testfile, $num_tests +my @tests; +my $before_tests = 4; # Number of "ok"s emitted to build extension +my $after_tests = 8; # Number of "ok"s emitted after make test run +my $dummytest = 1; + +my $here; +sub start_tests { + $dummytest += $before_tests; + $here = $dummytest; +} +sub end_tests { + my ($name, $items, $export_names, $header, $testfile) = @_; + push @tests, [$name, $items, $export_names, $package, $header, $testfile, + $dummytest - $here]; + $dummytest += $after_tests; +} + +my $pound; +if (ord('A') == 193) { # EBCDIC platform + $pound = chr 177; # A pound sign. (Currency) +} else { # ASCII platform + $pound = chr 163; # A pound sign. (Currency) +} +my @common_items = ( + {name=>"perl", type=>"PV",}, + {name=>"*/", type=>"PV", value=>'"CLOSE"', macro=>1}, + {name=>"/*", type=>"PV", value=>'"OPEN"', macro=>1}, + {name=>$pound, type=>"PV", value=>'"Sterling"', macro=>1}, + ); + +{ + # Simple tests + start_tests(); + my $parent_rfc1149 = + 'A Standard for the Transmission of IP Datagrams on Avian Carriers'; + # Test the code that generates 1 and 2 letter name comparisons. + my %compass = ( + N => 0, 'NE' => 45, E => 90, SE => 135, + S => 180, SW => 225, W => 270, NW => 315 + ); + + my $header = << "EOT"; +#define FIVE 5 +#define OK6 "ok 6\\n" +#define OK7 1 +#define FARTHING 0.25 +#define NOT_ZERO 1 +#define Yes 0 +#define No 1 +#define Undef 1 +#define RFC1149 "$parent_rfc1149" +#undef NOTDEF +#define perl "rules" +EOT -print FH << 'EOT'; + while (my ($point, $bearing) = each %compass) { + $header .= "#define $point $bearing\n" + } + my @items = ("FIVE", {name=>"OK6", type=>"PV",}, + {name=>"OK7", type=>"PVN", + value=>['"not ok 7\\n\\0ok 7\\n"', 15]}, + {name => "FARTHING", type=>"NV"}, + {name => "NOT_ZERO", type=>"UV", value=>"~(UV)0"}, + {name => "OPEN", type=>"PV", value=>'"/*"', macro=>1}, + {name => "CLOSE", type=>"PV", value=>'"*/"', + macro=>["#if 1\n", "#endif\n"]}, + {name => "ANSWER", default=>["UV", 42]}, "NOTDEF", + {name => "Yes", type=>"YES"}, + {name => "No", type=>"NO"}, + {name => "Undef", type=>"UNDEF"}, + # OK. It wasn't really designed to allow the creation of dual valued + # constants. + # It was more for INADDR_ANY INADDR_BROADCAST INADDR_LOOPBACK INADDR_NONE + {name=>"RFC1149", type=>"SV", value=>"sv_2mortal(temp_sv)", + pre=>"SV *temp_sv = newSVpv(RFC1149, 0); " + . "(void) SvUPGRADE(temp_sv,SVt_PVIV); SvIOK_on(temp_sv); " + . "SvIVX(temp_sv) = 1149;"}, + ); + + push @items, $_ foreach keys %compass; + + # Automatically compile the list of all the macro names, and make them + # exported constants. + my @export_names = map {(ref $_) ? $_->{name} : $_} @items; + + # Exporter::Heavy (currently) isn't able to export the last 3 of these: + push @items, @common_items; + + # XXX there are hardwired still. + my $test_body = <<'EOT'; # What follows goes to the temporary file. # IV my $five = FIVE; if ($five == 5) { print "ok 5\n"; } else { - print "not ok 5 # $five\n"; + print "not ok 5 # \$five\n"; } # PV @@ -323,7 +590,6 @@ unless (defined $undef) { print "not ok 16 # \$undef='$undef'\n"; } - # invalid macro (chosen to look like a mix up between No and SW) $notdef = eval { &ExtTest::So }; if (defined $notdef) { @@ -348,10 +614,10 @@ my %compass = ( EOT while (my ($point, $bearing) = each %compass) { - print FH "'$point' => $bearing, " + $test_body .= "'$point' => $bearing, " } -print FH <<'EOT'; +$test_body .= <<'EOT'; ); @@ -377,7 +643,7 @@ if ($fail) { EOT -print FH <<"EOT"; +$test_body .= <<"EOT"; my \$rfc1149 = RFC1149; if (\$rfc1149 ne "$parent_rfc1149") { print "not ok 20 # '\$rfc1149' ne '$parent_rfc1149'\n"; @@ -393,7 +659,7 @@ if (\$rfc1149 != 1149) { EOT -print FH <<'EOT'; +$test_body .= <<'EOT'; # test macro=>1 my $open = OPEN; if ($open eq '/*') { @@ -402,26 +668,80 @@ if ($open eq '/*') { print "not ok 22 # \$open='$open'\n"; } EOT +$dummytest+=18; + + end_tests("Simple tests", \@items, \@export_names, $header, $test_body); +} + +if ($do_utf_tests) { + # utf8 tests + start_tests(); + my ($inf, $pound_bytes, $pound_utf8); -# Do this in 7 bit in case someone is testing with some settings that cause -# 8 bit files incapable of storing this character. -my @values - = map {"'" . join (",", unpack "U*", $_) . "'"} - ($pound, $inf, $pound_bytes, $pound_utf8); -# Values is a list of strings, such as ('194,163,49', '163,49') + $inf = chr 0x221E; + # Check that we can distiguish the pathological case of a string, and the + # utf8 representation of that string. + $pound_utf8 = $pound . '1'; + if ($better_than_56) { + $pound_bytes = $pound_utf8; + utf8::encode ($pound_bytes); + } else { + # Must have that "U*" to generate a zero length UTF string that forces + # top bit set chars (such as the pound sign) into UTF8, so that the + # unpack 'C*' then gets the byte form of the UTF8. + $pound_bytes = pack 'C*', unpack 'C*', $pound_utf8 . pack "U*"; + } -print FH <<'EOT'; + my @items = (@common_items, + {name=>$inf, type=>"PV", value=>'"Infinity"', macro=>1}, + {name=>$pound_utf8, type=>"PV", value=>'"1 Pound"', macro=>1}, + {name=>$pound_bytes, type=>"PV", value=>'"1 Pound (as bytes)"', + macro=>1}, + ); -# I can see that this child test program might be about to use parts of -# Test::Builder +=pod + +The above set of names seems to produce a suitably bad set of compile +problems on a Unicode naive version of ExtUtils::Constant (ie 0.11): + +nick@thinking-cap 15439-32-utf$ PERL_CORE=1 ./perl lib/ExtUtils/t/Constant.t +1..33 +# perl=/stuff/perl5/15439-32-utf/perl +# ext-30370 being created... +Wide character in print at lib/ExtUtils/t/Constant.t line 140. +ok 1 +ok 2 +# make = 'make' +ExtTest.xs: In function `constant_1': +ExtTest.xs:80: warning: multi-character character constant +ExtTest.xs:80: warning: case value out of range +ok 3 + +=cut + +# Grr ` + + # Do this in 7 bit in case someone is testing with some settings that cause + # 8 bit files incapable of storing this character. + my @values + = map {"'" . join (",", unpack "U*", $_ . pack "U*") . "'"} + ($pound, $inf, $pound_bytes, $pound_utf8); + # Values is a list of strings, such as ('194,163,49', '163,49') + + my $test_body .= "my \$test = $dummytest;\n"; + $dummytest += 7 * 3; # 3 tests for each of the 7 things: + + $test_body .= << 'EOT'; + +use utf8; +my $better_than_56 = $] > 5.007; -my $test = 23; my ($pound, $inf, $pound_bytes, $pound_utf8) = map {eval "pack 'U*', $_"} EOT -print FH join ",", @values; + $test_body .= join ",", @values; -print FH << 'EOT'; + $test_body .= << 'EOT'; ; foreach (["perl", "rules", "rules"], @@ -437,12 +757,19 @@ foreach (["perl", "rules", "rules"], (my $name = $string) =~ s/([^ -~])/sprintf '\x{%X}', ord $1/ges; print "# \"$name\" => \'$expect\'\n"; # Try to force this to be bytes if possible. - utf8::downgrade ($string, 1); + if ($better_than_56) { + utf8::downgrade ($string, 1); + } else { + if ($string =~ tr/0-\377// == length $string) { + # No chars outside range 0-255 + $string = pack 'C*', unpack 'U*', ($string . pack 'U*'); + } + } EOT -print FH "my (\$error, \$got) = ${package}::constant (\$string);\n"; + $test_body .= "my (\$error, \$got) = ${package}::constant (\$string);\n"; -print FH <<'EOT'; + $test_body .= <<'EOT'; if ($error or $got ne $expect) { print "not ok $test # error '$error', got '$got'\n"; } else { @@ -450,12 +777,16 @@ print FH <<'EOT'; } $test++; print "# Now upgrade '$name' to utf8\n"; - utf8::upgrade ($string); + if ($better_than_56) { + utf8::upgrade ($string); + } else { + $string = pack ('U*') . $string; + } EOT -print FH "my (\$error, \$got) = ${package}::constant (\$string);\n"; + $test_body .= "my (\$error, \$got) = ${package}::constant (\$string);\n"; -print FH <<'EOT'; + $test_body .= <<'EOT'; if ($error or $got ne $expect) { print "not ok $test # error '$error', got '$got'\n"; } else { @@ -465,12 +796,16 @@ print FH <<'EOT'; if (defined $expect_bytes) { print "# And now with the utf8 byte sequence for name\n"; # Try the encoded bytes. - utf8::encode ($string); + if ($better_than_56) { + utf8::encode ($string); + } else { + $string = pack 'C*', unpack 'C*', $string . pack "U*"; + } EOT -print FH "my (\$error, \$got) = ${package}::constant (\$string);\n"; + $test_body .= "my (\$error, \$got) = ${package}::constant (\$string);\n"; -print FH <<'EOT'; + $test_body .= <<'EOT'; if (ref $expect_bytes) { # Error expected. if ($error) { @@ -488,216 +823,100 @@ print FH <<'EOT'; } EOT -close FH or die "close $testpl: $!\n"; - -# This is where the test numbers carry on after the test number above are -# relayed -my $test = 44; - -################ Makefile.PL -# We really need a Makefile.PL because make test for a no dynamic linking perl -# will run Makefile.PL again as part of the "make perl" target. -my $makefilePL = catfile($dir, "Makefile.PL"); -push @files, "Makefile.PL"; -open FH, ">$makefilePL" or die "open >$makefilePL: $!\n"; -print FH <<"EOT"; -#!$perl -w -use ExtUtils::MakeMaker; -WriteMakefile( - 'NAME' => "$package", - 'VERSION_FROM' => "$package.pm", # finds \$VERSION - (\$] >= 5.005 ? - (#ABSTRACT_FROM => "$package.pm", # XXX add this - AUTHOR => "$0") : ()) - ); -EOT - -close FH or die "close $makefilePL: $!\n"; - -################ MANIFEST -# We really need a MANIFEST because make distclean checks it. -my $manifest = catfile($dir, "MANIFEST"); -push @files, "MANIFEST"; -open FH, ">$manifest" or die "open >$manifest: $!\n"; -print FH "$_\n" foreach @files; -close FH or die "close $manifest: $!\n"; - -chdir $dir or die $!; push @INC, '../../lib'; -END {chdir ".." or warn $!}; - -my @perlout = `$runperl Makefile.PL PERL_CORE=1`; -if ($?) { - print "not ok 1 # $runperl Makefile.PL failed: $?\n"; - print "# $_" foreach @perlout; - exit($?); -} else { - print "ok 1\n"; -} - - -my $makefile = ($^O eq 'VMS' ? 'descrip' : 'Makefile'); -my $makefile_ext = ($^O eq 'VMS' ? '.mms' : ''); -if (-f "$makefile$makefile_ext") { - print "ok 2\n"; -} else { - print "not ok 2\n"; -} - -# Renamed by make clean -my $makefile_rename = $makefile . ($^O eq 'VMS' ? '.mms' : '.old'); - -my $make = $Config{make}; - -$make = $ENV{MAKE} if exists $ENV{MAKE}; - -if ($^O eq 'MSWin32' && $make eq 'nmake') { $make .= " -nologo"; } - -my @makeout; - -if ($^O eq 'VMS') { $make .= ' all'; } -print "# make = '$make'\n"; -@makeout = `$make`; -if ($?) { - print "not ok 3 # $make failed: $?\n"; - print "# $_" foreach @makeout; - exit($?); -} else { - print "ok 3\n"; + end_tests("utf8 tests", \@items, [], "#define perl \"rules\"\n", $test_body); } -if ($^O eq 'VMS') { $make =~ s{ all}{}; } +# XXX I think that I should merge this into the utf8 test above. +sub explict_call_constant { + my ($string, $expect) = @_; + # This does assume simple strings suitable for '' + my $test_body = <<"EOT"; +{ + my (\$error, \$got) = ${package}::constant ('$string');\n; +EOT -if ($Config{usedl}) { - print "ok 4\n"; -} else { - my $makeperl = "$make perl"; - print "# make = '$makeperl'\n"; - @makeout = `$makeperl`; - if ($?) { - print "not ok 4 # $makeperl failed: $?\n"; - print "# $_" foreach @makeout; - exit($?); + if (defined $expect) { + # No error expected + $test_body .= <<"EOT"; + if (\$error or \$got ne "$expect") { + print "not ok $dummytest # error '\$error', expect '$expect', got '\$got'\n"; + } else { + print "ok $dummytest\n"; + } + } +EOT + } else { + # Error expected. + $test_body .= <<"EOT"; + if (\$error) { + print "ok $dummytest # error='\$error' (as expected)\n"; } else { - print "ok 4\n"; + print "not ok $dummytest # expected error, got no error and '\$got'\n"; } +EOT + } + $dummytest++; + return $test_body . <<'EOT'; } - -my $maketest = "$make test"; -print "# make = '$maketest'\n"; - -@makeout = `$maketest`; - -if (open OUTPUT, "<$output") { - print while <OUTPUT>; - close OUTPUT or print "# Close $output failed: $!\n"; -} else { - # Harness will report missing test results at this point. - print "# Open <$output failed: $!\n"; +EOT } -if ($?) { - print "not ok $test # $maketest failed: $?\n"; - print "# $_" foreach @makeout; +# Simple tests to verify bits of the switch generation system work. +sub simple { + start_tests(); + # Deliberately leave $name in @_, so that it is indexed from 1. + my ($name, @items) = @_; + my $test_header; + my $test_body = "my \$value;\n"; + foreach my $counter (1 .. $#_) { + my $thisname = $_[$counter]; + $test_header .= "#define $thisname $counter\n"; + $test_body .= <<"EOT"; +\$value = $thisname; +if (\$value == $counter) { + print "ok $dummytest\n"; } else { - print "ok $test - maketest\n"; + print "not ok $dummytest # $thisname gave \$value\n"; } -$test++; - - -# -x is busted on Win32 < 5.6.1, so we emulate it. -my $regen; -if( $^O eq 'MSWin32' && $] <= 5.006001 ) { - open(REGENTMP, ">regentmp") or die $!; - open(XS, "$package.xs") or die $!; - my $saw_shebang; - while(<XS>) { - $saw_shebang++ if /^#!.*/i ; - print REGENTMP $_ if $saw_shebang; +EOT + ++$dummytest; + # Yes, the last time round the loop appends a z to the string. + for my $i (0 .. length $thisname) { + my $copyname = $thisname; + substr ($copyname, $i, 1) = 'z'; + $test_body .= explict_call_constant ($copyname, + $copyname eq $thisname + ? $thisname : undef); } - close XS; close REGENTMP; - $regen = `$runperl regentmp`; - unlink 'regentmp'; -} -else { - $regen = `$runperl -x $package.xs`; -} -if ($?) { - print "not ok $test # $runperl -x $package.xs failed: $?\n"; -} else { - print "ok $test - regen\n"; -} -$test++; - -my $expect = $constant_types . $C_constant . - "\n#### XS Section:\n" . $XS_constant; - -if ($expect eq $regen) { - print "ok $test - regen worked\n"; -} else { - print "not ok $test - regen worked\n"; - # open FOO, ">expect"; print FOO $expect; - # open FOO, ">regen"; print FOO $regen; close FOO; -} -$test++; - -my $makeclean = "$make clean"; -print "# make = '$makeclean'\n"; -@makeout = `$makeclean`; -if ($?) { - print "not ok $test # $make failed: $?\n"; - print "# $_" foreach @makeout; -} else { - print "ok $test\n"; -} -$test++; - -sub check_for_bonus_files { - my $dir = shift; - my %expect = map {($^O eq 'VMS' ? lc($_) : $_), 1} @_; - - my $fail; - opendir DIR, $dir or die "opendir '$dir': $!"; - while (defined (my $entry = readdir DIR)) { - $entry =~ s/\.$// if $^O eq 'VMS'; # delete trailing dot that indicates no extension - next if $expect{$entry}; - print "# Extra file '$entry'\n"; - $fail = 1; } - - closedir DIR or warn "closedir '.': $!"; - if ($fail) { - print "not ok $test\n"; - } else { - print "ok $test\n"; - } - $test++; + # Ho. This seems to be buggy in 5.005_03: + # # Now remove $name from @_: + # shift @_; + end_tests($name, \@items, \@items, $test_header, $test_body); } -check_for_bonus_files ('.', @files, $output, $makefile_rename, '.', '..'); +# Check that the memeq clauses work correctly when there isn't a switch +# statement to bump off a character +simple ("Singletons", "A", "AB", "ABC", "ABCD", "ABCDE"); +# Check the three code. +simple ("Three start", qw(Bea kea Lea lea nea pea rea sea tea Wea yea Zea)); +# There were 162 2 letter words in /usr/share/dict/words on FreeBSD 4.6, which +# I felt was rather too many. So I used words with 2 vowels. +simple ("Twos and three middle", qw(aa ae ai ea eu ie io oe era eta)); +# Given the choice go for the end, else the earliest point +simple ("Three end and four symetry", qw(ean ear eat barb marm tart)); -rename $makefile_rename, $makefile - or die "Can't rename '$makefile_rename' to '$makefile': $!"; -unlink $output or warn "Can't unlink '$output': $!"; +# Need this if the single test below is rolled into @tests : +# --$dummytest; +print "1..$dummytest\n"; -# Need to make distclean to remove ../../lib/ExtTest.pm -my $makedistclean = "$make distclean"; -print "# make = '$makedistclean'\n"; -@makeout = `$makedistclean`; -if ($?) { - print "not ok $test # $make failed: $?\n"; - print "# $_" foreach @makeout; -} else { - print "ok $test\n"; -} -$test++; - -check_for_bonus_files ('.', @files, '.', '..'); +write_and_run_extension @$_ foreach @tests; -unless ($keep_files) { - foreach (@files) { - unlink $_ or warn "unlink $_: $!"; - } -} +# This was causing an assertion failure (a C<confess>ion) +# Any single byte > 128 should do it. +C_constant ($package, undef, undef, undef, undef, undef, chr 255); +print "ok $realtest\n"; $realtest++; -check_for_bonus_files ('.', '.', '..'); +print STDERR "# You were running with \$keep_files set to $keep_files\n" + if $keep_files; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t index 5460a254bd6..fc0ed3cbc17 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Embed.t @@ -102,7 +102,7 @@ if ($^O eq 'VMS') { # Everyone needs libperl copied if it's not found by '-lperl'. $testlib = $Config{'libperl'}; my $srclib = $testlib; - $testlib =~ s/^[^.]+/libperl/; + $testlib =~ s/.+(?=\.[^.]*)/libperl/; $testlib = File::Spec::->catfile($lib, $testlib); $srclib = File::Spec::->catfile($lib, $srclib); if (-f $srclib) { @@ -151,11 +151,15 @@ __END__ #define my_puts(a) if(puts(a) < 0) exit(666) -static char *cmds[] = { "perl","-e", "print qq[ok 5\\n]", NULL }; +static char *cmds[] = { "perl","-e", "$|=1; print qq[ok 5\\n]", NULL }; int main(int argc, char **argv, char **env) { - PerlInterpreter *my_perl = perl_alloc(); + PerlInterpreter *my_perl; + + PERL_SYS_INIT3(&argc,&argv,&env); + + my_perl = perl_alloc(); my_puts("ok 2"); @@ -181,5 +185,7 @@ int main(int argc, char **argv, char **env) my_puts("ok 8"); + PERL_SYS_TERM(); + return 0; } diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/INST.t b/gnu/usr.bin/perl/lib/ExtUtils/t/INST.t index d6780ac6744..3639acd11b3 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/INST.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/INST.t @@ -60,7 +60,7 @@ is( $mm->{VERSION}, 0.01, 'VERSION' ); my $config_prefix = $Config{installprefixexp} || $Config{installprefix} || $Config{prefixexp} || $Config{prefix}; -is( $mm->{PREFIX}, $config_prefix, 'PREFIX' ); +is( $mm->{PERLPREFIX}, $config_prefix, 'PERLPREFIX' ); is( !!$mm->{PERL_CORE}, !!$ENV{PERL_CORE}, 'PERL_CORE' ); diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/INST_PREFIX.t b/gnu/usr.bin/perl/lib/ExtUtils/t/INST_PREFIX.t index 8af8c307fa8..2d90a8c472a 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/INST_PREFIX.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/INST_PREFIX.t @@ -16,7 +16,7 @@ BEGIN { } use strict; -use Test::More tests => 26; +use Test::More tests => 36; use MakeMaker::Test::Utils; use ExtUtils::MakeMaker; use File::Spec; @@ -38,15 +38,15 @@ my $Updir = File::Spec->updir; ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || diag("chdir failed: $!"); -my $PREFIX = File::Spec->catdir('foo', 'bar'); my $stdout = tie *STDOUT, 'TieOut' or die; + my $mm = WriteMakefile( NAME => 'Big::Dummy', VERSION_FROM => 'lib/Big/Dummy.pm', PREREQ_PM => {}, PERL_CORE => $ENV{PERL_CORE}, - PREFIX => $PREFIX, ); + like( $stdout->read, qr{ Writing\ $Makefile\ for\ Big::Liar\n Big::Liar's\ vars\n @@ -54,16 +54,41 @@ like( $stdout->read, qr{ INST_ARCHLIB\ =\ \S+\n Writing\ $Makefile\ for\ Big::Dummy\n }x ); -undef $stdout; -untie *STDOUT; isa_ok( $mm, 'ExtUtils::MakeMaker' ); is( $mm->{NAME}, 'Big::Dummy', 'NAME' ); is( $mm->{VERSION}, 0.01, 'VERSION' ); +foreach my $prefix (qw(PREFIX PERLPREFIX SITEPREFIX VENDORPREFIX)) { + unlike( $mm->{$prefix}, qr/\$\(PREFIX\)/ ); +} + + +my $PREFIX = File::Spec->catdir('foo', 'bar'); +$mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION_FROM => 'lib/Big/Dummy.pm', + PREREQ_PM => {}, + PERL_CORE => $ENV{PERL_CORE}, + PREFIX => $PREFIX, +); +like( $stdout->read, qr{ + Writing\ $Makefile\ for\ Big::Liar\n + Big::Liar's\ vars\n + INST_LIB\ =\ \S+\n + INST_ARCHLIB\ =\ \S+\n + Writing\ $Makefile\ for\ Big::Dummy\n +}x ); +undef $stdout; +untie *STDOUT; + is( $mm->{PREFIX}, $PREFIX, 'PREFIX' ); +foreach my $prefix (qw(PERLPREFIX SITEPREFIX VENDORPREFIX)) { + is( $mm->{$prefix}, '$(PREFIX)', "\$(PREFIX) overrides $prefix" ); +} + is( !!$mm->{PERL_CORE}, !!$ENV{PERL_CORE}, 'PERL_CORE' ); my($perl_src, $mm_perl_src); @@ -80,41 +105,36 @@ is( $mm_perl_src, $perl_src, 'PERL_SRC' ); # Every INSTALL* variable must start with some PREFIX. -my @Perl_Install = qw(archlib privlib bin script - man1dir man3dir); -my @Site_Install = qw(sitearch sitelib sitebin - siteman1dir siteman3dir); -my @Vend_Install = qw(vendorarch vendorlib vendorbin - vendorman1dir vendorman3dir); - -foreach my $var (@Perl_Install) { - my $prefix = $Is_VMS ? '[.foo.bar' : File::Spec->catdir(qw(foo bar)); - - # support for man page skipping - $prefix = 'none' if $var =~ /man/ && !$Config{"install$var"}; - like( $mm->{uc "install$var"}, qr/^\Q$prefix\E/, "PREFIX + $var" ); -} +my %Install_Vars = ( + PERL => [qw(archlib privlib bin man1dir man3dir script)], + SITE => [qw(sitearch sitelib sitebin siteman1dir siteman3dir)], + VENDOR => [qw(vendorarch vendorlib vendorbin vendorman1dir vendorman3dir)] +); -foreach my $var (@Site_Install) { - my $prefix = $Is_VMS ? '[.foo.bar' : File::Spec->catdir(qw(foo bar)); +while( my($type, $vars) = each %Install_Vars) { - like( $mm->{uc "install$var"}, qr/^\Q$prefix\E/, - "SITEPREFIX + $var" ); -} + SKIP: foreach my $var (@$vars) { + skip "VMS must expand macros in INSTALL* vars", scalar @$vars + if $Is_VMS; -foreach my $var (@Vend_Install) { - my $prefix = $Is_VMS ? '[.foo.bar' : File::Spec->catdir(qw(foo bar)); + my $prefix = '$('.$type.'PREFIX)'; - like( $mm->{uc "install$var"}, qr/^\Q$prefix\E/, - "VENDORPREFIX + $var" ); + # support for man page skipping + $prefix = 'none' if $type eq 'PERL' && + $var =~ /man/ && + !$Config{"install$var"}; + like( $mm->{uc "install$var"}, qr/^\Q$prefix\E/, "$prefix + $var" ); + } } - # Check that when installman*dir isn't set in Config no man pages # are generated. { undef *ExtUtils::MM_Unix::Config; + undef *ExtUtils::MM_Unix::Config_Override; %ExtUtils::MM_Unix::Config = %Config; + *ExtUtils::MM_VMS::Config = \%ExtUtils::MM_Unix::Config; + $ExtUtils::MM_Unix::Config{installman1dir} = ''; $ExtUtils::MM_Unix::Config{installman3dir} = ''; @@ -132,3 +152,37 @@ foreach my $var (@Vend_Install) { is( $mm->{INSTALLMAN1DIR}, $wibble ); is( $mm->{INSTALLMAN3DIR}, 'none' ); } + +# Check that when installvendorman*dir is set in Config it is honored +# [rt.cpan.org 2949] +{ + undef *ExtUtils::MM_Unix::Config; + undef *ExtUtils::MM_Unix::Config_Override; + undef *ExtUtils::MM_VMS::Config; + + %ExtUtils::MM_Unix::Config = %Config; + *ExtUtils::MM_VMS::Config = \%ExtUtils::MM_Unix::Config; + + $ExtUtils::MM_Unix::Config{installvendorman1dir} = + File::Spec->catdir('foo','bar'); + $ExtUtils::MM_Unix::Config{installvendorman3dir} = ''; + $ExtUtils::MM_Unix::Config{usevendorprefix} = 1; + $ExtUtils::MM_Unix::Config{vendorprefixexp} = 'something'; + + my $stdout = tie *STDOUT, 'TieOut' or die; + my $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION_FROM => 'lib/Big/Dummy.pm', + PREREQ_PM => {}, + PERL_CORE => $ENV{PERL_CORE}, + + # In case the local installation doesn't have man pages. + INSTALLMAN1DIR=> 'foo/bar/baz', + INSTALLMAN3DIR=> 'foo/bar/baz', + ); + + is( $mm->{INSTALLVENDORMAN1DIR}, File::Spec->catdir('foo','bar'), + 'installvendorman1dir (in %Config) not modified' ); + isnt( $mm->{INSTALLVENDORMAN3DIR}, '', + 'installvendorman3dir (not in %Config) set' ); +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Install.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Install.t new file mode 100644 index 00000000000..13b3a6779ca --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Install.t @@ -0,0 +1,112 @@ +#!/usr/bin/perl -w + +# Test ExtUtils::Install. + +BEGIN { + if( $ENV{PERL_CORE} ) { + @INC = ('../../lib', '../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} +chdir 't'; + +use strict; +use TieOut; +use File::Path; +use File::Spec; + +use Test::More tests => 29; + +BEGIN { use_ok('ExtUtils::Install') } + +# Check exports. +foreach my $func (qw(install uninstall pm_to_blib install_default)) { + can_ok(__PACKAGE__, $func); +} + + +chdir 'Big-Dummy'; + +my $stdout = tie *STDOUT, 'TieOut'; +pm_to_blib( { 'lib/Big/Dummy.pm' => 'blib/lib/Big/Dummy.pm' }, + 'blib/lib/auto' + ); +END { rmtree 'blib' } + +ok( -d 'blib/lib', 'pm_to_blib created blib dir' ); +ok( -r 'blib/lib/Big/Dummy.pm', ' copied .pm file' ); +ok( -r 'blib/lib/auto', ' created autosplit dir' ); +is( $stdout->read, "cp lib/Big/Dummy.pm blib/lib/Big/Dummy.pm\n" ); + +pm_to_blib( { 'lib/Big/Dummy.pm' => 'blib/lib/Big/Dummy.pm' }, + 'blib/lib/auto' + ); +ok( -d 'blib/lib', 'second run, blib dir still there' ); +ok( -r 'blib/lib/Big/Dummy.pm', ' .pm file still there' ); +ok( -r 'blib/lib/auto', ' autosplit still there' ); +is( $stdout->read, "Skip blib/lib/Big/Dummy.pm (unchanged)\n" ); + +install( { 'blib/lib' => 'install-test/lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + }, + 0, 1); +ok( ! -d 'install-test/lib/perl', 'install made dir (dry run)'); +ok( ! -r 'install-test/lib/perl/Big/Dummy.pm', + ' .pm file installed (dry run)'); +ok( ! -r 'install-test/packlist', ' packlist exists (dry run)'); + +install( { 'blib/lib' => 'install-test/lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + } ); +ok( -d 'install-test/lib/perl', 'install made dir' ); +ok( -r 'install-test/lib/perl/Big/Dummy.pm', ' .pm file installed' ); +ok( -r 'install-test/packlist', ' packlist exists' ); + +open(PACKLIST, 'install-test/packlist' ); +my %packlist = map { chomp; ($_ => 1) } <PACKLIST>; +close PACKLIST; + +# On case-insensitive filesystems (ie. VMS), the keys of the packlist might +# be lowercase. :( +my $native_dummy = File::Spec->catfile(qw(install-test lib perl Big Dummy.pm)); +is( keys %packlist, 1 ); +is( lc((keys %packlist)[0]), lc $native_dummy, 'packlist written' ); + + +# Test UNINST=1 preserving same versions in other dirs. +install( { 'blib/lib' => 'install-test/other_lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + }, + 0, 0, 1); +ok( -d 'install-test/other_lib/perl', 'install made other dir' ); +ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' ); +ok( -r 'install-test/packlist', ' packlist exists' ); +ok( -r 'install-test/lib/perl/Big/Dummy.pm', ' UNINST=1 preserved same' ); + + + +# Test UNINST=1 removing other versions in other dirs. +chmod 0644, 'blib/lib/Big/Dummy.pm' or die $!; +open(DUMMY, ">>blib/lib/Big/Dummy.pm") or die $!; +print DUMMY "Extra stuff\n"; +close DUMMY; + +{ + local @INC = ('install-test/lib/perl'); + local $ENV{PERL5LIB} = ''; + install( { 'blib/lib' => 'install-test/other_lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + }, + 0, 0, 1); + ok( -d 'install-test/other_lib/perl', 'install made other dir' ); + ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' ); + ok( -r 'install-test/packlist', ' packlist exists' ); + ok( !-r 'install-test/lib/perl/Big/Dummy.pm', + ' UNINST=1 removed different' ); +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t index d62afba4348..30dfcb3d66b 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Installed.t @@ -9,7 +9,9 @@ BEGIN { unshift @INC, 't/lib/'; } } -chdir 't'; + +my $Is_VMS = $^O eq 'VMS'; +chdir($Is_VMS ? 'BFD_TEST_ROOT:[t]' : 't'); use strict; @@ -54,7 +56,7 @@ 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'; +$prefix = VMS::Filespec::unixify($prefix) if $Is_VMS; # ActivePerl 5.6.1/631 has $Config{prefixexp} as 'p:' for some reason $prefix = $Config{prefix} if $prefix eq 'p:' && $^O eq 'MSWin32'; @@ -80,11 +82,9 @@ ok( !$ei->_is_under('foo', @under), '... should find no file not under dirs'); ok( $ei->_is_under('baz', @under), '... should find file under dir' ); -my $wrotelist; - rmtree 'auto/FakeMod'; ok( mkpath('auto/FakeMod') ); -END { rmtree 'auto/FakeMod' } +END { rmtree 'auto' } ok(open(PACKLIST, '>auto/FakeMod/.packlist')); print PACKLIST 'list'; @@ -230,14 +230,6 @@ is( ${ $ei->packlist('yesmod') }, 102, is( $ei->version('yesmod'), 101, 'version() should report installed mod version' ); -END { - if ($wrotelist) { - for my $file (qw( .packlist FakePak.pm )) { - 1 while unlink $file; - } - File::Path::rmtree('auto') or warn "Couldn't rmtree auto: $!"; - } -} package Fakepak; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Liblist.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Liblist.t new file mode 100644 index 00000000000..0ee90be2eed --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Liblist.t @@ -0,0 +1,36 @@ +#!/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; +use Test::More tests => 6; +use Data::Dumper; + +BEGIN { + use_ok( 'ExtUtils::Liblist' ); +} + +ok( defined &ExtUtils::Liblist::ext, + 'ExtUtils::Liblist::ext() defined for backwards compat' ); + +{ + my @warn; + local $SIG{__WARN__} = sub {push @warn, [@_]}; + + my $ll = bless {}, 'ExtUtils::Liblist'; + my @out = $ll->ext('-ln0tt43r3_perl'); + is( @out, 4, 'enough output' ); + unlike( $out[2], qr/-ln0tt43r3_perl/, 'bogus library not added' ); + ok( @warn, 'had warning'); + + is( grep(/\QNote (probably harmless): No library found for \E(-l)?n0tt43r3_perl/, map { @$_ } @warn), 1 ) || diag Dumper @warn; +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Any.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Any.t new file mode 100644 index 00000000000..0326274fe70 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Any.t @@ -0,0 +1,33 @@ +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = '../lib'; + } + else { + unshift @INC, 't/lib'; + } +} +chdir 't'; + +use Test::More tests => 7; +BEGIN { use_ok('ExtUtils::MM') } + + +### OS Flavor methods + +can_ok( 'MM', 'os_flavor', 'os_flavor_is' ); + +# Can't really know what the flavors are going to be, so we just +# make sure it returns something. +my @flavors = MM->os_flavor; +ok( @flavors, 'os_flavor() returned something' ); + +ok( MM->os_flavor_is($flavors[rand @flavors]), + 'os_flavor_is() one flavor' ); +ok( MM->os_flavor_is($flavors[rand @flavors], 'BogusOS'), + ' many flavors' ); +ok( !MM->os_flavor_is('BogusOS'), ' wrong flavor' ); +ok( !MM->os_flavor_is(), ' no flavor' ); + diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t index 870e8d47fe7..3161176cadf 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_BeOS.t @@ -40,9 +40,16 @@ use File::Basename; require_ok( 'ExtUtils::MM_BeOS' ); -# perl_archive() + +# init_linker { - my $libperl = $Config{libperl} || 'libperl.a'; - is( MM->perl_archive(), File::Spec->catfile('$(PERL_INC)', $libperl ), - 'perl_archive() should respect libperl setting' ); + my $libperl = File::Spec->catfile('$(PERL_INC)', + $Config{libperl} || 'libperl.a' ); + my $export = ''; + my $after = ''; + $MM->init_linker; + + is( $MM->{PERL_ARCHIVE}, $libperl, 'PERL_ARCHIVE' ); + is( $MM->{PERL_ARCHIVE_AFTER}, $after, 'PERL_ARCHIVE_AFTER' ); + is( $MM->{EXPORT_LIST}, $export, 'EXPORT_LIST' ); } diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t index 03641d33f22..5b0b04f6c63 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Cygwin.t @@ -11,11 +11,12 @@ BEGIN { } chdir 't'; +use strict; use Test::More; BEGIN { if ($^O =~ /cygwin/i) { - plan tests => 13; + plan tests => 11; } else { plan skip_all => "This is not cygwin"; } @@ -33,83 +34,69 @@ is( MM->canonpath('/a/../../c'), $path, 'canonpath() method should work just like the one in File::Spec' ); # test cflags, with the fake package below -my $args = bless({ +my $MM = bless({ CFLAGS => 'fakeflags', CCFLAGS => '', -}, MM); +}, 'MM'); # with CFLAGS set, it should be returned -is( $args->cflags(), 'fakeflags', +is( $MM->cflags(), 'fakeflags', 'cflags() should return CFLAGS member data, if set' ); -delete $args->{CFLAGS}; +delete $MM->{CFLAGS}; # ExtUtils::MM_Cygwin::cflags() calls this, fake the output { local $SIG{__WARN__} = sub { - # no warnings 'redefine'; warn @_ unless $_[0] =~ /^Subroutine .* redefined/; }; - sub ExtUtils::MM_Unix::cflags { return $_[1] }; + *ExtUtils::MM_Unix::cflags = sub { return $_[1] }; } # respects the config setting, should ignore whitespace around equal sign my $ccflags = $Config{useshrplib} eq 'true' ? ' -DUSEIMPORTLIB' : ''; { - local $args->{NEEDS_LINKING} = 1; - $args->cflags(<<FLAGS); + local $MM->{NEEDS_LINKING} = 1; + $MM->cflags(<<FLAGS); OPTIMIZE = opt PERLTYPE =pt FLAGS } -like( $args->{CFLAGS}, qr/OPTIMIZE = opt/, '... should set OPTIMIZE' ); -like( $args->{CFLAGS}, qr/PERLTYPE = pt/, '... should set PERLTYPE' ); -like( $args->{CFLAGS}, qr/CCFLAGS = $ccflags/, '... should set CCFLAGS' ); +like( $MM->{CFLAGS}, qr/OPTIMIZE = opt/, '... should set OPTIMIZE' ); +like( $MM->{CFLAGS}, qr/PERLTYPE = pt/, '... should set PERLTYPE' ); +like( $MM->{CFLAGS}, qr/CCFLAGS = $ccflags/, '... should set CCFLAGS' ); # test manifypods -$args = bless({ +$MM = bless({ NOECHO => 'noecho', MAN3PODS => {}, MAN1PODS => {}, MAKEFILE => 'Makefile', }, 'MM'); -like( $args->manifypods(), qr/pure_all\n\tnoecho/, +unlike( $MM->manifypods(), qr/foo/, 'manifypods() should return without PODS values set' ); -$args->{MAN3PODS} = { foo => 1 }; -my $out = tie *STDOUT, 'FakeOut'; +$MM->{MAN3PODS} = { foo => 'foo.1' }; +my $res = $MM->manifypods(); +like( $res, qr/pure_all.*foo.*foo.1/s, '... should add MAN3PODS targets' ); + + +# init_linker { - local $SIG{__WARN__} = sub { - # no warnings 'redefine'; - warn @_ unless $_[0] =~ /used only once/; - }; - 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' ); -} + my $libperl = $Config{libperl} || 'libperl.a'; + $libperl =~ s/\.a/.dll.a/ if $] >= 5.007; + $libperl = "\$(PERL_INC)/$libperl"; + + my $export = ''; + my $after = ''; + $MM->init_linker; -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'); + is( $MM->{PERL_ARCHIVE}, $libperl, 'PERL_ARCHIVE' ); + is( $MM->{PERL_ARCHIVE_AFTER}, $after, 'PERL_ARCHIVE_AFTER' ); + is( $MM->{EXPORT_LIST}, $export, 'EXPORT_LIST' ); } -# test perl_archive -my $libperl = $Config{libperl} || 'libperl.a'; -$libperl =~ s/\.a/.dll.a/; -is( $args->perl_archive(), "\$(PERL_INC)/$libperl", - 'perl_archive() should respect libperl setting' ); package FakeOut; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_NW5.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_NW5.t index d2046eeebbf..13359d17fbc 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_NW5.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_NW5.t @@ -172,19 +172,20 @@ delete $ENV{PATH} unless $had_path; 'clean() Makefile target' ); } -# perl_archive() + +# init_linker { my $libperl = $Config{libperl} || 'libperl.a'; - is( $MM->perl_archive(), File::Spec->catfile('$(PERL_INC)', $libperl ), - 'perl_archive() should respect libperl setting' ); -} + my $export = '$(BASEEXT).def'; + my $after = ''; + $MM->init_linker; -# export_list -{ - my $mm_w32 = bless { BASEEXT => 'someext' }, 'MM'; - is( $mm_w32->export_list(), 'someext.def', 'export_list()' ); + is( $MM->{PERL_ARCHIVE}, $libperl, 'PERL_ARCHIVE' ); + is( $MM->{PERL_ARCHIVE_AFTER}, $after, 'PERL_ARCHIVE_AFTER' ); + is( $MM->{EXPORT_LIST}, $export, 'EXPORT_LIST' ); } + # canonpath() { my $path = 'SYS:/TEMP'; @@ -272,14 +273,6 @@ unlink "${script_name}$script_ext" if -f "${script_name}$script_ext"; # xs_o() should look into that # top_targets() should look into that -# manifypods() -{ - my $mm_w32 = bless { NOECHO => '' }, 'MM'; - like( $mm_w32->manifypods(), - qr/^\nmanifypods :\n\t\$\Q(NOOP)\E\n$/, - 'manifypods() Makefile target' ); -} - # dist_ci() should look into that # dist_core() should look into that diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_OS2.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_OS2.t index 53b83f3f855..c09f68a4473 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_OS2.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_OS2.t @@ -247,26 +247,30 @@ ok( ExtUtils::MM_OS2->file_name_is_absolute( '\foo' ), ok( ! ExtUtils::MM_OS2->file_name_is_absolute( 'arduk' ), '... but not for paths with no leading slash or volume' ); -# perl_archive -is( ExtUtils::MM_OS2->perl_archive(), '$(PERL_INC)/libperl$(LIB_EXT)', - 'perl_archive() should return a static string' ); -# perl_archive_after +$mm->init_linker; + +# PERL_ARCHIVE +is( $mm->{PERL_ARCHIVE}, '$(PERL_INC)/libperl$(LIB_EXT)', 'PERL_ARCHIVE' ); + +# PERL_ARCHIVE_AFTER { my $aout = 0; local *OS2::is_aout; *OS2::is_aout = \$aout; - isnt( ExtUtils::MM_OS2->perl_archive_after(), '', - 'perl_archive_after() should return string without $is_aout set' ); + $mm->init_linker; + isnt( $mm->{PERL_ARCHIVE_AFTER}, '', + 'PERL_ARCHIVE_AFTER should be empty without $is_aout set' ); $aout = 1; - is( ExtUtils::MM_OS2->perl_archive_after(), '', - '... and blank string if it is set' ); + is( $mm->{PERL_ARCHIVE_AFTER}, + '$(PERL_INC)/libperl_override$(LIB_EXT)', + '... and has libperl_override if it is set' ); } -# export_list -is( ExtUtils::MM_OS2::export_list({ BASEEXT => 'foo' }), 'foo.def', - 'export_list() should add .def to BASEEXT member' ); +# EXPORT_LIST +is( $mm->{EXPORT_LIST}, '$(BASEEXT).def', + 'EXPORT_LIST should add .def to BASEEXT member' ); END { use File::Path; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t index 1e47f1bc370..6683761995b 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Unix.t @@ -2,7 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't' if -d 't'; + chdir 't'; @INC = '../lib'; } else { @@ -18,7 +18,7 @@ BEGIN { plan skip_all => 'Non-Unix platform'; } else { - plan tests => 112; + plan tests => 115; } } @@ -79,14 +79,13 @@ foreach ( qw / dist_basics dist_ci dist_core - dist_dir + distdir dist_test dlsyms dynamic dynamic_bs dynamic_lib exescan - export_list extliblist find_perl fixin @@ -103,7 +102,6 @@ foreach ( qw / makeaperl makefile manifypods - maybe_command_in_dirs needs_linking pasthru perldepend @@ -129,7 +127,6 @@ foreach ( qw / xs_c xs_cpp xs_o - xsubpp_version / ) { can_ok($class, $_); @@ -165,10 +162,14 @@ is ($t->has_link_code(),1); is ($t->{HAS_LINK_CODE},1); ############################################################################### # libscan -is ($t->libscan('RCS'),'','libscan on RCS'); -is ($t->libscan('CVS'),'','libscan on CVS'); -is ($t->libscan('SCCS'),'','libscan on SCCS'); -is ($t->libscan('Fatty'),'Fatty','libscan on something not RCS, CVS or SCCS'); +is ($t->libscan('foo/RCS/bar'), '', 'libscan on RCS'); +is ($t->libscan('CVS/bar/car'), '', 'libscan on CVS'); +is ($t->libscan('SCCS'), '', 'libscan on SCCS'); +is ($t->libscan('.svn/something'), '', 'libscan on Subversion'); +is ($t->libscan('foo/b~r'), 'foo/b~r', 'libscan on file with ~'); +is ($t->libscan('foo/RCS.pm'), 'foo/RCS.pm', 'libscan on file with RCS'); + +is ($t->libscan('Fatty'), 'Fatty', 'libscan on something not a VC file' ); ############################################################################### # maybe_command @@ -214,6 +215,7 @@ is ($t->perl_script($self_name),$self_name, 'we pass as a perl_script()'); ############################################################################### # perm_rw perm_rwx +$t->init_PERM; is ($t->perm_rw(),'644', 'perm_rw() is 644'); is ($t->perm_rwx(),'755', 'perm_rwx() is 755'); @@ -231,12 +233,13 @@ foreach (qw/ post_constants postamble post_initialize/) is ($t->replace_manpage_separator('Foo/Bar'),'Foo::Bar','manpage_separator'); ############################################################################### -# export_list, perl_archive, perl_archive_after -foreach (qw/ export_list perl_archive perl_archive_after/) - { - is ($t->$_(),'',"$_() is empty string on Unix"); - } +$t->init_linker; +foreach (qw/ EXPORT_LIST PERL_ARCHIVE PERL_ARCHIVE_AFTER /) +{ + ok( exists $t->{$_}, "$_ was defined" ); + is( $t->{$_}, '', "$_ is empty on Unix"); +} { diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_VMS.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_VMS.t index 303a599798d..dcc5ed6230a 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_VMS.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_VMS.t @@ -19,7 +19,6 @@ BEGIN { find_perl path maybe_command - maybe_command_in_dirs perl_script file_name_is_absolute replace_manpage_separator @@ -30,7 +29,6 @@ BEGIN { pm_to_blib tool_autosplit tool_xsubpp - xsubpp_version tools_other dist c_o @@ -49,7 +47,7 @@ BEGIN { realclean dist_basics dist_core - dist_dir + distdir dist_test install perldepend diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t index 8e2b52c03c4..e980b1a84e6 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/MM_Win32.t @@ -16,7 +16,7 @@ use Test::More; BEGIN { if ($^O =~ /MSWin32/i) { - plan tests => 40; + plan tests => 42; } else { plan skip_all => 'This is not Win32'; } @@ -84,7 +84,7 @@ delete $ENV{PATHEXT} unless $had_pathext; { 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 ], 0 ), qr/^\Q$my_perl\E$/i, 'find_perl() finds this perl' ); } @@ -112,7 +112,7 @@ delete $ENV{PATHEXT} unless $had_pathext; # init_others(): check if all keys are created and set? # qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP TEST_F LD AR LDLOADLIBS DEV_NUL ) { - my $mm_w32 = bless( {}, 'MM' ); + my $mm_w32 = bless( { BASEEXT => 'Foo' }, 'MM' ); $mm_w32->init_others(); my @keys = qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP TEST_F LD AR LDLOADLIBS DEV_NULL ); @@ -122,32 +122,44 @@ delete $ENV{PATHEXT} unless $had_pathext; } # constants() +# XXX this test is probably useless now that we can call individual +# init_* methods and check the keys in $mm_w32 directly { my $mm_w32 = bless { NAME => 'TestMM_Win32', VERSION => '1.00', - VERSION_FROM => 'TestMM_Win32', PM => { 'MM_Win32.pm' => 1 }, }, 'MM'; # XXX Hack until we have a proper init method. # Flesh out some necessary keys in the MM object. - foreach my $key (qw(XS C O_FILES H HTMLLIBPODS HTMLSCRIPTPODS - MAN1PODS MAN3PODS PARENT_NAME)) { - $mm_w32->{$key} = ''; - } + @{$mm_w32}{qw(XS MAN1PODS MAN3PODS)} = ({}) x 3; + @{$mm_w32}{qw(C O_FILES H)} = ([]) x 3; + @{$mm_w32}{qw(PARENT_NAME)} = ('') x 3; + $mm_w32->{FULLEXT} = 'TestMM_Win32'; + $mm_w32->{BASEEXT} = 'TestMM_Win32'; + + $mm_w32->init_VERSION; + $mm_w32->init_linker; + $mm_w32->init_INST; + $mm_w32->init_xs; + my $s_PM = join( " \\\n\t", sort keys %{$mm_w32->{PM}} ); my $k_PM = join( " \\\n\t", %{$mm_w32->{PM}} ); - like( $mm_w32->constants(), - 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()' ); - + my $constants = $mm_w32->constants; + + foreach my $regex ( + qr|^NAME \s* = \s* TestMM_Win32 \s* $|xms, + qr|^VERSION \s* = \s* 1\.00 \s* $|xms, + qr|^MAKEMAKER \s* = \s* \Q$INC{'ExtUtils/MakeMaker.pm'}\E \s* $|xms, + qr|^MM_VERSION \s* = \s* \Q$ExtUtils::MakeMaker::VERSION\E \s* $|xms, + qr|^TO_INST_PM \s* = \s* \Q$s_PM\E \s* $|xms, + qr|^PM_TO_BLIB \s* = \s* \Q$k_PM\E \s* $|xms, + ) + { + like( $constants, $regex, 'constants() check' ); + } } # path() @@ -172,17 +184,17 @@ delete $ENV{PATH} unless $had_path; 'clean() Makefile target' ); } -# perl_archive() +# init_linker { - my $libperl = $Config{libperl} || 'libperl.a'; - is( $MM->perl_archive(), File::Spec->catfile('$(PERL_INC)', $libperl ), - 'perl_archive() should respect libperl setting' ); -} - -# export_list -{ - my $mm_w32 = bless { BASEEXT => 'someext' }, 'MM'; - is( $mm_w32->export_list(), 'someext.def', 'export_list()' ); + my $libperl = File::Spec->catfile('$(PERL_INC)', + $Config{libperl} || 'libperl.a'); + my $export = '$(BASEEXT).def'; + my $after = ''; + $MM->init_linker; + + is( $MM->{PERL_ARCHIVE}, $libperl, 'PERL_ARCHIVE' ); + is( $MM->{PERL_ARCHIVE_AFTER}, $after, 'PERL_ARCHIVE_AFTER' ); + is( $MM->{EXPORT_LIST}, $export, 'EXPORT_LIST' ); } # canonpath() @@ -234,52 +246,9 @@ EOSCRIPT unlink "${script_name}$script_ext" if -f "${script_name}$script_ext"; -# 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' ); -} - -# tool_autosplit() -{ - my %attribs = ( MAXLEN => 255 ); - like( $MM->tool_autosplit( %attribs ), - qr/^\#\ Usage:\ \$\(AUTOSPLITFILE\) - \ FileToSplit\ AutoDirToSplitInto.+ - AUTOSPLITFILE\ =\ \$\(PERLRUN\)\ .+ - \$AutoSplit::Maxlen=$attribs{MAXLEN}; - /xms, - 'tool_autosplit()' ); -} - -# tools_other() -{ - ( my $mm_w32 = bless { }, 'MM' )->init_others(); - - my $bin_sh = ( $Config{make} =~ /^dmake/i - ? "" : ($Config{sh} || 'cmd /c') . "\n" ); - $bin_sh = "SHELL = $bin_sh" if $bin_sh; - - my $tools = join "\n", map "$_ = $mm_w32->{ $_ }" - => qw(CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL); - - like( $mm_w32->tools_other(), - qr/^\Q$bin_sh$tools/m, - 'tools_other()' ); -}; - # xs_o() should look into that # top_targets() should look into that -# manifypods() -{ - my $mm_w32 = bless { NOECHO => '' }, 'MM'; - like( $mm_w32->manifypods(), - qr/^\nmanifypods :\n\t\$\Q(NOOP)\E\n$/, - 'manifypods() Makefile target' ); -} - # dist_ci() should look into that # dist_core() should look into that diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t b/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t index 7a488be0937..215a24b14e4 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/Manifest.t @@ -14,7 +14,7 @@ chdir 't'; use strict; # these files help the test run -use Test::More tests => 33; +use Test::More tests => 41; use Cwd; # these files are needed for the module itself @@ -26,14 +26,14 @@ use File::Path; @INC = map { File::Spec->rel2abs($_) } @INC; # 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( T, '>'.$file) or return; - print T $data; - ++$files{$file}; + my ($file, $data) = @_; + $data ||= 'foo'; + 1 while unlink $file; # or else we'll get multiple versions on VMS + open( T, '>'.$file) or return; + print T $data; + ++$Files{$file}; close T; } @@ -58,7 +58,7 @@ sub remove_dir { BEGIN { use_ok( 'ExtUtils::Manifest', qw( mkmanifest manicheck filecheck fullcheck - maniread manicopy skipcheck ) ); + maniread manicopy skipcheck maniadd) ); } my $cwd = Cwd::getcwd(); @@ -127,10 +127,12 @@ ok( exists( ExtUtils::Manifest::manifind()->{'moretest/quux'} ), "manifind found moretest/quux" ); # only MANIFEST and foo are in the manifest +$_ = 'foo'; 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( $_, 'foo', q{maniread() doesn't clobber $_} ); # poison the manifest, and add a comment that should be reported add_file( 'MANIFEST', 'none #none' ); @@ -158,7 +160,7 @@ like($warn, qr/^Skipping MANIFEST.SKIP/i, 'warned about MANIFEST.SKIP' ); 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'}++; + $Files{'albatross'}++; } @@ -173,21 +175,59 @@ like( $warn, qr{^Skipping moretest/quux$}i, 'got skipping warning again' ); # There was a bug where entries in MANIFEST would be blotted out # by MANIFEST.SKIP rules. add_file( 'MANIFEST.SKIP' => 'foo' ); -add_file( 'MANIFEST' => 'foobar' ); +add_file( 'MANIFEST' => "foobar\n" ); add_file( 'foobar' => '123' ); ($res, $warn) = catch_warning( \&manicheck ); is( $res, '', 'MANIFEST overrides MANIFEST.SKIP' ); is( $warn, undef, 'MANIFEST overrides MANIFEST.SKIP, no warnings' ); +$files = maniread; +ok( !$files->{wibble}, 'MANIFEST in good state' ); +maniadd({ wibble => undef }); +maniadd({ yarrow => "hock" }); +$files = maniread; +is( $files->{wibble}, '', 'maniadd() with undef comment' ); +is( $files->{yarrow}, 'hock',' with comment' ); +is( $files->{foobar}, '', ' preserved old entries' ); + +add_file('MANIFEST' => 'Makefile.PL'); +maniadd({ foo => 'bar' }); +$files = maniread; +# VMS downcases the MANIFEST. We normalize it here to match. +%$files = map { (lc $_ => $files->{$_}) } keys %$files; +my %expect = ( 'makefile.pl' => '', + 'foo' => 'bar' + ); +is_deeply( $files, \%expect, 'maniadd() vs MANIFEST without trailing newline'); + +add_file('MANIFEST' => 'Makefile.PL'); +maniadd({ foo => 'bar' }); + +SKIP: { + chmod( 0400, 'MANIFEST' ); + skip "Can't make MANIFEST read-only", 2 if -w 'MANIFEST'; + + eval { + maniadd({ 'foo' => 'bar' }); + }; + is( $@, '', "maniadd() won't open MANIFEST if it doesn't need to" ); + + eval { + maniadd({ 'grrrwoof' => 'yippie' }); + }; + like( $@, qr/^\Qmaniadd() could not open MANIFEST:\E/, + "maniadd() dies if it can't open the MANIFEST" ); + + chmod( 0600, 'MANIFEST' ); +} + END { - # the args are evaluated in scalar context - is( unlink( keys %files ), keys %files, 'remove all added files' ); + is( unlink( keys %Files ), keys %Files, 'remove all added files' ); remove_dir( 'moretest', 'copy' ); # now get rid of the parent directory ok( chdir( $cwd ), 'return to parent directory' ); - unlink('mantest/MANIFEST'); remove_dir( 'mantest' ); } diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t b/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t index 9080434333c..960a75dfdf9 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/basic.t @@ -14,40 +14,22 @@ BEGIN { } use strict; -use Test::More tests => 17; +use Config; + +use Test::More tests => 73; use MakeMaker::Test::Utils; +use File::Find; use File::Spec; -use TieOut; +use File::Path; -my $perl = which_perl(); +# 'make disttest' sets a bunch of environment variables which interfere +# with our testing. +delete @ENV{qw(PREFIX LIB MAKEFLAGS)}; -my $root_dir = 't'; - -if( $^O eq 'VMS' ) { - # On older systems we might exceed the 8-level directory depth limit - # imposed by RMS. We get around this with a rooted logical, but we - # can't create logical names with attributes in Perl, so we do it - # in a DCL subprocess and put it in the job table so the parent sees it. - open( BFDTMP, '>bfdtesttmp.com' ) || die "Error creating command file; $!"; - print BFDTMP <<'COMMAND'; -$ IF F$TRNLNM("PERL_CORE") .EQS. "" .AND. F$TYPE(PERL_CORE) .EQS. "" -$ THEN -$! building CPAN version -$ BFD_TEST_ROOT = F$PARSE("SYS$DISK:[]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]" -$ ELSE -$! we're in the core -$ BFD_TEST_ROOT = F$PARSE("SYS$DISK:[-]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]" -$ ENDIF -$ DEFINE/JOB/NOLOG/TRANSLATION=CONCEALED BFD_TEST_ROOT 'BFD_TEST_ROOT' -COMMAND - close BFDTMP; - - system '@bfdtesttmp.com'; - END { 1 while unlink 'bfdtesttmp.com' } - $root_dir = 'BFD_TEST_ROOT:[t]'; -} +my $perl = which_perl(); +my $Is_VMS = $^O eq 'VMS'; -chdir $root_dir; +chdir($Is_VMS ? 'BFD_TEST_ROOT:[t]' : 't'); perl_lib; @@ -56,10 +38,11 @@ my $Touch_Time = calibrate_mtime(); $| = 1; -ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || +ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) || diag("chdir failed: $!"); -my @mpl_out = `$perl Makefile.PL PREFIX=dummy-install`; +my @mpl_out = run(qq{$perl Makefile.PL "PREFIX=../dummy-install"}); +END { rmtree '../dummy-install'; } cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); @@ -86,36 +69,188 @@ my $make = make_run(); { # Supress 'make manifest' noise local $ENV{PERL_MM_MANIFEST_VERBOSE} = 0; - my $manifest_out = `$make manifest`; + my $manifest_out = run("$make manifest"); ok( -e 'MANIFEST', 'make manifest created a MANIFEST' ); ok( -s 'MANIFEST', ' its not empty' ); } END { unlink 'MANIFEST'; } -my $test_out = `$make test`; + +my $ppd_out = run("$make ppd"); +is( $?, 0, ' exited normally' ) || diag $ppd_out; +ok( open(PPD, 'Big-Dummy.ppd'), ' .ppd file generated' ); +my $ppd_html; +{ local $/; $ppd_html = <PPD> } +close PPD; +like( $ppd_html, qr{^<SOFTPKG NAME="Big-Dummy" VERSION="0,01,0,0">}m, + ' <SOFTPKG>' ); +like( $ppd_html, qr{^\s*<TITLE>Big-Dummy</TITLE>}m, ' <TITLE>' ); +like( $ppd_html, qr{^\s*<ABSTRACT>Try "our" hot dog's</ABSTRACT>}m, + ' <ABSTRACT>'); +like( $ppd_html, + qr{^\s*<AUTHOR>Michael G Schwern <schwern\@pobox.com></AUTHOR>}m, + ' <AUTHOR>' ); +like( $ppd_html, qr{^\s*<IMPLEMENTATION>}m, ' <IMPLEMENTATION>'); +like( $ppd_html, qr{^\s*<DEPENDENCY NAME="strict" VERSION="0,0,0,0" />}m, + ' <DEPENDENCY>' ); +like( $ppd_html, qr{^\s*<OS NAME="$Config{osname}" />}m, + ' <OS>' ); +like( $ppd_html, qr{^\s*<ARCHITECTURE NAME="$Config{archname}" />}m, + ' <ARCHITECTURE>'); +like( $ppd_html, qr{^\s*<CODEBASE HREF="" />}m, ' <CODEBASE>'); +like( $ppd_html, qr{^\s*</IMPLEMENTATION>}m, ' </IMPLEMENTATION>'); +like( $ppd_html, qr{^\s*</SOFTPKG>}m, ' </SOFTPKG>'); +END { unlink 'Big-Dummy.ppd' } + + +my $test_out = run("$make test"); like( $test_out, qr/All tests successful/, 'make test' ); -is( $?, 0 ); +is( $?, 0, ' exited normally' ) || + diag $test_out; # Test 'make test TEST_VERBOSE=1' my $make_test_verbose = make_macro($make, 'test', TEST_VERBOSE => 1); -$test_out = `$make_test_verbose`; +$test_out = run("$make_test_verbose"); like( $test_out, qr/ok \d+ - TEST_VERBOSE/, 'TEST_VERBOSE' ); -like( $test_out, qr/All tests successful/, ' successful' ); -is( $?, 0 ); +like( $test_out, qr/All tests successful/, ' successful' ); +is( $?, 0, ' exited normally' ) || + diag $test_out; + + +my $install_out = run("$make install"); +is( $?, 0, 'install' ) || diag $install_out; +like( $install_out, qr/^Installing /m ); +like( $install_out, qr/^Writing /m ); + +ok( -r '../dummy-install', ' install dir created' ); +my %files = (); +find( sub { + # do it case-insensitive for non-case preserving OSs + $files{lc $_} = $File::Find::name; +}, '../dummy-install' ); +ok( $files{'dummy.pm'}, ' Dummy.pm installed' ); +ok( $files{'liar.pm'}, ' Liar.pm installed' ); +ok( $files{'.packlist'}, ' packlist created' ); +ok( $files{'perllocal.pod'},' perllocal.pod created' ); + + +SKIP: { + skip "VMS install targets do not preserve $(PREFIX)", 8 if $Is_VMS; + + $install_out = run("$make install PREFIX=elsewhere"); + is( $?, 0, 'install with PREFIX override' ) || diag $install_out; + like( $install_out, qr/^Installing /m ); + like( $install_out, qr/^Writing /m ); + + ok( -r 'elsewhere', ' install dir created' ); + %files = (); + find( sub { $files{$_} = $File::Find::name; }, 'elsewhere' ); + ok( $files{'Dummy.pm'}, ' Dummy.pm installed' ); + ok( $files{'Liar.pm'}, ' Liar.pm installed' ); + ok( $files{'.packlist'}, ' packlist created' ); + ok( $files{'perllocal.pod'},' perllocal.pod created' ); + rmtree('elsewhere'); +} + + +SKIP: { + skip "VMS install targets do not preserve $(DESTDIR)", 10 if $Is_VMS; + + $install_out = run("$make install PREFIX= DESTDIR=other"); + is( $?, 0, 'install with DESTDIR' ) || + diag $install_out; + like( $install_out, qr/^Installing /m ); + like( $install_out, qr/^Writing /m ); + + ok( -d 'other', ' destdir created' ); + %files = (); + my $perllocal; + find( sub { + $files{$_} = $File::Find::name; + }, 'other' ); + ok( $files{'Dummy.pm'}, ' Dummy.pm installed' ); + ok( $files{'Liar.pm'}, ' Liar.pm installed' ); + ok( $files{'.packlist'}, ' packlist created' ); + ok( $files{'perllocal.pod'},' perllocal.pod created' ); + + ok( open(PERLLOCAL, $files{'perllocal.pod'} ) ) || + diag("Can't open $files{'perllocal.pod'}: $!"); + { local $/; + unlike(<PERLLOCAL>, qr/other/, 'DESTDIR should not appear in perllocal'); + } + close PERLLOCAL; + +# TODO not available in the min version of Test::Harness we require +# ok( open(PACKLIST, $files{'.packlist'} ) ) || +# diag("Can't open $files{'.packlist'}: $!"); +# { local $/; +# local $TODO = 'DESTDIR still in .packlist'; +# unlike(<PACKLIST>, qr/other/, 'DESTDIR should not appear in .packlist'); +# } +# close PACKLIST; + + rmtree('other'); +} + + +SKIP: { + skip "VMS install targets do not preserve $(PREFIX)", 9 if $Is_VMS; + + $install_out = run("$make install PREFIX=elsewhere DESTDIR=other/"); + is( $?, 0, 'install with PREFIX override and DESTDIR' ) || + diag $install_out; + like( $install_out, qr/^Installing /m ); + like( $install_out, qr/^Writing /m ); + + ok( !-d 'elsewhere', ' install dir not created' ); + ok( -d 'other/elsewhere', ' destdir created' ); + %files = (); + find( sub { $files{$_} = $File::Find::name; }, 'other/elsewhere' ); + ok( $files{'Dummy.pm'}, ' Dummy.pm installed' ); + ok( $files{'Liar.pm'}, ' Liar.pm installed' ); + ok( $files{'.packlist'}, ' packlist created' ); + ok( $files{'perllocal.pod'},' perllocal.pod created' ); + rmtree('other'); +} + -my $dist_test_out = `$make disttest`; +my $dist_test_out = run("$make disttest"); is( $?, 0, 'disttest' ) || diag($dist_test_out); +# Test META.yml generation +use ExtUtils::Manifest qw(maniread); +ok( -f 'META.yml', 'META.yml written' ); +my $manifest = maniread(); +# VMS is non-case preserving, so we can't know what the MANIFEST will +# look like. :( +_normalize($manifest); +is( $manifest->{'meta.yml'}, 'Module meta-data (added by MakeMaker)' ); + +# Test NO_META META.yml suppression +unlink 'META.yml'; +ok( !-f 'META.yml', 'META.yml deleted' ); +@mpl_out = run(qq{$perl Makefile.PL "NO_META=1"}); +cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); +my $metafile_out = run("$make metafile"); +is( $?, 0, 'metafile' ) || diag($metafile_out); +ok( !-f 'META.yml', 'META.yml generation suppressed by NO_META' ); + +# Test if MANIFEST is read-only. +chmod 0444, 'MANIFEST'; +@mpl_out = run(qq{$perl Makefile.PL}); +cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); +$metafile_out = run("$make metafile_addtomanifest"); +is( $?, 0, q{metafile_addtomanifest didn't die with locked MANIFEST} ) || + diag($metafile_out); + # Make sure init_dirscan doesn't go into the distdir -@mpl_out = `$perl Makefile.PL "PREFIX=dummy-install"`; +@mpl_out = run(qq{$perl Makefile.PL "PREFIX=../dummy-install"}); -cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || - diag(@mpl_out); +cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); -ok( grep(/^Writing $makefile for Big::Dummy/, - @mpl_out) == 1, +ok( grep(/^Writing $makefile for Big::Dummy/, @mpl_out) == 1, 'init_dirscan skipped distdir') || diag(@mpl_out); @@ -124,8 +259,18 @@ ok( grep(/^Writing $makefile for Big::Dummy/, open(SAVERR, ">&STDERR") or die $!; open(STDERR, ">".File::Spec->devnull) or die $!; -my $realclean_out = `$make realclean`; +my $realclean_out = run("$make realclean"); is( $?, 0, 'realclean' ) || diag($realclean_out); open(STDERR, ">&SAVERR") or die $!; close SAVERR; + + +sub _normalize { + my $hash = shift; + + while(my($k,$v) = each %$hash) { + delete $hash->{$k}; + $hash->{lc $k} = $v; + } +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/bytes.t b/gnu/usr.bin/perl/lib/ExtUtils/t/bytes.t new file mode 100644 index 00000000000..e566831cc21 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/bytes.t @@ -0,0 +1,30 @@ +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; +use Test::More tests => 4; + +use_ok('ExtUtils::MakeMaker::bytes'); + +SKIP: { + skip "bytes.pm appeared in 5.6", 3 if $] < 5.006; + + my $chr = chr(400); + is( length $chr, 1 ); + + { + use ExtUtils::MakeMaker::bytes; + is( length $chr, 2, 'byte.pm in effect' ); + } + + is( length $chr, 1, ' score is lexical' ); +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/hints.t b/gnu/usr.bin/perl/lib/ExtUtils/t/hints.t index 62608d7bbb6..b74690fe0ab 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/hints.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/hints.t @@ -11,10 +11,16 @@ BEGIN { } chdir 't'; +use File::Spec; + use Test::More tests => 3; +# Having the CWD in @INC masked a bug in finding hint files +my $curdir = File::Spec->curdir; +@INC = grep { $_ ne $curdir && $_ ne '.' } @INC; + mkdir('hints', 0777); -my $hint_file = "hints/$^O.pl"; +my $hint_file = File::Spec->catfile('hints', "$^O.pl"); open(HINT, ">$hint_file") || die "Can't write dummy hints file $hint_file: $!"; print HINT <<'CLOO'; $self->{CCFLAGS} = 'basset hounds got long ears'; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/oneliner.t b/gnu/usr.bin/perl/lib/ExtUtils/t/oneliner.t new file mode 100644 index 00000000000..5e0521b45f4 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/oneliner.t @@ -0,0 +1,51 @@ +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +chdir 't'; + +use MakeMaker::Test::Utils; +use Test::More tests => 6; +use File::Spec; + +my $TB = Test::More->builder; + +BEGIN { use_ok('ExtUtils::MM') } + +my $mm = bless { NAME => "Foo" }, 'MM'; +isa_ok($mm, 'ExtUtils::MakeMaker'); +isa_ok($mm, 'ExtUtils::MM_Any'); + + +sub try_oneliner { + my($code, $switches, $expect, $name) = @_; + my $cmd = $mm->oneliner($code, $switches); + $cmd =~ s{\$\(PERLRUN\)}{$^X}; + + # VMS likes to put newlines at the end of commands if there isn't + # one already. + $expect =~ s/([^\n])\z/$1\n/ if $^O eq 'VMS'; + + $TB->is_eq(scalar `$cmd`, $expect, $name) || $TB->diag("oneliner:\n$cmd"); +} + +# Lets see how it deals with quotes. +try_oneliner(q{print "foo'o", ' bar"ar'}, [], q{foo'o bar"ar}, 'quotes'); + +# How about dollar signs? +try_oneliner(q{$PATH = 'foo'; print $PATH},[], q{foo}, 'dollar signs' ); + +# switches? +try_oneliner(q{print 'foo'}, ['-l'], "foo\n", 'switches' ); + +# XXX gotta rethink the newline test. The Makefile does newline +# escaping, then the shell. + diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/postamble.t b/gnu/usr.bin/perl/lib/ExtUtils/t/postamble.t new file mode 100644 index 00000000000..b8c049277fc --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/postamble.t @@ -0,0 +1,65 @@ +#!/usr/bin/perl -w + +# Wherein we ensure that postamble works ok. + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; +use Test::More tests => 5; +use MakeMaker::Test::Utils; +use ExtUtils::MakeMaker; +use TieOut; + +chdir 't'; +perl_lib; +$| = 1; + +my $Makefile = makefile_name; + +ok( chdir 'Big-Dummy', q{chdir'd to Big-Dummy} ) || + diag("chdir failed: $!"); + +{ + my $warnings = ''; + local $SIG{__WARN__} = sub { + $warnings = join '', @_; + }; + + my $stdout = tie *STDOUT, 'TieOut' or die; + my $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION_FROM => 'lib/Big/Dummy.pm', + postamble => { + FOO => 1, + BAR => "fugawazads" + } + ); + is( $warnings, '', 'postamble argument not warned about' ); +} + +sub MY::postamble { + my($self, %extra) = @_; + + is_deeply( \%extra, { FOO => 1, BAR => 'fugawazads' }, + 'postamble args passed' ); + + return <<OUT; +# This makes sure the postamble gets written +OUT + +} + + +ok( open(MAKEFILE, $Makefile) ) or diag "Can't open $Makefile: $!"; +{ local $/; + like( <MAKEFILE>, qr/^\# This makes sure the postamble gets written\n/m, + 'postamble added to the Makefile' ); +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t b/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t index 0f92a4a8b24..644bc00e8aa 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/prefixify.t @@ -17,18 +17,24 @@ if( $^O eq 'VMS' ) { plan skip_all => 'prefixify works differently on VMS'; } else { - plan tests => 2; + plan tests => 3; } +use Config; use File::Spec; use ExtUtils::MM; my $mm = bless {}, 'MM'; my $default = File::Spec->catdir(qw(this that)); + $mm->prefixify('installbin', 'wibble', 'something', $default); +is( $mm->{INSTALLBIN}, $Config{installbin}, + 'prefixify w/defaults'); +$mm->{ARGS}{PREFIX} = 'foo'; +$mm->prefixify('installbin', 'wibble', 'something', $default); is( $mm->{INSTALLBIN}, File::Spec->catdir('something', $default), - 'prefixify w/defaults'); + 'prefixify w/defaults and PREFIX'); { undef *ExtUtils::MM_Unix::Config; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/prereq_print.t b/gnu/usr.bin/perl/lib/ExtUtils/t/prereq_print.t new file mode 100644 index 00000000000..78dc6e8e1f3 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/prereq_print.t @@ -0,0 +1,66 @@ +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; +use Config; + +use Test::More tests => 8; +use MakeMaker::Test::Utils; + +# 'make disttest' sets a bunch of environment variables which interfere +# with our testing. +delete @ENV{qw(PREFIX LIB MAKEFLAGS)}; + +my $Perl = which_perl(); +my $Makefile = makefile_name(); +my $Is_VMS = $^O eq 'VMS'; + +chdir($Is_VMS ? 'BFD_TEST_ROOT:[t]' : 't'); +perl_lib; + +$| = 1; + +ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) || + diag("chdir failed: $!"); + +unlink $Makefile; +my $prereq_out = run(qq{$Perl Makefile.PL "PREREQ_PRINT=1"}); +ok( !-r $Makefile, "PREREQ_PRINT produces no $Makefile" ); +is( $?, 0, ' exited normally' ); +{ + package _Prereq::Print; + no strict; + $PREREQ_PM = undef; # shut up "used only once" warning. + eval $prereq_out; + ::is_deeply( $PREREQ_PM, { strict => 0 }, 'prereqs dumped' ); + ::is( $@, '', ' without error' ); +} + + +$prereq_out = run(qq{$Perl Makefile.PL "PRINT_PREREQ=1"}); +ok( !-r $Makefile, "PRINT_PREREQ produces no $Makefile" ); +is( $?, 0, ' exited normally' ); +::like( $prereq_out, qr/^perl\(strict\) \s* >= \s* 0 \s*$/x, + 'prereqs dumped' ); + + +# Currently a bug. +#my $prereq_out = run(qq{$Perl Makefile.PL "PREREQ_PRINT=0"}); +#ok( -r $Makefile, "PREREQ_PRINT=0 produces a $Makefile" ); +#is( $?, 0, ' exited normally' ); +#unlink $Makefile; + +# Currently a bug. +#my $prereq_out = run(qq{$Perl Makefile.PL "PRINT_PREREQ=1"}); +#ok( -r $Makefile, "PRINT_PREREQ=0 produces a $Makefile" ); +#is( $?, 0, ' exited normally' ); +#unlink $Makefile; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/prompt.t b/gnu/usr.bin/perl/lib/ExtUtils/t/prompt.t new file mode 100644 index 00000000000..ec9aa10036e --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/prompt.t @@ -0,0 +1,56 @@ +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; +use Test::More tests => 11; +use ExtUtils::MakeMaker; +use TieOut; +use TieIn; + +eval q{ + prompt(); +}; +like( $@, qr/^Not enough arguments for ExtUtils::MakeMaker::prompt/, + 'no args' ); + +eval { + prompt(undef); +}; +like( $@, qr/^prompt function called without an argument/, + 'undef message' ); + +my $stdout = tie *STDOUT, 'TieOut' or die; + + +$ENV{PERL_MM_USE_DEFAULT} = 1; +is( prompt("Foo?"), '', 'no default' ); +like( $stdout->read, qr/^Foo\?\s*\n$/, ' question' ); + +is( prompt("Foo?", undef), '', 'undef default' ); +like( $stdout->read, qr/^Foo\?\s*\n$/, ' question' ); + +is( prompt("Foo?", 'Bar!'), 'Bar!', 'default' ); +like( $stdout->read, qr/^Foo\? \[Bar!\]\s+Bar!\n$/, ' question' ); + + +SKIP: { + skip "eof() doesn't honor ties in 5.5.3", 3 if $] < 5.006; + + $ENV{PERL_MM_USE_DEFAULT} = 0; + close STDIN; + my $stdin = tie *STDIN, 'TieIn' or die; + $stdin->write("From STDIN"); + ok( !-t STDIN, 'STDIN not a tty' ); + + is( prompt("Foo?", 'Bar!'), 'From STDIN', 'from STDIN' ); + like( $stdout->read, qr/^Foo\? \[Bar!\]\s*$/, ' question' ); +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/recurs.t b/gnu/usr.bin/perl/lib/ExtUtils/t/recurs.t new file mode 100644 index 00000000000..9ec4f4ce28c --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/recurs.t @@ -0,0 +1,113 @@ +#!/usr/bin/perl -w + +# This tests MakeMaker against recursive builds + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; +use Config; + +use Test::More tests => 25; +use MakeMaker::Test::Utils; +use MakeMaker::Test::Setup::Recurs; + +# 'make disttest' sets a bunch of environment variables which interfere +# with our testing. +delete @ENV{qw(PREFIX LIB MAKEFLAGS)}; + +my $perl = which_perl(); +my $Is_VMS = $^O eq 'VMS'; + +chdir('t'); + +perl_lib; + +my $Touch_Time = calibrate_mtime(); + +$| = 1; + +ok( setup_recurs(), 'setup' ); +END { + ok( chdir File::Spec->updir ); + ok( teardown_recurs(), 'teardown' ); +} + +ok( chdir('Recurs'), q{chdir'd to Recurs} ) || + diag("chdir failed: $!"); + + +# Check recursive Makefile building. +my @mpl_out = run(qq{$perl Makefile.PL}); + +cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || + diag(@mpl_out); + +my $makefile = makefile_name(); + +ok( -e $makefile, 'Makefile written' ); +ok( -e File::Spec->catfile('prj2',$makefile), 'sub Makefile written' ); + +my $make = make_run(); + +run("$make"); +is( $?, 0, 'recursive make exited normally' ); + +ok( chdir File::Spec->updir ); +ok( teardown_recurs(), 'cleaning out recurs' ); +ok( setup_recurs(), ' setting up fresh copy' ); +ok( chdir('Recurs'), q{chdir'd to Recurs} ) || + diag("chdir failed: $!"); + + +# Check NORECURS +@mpl_out = run(qq{$perl Makefile.PL "NORECURS=1"}); + +cmp_ok( $?, '==', 0, 'Makefile.PL NORECURS=1 exited with zero' ) || + diag(@mpl_out); + +$makefile = makefile_name(); + +ok( -e $makefile, 'Makefile written' ); +ok( !-e File::Spec->catfile('prj2',$makefile), 'sub Makefile not written' ); + +$make = make_run(); + +run("$make"); +is( $?, 0, 'recursive make exited normally' ); + + +ok( chdir File::Spec->updir ); +ok( teardown_recurs(), 'cleaning out recurs' ); +ok( setup_recurs(), ' setting up fresh copy' ); +ok( chdir('Recurs'), q{chdir'd to Recurs} ) || + diag("chdir failed: $!"); + + +# Check that arguments aren't stomped when they have .. prepended +# [rt.perl.org 4345] +@mpl_out = run(qq{$perl Makefile.PL "INST_SCRIPT=cgi"}); + +cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || + diag(@mpl_out); + +$makefile = makefile_name(); +my $submakefile = File::Spec->catfile('prj2',$makefile); + +ok( -e $makefile, 'Makefile written' ); +ok( -e $submakefile, 'sub Makefile written' ); + +my $inst_script = File::Spec->catdir(File::Spec->updir, 'cgi'); +ok( open(MAKEFILE, $submakefile) ) || diag("Can't open $submakefile: $!"); +{ local $/; + like( <MAKEFILE>, qr/^\s*INST_SCRIPT\s*=\s*\Q$inst_script\E/m, + 'prepend .. not stomping WriteMakefile args' ) +} +close MAKEFILE; diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/split_command.t b/gnu/usr.bin/perl/lib/ExtUtils/t/split_command.t new file mode 100644 index 00000000000..49e2629cfbf --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/split_command.t @@ -0,0 +1,66 @@ +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +chdir 't'; + +use ExtUtils::MM; +use MakeMaker::Test::Utils; + +my $Is_VMS = $^O eq 'VMS'; +my $Is_Win32 = $^O eq 'MSWin32'; + +use Test::More tests => 7; + +my $perl = which_perl; +my $mm = bless { NAME => "Foo" }, "MM"; + +# I don't expect anything to have a length shorter than 256 chars. +cmp_ok( $mm->max_exec_len, '>=', 256, 'max_exec_len' ); + +my $echo = $mm->oneliner(q{print @ARGV}, ['-l']); + +# Force a short command length to make testing split_command easier. +$mm->{_MAX_EXEC_LEN} = length($echo) + 15; +is( $mm->max_exec_len, $mm->{_MAX_EXEC_LEN}, ' forced a short max_exec_len' ); + +my @test_args = qw(foo bar baz yar car har ackapicklerootyjamboree); +my @cmds = $mm->split_command($echo, @test_args); +isnt( @cmds, 0 ); + +@results = _run(@cmds); +is( join('', @results), join('', @test_args)); + + +my %test_args = ( foo => 42, bar => 23, car => 'har' ); +$even_args = $mm->oneliner(q{print !(@ARGV % 2)}); +@cmds = $mm->split_command($even_args, %test_args); +isnt( @cmds, 0 ); + +@results = _run(@cmds); +like( join('', @results ), qr/^1+$/, 'pairs preserved' ); + +is( $mm->split_command($echo), 0, 'no args means no commands' ); + + +sub _run { + my @cmds = @_; + + s{\$\(PERLRUN\)}{$perl} foreach @cmds; + if( $Is_VMS ) { + s{-\n}{} foreach @cmds + } + elsif( $Is_Win32 ) { + s{\\\n}{} foreach @cmds; + } + + return map { s/\n+$//; $_ } map { `$_` } @cmds +} diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/vmsish.t b/gnu/usr.bin/perl/lib/ExtUtils/t/vmsish.t new file mode 100644 index 00000000000..6195a0d5c11 --- /dev/null +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/vmsish.t @@ -0,0 +1,17 @@ +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; +use Test::More tests => 1; + +use_ok('ExtUtils::MakeMaker::vmsish'); + diff --git a/gnu/usr.bin/perl/lib/ExtUtils/t/zz_cleanup_dummy.t b/gnu/usr.bin/perl/lib/ExtUtils/t/zz_cleanup_dummy.t index 69738445966..1b01f0a5d02 100644 --- a/gnu/usr.bin/perl/lib/ExtUtils/t/zz_cleanup_dummy.t +++ b/gnu/usr.bin/perl/lib/ExtUtils/t/zz_cleanup_dummy.t @@ -8,14 +8,16 @@ BEGIN { unshift @INC, 't/lib'; } } -chdir 't'; +chdir($^O eq 'VMS' ? 'BFD_TEST_ROOT:[t]' : 't'); use strict; -use Test::More tests => 2; +use Test::More tests => 3; use File::Path; rmtree('Big-Dummy'); ok(!-d 'Big-Dummy', 'Big-Dummy cleaned up'); rmtree('Problem-Module'); ok(!-d 'Problem-Module', 'Problem-Module cleaned up'); +rmtree('dummy-install'); +ok(!-d 'dummy-install', 'dummy-install cleaned up'); |