lib/ExtUtils/Liblist/Kid.pm Does the real work of the above
lib/ExtUtils/Liblist.pm Locates libraries
lib/ExtUtils/MakeMaker/bytes.pm Version agnostic bytes.pm
+lib/ExtUtils/MakeMaker/Config.pm MakeMaker wrapper for Config
lib/ExtUtils/MakeMaker/FAQ.pod MakeMaker FAQ
lib/ExtUtils/MakeMaker.pm Write Makefiles for extensions
lib/ExtUtils/MakeMaker/Tutorial.pod Writing a module with MakeMaker
lib/ExtUtils/META.yml ExtUtils::MakeMaker metadata
lib/ExtUtils/Mkbootstrap.pm Writes a bootstrap file (see MakeMaker)
lib/ExtUtils/Mksymlists.pm Writes a linker options file for extensions
+lib/ExtUtils/MM_AIX.pm MakeMaker methods for AIX
lib/ExtUtils/MM_Any.pm MakeMaker methods for Any OS
lib/ExtUtils/MM_BeOS.pm MakeMaker methods for BeOS
lib/ExtUtils/MM_Cygwin.pm MakeMaker methods for Cygwin
lib/ExtUtils/MM_NW5.pm MakeMaker methods for NetWare
lib/ExtUtils/MM_OS2.pm MakeMaker methods for OS/2
lib/ExtUtils/MM.pm MakeMaker adaptor class
+lib/ExtUtils/MM_QNX.pm MakeMaker methods for QNX
lib/ExtUtils/MM_Unix.pm MakeMaker methods for Unix
lib/ExtUtils/MM_UWIN.pm MakeMaker methods for U/WIN
lib/ExtUtils/MM_VMS.pm MakeMaker methods for VMS
+lib/ExtUtils/MM_VOS.pm MakeMaker methods for VOS
lib/ExtUtils/MM_Win32.pm MakeMaker methods for Win32
lib/ExtUtils/MM_Win95.pm MakeMaker methods for Win95
lib/ExtUtils/MY.pm MakeMaker user override class
lib/ExtUtils/t/basic.t See if MakeMaker can build a module
lib/ExtUtils/t/bytes.t Test ExtUtils::MakeMaker::bytes
lib/ExtUtils/t/Command.t See if ExtUtils::Command works (Win32 only)
+lib/ExtUtils/t/config.t Test ExtUtils::MakeMaker::Config
lib/ExtUtils/t/Constant.t See if ExtUtils::Constant works
lib/ExtUtils/t/dir_target.t Verify if dir_target() is supported
lib/ExtUtils/t/Embed.t See if ExtUtils::Embed and embedding works
lib/ExtUtils/testlib.pm Fixes up @INC to use just-built extension
lib/ExtUtils/t/hints.t See if hint files are honored.
+lib/ExtUtils/t/installbase.t Test INSTALLBASE in MakeMaker
lib/ExtUtils/t/Installed.t See if ExtUtils::Installed works
lib/ExtUtils/t/Install.t See if ExtUtils::Install works
lib/ExtUtils/t/INST_PREFIX.t See if MakeMaker can apply PREFIXs
lib/ExtUtils/t/oneliner.t See if MM can generate perl one-liners
lib/ExtUtils/t/Packlist.t See if Packlist works
lib/ExtUtils/t/parse_version.t See if parse_version works
+lib/ExtUtils/t/PL_FILES.t Test PL_FILES in MakeMaker
lib/ExtUtils/t/postamble.t See if postamble works
lib/ExtUtils/t/prefixify.t See if MakeMaker can apply a PREFIX
lib/ExtUtils/t/prereq_print.t See if PREREQ_PRINT works
lib/ExtUtils/t/VERSION_FROM.t See if MakeMaker's VERSION_FROM works
lib/ExtUtils/t/vmsish.t Test ExtUtils::MakeMaker::vmsish
lib/ExtUtils/t/writemakefile_args.t See if WriteMakefile works
+lib/ExtUtils/t/xs.t Part of MakeMaker's test suite
lib/ExtUtils/typemap Extension interface types
lib/ExtUtils/xsubpp External subroutine preprocessor
lib/fastcwd.pl a faster but more dangerous getcwd
t/lib/locale/latin1 Part of locale.t in Latin 1
t/lib/locale/utf8 Part of locale.t in UTF8
t/lib/MakeMaker/Test/Setup/BFD.pm MakeMaker test utilities
+t/lib/MakeMaker/Test/Setup/PL_FILES.pm MakeMaker test utilities
t/lib/MakeMaker/Test/Setup/Problem.pm MakeMaker test utilities
t/lib/MakeMaker/Test/Setup/Recurs.pm MakeMaker test utilities
t/lib/MakeMaker/Test/Utils.pm MakeMaker test utilities
+6.27 Mon Apr 4 16:36:14 PDT 2005
+ * Added _darcs to the list of revision control administrative
+ directories skipped both in libscan and in MANIFEST.SKIP.
+
+6.26_01 Mon Mar 28 21:34:39 PST 2005
+ * PL_FILES was broken in the last release. The .PL files were not being
+ passed the file they were to generate.
+ * How PL_FILES runs the programs and what it does with the value is
+ now documented.
+ * The default behavior of PL_FILES is now documented.
+
+6.26 Mon Mar 21 20:36:22 PST 2005
+
+6.25_12 Fri Mar 18 16:15:35 PST 2005
+ - Use the generic dmake search.cpan.org URL in the README so the newest
+ version is found.
+ - Fixed pm_to_blib trouble on VMS introduced in 6.25_10.
+
+6.25_11 Tue Mar 15 02:00:20 PST 2005
+ - Fixed minor parent class dependency loop in ExtUtils::MM_Any.
+ - Fixed a circular dependency on processed PL files introduced as part
+ of RT 6460 in 6.25_02.
+
+6.25_10 Sun Mar 13 16:14:04 PST 2005
+ - pm_to_blib.ts is gone, back to pm_to_blib (except on VMS). I
+ couldn't make it work and still retain backwards compatibility.
+ This fixes the recompilation problems that plagued _09 and various
+ previous alpha releases.
+
+6.25_09 Sat Mar 12 10:10:34 PST 2005
+ - Stubbing out PASTHRU on VMS. $(MMSQUALIFIERS) should do the equivalent
+ and better.
+ - Added test to check for the existence of a compiler so XS tests are
+ now possible.
+
+6.25_08 Tue Feb 8 09:04:36 EST 2005
+ - Fixing xsubpp on VMS. Had a foo/bar path in it.
+ - Turning XSUBPP into a runable command by the addition of PERLRUN
+ made it unusable as a dependency. Added XSUBPPRUN for that and left
+ XSUBPP alone.
+ - Removed DESTDIR from PASTHRU as install is not recursive and it can
+ make commands too long on VMS.
+ - Older versions of MMS cannot handle directory targets at all. Using
+ .exists files everywhere.
+ - Restore missing *.Opt clean on VMS.
+ - Fix .exists files accidentally getting caught in static builds.
+ - Older versions of MMS cannot handle directory targets at all.
+ - Add Interix support (bleadperl@33892)
+ - distsign target changed to distsignature to avoid clash with
+ Module::Install
+
+6.25_07 Fri Dec 31 03:47:20 EST 2004
+ - perllocal on VMS was inserting executables twice.
+ - No longer using $(IGNORE) macro. Turns out MMS/K was not honoring
+ it. Using "-$(NOECHO) command" which seems to make everybody happy.
+ - Executables with no extension weren't getting installed on VMS due to
+ a bug in rename(). Broken sometime in this series of alphas.
+
+6.25_06 Sun Dec 26 17:21:37 EST 2004
+ - Forgot to define BOOTDEP macro.
+ - .exists files are back. Directories cannot be used directly as
+ targets as their mod time changes too frequently.
+ * Added INSTALLBASE as an alternative to PREFIX but haven't documented
+ it yet. I'll do that next release.
+
+6.25_05 Wed Dec 22 07:59:02 EST 2004
+ - One of the 6.25 alphas broke BSD make. It doesn't like "- @ command".
+ Fixed by adding an $(IGNORE) macro.
+ - 6.25 alphas caused a Makefile to be added to the dist. Fixed.
+ - The new cd() code needed to be dependent on dmake or nmake for
+ Windows. Not Win9x vs WinNT/XP.
+
+6.25_04 Tue Dec 21 00:53:06 EST 2004
+ - 6.25_03 was always rebuilding XS modules.
+
+6.25_03 Mon Dec 20 23:04:22 EST 2004
+ - dir_target() is back. Now each directory to be created has its own
+ target like before, but no more .exists or blibdirs.ts files. This
+ ensures that each blib directory is created as necessary and fixes
+ things like SVN's perl bindings.
+
+6.25_02 Mon Dec 20 03:31:49 EST 2004
+ - Set PM_FILTER as late as possible so it can see all the earlier
+ macro definitions. Necessary for challenged make implementations
+ like nmake. Should fix Mail::SpamAssassin installs on Win32.
+ [rt.cpan.org 4545]
+ - clean and realclean are now more careful about accidentally deleting
+ directories instead of files. [rt.cpan.org 6851]
+ - small fix for parallel builds, make sure pm_to_blib has run before
+ we try to use stuff in blib. [rt.cpan.org 6460]
+ - MAKEFILE=foo appears to have been broken for recursive builds and
+ several other things. I think this was broken by 6.18.
+
+6.25_01 Fri Dec 17 21:29:04 EST 2004
+ * *.bak added to the default MANIFEST.SKIP.
+ * META.yml will no longer be generated in the build directory. It will
+ only appear in the distdir. This should make it easier on developers,
+ they don't have to worry about checking the file in all the time.
+ * Similarly, the SIGNATURE file will not be updated in the build
+ directory. It will only be generated in the distdir.
+ - A bunch of redundant Win9x and VMS code removed.
+ - 'make test' on Windows no longer pre-expands its list of test files.
+ This caused problems on large distributions like bioperl. Thanks to
+ Tim Bunce for suggesting the obvious fix.
+
6.25 Wed Dec 15 06:59:46 EST 2004
- Build.PL was being considered like Module_pm.PL. Build.PL is now
ignored. [radek@karnet.pl] [rt.cpan.org 8809]
@ISA = qw(Exporter);
@EXPORT = qw(cp rm_f rm_rf mv cat eqtime mkpath touch test_f chmod
dos2unix);
-$VERSION = '1.07';
+$VERSION = '1.09';
my $Is_VMS = $^O eq 'VMS';
=head1 SYNOPSIS
- perl -MExtUtils::Command -e cat files... > destination
- perl -MExtUtils::Command -e mv source... destination
- perl -MExtUtils::Command -e cp source... destination
- perl -MExtUtils::Command -e touch files...
- perl -MExtUtils::Command -e rm_f files...
- perl -MExtUtils::Command -e rm_rf directories...
- perl -MExtUtils::Command -e mkpath directories...
- perl -MExtUtils::Command -e eqtime source destination
- perl -MExtUtils::Command -e test_f file
- perl -MExtUtils::Command -e chmod mode files...
+ perl -MExtUtils::Command -e cat files... > destination
+ perl -MExtUtils::Command -e mv source... destination
+ perl -MExtUtils::Command -e cp source... destination
+ perl -MExtUtils::Command -e touch files...
+ perl -MExtUtils::Command -e rm_f files...
+ perl -MExtUtils::Command -e rm_rf directories...
+ perl -MExtUtils::Command -e mkpath directories...
+ perl -MExtUtils::Command -e eqtime source destination
+ perl -MExtUtils::Command -e test_f file
+ perl -MExtUtils::Command -e chmod mode files...
...
=head1 DESCRIPTION
perl -MExtUtils::Command -e 'some_command qw(some files to work on)'
+For that use L<Shell::Command>.
+
Filenames with * and ? will be glob expanded.
=over 4
}
-=item cat
+=item cat
+
+ cat file ...
Concatenates all files mentioned on command line to STDOUT.
print while (<>);
}
-=item eqtime src dst
+=item eqtime
-Sets modified time of dst to that of src
+ eqtime source destination
+
+Sets modified time of destination to that of source.
=cut
utime((stat($src))[8,9],$dst);
}
-=item rm_rf files....
+=item rm_rf
+
+ rm_rf files or directories ...
-Removes directories - recursively (even if readonly)
+Removes files and directories - recursively (even if readonly)
=cut
rmtree([grep -e $_,@ARGV],0,0);
}
-=item rm_f files....
+=item rm_f
+
+ rm_f file ...
Removes files (even if readonly)
chmod(0777, $file);
next if _unlink($file);
-
+
carp "Cannot delete $file: $!";
}
}
}
-=item touch files ...
+=item touch
+
+ touch file ...
Makes files exist, with current timestamp
}
}
-=item mv source... destination
+=item mv
+
+ mv source_file destination_file
+ mv source_file source_file destination_dir
Moves source to destination. Multiple sources are allowed if
destination is an existing directory.
return !$nok;
}
-=item cp source... destination
+=item cp
-Copies source to destination. Multiple sources are allowed if
+ cp source_file destination_file
+ cp source_file source_file destination_dir
+
+Copies sources to the destination. Multiple sources are allowed if
destination is an existing directory.
Returns true if all copies succeeded, false otherwise.
return $nok;
}
-=item chmod mode files...
+=item chmod
+
+ chmod mode files ...
Sets UNIX like permissions 'mode' on all the files. e.g. 0666
chmod(oct $mode,@ARGV) || die "Cannot chmod ".join(' ',$mode,@ARGV).":$!";
}
-=item mkpath directory...
+=item mkpath
-Creates directory, including any parent directories.
+ mkpath directory ...
+
+Creates directories, including any parent directories.
=cut
File::Path::mkpath([@ARGV],0,0777);
}
-=item test_f file
+=item test_f
+
+ test_f file
Tests if a file exists
=item dos2unix
+ dos2unix files or dirs ...
+
Converts DOS and OS/2 linefeeds to Unix style recursively.
=cut
=back
-=head1 BUGS
-
-Should probably be Auto/Self loaded.
-
=head1 SEE ALSO
-ExtUtils::MakeMaker, ExtUtils::MM_Unix, ExtUtils::MM_Win32
+Shell::Command which is these same functions but take arguments normally.
+
=head1 AUTHOR
@EXPORT = qw(test_harness pod2man perllocal_install uninstall
warn_if_old_packlist);
-$VERSION = '0.03_01';
+$VERSION = '0.05';
my $Is_VMS = $^O eq 'VMS';
+
=head1 NAME
ExtUtils::Command::MM - Commands for the MM's to use in Makefiles
$Test::Harness::verbose = shift;
+ # Because Windows doesn't do this for us and listing all the *.t files
+ # out on the command line can blow over its exec limit.
+ require ExtUtils::Command;
+ my @argv = ExtUtils::Command::expand_wildcards(@ARGV);
+
local @INC = @INC;
unshift @INC, map { File::Spec->rel2abs($_) } @_;
- Test::Harness::runtests(sort { lc $a cmp lc $b } @ARGV);
+ Test::Harness::runtests(sort { lc $a cmp lc $b } @argv);
}
perl "-MExtUtils::Command::MM" -e perllocal_install
<type> <module name> <key> <value> ...
- # VMS only, key/value pairs come on STDIN
+ # VMS only, key|value pairs come on STDIN
perl "-MExtUtils::Command::MM" -e perllocal_install
- <type> <module name> < <key> <value> ...
+ <type> <module name> < <key>|<value> ...
Prints a fragment of POD suitable for appending to perllocal.pod.
Arguments are read from @ARGV.
use 5.00503;
use vars qw(@ISA @EXPORT $VERSION);
-$VERSION = 1.32;
+$VERSION = '1.33';
use Exporter;
use Carp ();
@_ < 2 or die "install_default should be called with 0 or 1 argument";
my $FULLEXT = @_ ? shift : $ARGV[0];
defined $FULLEXT or die "Do not know to where to write install log";
- my $INST_LIB = File::Spec->catdir(File::Spec->curdir,"blib","lib");
- my $INST_ARCHLIB = File::Spec->catdir(File::Spec->curdir,"blib","arch");
- my $INST_BIN = File::Spec->catdir(File::Spec->curdir,'blib','bin');
- my $INST_SCRIPT = File::Spec->catdir(File::Spec->curdir,'blib','script');
- my $INST_MAN1DIR = File::Spec->catdir(File::Spec->curdir,'blib','man1');
- my $INST_MAN3DIR = File::Spec->catdir(File::Spec->curdir,'blib','man3');
+ my $INST_LIB = File::Spec->catdir($Curdir,"blib","lib");
+ my $INST_ARCHLIB = File::Spec->catdir($Curdir,"blib","arch");
+ my $INST_BIN = File::Spec->catdir($Curdir,'blib','bin');
+ my $INST_SCRIPT = File::Spec->catdir($Curdir,'blib','script');
+ my $INST_MAN1DIR = File::Spec->catdir($Curdir,'blib','man1');
+ my $INST_MAN3DIR = File::Spec->catdir($Curdir,'blib','man3');
install({
read => "$Config{sitearchexp}/auto/$FULLEXT/.packlist",
write => "$Config{installsitearch}/auto/$FULLEXT/.packlist",
use File::Compare qw(compare);
use AutoSplit;
- if (!ref($fromto) && -r $fromto)
- {
- # Win32 has severe command line length limitations, but
- # can generate temporary files on-the-fly
- # so we pass name of file here - eval it to get hash
- open(FROMTO,"<$fromto") or die "Cannot open $fromto:$!";
- my $str = '$fromto = {qw{'.join('',<FROMTO>).'}}';
- eval $str;
- close(FROMTO);
- }
-
mkpath($autodir,0,0755);
while(my($from, $to) = each %$fromto) {
if( -f $to && -s $from == -s $to && -M $to < -M $from ) {
\bSCCS\b
,v$
\B\.svn\b
+^_darcs$
# Avoid Makemaker generated and utility files.
\bMANIFEST\.bak
\bblib/
\bMakeMaker-\d
\bpm_to_blib\.ts$
-\bblibdirs\.ts$
+\bpm_to_blib$
+\bblibdirs\.ts$ # 6.18 through 6.25 generated this
# Avoid Module::Build generated and utility files.
\bBuild$
\.old$
\#$
\b\.#
+\.bak$
# Avoid Devel::Cover files.
\bcover_db\b
# 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.25
+version: 6.27
version_from: lib/ExtUtils/MakeMaker.pm
installdirs: perl
requires:
Pod::Man: 0
distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.25
+generated_by: ExtUtils::MakeMaker version 6.27
package ExtUtils::MM;
use strict;
-use Config;
+use ExtUtils::MakeMaker::Config;
use vars qw(@ISA $VERSION);
-$VERSION = 0.04;
+$VERSION = '0.05';
require ExtUtils::Liblist;
require ExtUtils::MakeMaker;
$^O = 'NetWare';
delete $Is{Win32};
}
+$Is{VOS} = $^O eq 'vos';
+$Is{QNX} = $^O eq 'qnx';
+$Is{AIX} = $^O eq 'aix';
+
$Is{Unix} = !grep { $_ } values %Is;
map { delete $Is{$_} unless $Is{$_} } keys %Is;
--- /dev/null
+package ExtUtils::MM_AIX;
+
+use strict;
+use vars qw($VERSION @ISA);
+$VERSION = '0.02';
+
+require ExtUtils::MM_Unix;
+@ISA = qw(ExtUtils::MM_Unix);
+
+
+=head1 NAME
+
+ExtUtils::MM_AIX - AIX specific subclass of ExtUtils::MM_Unix
+
+=head1 SYNOPSIS
+
+ Don't use this module directly.
+ Use ExtUtils::MM and let it choose.
+
+=head1 DESCRIPTION
+
+This is a subclass of ExtUtils::MM_Unix which contains functionality for
+AIX.
+
+Unless otherwise stated it works just like ExtUtils::MM_Unix
+
+=head2 Overridden methods
+
+=head3 dlsyms
+
+Define DL_FUNCS and DL_VARS and write the *.exp files.
+
+=cut
+
+sub dlsyms {
+ my($self,%attribs) = @_;
+
+ return '' unless $self->needs_linking();
+
+ my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
+ my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
+ my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
+ my(@m);
+
+ push(@m,"
+dynamic :: $self->{BASEEXT}.exp
+
+") unless $self->{SKIPHASH}{'dynamic'}; # dynamic and static are subs, so...
+
+ push(@m,"
+static :: $self->{BASEEXT}.exp
+
+") unless $self->{SKIPHASH}{'static'}; # we avoid a warning if we tick them
+
+ push(@m,"
+$self->{BASEEXT}.exp: Makefile.PL
+",' $(PERLRUN) -e \'use ExtUtils::Mksymlists; \\
+ Mksymlists("NAME" => "',$self->{NAME},'", "DL_FUNCS" => ',
+ neatvalue($funcs), ', "FUNCLIST" => ', neatvalue($funclist),
+ ', "DL_VARS" => ', neatvalue($vars), ');\'
+');
+
+ join('',@m);
+}
+
+
+=head1 AUTHOR
+
+Michael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix
+
+=head1 SEE ALSO
+
+L<ExtUtils::MakeMaker>
+
+=cut
+
+
+1;
use strict;
use vars qw($VERSION @ISA);
-$VERSION = '0.10';
-@ISA = qw(File::Spec);
+$VERSION = '0.12';
-use Config;
use File::Spec;
+BEGIN { @ISA = qw(File::Spec); }
+
+# We need $Verbose
+use ExtUtils::MakeMaker qw($Verbose);
+
+use ExtUtils::MakeMaker::Config;
+
+
+# So we don't have to keep calling the methods over and over again,
+# we have these globals to cache the values. Faster and shrtr.
+my $Curdir = __PACKAGE__->curdir;
+my $Rootdir = __PACKAGE__->rootdir;
+my $Updir = __PACKAGE__->updir;
=head1 NAME
B<THIS MAY BE TEMPORARY!>
-=head1 Inherently Cross-Platform Methods
-These are methods which are by their nature cross-platform and should
-always be cross-platform.
+=head1 METHODS
-=over 4
+Any methods marked I<Abstract> must be implemented by subclasses.
-=item installvars
- my @installvars = $mm->installvars;
+=head2 Cross-platform helper methods
-A list of all the INSTALL* variables without the INSTALL prefix. Useful
-for iteration or building related variable sets.
+These are methods which help writing cross-platform code.
-=cut
-sub installvars {
- return qw(PRIVLIB SITELIB VENDORLIB
- ARCHLIB SITEARCH VENDORARCH
- BIN SITEBIN VENDORBIN
- SCRIPT
- MAN1DIR SITEMAN1DIR VENDORMAN1DIR
- MAN3DIR SITEMAN3DIR VENDORMAN3DIR
- );
-}
-=item os_flavor_is
+=head3 os_flavor I<Abstract>
+
+ 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, etc...) and the rest are sub families.
+
+Some examples:
+
+ Cygwin98 ('Unix', 'Cygwin', 'Cygwin9x')
+ Windows NT ('Win32', 'WinNT')
+ Win98 ('Win32', 'Win9x')
+ Linux ('Unix', 'Linux')
+ 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.
+
- $mm->os_flavor_is($this_flavor);
- $mm->os_flavor_is(@one_of_these_flavors);
+=head3 os_flavor_is
+
+ my $is_this_flavor = $mm->os_flavor_is($this_flavor);
+ my $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.
}
-=item dir_target B<DEPRECATED>
-
- my $make_frag = $mm->dir_target(@directories);
-
-I<This function is deprecated> its use is no longer necessary and is
-I<only provided for backwards compatibility>. It is now a no-op.
-blibdirs_target provides a much simpler mechanism and pm_to_blib() can
-create its own directories anyway.
-
-=cut
-
-sub dir_target {}
-
-
-=item blibdirs_target (o)
-
- my $make_frag = $mm->blibdirs_target;
-
-Creates the blibdirs.ts target which creates all the directories we use in
-blib/.
-
-=cut
-
-sub blibdirs_target {
- my $self = shift;
-
- my @dirs = map { uc "\$(INST_$_)" } qw(libdir archlib
- autodir archautodir
- bin script
- man1dir man3dir
- );
- my @mkpath = $self->split_command('$(NOECHO) $(MKPATH)', @dirs);
- my @chmod = $self->split_command('$(NOECHO) $(CHMOD) 755', @dirs);
-
- my $make = "\nblibdirs.ts :\n";
- $make .= join "", map { "\t$_\n" } @mkpath, @chmod;
- $make .= <<'MAKE';
- $(NOECHO) $(TOUCH) $@
-
-MAKE
-
- return $make;
-}
-
-
-=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 {
- 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>
+=head3 split_command
my @cmds = $MM->split_command($cmd, @args);
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
+C<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.
}
-=item B<echo>
+=head3 echo
my @commands = $MM->echo($text);
my @commands = $MM->echo($text, $file);
}
-=item init_VERSION
+=head3 wraplist
- $mm->init_VERSION
+ my $args = $mm->wraplist(@list);
-Initialize macros representing versions of MakeMaker and other tools
+Takes an array of items and turns them into a well-formatted list of
+arguments. In most cases this is simply something like:
-MAKEMAKER: path to the MakeMaker module.
+ FOO \
+ BAR \
+ BAZ
-MM_VERSION: ExtUtils::MakeMaker Version
+=cut
-MM_REVISION: ExtUtils::MakeMaker version control revision (for backwards
- compat)
+sub wraplist {
+ my $self = shift;
+ return join " \\\n\t", @_;
+}
-VERSION: version of your module
-VERSION_MACRO: which macro represents the version (usually 'VERSION')
+=head3 cd I<Abstract>
-VERSION_SYM: like version but safe for use as an RCS revision number
+ my $subdir_cmd = $MM->cd($subdir, @cmds);
-DEFINE_VERSION: -D line to set the module version when compiling
+This will generate a make fragment which runs the @cmds in the given
+$dir. The rough equivalent to this, except cross platform.
-XS_VERSION: version in your .xs file. Defaults to $(VERSION)
+ cd $subdir && $cmd
-XS_VERSION_MACRO: which macro represents the XS version.
+Currently $dir can only go down one level. "foo" is fine. "foo/bar" is
+not. "../foo" is right out.
-XS_DEFINE_VERSION: -D line to set the xs version when compiling.
+The resulting $subdir_cmd has no leading tab nor trailing newline. This
+makes it easier to embed in a make string. For example.
-Called by init_main.
+ my $make = sprintf <<'CODE', $subdir_cmd;
+ foo :
+ $(ECHO) what
+ %s
+ $(ECHO) mouche
+ CODE
-=cut
-sub init_VERSION {
- my($self) = shift;
+=head3 oneliner I<Abstract>
- $self->{MAKEMAKER} = $ExtUtils::MakeMaker::Filename;
- $self->{MM_VERSION} = $ExtUtils::MakeMaker::VERSION;
- $self->{MM_REVISION}= $ExtUtils::MakeMaker::Revision;
- $self->{VERSION_FROM} ||= '';
+ my $oneliner = $MM->oneliner($perl_code);
+ my $oneliner = $MM->oneliner($perl_code, \@switches);
- 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");
- }
- }
+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.
- # strip blanks
- if (defined $self->{VERSION}) {
- $self->{VERSION} =~ s/^\s+//;
- $self->{VERSION} =~ s/\s+$//;
- }
- else {
- $self->{VERSION} = '';
- }
+$(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:
- $self->{VERSION_MACRO} = 'VERSION';
- ($self->{VERSION_SYM} = $self->{VERSION}) =~ s/\W/_/g;
- $self->{DEFINE_VERSION} = '-D$(VERSION_MACRO)=\"$(VERSION)\"';
+ my $code = $MM->oneliner(<<'CODE', [...switches...]);
+some code here
+another line here
+CODE
+Usage might be something like:
- # 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};
+ # an echo emulation
+ $oneliner = $MM->oneliner('print "Foo\n"');
+ $make = '$oneliner > somefile';
- $self->{XS_VERSION_MACRO} = 'XS_VERSION';
- $self->{XS_DEFINE_VERSION} = '-D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"';
+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)"');
-=item wraplist
+Its currently very simple and may be expanded sometime in the figure
+to include more flexible code and switches.
-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
+=head3 quote_literal I<Abstract>
-=cut
+ my $safe_text = $MM->quote_literal($text);
-sub wraplist {
- my $self = shift;
- return join " \\\n\t", @_;
-}
+This will quote $text so it is interpreted literally in the shell.
-=item manifypods
+For example, on Unix this would escape any single-quotes in $text and
+put single-quotes around the whole thing.
-Defines targets and routines to translate the pods into manpages and
-put them into the INST_* directories.
-=cut
+=head3 escape_newlines I<Abstract>
-sub manifypods {
- my $self = shift;
+ my $escaped_text = $MM->escape_newlines($text);
- my $POD2MAN_macro = $self->POD2MAN_macro();
- my $manifypods_target = $self->manifypods_target();
+Shell escapes newlines in $text.
- return <<END_OF_TARGET;
-$POD2MAN_macro
+=head3 max_exec_len I<Abstract>
-$manifypods_target
+ my $max_exec_len = $MM->max_exec_len;
-END_OF_TARGET
+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 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
+=head2 Targets
-sub manifypods_target {
- my($self) = shift;
+These are methods which produce make targets.
- my $man1pods = '';
- my $man3pods = '';
- my $dependencies = '';
- # populate manXpods & dependencies:
- foreach my $name (keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}}) {
- $dependencies .= " \\\n\t$name";
- }
+=head3 all_target
- foreach my $name (keys %{$self->{MAN3PODS}}) {
- $dependencies .= " \\\n\t$name"
- }
+Generate the default target 'all'.
- my $manify = <<END;
-manifypods : pure_all $dependencies
-END
+=cut
- 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
- }
+sub all_target {
+ my $self = shift;
- $manify .= "\t\$(NOECHO) \$(NOOP)\n" unless @man_cmds;
- $manify .= join '', map { "$_\n" } @man_cmds;
+ return <<'MAKE_EXT';
+all :: pure_all
+ $(NOECHO) $(NOOP)
+MAKE_EXT
- return $manify;
}
-=item makemakerdflt_target
+=head3 blibdirs_target
- my $make_frag = $mm->makemakerdflt_target
+ my $make_frag = $mm->blibdirs_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.
+Creates the blibdirs target which creates all the directories we use
+in blib/.
-=cut
+The blibdirs.ts target is deprecated. Depend on blibdirs instead.
-sub makemakerdflt_target {
- return <<'MAKE_FRAG';
-makemakerdflt: all
- $(NOECHO) $(NOOP)
-MAKE_FRAG
-}
+=cut
+
+sub blibdirs_target {
+ my $self = shift;
+
+ my @dirs = map { uc "\$(INST_$_)" } qw(libdir archlib
+ autodir archautodir
+ bin script
+ man1dir man3dir
+ );
+ my @exists = map { $_.'$(DFSEP).exists' } @dirs;
-=item special_targets
+ my $make = sprintf <<'MAKE', join(' ', @exists);
+blibdirs : %s
+ $(NOECHO) $(NOOP)
- my $make_frag = $mm->special_targets
+# Backwards compat with 6.18 through 6.25
+blibdirs.ts : blibdirs
+ $(NOECHO) $(NOOP)
-Returns a make fragment containing any targets which have special
-meaning to make. For example, .SUFFIXES and .PHONY.
+MAKE
+
+ $make .= $self->dir_target(@dirs);
+
+ return $make;
+}
+
+
+=head3 clean (o)
+
+Defines the clean target.
=cut
-sub special_targets {
- my $make_frag = <<'MAKE_FRAG';
-.SUFFIXES: .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT)
+sub clean {
+# --- Cleanup and Distribution Sections ---
-.PHONY: all config static dynamic test linkext manifest
+ my($self, %attribs) = @_;
+ my @m;
+ push(@m, '
+# 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_subdirs
+');
+
+ my @files = values %{$self->{XS}}; # .c files from *.xs files
+ my @dirs = qw(blib);
+
+ # Normally these are all under blib but they might have been
+ # redefined.
+ # XXX normally this would be a good idea, but the Perl core sets
+ # INST_LIB = ../../lib rather than actually installing the files.
+ # So a "make clean" in an ext/ directory would blow away lib.
+ # Until the core is adjusted let's leave this out.
+# push @dirs, qw($(INST_ARCHLIB) $(INST_LIB)
+# $(INST_BIN) $(INST_SCRIPT)
+# $(INST_MAN1DIR) $(INST_MAN3DIR)
+# $(INST_LIBDIR) $(INST_ARCHLIBDIR) $(INST_AUTODIR)
+# $(INST_STATIC) $(INST_DYNAMIC) $(INST_BOOT)
+# );
+
+
+ if( $attribs{FILES} ) {
+ # Use @dirs because we don't know what's in here.
+ push @dirs, ref $attribs{FILES} ?
+ @{$attribs{FILES}} :
+ split /\s+/, $attribs{FILES} ;
+ }
-MAKE_FRAG
+ push(@files, qw[$(MAKE_APERL_FILE)
+ perlmain.c tmon.out mon.out so_locations
+ blibdirs.ts pm_to_blib pm_to_blib.ts
+ *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT)
+ $(BOOTSTRAP) $(BASEEXT).bso
+ $(BASEEXT).def lib$(BASEEXT).def
+ $(BASEEXT).exp $(BASEEXT).x
+ ]);
- $make_frag .= <<'MAKE_FRAG' if $ENV{CLEARCASE_ROOT};
-.NO_CONFIG_REC: Makefile
+ push(@files, $self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'));
+ push(@files, $self->catfile('$(INST_ARCHAUTODIR)','extralibs.ld'));
-MAKE_FRAG
+ # core files
+ push(@files, qw[core core.*perl.*.? *perl.core]);
+ push(@files, map { "core." . "[0-9]"x$_ } (1..5));
- return $make_frag;
-}
+ # OS specific things to clean up. Use @dirs since we don't know
+ # what might be in here.
+ push @dirs, $self->extra_clean_files;
-=item POD2MAN_macro
+ # Occasionally files are repeated several times from different sources
+ { my(%f) = map { ($_ => 1) } @files; @files = keys %f; }
+ { my(%d) = map { ($_ => 1) } @dirs; @dirs = keys %d; }
- my $pod2man_macro = $self->POD2MAN_macro
+ push @m, map "\t$_\n", $self->split_command('- $(RM_F)', @files);
+ push @m, map "\t$_\n", $self->split_command('- $(RM_RF)', @dirs);
-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.
+ # Leave Makefile.old around for realclean
+ push @m, <<'MAKE';
+ - $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL)
+MAKE
-Typical usage:
+ push(@m, "\t$attribs{POSTOP}\n") if $attribs{POSTOP};
- $(POD2MAN) --section=3 --perm_rw=$(PERM_RW) podfile1 man_page1 ...
+ join("", @m);
+}
+
+
+=head3 clean_subdirs_target
+
+ my $make_frag = $MM->clean_subdirs_target;
+
+Returns the clean_subdirs target. This is used by the clean target to
+call clean on any subdirectories which contain Makefiles.
=cut
-sub POD2MAN_macro {
- my $self = shift;
+sub clean_subdirs_target {
+ 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
+ # 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}}) {
+ my $subclean = $self->oneliner(sprintf <<'CODE', $dir);
+chdir '%s'; system '$(MAKE) clean' if -f '$(FIRST_MAKEFILE)';
+CODE
+
+ $clean .= "\t$subclean\n";
+ }
+
+ return $clean;
}
-=item test_via_harness
+=head3 dir_target
- my $command = $mm->test_via_harness($perl, $tests);
+ my $make_frag = $mm->dir_target(@directories);
-Returns a $command line which runs the given set of $tests with
-Test::Harness and the given $perl.
+Generates targets to create the specified directories and set its
+permission to 0755.
-Used on the t/*.t files.
+Because depending on a directory to just ensure it exists doesn't work
+too well (the modified time changes too often) dir_target() creates a
+.exists file in the created directory. It is this you should depend on.
+For portability purposes you should use the $(DIRFILESEP) macro rather
+than a '/' to seperate the directory from the file.
+
+ yourdirectory$(DIRFILESEP).exists
=cut
-sub test_via_harness {
- my($self, $perl, $tests) = @_;
+sub dir_target {
+ my($self, @dirs) = @_;
- return qq{\t$perl "-MExtUtils::Command::MM" }.
- qq{"-e" "test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $tests\n};
-}
+ my $make = '';
+ foreach my $dir (@dirs) {
+ $make .= sprintf <<'MAKE', ($dir) x 7;
+%s$(DFSEP).exists :
+ $(NOECHO) $(MKPATH) %s
+ $(NOECHO) $(CHMOD) 755 %s
+ $(NOECHO) $(TOUCH) %s$(DFSEP).exists
-=item test_via_script
+MAKE
- my $command = $mm->test_via_script($perl, $script);
+ }
-Returns a $command line which just runs a single test without
-Test::Harness. No checks are done on the results, they're just
-printed.
+ return $make;
+}
-Used for test.pl, since they don't always follow Test::Harness
-formatting.
+
+=head3 distdir
+
+Defines the scratch directory target that will hold the distribution
+before tar-ing (or shar-ing).
=cut
-sub test_via_script {
- my($self, $perl, $script) = @_;
- return qq{\t$perl "-I\$(INST_LIB)" "-I\$(INST_ARCHLIB)" $script\n};
-}
+# For backwards compatibility.
+*dist_dir = *distdir;
-=item libscan
+sub distdir {
+ my($self) = shift;
- my $wanted = $self->libscan($path);
+ my $meta_target = $self->{NO_META} ? '' : 'distmeta';
+ my $sign_target = !$self->{SIGN} ? '' : 'distsignature';
-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.
+ return sprintf <<'MAKE_FRAG', $meta_target, $sign_target;
+create_distdir :
+ $(RM_RF) $(DISTVNAME)
+ $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
+ -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
-Mainly used to exclude RCS, CVS, and SCCS directories from
-installation.
+distdir : create_distdir %s %s
+ $(NOECHO) $(NOOP)
+
+MAKE_FRAG
+
+}
+
+
+=head3 dist_test
+
+Defines a target that produces the distribution in the
+scratchdirectory, and runs 'perl Makefile.PL; make ;make test' in that
+subdirectory.
=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;
+sub dist_test {
+ my($self) = shift;
+
+ my $mpl_args = join " ", map qq["$_"], @ARGV;
+
+ my $test = $self->cd('$(DISTVNAME)',
+ '$(ABSPERLRUN) Makefile.PL '.$mpl_args,
+ '$(MAKE) $(PASTHRU)',
+ '$(MAKE) test $(PASTHRU)'
+ );
+
+ return sprintf <<'MAKE_FRAG', $test;
+disttest : distdir
+ %s
+
+MAKE_FRAG
+
- return $path;
}
-=item tool_autosplit
-Defines a simple perl call that runs autosplit. May be deprecated by
-pm_to_blib soon.
+=head3 dynamic (o)
+
+Defines the dynamic target.
=cut
-sub tool_autosplit {
- my($self, %attribs) = @_;
+sub dynamic {
+# --- Dynamic Loading Sections ---
- my $maxlen = $attribs{MAXLEN} ? '$$AutoSplit::Maxlen=$attribs{MAXLEN};'
- : '';
+ my($self) = shift;
+ '
+dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT)
+ $(NOECHO) $(NOOP)
+';
+}
- 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
+=head3 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
+
+sub makemakerdflt_target {
+ return <<'MAKE_FRAG';
+makemakerdflt: all
+ $(NOECHO) $(NOOP)
MAKE_FRAG
}
-=item all_target
+=head3 manifypods_target
-Generate the default target 'all'.
+ 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 all_target {
- my $self = shift;
+sub manifypods_target {
+ my($self) = shift;
- return <<'MAKE_EXT';
-all :: pure_all
- $(NOECHO) $(NOOP)
-MAKE_EXT
+ 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 metafile_target
+=head3 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:
+Writes the file META.yml YAML encoded meta-data about the module in
+the distdir. The format follows Module::Build's as closely as
+possible. Additionally, we include:
version_from
installdirs
YAML
my @write_meta = $self->echo($meta, 'META_new.yml');
- my $move = $self->oneliner(<<'CODE', ['-MExtUtils::Command', '-MFile::Compare']);
-compare(@ARGV) != 0 ? (mv or warn "Cannot move @ARGV: $$!\n") : unlink(shift);
-CODE
- return sprintf <<'MAKE_FRAG', join("\n\t", @write_meta), $move;
-metafile :
+ return sprintf <<'MAKE_FRAG', join("\n\t", @write_meta);
+metafile : create_distdir
$(NOECHO) $(ECHO) Generating META.yml
%s
- -$(NOECHO) %s META_new.yml META.yml
+ -$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml
MAKE_FRAG
}
-=item signature_target
+=head3 distmeta_target
- my $target = $mm->signature_target;
-
-Generate the signature target.
+ my $make_frag = $mm->distmeta_target;
-Writes the file SIGNATURE with "cpansign -s".
+Generates the distmeta target to add META.yml to the MANIFEST in the
+distdir.
=cut
-sub signature_target {
+sub distmeta_target {
my $self = shift;
- return <<'MAKE_FRAG' if !$self->{SIGN};
-signature :
- $(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 <<'MAKE_FRAG';
-signature : signature_addtomanifest
- cpansign -s
-MAKE_FRAG
+ my $add_meta_to_distdir = $self->cd('$(DISTVNAME)', $add_meta);
-}
+ return sprintf <<'MAKE', $add_meta_to_distdir;
+distmeta : create_distdir metafile
+ $(NOECHO) %s
+
+MAKE
+}
-=item metafile_addtomanifest_target
- my $target = $mm->metafile_addtomanifest_target
+=head3 realclean (o)
-Adds the META.yml file to the MANIFEST.
+Defines the realclean target.
=cut
-sub metafile_addtomanifest_target {
- my $self = shift;
+sub realclean {
+ my($self, %attribs) = @_;
- return <<'MAKE_FRAG' if $self->{NO_META};
-metafile_addtomanifest:
- $(NOECHO) $(NOOP)
-MAKE_FRAG
+ my @dirs = qw($(DISTVNAME));
+ my @files = qw($(FIRST_MAKEFILE) $(MAKEFILE_OLD));
- 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
+ if ($self->{PERL_CORE}) {
+ push @dirs, qw($(INST_AUTODIR) $(INST_ARCHAUTODIR));
+ push @files, values %{$self->{PM}};
+ }
- return sprintf <<'MAKE_FRAG', $add_meta;
-metafile_addtomanifest:
- $(NOECHO) $(ECHO) Adding META.yml to MANIFEST
- $(NOECHO) %s
-MAKE_FRAG
+ if( $self->has_link_code ){
+ push @files, qw($(OBJECT));
+ }
+
+ if( $attribs{FILES} ) {
+ if( ref $attribs{FILES} ) {
+ push @dirs, @{ $attribs{FILES} };
+ }
+ else {
+ push @dirs, split /\s+/, $attribs{FILES};
+ }
+ }
+
+ # Occasionally files are repeated several times from different sources
+ { my(%f) = map { ($_ => 1) } @files; @files = keys %f; }
+ { my(%d) = map { ($_ => 1) } @dirs; @dirs = keys %d; }
+
+ my $rm_cmd = join "\n\t", map { "$_" }
+ $self->split_command('- $(RM_F)', @files);
+ my $rmf_cmd = join "\n\t", map { "$_" }
+ $self->split_command('- $(RM_RF)', @dirs);
+
+ my $m = sprintf <<'MAKE', $rm_cmd, $rmf_cmd;
+# Delete temporary files (via clean) and also delete dist files
+realclean purge :: clean realclean_subdirs
+ %s
+ %s
+MAKE
+
+ $m .= "\t$attribs{POSTOP}\n" if $attribs{POSTOP};
+ return $m;
}
-=item signature_addtomanifest_target
+=head3 realclean_subdirs_target
- my $target = $mm->signature_addtomanifest_target
+ my $make_frag = $MM->realclean_subdirs_target;
-Adds the META.yml file to the MANIFEST.
+Returns the realclean_subdirs target. This is used by the realclean
+target to call realclean on any subdirectories which contain Makefiles.
=cut
-sub signature_addtomanifest_target {
+sub realclean_subdirs_target {
my $self = shift;
- return <<'MAKE_FRAG' if !$self->{SIGN};
-signature_addtomanifest :
+ return <<'NOOP_FRAG' unless @{$self->{DIR}};
+realclean_subdirs :
$(NOECHO) $(NOOP)
-MAKE_FRAG
+NOOP_FRAG
- my $add_sign = $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']);
-eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) }
- or print "Could not add SIGNATURE to MANIFEST: $${'@'}\n"
+ my $rclean = "realclean_subdirs :\n";
+
+ foreach my $dir (@{$self->{DIR}}) {
+ foreach my $makefile ('$(MAKEFILE_OLD)', '$(FIRST_MAKEFILE)' ) {
+ my $subrclean .= $self->oneliner(sprintf <<'CODE', $dir, ($makefile) x 2);
+chdir '%s'; system '$(MAKE) $(USEMAKEFILE) %s realclean' if -f '%s';
CODE
- return sprintf <<'MAKE_FRAG', $add_sign;
-signature_addtomanifest :
- $(NOECHO) $(ECHO) Adding SIGNATURE to MANIFEST
- $(NOECHO) %s
-MAKE_FRAG
+ $rclean .= sprintf <<'RCLEAN', $subrclean;
+ - %s
+RCLEAN
-}
+ }
+ }
+ return $rclean;
+}
-=back
-=head2 Abstract methods
+=head3 signature_target
-Methods which cannot be made cross-platform and each subclass will
-have to do their own implementation.
+ my $target = $mm->signature_target;
-=over 4
+Generate the signature target.
-=item oneliner
+Writes the file SIGNATURE with "cpansign -s".
- my $oneliner = $MM->oneliner($perl_code);
- my $oneliner = $MM->oneliner($perl_code, \@switches);
+=cut
-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.
+sub signature_target {
+ my $self = shift;
-$(PERLRUN) will be used as perl.
+ return <<'MAKE_FRAG';
+signature :
+ cpansign -s
+MAKE_FRAG
-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
+
+=head3 distsignature_target
+
+ my $make_frag = $mm->distsignature_target;
+
+Generates the distsignature target to add SIGNATURE to the MANIFEST in the
+distdir.
+
+=cut
+
+sub distsignature_target {
+ my $self = shift;
+
+ my $add_sign = $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']);
+eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) }
+ or print "Could not add SIGNATURE to MANIFEST: $${'@'}\n"
CODE
-Usage might be something like:
+ my $sign_dist = $self->cd('$(DISTVNAME)' => 'cpansign -s');
- # an echo emulation
- $oneliner = $MM->oneliner('print "Foo\n"');
- $make = '$oneliner > somefile';
+ # cpansign -s complains if SIGNATURE is in the MANIFEST yet does not
+ # exist
+ my $touch_sig = $self->cd('$(DISTVNAME)' => '$(TOUCH) SIGNATURE');
+ my $add_sign_to_dist = $self->cd('$(DISTVNAME)' => $add_sign );
-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:
+ return sprintf <<'MAKE', $add_sign_to_dist, $touch_sig, $sign_dist
+distsignature : create_distdir
+ $(NOECHO) %s
+ $(NOECHO) %s
+ %s
- # Assign the value of the $(VERSION_FROM) make macro to $vf.
- $oneliner = $MM->oneliner('$$vf = "$(VERSION_FROM)"');
+MAKE
-Its currently very simple and may be expanded sometime in the figure
-to include more flexible code and switches.
+}
-=item B<quote_literal>
+=head3 special_targets
- my $safe_text = $MM->quote_literal($text);
+ my $make_frag = $mm->special_targets
-This will quote $text so it is interpreted literally in the shell.
+Returns a make fragment containing any targets which have special
+meaning to make. For example, .SUFFIXES and .PHONY.
-For example, on Unix this would escape any single-quotes in $text and
-put single-quotes around the whole thing.
+=cut
+sub special_targets {
+ my $make_frag = <<'MAKE_FRAG';
+.SUFFIXES : .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT)
-=item B<escape_newlines>
+.PHONY: all config static dynamic test linkext manifest blibdirs clean realclean disttest distdir
- my $escaped_text = $MM->escape_newlines($text);
+MAKE_FRAG
-Shell escapes newlines in $text.
+ $make_frag .= <<'MAKE_FRAG' if $ENV{CLEARCASE_ROOT};
+.NO_CONFIG_REC: Makefile
+MAKE_FRAG
-=item max_exec_len
+ return $make_frag;
+}
- 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>
+=head2 Init methods
+
+Methods which help initialize the MakeMaker object and macros.
+
+
+=head3 init_INST
+
+ $mm->init_INST;
+
+Called by init_main. Sets up all INST_* variables except those related
+to XS code. Those are handled in init_xs.
+
+=cut
+
+sub init_INST {
+ my($self) = shift;
+
+ $self->{INST_ARCHLIB} ||= $self->catdir($Curdir,"blib","arch");
+ $self->{INST_BIN} ||= $self->catdir($Curdir,'blib','bin');
+
+ # INST_LIB typically pre-set if building an extension after
+ # perl has been built and installed. Setting INST_LIB allows
+ # you to build directly into, say $Config{privlibexp}.
+ unless ($self->{INST_LIB}){
+ if ($self->{PERL_CORE}) {
+ if (defined $Cross::platform) {
+ $self->{INST_LIB} = $self->{INST_ARCHLIB} =
+ $self->catdir($self->{PERL_LIB},"..","xlib",
+ $Cross::platform);
+ }
+ else {
+ $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB};
+ }
+ } else {
+ $self->{INST_LIB} = $self->catdir($Curdir,"blib","lib");
+ }
+ }
+
+ my @parentdir = split(/::/, $self->{PARENT_NAME});
+ $self->{INST_LIBDIR} = $self->catdir('$(INST_LIB)', @parentdir);
+ $self->{INST_ARCHLIBDIR} = $self->catdir('$(INST_ARCHLIB)', @parentdir);
+ $self->{INST_AUTODIR} = $self->catdir('$(INST_LIB)', 'auto',
+ '$(FULLEXT)');
+ $self->{INST_ARCHAUTODIR} = $self->catdir('$(INST_ARCHLIB)', 'auto',
+ '$(FULLEXT)');
+
+ $self->{INST_SCRIPT} ||= $self->catdir($Curdir,'blib','script');
+
+ $self->{INST_MAN1DIR} ||= $self->catdir($Curdir,'blib','man1');
+ $self->{INST_MAN3DIR} ||= $self->catdir($Curdir,'blib','man3');
+
+ return 1;
+}
+
+
+=head3 init_INSTALL
+
+ $mm->init_INSTALL;
+
+Called by init_main. Sets up all INSTALL_* variables (except
+INSTALLDIRS) and *PREFIX.
+
+=cut
+
+sub init_INSTALL {
+ my($self) = shift;
+
+ if( $self->{ARGS}{INSTALLBASE} and $self->{ARGS}{PREFIX} ) {
+ die "Only one of PREFIX or INSTALLBASE can be given. Not both.\n";
+ }
+
+ if( $self->{ARGS}{INSTALLBASE} ) {
+ $self->init_INSTALL_from_INSTALLBASE;
+ }
+ else {
+ $self->init_INSTALL_from_PREFIX;
+ }
+}
+
+
+=head3 init_INSTALL_from_PREFIX
+
+ $mm->init_INSTALL_from_PREFIX;
+
+=cut
+
+sub init_INSTALL_from_PREFIX {
+ my $self = shift;
+
+ $self->init_lib2arch;
+
+ # There are often no Config.pm defaults for these new man variables so
+ # we fall back to the old behavior which is to use installman*dir
+ foreach my $num (1, 3) {
+ my $k = 'installsiteman'.$num.'dir';
+
+ $self->{uc $k} ||= uc "\$(installman${num}dir)"
+ unless $Config{$k};
+ }
+
+ foreach my $num (1, 3) {
+ my $k = 'installvendorman'.$num.'dir';
+
+ unless( $Config{$k} ) {
+ $self->{uc $k} ||= $Config{usevendorprefix}
+ ? uc "\$(installman${num}dir)"
+ : '';
+ }
+ }
+
+ $self->{INSTALLSITEBIN} ||= '$(INSTALLBIN)'
+ unless $Config{installsitebin};
+
+ unless( $Config{installvendorbin} ) {
+ $self->{INSTALLVENDORBIN} ||= $Config{usevendorprefix}
+ ? $Config{installbin}
+ : '';
+ }
+
+
+ my $iprefix = $Config{installprefixexp} || $Config{installprefix} ||
+ $Config{prefixexp} || $Config{prefix} || '';
+ my $vprefix = $Config{usevendorprefix} ? $Config{vendorprefixexp} : '';
+ my $sprefix = $Config{siteprefixexp} || '';
+
+ # 5.005_03 doesn't have a siteprefix.
+ $sprefix = $iprefix unless $sprefix;
+
+
+ $self->{PREFIX} ||= '';
+
+ if( $self->{PREFIX} ) {
+ @{$self}{qw(PERLPREFIX SITEPREFIX VENDORPREFIX)} =
+ ('$(PREFIX)') x 3;
+ }
+ else {
+ $self->{PERLPREFIX} ||= $iprefix;
+ $self->{SITEPREFIX} ||= $sprefix;
+ $self->{VENDORPREFIX} ||= $vprefix;
+
+ # Lots of MM extension authors like to use $(PREFIX) so we
+ # put something sensible in there no matter what.
+ $self->{PREFIX} = '$('.uc $self->{INSTALLDIRS}.'PREFIX)';
+ }
+
+ my $arch = $Config{archname};
+ my $version = $Config{version};
+
+ # default style
+ my $libstyle = $Config{installstyle} || 'lib/perl5';
+ my $manstyle = '';
+
+ if( $self->{LIBSTYLE} ) {
+ $libstyle = $self->{LIBSTYLE};
+ $manstyle = $self->{LIBSTYLE} eq 'lib/perl5' ? 'lib/perl5' : '';
+ }
+
+ # Some systems, like VOS, set installman*dir to '' if they can't
+ # read man pages.
+ for my $num (1, 3) {
+ $self->{'INSTALLMAN'.$num.'DIR'} ||= 'none'
+ unless $Config{'installman'.$num.'dir'};
+ }
+
+ my %bin_layouts =
+ (
+ bin => { s => $iprefix,
+ t => 'perl',
+ d => 'bin' },
+ vendorbin => { s => $vprefix,
+ t => 'vendor',
+ d => 'bin' },
+ sitebin => { s => $sprefix,
+ t => 'site',
+ d => 'bin' },
+ script => { s => $iprefix,
+ t => 'perl',
+ d => 'bin' },
+ );
+
+ my %man_layouts =
+ (
+ man1dir => { s => $iprefix,
+ t => 'perl',
+ d => 'man/man1',
+ style => $manstyle, },
+ siteman1dir => { s => $sprefix,
+ t => 'site',
+ d => 'man/man1',
+ style => $manstyle, },
+ vendorman1dir => { s => $vprefix,
+ t => 'vendor',
+ d => 'man/man1',
+ style => $manstyle, },
+
+ man3dir => { s => $iprefix,
+ t => 'perl',
+ d => 'man/man3',
+ style => $manstyle, },
+ siteman3dir => { s => $sprefix,
+ t => 'site',
+ d => 'man/man3',
+ style => $manstyle, },
+ vendorman3dir => { s => $vprefix,
+ t => 'vendor',
+ d => 'man/man3',
+ style => $manstyle, },
+ );
+
+ my %lib_layouts =
+ (
+ privlib => { s => $iprefix,
+ t => 'perl',
+ d => '',
+ style => $libstyle, },
+ vendorlib => { s => $vprefix,
+ t => 'vendor',
+ d => '',
+ style => $libstyle, },
+ sitelib => { s => $sprefix,
+ t => 'site',
+ d => 'site_perl',
+ style => $libstyle, },
+
+ archlib => { s => $iprefix,
+ t => 'perl',
+ d => "$version/$arch",
+ style => $libstyle },
+ vendorarch => { s => $vprefix,
+ t => 'vendor',
+ d => "$version/$arch",
+ style => $libstyle },
+ sitearch => { s => $sprefix,
+ t => 'site',
+ d => "site_perl/$version/$arch",
+ style => $libstyle },
+ );
+
+
+ # Special case for LIB.
+ if( $self->{LIB} ) {
+ foreach my $var (keys %lib_layouts) {
+ my $Installvar = uc "install$var";
+
+ if( $var =~ /arch/ ) {
+ $self->{$Installvar} ||=
+ $self->catdir($self->{LIB}, $Config{archname});
+ }
+ else {
+ $self->{$Installvar} ||= $self->{LIB};
+ }
+ }
+ }
+
+ my %type2prefix = ( perl => 'PERLPREFIX',
+ site => 'SITEPREFIX',
+ vendor => 'VENDORPREFIX'
+ );
+
+ my %layouts = (%bin_layouts, %man_layouts, %lib_layouts);
+ while( my($var, $layout) = each(%layouts) ) {
+ my($s, $t, $d, $style) = @{$layout}{qw(s t d style)};
+ my $r = '$('.$type2prefix{$t}.')';
+
+ print STDERR "Prefixing $var\n" if $Verbose >= 2;
+
+ my $installvar = "install$var";
+ my $Installvar = uc $installvar;
+ next if $self->{$Installvar};
+
+ $d = "$style/$d" if $style;
+ $self->prefixify($installvar, $s, $r, $d);
+
+ print STDERR " $Installvar == $self->{$Installvar}\n"
+ if $Verbose >= 2;
+ }
+
+ # Generate these if they weren't figured out.
+ $self->{VENDORARCHEXP} ||= $self->{INSTALLVENDORARCH};
+ $self->{VENDORLIBEXP} ||= $self->{INSTALLVENDORLIB};
+
+ return 1;
+}
+
+
+=head3 init_from_INSTALLBASE
+
+ $mm->init_from_INSTALLBASE
+
+=cut
+
+my %map = (
+ lib => [qw(lib perl5)],
+ arch => [('lib', 'perl5', $Config{archname})],
+ bin => [qw(bin)],
+ man1dir => [qw(man man1)],
+ man3dir => [qw(man man3)]
+ );
+$map{script} = $map{bin};
+
+sub init_INSTALL_from_INSTALLBASE {
+ my $self = shift;
+
+ @{$self}{qw(PREFIX VENDORPREFIX SITEPREFIX PERLPREFIX)} =
+ '$(INSTALLBASE)';
+
+ my %install;
+ foreach my $thing (keys %map) {
+ foreach my $dir (('', 'SITE', 'VENDOR')) {
+ my $uc_thing = uc $thing;
+ my $key = "INSTALL".$dir.$uc_thing;
+
+ $install{$key} ||=
+ $self->catdir('$(INSTALLBASE)', @{$map{$thing}});
+ }
+ }
+
+ # Adjust for variable quirks.
+ $install{INSTALLARCHLIB} ||= delete $install{INSTALLARCH};
+ $install{INSTALLPRIVLIB} ||= delete $install{INSTALLLIB};
+ delete @install{qw(INSTALLVENDORSCRIPT INSTALLSITESCRIPT)};
+
+ foreach my $key (keys %install) {
+ $self->{$key} ||= $install{$key};
+ }
+
+ return 1;
+}
+
+
+=head3 init_VERSION I<Abstract>
+
+ $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)\"';
+
+}
+
+
+=head3 init_others I<Abstract>
$MM->init_others();
UMASK_NULL Nullify umask
DEV_NULL Supress all command output
-=item init_DIRFILESEP
+
+=head3 init_DIRFILESEP I<Abstract>
$MM->init_DIRFILESEP;
my $dirfilesep = $MM->{DIRFILESEP};
systems use different seperators between subdirectories as between
directories and filenames (for example: VOLUME:[dir1.dir2]file on VMS).
-=item init_linker
+=head3 init_linker I<Abstract>
$mm->init_linker;
Some OSes do not need these in which case leave it blank.
-=item init_platform
+=head3 init_platform
$mm->init_platform
A typical one is the version number of your OS specific mocule.
(ie. MM_Unix_VERSION or MM_VMS_VERSION).
-=item platform_constants
+=cut
- my $make_frag = $mm->platform_constants
+sub init_platform {
+ return '';
+}
-Returns a make fragment defining all the macros initialized in
-init_platform() rather than put them in constants().
+
+
+
+
+=head2 Tools
+
+A grab bag of methods to generate specific macros and commands.
+
+
+
+=head3 manifypods
+
+Defines targets and routines to translate the pods into manpages and
+put them into the INST_* directories.
=cut
-sub init_platform {
- return '';
+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
+
}
-sub platform_constants {
- return '';
+
+=head3 POD2MAN_macro
+
+ my $pod2man_macro = $self->POD2MAN_macro
+
+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
}
-=item os_flavor
- my @os_flavor = $mm->os_flavor;
+=head3 test_via_harness
-@os_flavor is the style of operating system this is, usually
-corresponding to the MM_*.pm file we're using.
+ my $command = $mm->test_via_harness($perl, $tests);
-The first element of @os_flavor is the major family (ie. Unix,
-Windows, VMS, OS/2, etc...) and the rest are sub families.
+Returns a $command line which runs the given set of $tests with
+Test::Harness and the given $perl.
-Some examples:
+Used on the t/*.t files.
- Cygwin98 ('Unix', 'Cygwin', 'Cygwin9x')
- Windows NT ('Win32', 'WinNT')
- Win98 ('Win32', 'Win9x')
- Linux ('Unix', 'Linux')
- MacOS X ('Unix', 'Darwin', 'MacOS', 'MacOS X')
- OS/2 ('OS/2')
+=cut
-This is used to write code for styles of operating system.
-See os_flavor_is() for use.
+sub test_via_harness {
+ my($self, $perl, $tests) = @_;
+
+ return qq{\t$perl "-MExtUtils::Command::MM" }.
+ qq{"-e" "test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $tests\n};
+}
+
+=head3 test_via_script
+
+ my $command = $mm->test_via_script($perl, $script);
+
+Returns a $command line which just runs a single test without
+Test::Harness. No checks are done on the results, they're just
+printed.
+Used for test.pl, since they don't always follow Test::Harness
+formatting.
+
+=cut
+
+sub test_via_script {
+ my($self, $perl, $script) = @_;
+ return qq{\t$perl "-I\$(INST_LIB)" "-I\$(INST_ARCHLIB)" $script\n};
+}
+
+
+=head3 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
+
+}
+
+
+
+
+=head2 File::Spec wrappers
+
+ExtUtils::MM_Any is a subclass of File::Spec. The methods noted here
+override File::Spec.
+
+
+
+=head3 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 {
+ my $self = shift;
+ return $self->canonpath($self->SUPER::catfile(@_));
+}
+
+
+
+=head2 Misc
+
+Methods I can't really figure out where they should go yet.
+
+
+=head3 find_tests
+
+ my $test = $mm->find_tests;
+
+Returns a string suitable for feeding to the shell to return all
+tests in t/*.t.
+
+=cut
+
+sub find_tests {
+ my($self) = shift;
+ return -d 't' ? 't/*.t' : '';
+}
+
+
+=head3 extra_clean_files
+
+ my @files_to_clean = $MM->extra_clean_files;
+
+Returns a list of OS specific files to be removed in the clean target in
+addition to the usual set.
+
+=cut
+
+# An empty method here tickled a perl 5.8.1 bug and would return its object.
+sub extra_clean_files {
+ return;
+}
+
+
+=head3 installvars
+
+ my @installvars = $mm->installvars;
+
+A list of all the INSTALL* variables without the INSTALL prefix. Useful
+for iteration or building related variable sets.
+
+=cut
+
+sub installvars {
+ return qw(PRIVLIB SITELIB VENDORLIB
+ ARCHLIB SITEARCH VENDORARCH
+ BIN SITEBIN VENDORBIN
+ SCRIPT
+ MAN1DIR SITEMAN1DIR VENDORMAN1DIR
+ MAN3DIR SITEMAN3DIR VENDORMAN3DIR
+ );
+}
+
+
+=head3 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 version control administrative directories from
+installation.
+
+=cut
+
+sub libscan {
+ my($self,$path) = @_;
+ my($dirs,$file) = ($self->splitpath($path))[1,2];
+ return '' if grep /^(?:RCS|CVS|SCCS|\.svn|_darcs)$/,
+ $self->splitdir($dirs), $file;
+
+ return $path;
+}
+
+
+=head3 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 platform_constants {
+ return '';
+}
-=back
=head1 AUTHOR
=cut
-use Config;
+use ExtUtils::MakeMaker::Config;
use File::Spec;
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
use vars qw(@ISA $VERSION);
@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
-$VERSION = 1.04;
+$VERSION = '1.05';
-=item os_flavor (o)
+=item os_flavor
BeOS is BeOS.
use strict;
use vars qw($VERSION @ISA);
-use Config;
+use ExtUtils::MakeMaker::Config;
use File::Spec;
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
-$VERSION = 1.07;
+$VERSION = '1.08';
=head1 NAME
=over 4
-=item os_flavor (o)
+=item os_flavor
We're Unix and Cygwin.
return('Unix', 'Cygwin');
}
-=item cflags (o)
+=item cflags
if configured for dynamic loading, triggers #define EXT in EXTERN.h
}
-=item replace_manpage_separator (o)
+=item replace_manpage_separator
replaces strings '::' with '.' in MAN*POD man page names
=cut
use strict;
-use Config;
+use ExtUtils::MakeMaker::Config;
use File::Basename;
use vars qw(@ISA $VERSION);
-$VERSION = '2.07';
+$VERSION = '2.08';
require ExtUtils::MM_Win32;
@ISA = qw(ExtUtils::MM_Win32);
return ($self->SUPER::os_flavor, 'Netware');
}
-=item init_platform (o)
+=item init_platform
Add Netware macros.
}
-=item const_cccmd (o)
+=item const_cccmd
=cut
}
-=item static_lib (o)
+=item static_lib
=cut
return '' unless $self->has_link_code;
my $m = <<'END';
-$(INST_STATIC): $(OBJECT) $(MYEXTLIB) blibdirs.ts
+$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(RM_RF) $@
END
return $m;
}
-=item dynamic_lib (o)
+=item dynamic_lib
Defines how to produce the *.so (or equivalent) files.
INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
# Create xdc data for an MT safe NLM in case of mpk build
-$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP)
+$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(NOECHO) $(ECHO) Export boot_$(BOOT_SYMBOL) > $(BASEEXT).def
$(NOECHO) $(ECHO) $(BASE_IMPORT) >> $(BASEEXT).def
$(NOECHO) $(ECHO) Import @$(PERL_INC)\perl.imp >> $(BASEEXT).def
use ExtUtils::MakeMaker qw(neatvalue);
use File::Spec;
-$VERSION = '1.04';
+$VERSION = '1.05';
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
=over 4
-=item init_dist (o)
+=item init_dist
Define TO_UNIX to convert OS2 linefeeds to Unix style.
--- /dev/null
+package ExtUtils::MM_QNX;
+
+use strict;
+use vars qw($VERSION @ISA);
+$VERSION = '0.02';
+
+require ExtUtils::MM_Unix;
+@ISA = qw(ExtUtils::MM_Unix);
+
+
+=head1 NAME
+
+ExtUtils::MM_QNX - QNX specific subclass of ExtUtils::MM_Unix
+
+=head1 SYNOPSIS
+
+ Don't use this module directly.
+ Use ExtUtils::MM and let it choose.
+
+=head1 DESCRIPTION
+
+This is a subclass of ExtUtils::MM_Unix which contains functionality for
+QNX.
+
+Unless otherwise stated it works just like ExtUtils::MM_Unix
+
+=head2 Overridden methods
+
+=head3 extra_clean_files
+
+Add .err files corresponding to each .c file.
+
+=cut
+
+sub extra_clean_files {
+ my $self = shift;
+
+ my @errfiles = @{$self->{C}};
+ for ( @errfiles ) {
+ s/.c$/.err/;
+ }
+
+ return( @errfiles, 'perlmain.err' );
+}
+
+
+=head1 AUTHOR
+
+Michael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix
+
+=head1 SEE ALSO
+
+L<ExtUtils::MakeMaker>
+
+=cut
+
+
+1;
use Exporter ();
use Carp;
-use Config qw(%Config);
+use ExtUtils::MakeMaker::Config;
use File::Basename qw(basename dirname);
use DirHandle;
use vars qw($VERSION @ISA
- $Is_OS2 $Is_VMS $Is_Win32 $Is_Win95 $Is_Dos $Is_VOS
- $Is_QNX $Is_AIX $Is_OSF $Is_IRIX $Is_NetBSD $Is_BSD
+ $Is_OS2 $Is_VMS $Is_Win32 $Is_Dos
+ $Is_OSF $Is_IRIX $Is_NetBSD $Is_BSD
$Is_SunOS4 $Is_Solaris $Is_SunOS $Is_Interix
$Verbose %pm
%Config_Override
use ExtUtils::MakeMaker qw($Verbose neatvalue);
-$VERSION = '1.46_01';
+$VERSION = '1.48';
require ExtUtils::MM_Any;
@ISA = qw(ExtUtils::MM_Any);
-$Is_OS2 = $^O eq 'os2';
-$Is_Win32 = $^O eq 'MSWin32' || $Config{osname} eq 'NetWare';
-$Is_Win95 = $Is_Win32 && Win32::IsWin95();
-$Is_Dos = $^O eq 'dos';
-$Is_VOS = $^O eq 'vos';
-$Is_VMS = $^O eq 'VMS';
-$Is_QNX = $^O eq 'qnx';
-$Is_AIX = $^O eq 'aix';
-$Is_OSF = $^O eq 'dec_osf';
-$Is_IRIX = $^O eq 'irix';
-$Is_NetBSD = $^O eq 'netbsd';
-$Is_Interix = $^O eq 'interix';
-$Is_SunOS4 = $^O eq 'sunos';
-$Is_Solaris = $^O eq 'solaris';
-$Is_SunOS = $Is_SunOS4 || $Is_Solaris;
-$Is_BSD = $^O =~ /^(?:free|net|open)bsd|bsdos|interix$/;
+BEGIN {
+ $Is_OS2 = $^O eq 'os2';
+ $Is_Win32 = $^O eq 'MSWin32' || $Config{osname} eq 'NetWare';
+ $Is_Dos = $^O eq 'dos';
+ $Is_VMS = $^O eq 'VMS';
+ $Is_OSF = $^O eq 'dec_osf';
+ $Is_IRIX = $^O eq 'irix';
+ $Is_NetBSD = $^O eq 'netbsd';
+ $Is_Interix = $^O eq 'interix';
+ $Is_SunOS4 = $^O eq 'sunos';
+ $Is_Solaris = $^O eq 'solaris';
+ $Is_SunOS = $Is_SunOS4 || $Is_Solaris;
+ $Is_BSD = $^O =~ /^(?:free|net|open)bsd$/ or
+ $^O eq 'bsdos' or $^O eq 'interix';
+}
+
+BEGIN {
+ if( $Is_VMS ) {
+ # For things like vmsify()
+ require VMS::Filespec;
+ VMS::Filespec->import;
+ }
+}
=head1 NAME
Not all of the methods below are overridable in a
Makefile.PL. Overridable methods are marked as (o). All methods are
-overridable by a platform specific MM_*.pm file (See
-L<ExtUtils::MM_VMS>) and L<ExtUtils::MM_OS2>).
+overridable by a platform specific MM_*.pm file.
+
+Cross-platform methods are being moved into MM_Any. If you can't find
+something that used to be in here, look in MM_Any.
=cut
=over 4
-=item os_flavor (o)
+=item os_flavor
Simply says that we're Unix.
}
-=item clean (o)
-
-Defines the clean target.
-
-=cut
-
-sub clean {
-# --- Cleanup and Distribution Sections ---
-
- my($self, %attribs) = @_;
- my(@m,$dir);
- push(@m, '
-# 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_subdirs
-');
-
- my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
- if ( $Is_QNX ) {
- my @errfiles = @{$self->{C}};
- for ( @errfiles ) {
- s/.c$/.err/;
- }
- push( @otherfiles, @errfiles, 'perlmain.err' );
- }
- push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
- push(@otherfiles, qw[./blib $(MAKE_APERL_FILE)
- $(INST_ARCHAUTODIR)/extralibs.all
- $(INST_ARCHAUTODIR)/extralibs.ld
- perlmain.c tmon.out mon.out so_locations
- blibdirs.ts pm_to_blib.ts
- *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT)
- $(BOOTSTRAP) $(BASEEXT).bso
- $(BASEEXT).def lib$(BASEEXT).def
- $(BASEEXT).exp $(BASEEXT).x
- ]);
- if( $Is_VOS ) {
- push(@otherfiles, qw[*.kp]);
- }
- else {
- push(@otherfiles, qw[core core.*perl.*.? *perl.core]);
-
- # core.\d+
- push(@otherfiles, map { "core." . "[0-9]"x$_ } (1..5));
- }
-
- push @m, "\t-\$(RM_RF) @otherfiles\n";
- # See realclean and ext/utils/make_ext for usage of Makefile.old
- push(@m,
- "\t-\$(MV) \$(FIRST_MAKEFILE) \$(MAKEFILE_OLD) \$(DEV_NULL)\n");
- push(@m,
- "\t$attribs{POSTOP}\n") if $attribs{POSTOP};
- join("", @m);
-}
-
-
-=item clean_subdirs_target
-
- my $make_frag = $MM->clean_subdirs_target;
-
-Returns the clean_subdirs target. This is used by the clean target to
-call clean on any subdirectories which contain Makefiles.
-
-=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
-MAKE_FRAG
- }
-
- return $clean;
-}
-
=item const_cccmd (o)
my($self) = @_;
my @m = ();
+ $self->{DFSEP} = '$(DIRFILESEP)'; # alias for internal use
+
for my $macro (qw(
- AR_STATIC_ARGS DIRFILESEP
+ AR_STATIC_ARGS DIRFILESEP DFSEP
NAME NAME_SYM
VERSION VERSION_MACRO VERSION_SYM DEFINE_VERSION
XS_VERSION XS_VERSION_MACRO XS_DEFINE_VERSION
INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB
INST_MAN1DIR INST_MAN3DIR
MAN1EXT MAN3EXT
- INSTALLDIRS
- DESTDIR PREFIX
+ INSTALLDIRS INSTALLBASE DESTDIR PREFIX
PERLPREFIX SITEPREFIX VENDORPREFIX
),
(map { ("INSTALL".$_,
};
for my $macro (qw/
+ MAKE
FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
- LDFROM LINKTYPE PM_FILTER
+ LDFROM LINKTYPE BOOTDEP
/ )
{
next unless defined $self->{$macro};
push @m, q{
# Where is the Config information that we are using/depend on
-CONFIGDEP = $(PERL_ARCHLIB)$(DIRFILESEP)Config.pm $(PERL_INC)$(DIRFILESEP)config.h
+CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h
};
MAKE_FRAG
}
-=item distdir
-
-Defines the scratch directory target that will hold the distribution
-before tar-ing (or shar-ing).
-
-=cut
-
-# For backwards compatibility.
-*dist_dir = *distdir;
-
-sub distdir {
- my($self) = shift;
-
- return <<'MAKE_FRAG';
-distdir : metafile metafile_addtomanifest signature
- $(RM_RF) $(DISTVNAME)
- $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
- -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
-
-MAKE_FRAG
-
-}
-
-=item dist_test
-
-Defines a target that produces the distribution in the
-scratchdirectory, and runs 'perl Makefile.PL; make ;make test' in that
-subdirectory.
-
-=cut
-
-sub dist_test {
- my($self) = shift;
- my @m;
- push @m, q{
-disttest : distdir
- cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL
- cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
- cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)
-};
- join "", @m;
-}
=item dlsyms (o)
-Used by AIX and VMS to define DL_FUNCS and DL_VARS and write the *.exp
-files.
+Used by some OS' to define DL_FUNCS and DL_VARS and write the *.exp files.
+
+Normally just returns an empty string.
=cut
sub dlsyms {
- my($self,%attribs) = @_;
-
- return '' unless ($Is_AIX && $self->needs_linking() );
-
- my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
- my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
- my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
- my(@m);
-
- push(@m,"
-dynamic :: $self->{BASEEXT}.exp
-
-") unless $self->{SKIPHASH}{'dynamic'}; # dynamic and static are subs, so...
-
- push(@m,"
-static :: $self->{BASEEXT}.exp
-
-") unless $self->{SKIPHASH}{'static'}; # we avoid a warning if we tick them
-
- push(@m,"
-$self->{BASEEXT}.exp: Makefile.PL
-",' $(PERLRUN) -e \'use ExtUtils::Mksymlists; \\
- Mksymlists("NAME" => "',$self->{NAME},'", "DL_FUNCS" => ',
- neatvalue($funcs), ', "FUNCLIST" => ', neatvalue($funclist),
- ', "DL_VARS" => ', neatvalue($vars), ');\'
-');
-
- join('',@m);
+ return '';
}
-=item dynamic (o)
-
-Defines the dynamic target.
-
-=cut
-
-sub dynamic {
-# --- Dynamic Loading Sections ---
-
- my($self) = shift;
- '
-dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT)
- $(NOECHO) $(NOOP)
-';
-}
=item dynamic_bs (o)
BOOTSTRAP =
' unless $self->has_link_code();
- return <<'MAKE_FRAG';
+ my $target = $Is_VMS ? '$(MMS$TARGET)' : '$@';
+
+ return sprintf <<'MAKE_FRAG', ($target) x 5;
BOOTSTRAP = $(BASEEXT).bs
# As Mkbootstrap might not write a file (if none is required)
# we use touch to prevent make continually trying to remake it.
# The DynaLoader only reads a non-empty file.
-$(BOOTSTRAP): $(FIRST_MAKEFILE) $(BOOTDEP) blibdirs.ts
+$(BOOTSTRAP) : $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(NOECHO) $(ECHO) "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
$(NOECHO) $(PERLRUN) \
"-MExtUtils::Mkbootstrap" \
-e "Mkbootstrap('$(BASEEXT)','$(BSLOADLIBS)');"
- $(NOECHO) $(TOUCH) $@
- $(CHMOD) $(PERM_RW) $@
+ $(NOECHO) $(TOUCH) %s
+ $(CHMOD) $(PERM_RW) %s
-$(INST_BOOT): $(BOOTSTRAP) blibdirs.ts
- $(NOECHO) $(RM_RF) $@
- -$(CP) $(BOOTSTRAP) $@
- $(CHMOD) $(PERM_RW) $@
+$(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists
+ $(NOECHO) $(RM_RF) %s
+ - $(CP) $(BOOTSTRAP) %s
+ $(CHMOD) $(PERM_RW) %s
MAKE_FRAG
}
INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
INST_DYNAMIC_FIX = '.$ld_fix.'
-$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) blibdirs.ts $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
+$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
');
if ($armaybe ne ':'){
$ldfrom = 'tmp$(LIB_EXT)';
0; # false and not empty
}
-=item find_tests
-
- my $test = $mm->find_tests;
-
-Returns a string suitable for feeding to the shell to return all
-tests in t/*.t.
-
-=cut
-
-sub find_tests {
- my($self) = shift;
- return 't/*.t';
-}
-
-=back
-
-=head2 Methods to actually produce chunks of text for the Makefile
-
-The methods here are called for each MakeMaker object in the order
-specified by @ExtUtils::MakeMaker::MM_Sections.
-
-=over 2
=item fixin
chmod 0666, $file_bak;
unlink $file_bak;
- unless ( rename($file, $file_bak) ) {
+ unless ( _rename($file, $file_bak) ) {
warn "Can't rename $file to $file_bak: $!";
next;
}
- unless ( rename($file_new, $file) ) {
+ unless ( _rename($file_new, $file) ) {
warn "Can't rename $file_new to $file: $!";
- unless ( rename($file_bak, $file) ) {
+ unless ( _rename($file_bak, $file) ) {
warn "Can't rename $file_bak back to $file either: $!";
warn "Leaving $file renamed as $file_bak\n";
}
}
}
+
+sub _rename {
+ my($old, $new) = @_;
+
+ foreach my $file ($old, $new) {
+ if( $Is_VMS and basename($file) !~ /\./ ) {
+ # rename() in 5.8.0 on VMS will not rename a file if it
+ # does not contain a dot yet it returns success.
+ $file = "$file.";
+ }
+ }
+
+ return rename($old, $new);
+}
+
+
=item force (o)
-Just writes FORCE:
+Writes an empty FORCE: target.
=cut
$self->{NOOP} ||= '$(SHELL) -c true';
$self->{NOECHO} = '@' unless defined $self->{NOECHO};
- $self->{FIRST_MAKEFILE} ||= 'Makefile';
+ $self->{FIRST_MAKEFILE} ||= $self->{MAKEFILE} || 'Makefile';
$self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
$self->{MAKEFILE_OLD} ||= $self->{MAKEFILE}.'.old';
$self->{MAKE_APERL_FILE} ||= $self->{MAKEFILE}.'.aperl';
+ # Some makes require a wrapper around macros passed in on the command
+ # line.
+ $self->{MACROSTART} ||= '';
+ $self->{MACROEND} ||= '';
+
+ # Not everybody uses -f to indicate "use this Makefile instead"
+ $self->{USEMAKEFILE} ||= '-f';
+
$self->{SHELL} ||= $Config{sh} || '/bin/sh';
$self->{ECHO} ||= 'echo';
$self->oneliner(<<'CODE', ['-MExtUtils::Install']);
install({@ARGV}, '$(VERBINST)', 0, '$(UNINST)');
CODE
- $self->{DOC_INSTALL} ||=
+ $self->{DOC_INSTALL} ||=
'$(ABSPERLRUN) "-MExtUtils::Command::MM" -e perllocal_install';
- $self->{UNINSTALL} ||=
+ $self->{UNINSTALL} ||=
'$(ABSPERLRUN) "-MExtUtils::Command::MM" -e uninstall';
$self->{WARN_IF_OLD_PACKLIST} ||=
'$(ABSPERLRUN) "-MExtUtils::Command::MM" -e warn_if_old_packlist';
+ $self->{FIXIN} ||=
+ q{$(PERLRUN) "-MExtUtils::MY" -e "MY->fixin(shift)"};
$self->{UMASK_NULL} ||= "umask 0";
$self->{DEV_NULL} ||= "> /dev/null 2>&1";
return 1;
}
-=item init_INST
-
- $mm->init_INST;
-
-Called by init_main. Sets up all INST_* variables except those related
-to XS code. Those are handled in init_xs.
-
-=cut
-
-sub init_INST {
- my($self) = shift;
-
- $self->{INST_ARCHLIB} ||= $self->catdir($Curdir,"blib","arch");
- $self->{INST_BIN} ||= $self->catdir($Curdir,'blib','bin');
-
- # INST_LIB typically pre-set if building an extension after
- # perl has been built and installed. Setting INST_LIB allows
- # you to build directly into, say $Config{privlibexp}.
- unless ($self->{INST_LIB}){
- if ($self->{PERL_CORE}) {
- if (defined $Cross::platform) {
- $self->{INST_LIB} = $self->{INST_ARCHLIB} =
- $self->catdir($self->{PERL_LIB},"..","xlib",
- $Cross::platform);
- }
- else {
- $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB};
- }
- } else {
- $self->{INST_LIB} = $self->catdir($Curdir,"blib","lib");
- }
- }
-
- my @parentdir = split(/::/, $self->{PARENT_NAME});
- $self->{INST_LIBDIR} = $self->catdir('$(INST_LIB)', @parentdir);
- $self->{INST_ARCHLIBDIR} = $self->catdir('$(INST_ARCHLIB)', @parentdir);
- $self->{INST_AUTODIR} = $self->catdir('$(INST_LIB)', 'auto',
- '$(FULLEXT)');
- $self->{INST_ARCHAUTODIR} = $self->catdir('$(INST_ARCHLIB)', 'auto',
- '$(FULLEXT)');
-
- $self->{INST_SCRIPT} ||= $self->catdir($Curdir,'blib','script');
-
- $self->{INST_MAN1DIR} ||= $self->catdir($Curdir,'blib','man1');
- $self->{INST_MAN3DIR} ||= $self->catdir($Curdir,'blib','man3');
-
- return 1;
-}
-
-=item init_INSTALL
-
- $mm->init_INSTALL;
-
-Called by init_main. Sets up all INSTALL_* variables (except
-INSTALLDIRS) and *PREFIX.
-
-=cut
-
-sub init_INSTALL {
- my($self) = shift;
-
- $self->init_lib2arch;
-
- # There are often no Config.pm defaults for these new man variables so
- # we fall back to the old behavior which is to use installman*dir
- foreach my $num (1, 3) {
- my $k = 'installsiteman'.$num.'dir';
-
- $self->{uc $k} ||= uc "\$(installman${num}dir)"
- unless $Config{$k};
- }
-
- foreach my $num (1, 3) {
- my $k = 'installvendorman'.$num.'dir';
-
- unless( $Config{$k} ) {
- $self->{uc $k} ||= $Config{usevendorprefix}
- ? uc "\$(installman${num}dir)"
- : '';
- }
- }
-
- $self->{INSTALLSITEBIN} ||= '$(INSTALLBIN)'
- unless $Config{installsitebin};
-
- unless( $Config{installvendorbin} ) {
- $self->{INSTALLVENDORBIN} ||= $Config{usevendorprefix}
- ? $Config{installbin}
- : '';
- }
-
-
- my $iprefix = $Config{installprefixexp} || $Config{installprefix} ||
- $Config{prefixexp} || $Config{prefix} || '';
- my $vprefix = $Config{usevendorprefix} ? $Config{vendorprefixexp} : '';
- my $sprefix = $Config{siteprefixexp} || '';
-
- # 5.005_03 doesn't have a siteprefix.
- $sprefix = $iprefix unless $sprefix;
-
-
- $self->{PREFIX} ||= '';
-
- if( $self->{PREFIX} ) {
- @{$self}{qw(PERLPREFIX SITEPREFIX VENDORPREFIX)} =
- ('$(PREFIX)') x 3;
- }
- else {
- $self->{PERLPREFIX} ||= $iprefix;
- $self->{SITEPREFIX} ||= $sprefix;
- $self->{VENDORPREFIX} ||= $vprefix;
-
- # Lots of MM extension authors like to use $(PREFIX) so we
- # put something sensible in there no matter what.
- $self->{PREFIX} = '$('.uc $self->{INSTALLDIRS}.'PREFIX)';
- }
-
- my $arch = $Config{archname};
- my $version = $Config{version};
-
- # default style
- my $libstyle = $Config{installstyle} || 'lib/perl5';
- my $manstyle = '';
-
- if( $self->{LIBSTYLE} ) {
- $libstyle = $self->{LIBSTYLE};
- $manstyle = $self->{LIBSTYLE} eq 'lib/perl5' ? 'lib/perl5' : '';
- }
-
- # Some systems, like VOS, set installman*dir to '' if they can't
- # read man pages.
- for my $num (1, 3) {
- $self->{'INSTALLMAN'.$num.'DIR'} ||= 'none'
- unless $Config{'installman'.$num.'dir'};
- }
-
- my %bin_layouts =
- (
- bin => { s => $iprefix,
- t => 'perl',
- d => 'bin' },
- vendorbin => { s => $vprefix,
- t => 'vendor',
- d => 'bin' },
- sitebin => { s => $sprefix,
- t => 'site',
- d => 'bin' },
- script => { s => $iprefix,
- t => 'perl',
- d => 'bin' },
- );
-
- my %man_layouts =
- (
- man1dir => { s => $iprefix,
- t => 'perl',
- d => 'man/man1',
- style => $manstyle, },
- siteman1dir => { s => $sprefix,
- t => 'site',
- d => 'man/man1',
- style => $manstyle, },
- vendorman1dir => { s => $vprefix,
- t => 'vendor',
- d => 'man/man1',
- style => $manstyle, },
-
- man3dir => { s => $iprefix,
- t => 'perl',
- d => 'man/man3',
- style => $manstyle, },
- siteman3dir => { s => $sprefix,
- t => 'site',
- d => 'man/man3',
- style => $manstyle, },
- vendorman3dir => { s => $vprefix,
- t => 'vendor',
- d => 'man/man3',
- style => $manstyle, },
- );
-
- my %lib_layouts =
- (
- privlib => { s => $iprefix,
- t => 'perl',
- d => '',
- style => $libstyle, },
- vendorlib => { s => $vprefix,
- t => 'vendor',
- d => '',
- style => $libstyle, },
- sitelib => { s => $sprefix,
- t => 'site',
- d => 'site_perl',
- style => $libstyle, },
-
- archlib => { s => $iprefix,
- t => 'perl',
- d => "$version/$arch",
- style => $libstyle },
- vendorarch => { s => $vprefix,
- t => 'vendor',
- d => "$version/$arch",
- style => $libstyle },
- sitearch => { s => $sprefix,
- t => 'site',
- d => "site_perl/$version/$arch",
- style => $libstyle },
- );
-
-
- # Special case for LIB.
- if( $self->{LIB} ) {
- foreach my $var (keys %lib_layouts) {
- my $Installvar = uc "install$var";
-
- if( $var =~ /arch/ ) {
- $self->{$Installvar} ||=
- $self->catdir($self->{LIB}, $Config{archname});
- }
- else {
- $self->{$Installvar} ||= $self->{LIB};
- }
- }
- }
-
- my %type2prefix = ( perl => 'PERLPREFIX',
- site => 'SITEPREFIX',
- vendor => 'VENDORPREFIX'
- );
-
- my %layouts = (%bin_layouts, %man_layouts, %lib_layouts);
- while( my($var, $layout) = each(%layouts) ) {
- my($s, $t, $d, $style) = @{$layout}{qw(s t d style)};
- my $r = '$('.$type2prefix{$t}.')';
-
- print STDERR "Prefixing $var\n" if $Verbose >= 2;
-
- my $installvar = "install$var";
- my $Installvar = uc $installvar;
- next if $self->{$Installvar};
-
- $d = "$style/$d" if $style;
- $self->prefixify($installvar, $s, $r, $d);
-
- print STDERR " $Installvar == $self->{$Installvar}\n"
- if $Verbose >= 2;
- }
-
- # Generate these if they weren't figured out.
- $self->{VENDORARCHEXP} ||= $self->{INSTALLVENDORARCH};
- $self->{VENDORLIBEXP} ||= $self->{INSTALLVENDORLIB};
-
- return 1;
-}
=item init_linker
}
-=item init_platform (o)
+=item init_platform
-Add MM_Unix_VERSION.
+=item platform_constants
-=item platform_constants (o)
+Add MM_Unix_VERSION.
=cut
push @m, q{
install :: all pure_install doc_install
+ $(NOECHO) $(NOOP)
install_perl :: all pure_perl_install doc_perl_install
+ $(NOECHO) $(NOOP)
install_site :: all pure_site_install doc_site_install
+ $(NOECHO) $(NOOP)
install_vendor :: all pure_vendor_install doc_vendor_install
+ $(NOECHO) $(NOOP)
pure_install :: pure_$(INSTALLDIRS)_install
+ $(NOECHO) $(NOOP)
doc_install :: doc_$(INSTALLDIRS)_install
+ $(NOECHO) $(NOOP)
pure__install : pure_site_install
$(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
push @m, q{
uninstall :: uninstall_from_$(INSTALLDIRS)dirs
+ $(NOECHO) $(NOOP)
uninstall_from_perldirs ::
$(NOECHO) $(UNINSTALL) }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{
sub installbin {
my($self) = shift;
+
return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
- return "" unless @{$self->{EXE_FILES}};
- my(@m, $from, $to, %fromto, @to);
- for $from (@{$self->{EXE_FILES}}) {
+ my @exefiles = @{$self->{EXE_FILES}};
+ return "" unless @exefiles;
+
+ @exefiles = map vmsify($_), @exefiles if $Is_VMS;
+
+ my %fromto;
+ for my $from (@exefiles) {
my($path)= $self->catfile('$(INST_SCRIPT)', basename($from));
+
local($_) = $path; # for backwards compatibility
- $to = $self->libscan($path);
+ my $to = $self->libscan($path);
print "libscan($from) => '$to'\n" if ($Verbose >=2);
- $fromto{$from}=$to;
- }
- @to = values %fromto;
- my $fixin;
- if( $Is_Win32 ) {
- $fixin = $self->{PERL_CORE} ? '$(PERLRUN) ../../win32/bin/pl2bat.pl'
- : 'pl2bat.bat';
- }
- else {
- $fixin = q{$(PERLRUN) "-MExtUtils::MY" -e "MY->fixin(shift)"};
+ $to = vmsify($to) if $Is_VMS;
+ $fromto{$from} = $to;
}
+ my @to = values %fromto;
+ my @m;
push(@m, qq{
-EXE_FILES = @{$self->{EXE_FILES}}
-
-FIXIN = $fixin
+EXE_FILES = @exefiles
pure_all :: @to
\$(NOECHO) \$(NOOP)
realclean ::
- \$(RM_F) @to
});
- while (($from,$to) = each %fromto) {
+ # realclean can get rather large.
+ push @m, map "\t$_\n", $self->split_command('$(RM_F)', @to);
+ push @m, "\n";
+
+
+ # A target for each exe file.
+ while (my($from,$to) = each %fromto) {
last unless defined $from;
- my $todir = dirname($to);
- push @m, "
-$to : $from \$(FIRST_MAKEFILE) blibdirs.ts
- \$(NOECHO) \$(RM_F) $to
- \$(CP) $from $to
- \$(FIXIN) $to
- -\$(NOECHO) \$(CHMOD) \$(PERM_RWX) $to
-";
+
+ push @m, sprintf <<'MAKE', $to, $from, $to, $from, $to, $to, $to;
+%s : %s $(FIRST_MAKEFILE) $(INST_SCRIPT)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists
+ $(NOECHO) $(RM_F) %s
+ $(CP) %s %s
+ $(FIXIN) %s
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) %s
+
+MAKE
+
}
+
join "", @m;
}
unless ($self->{MAKEAPERL}) {
push @m, q{
$(MAP_TARGET) :: static $(MAKE_APERL_FILE)
- $(MAKE) -f $(MAKE_APERL_FILE) $@
+ $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@
-$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
+$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) pm_to_blib
$(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
$(NOECHO) $(PERLRUNINST) \
Makefile.PL DIR=}, $dir, q{ \
LLIBPERL = $llibperl
";
- push @m, "
-\$(INST_ARCHAUTODIR)/extralibs.all: blibdirs.ts ".join(" \\\n\t", @$extra).'
+ push @m, '
+$(INST_ARCHAUTODIR)/extralibs.all : $(INST_ARCHAUTODIR)$(DFSEP).exists '.join(" \\\n\t", @$extra).'
$(NOECHO) $(RM_F) $@
$(NOECHO) $(TOUCH) $@
';
\$(MAP_TARGET) :: $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all
\$(MAP_LINKCMD) -o \$\@ \$(OPTIMIZE) $tmp/perlmain\$(OBJ_EXT) \$(LDFROM) \$(MAP_STATIC) \$(LLIBPERL) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS)
\$(NOECHO) \$(ECHO) 'To install the new \"\$(MAP_TARGET)\" binary, call'
- \$(NOECHO) \$(ECHO) ' make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
+ \$(NOECHO) \$(ECHO) ' \$(MAKE) \$(USEMAKEFILE) $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
\$(NOECHO) \$(ECHO) 'To remove the intermediate files say'
- \$(NOECHO) \$(ECHO) ' make -f $makefilename map_clean'
+ \$(NOECHO) \$(ECHO) ' \$(MAKE) \$(USEMAKEFILE) $makefilename map_clean'
$tmp/perlmain\$(OBJ_EXT): $tmp/perlmain.c
";
- push @m, qq{\tcd $tmp && $cccmd "-I\$(PERL_INC)" perlmain.c\n};
+ push @m, "\t".$self->cd($tmp, qq[$cccmd "-I\$(PERL_INC)" perlmain.c])."\n";
push @m, qq{
$tmp/perlmain.c: $makefilename}, q{
sub makefile {
my($self) = shift;
- my @m;
+ my $m;
# We do not know what target was originally specified so we
# must force a manual rerun to be sure. But as it should only
# happen very rarely it is not a significant problem.
- push @m, '
+ $m = '
$(OBJECT) : $(FIRST_MAKEFILE)
+
' if $self->{OBJECT};
- push @m, q{
+ my $newer_than_target = $Is_VMS ? '$(MMS$SOURCE_LIST)' : '$?';
+ my $mpl_args = join " ", map qq["$_"], @ARGV;
+
+ $m .= sprintf <<'MAKE_FRAG', $newer_than_target, $mpl_args;
# We take a very conservative approach here, but it's worth it.
# We move Makefile to Makefile.old here to avoid gnu make looping.
$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
- $(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?"
+ $(NOECHO) $(ECHO) "Makefile out-of-date with respect to %s"
$(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..."
-$(NOECHO) $(RM_F) $(MAKEFILE_OLD)
-$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
- -$(MAKE) -f $(MAKEFILE_OLD) clean $(DEV_NULL) || $(NOOP)
- $(PERLRUN) Makefile.PL }.join(" ",map(qq["$_"],@ARGV)).q{
+ - $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL)
+ $(PERLRUN) Makefile.PL %s
$(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <=="
- $(NOECHO) $(ECHO) "==> Please rerun the make command. <=="
+ $(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <=="
false
-};
+MAKE_FRAG
- join "", @m;
+ return $m;
}
my($sep) = $Is_VMS ? ',' : '';
$sep .= "\\\n\t";
- foreach $key (qw(LIB LIBPERL_A LINKTYPE PREFIX OPTIMIZE)) {
+ foreach $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE
+ PREFIX INSTALLBASE)
+ )
+ {
next unless defined $self->{$key};
push @pasthru, "$key=\"\$($key)\"";
}
sub perldepend {
my($self) = shift;
my(@m);
- push @m, q{
+
+ my $make_config = $self->cd('$(PERL_SRC)', '$(MAKE) lib/Config.pm');
+
+ push @m, sprintf <<'MAKE_FRAG', $make_config if $self->{PERL_SRC};
# Check for unpropogated config.sh changes. Should never happen.
# We do NOT just update config.h because that is not sufficient.
# An out of date config.h is not fatal but complains loudly!
$(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh
$(NOECHO) $(ECHO) "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh"
- cd $(PERL_SRC) && $(MAKE) lib/Config.pm
-} if $self->{PERL_SRC};
+ %s
+MAKE_FRAG
return join "", @m unless $self->needs_linking;
my $self = shift;
my($autodir) = $self->catdir('$(INST_LIB)','auto');
my $r = q{
-# For backwards compat with anything that referenced this target.
-pm_to_blib: pm_to_blib.ts
- $(NOOP)
-
-pm_to_blib.ts: $(TO_INST_PM)
+pm_to_blib : $(TO_INST_PM)
};
my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']);
my @cmds = $self->split_command($pm_to_blib, %{$self->{PM}});
$r .= join '', map { "\t\$(NOECHO) $_\n" } @cmds;
- $r .= q{ $(NOECHO) $(TOUCH) $@};
+ $r .= qq{\t\$(NOECHO) \$(TOUCH) pm_to_blib\n};
return $r;
}
=cut
sub processPL {
- my($self) = shift;
- return "" unless $self->{PL_FILES};
- my(@m, $plfile);
- foreach $plfile (sort keys %{$self->{PL_FILES}}) {
- my $list = ref($self->{PL_FILES}->{$plfile})
- ? $self->{PL_FILES}->{$plfile}
- : [$self->{PL_FILES}->{$plfile}];
- my $target;
- foreach $target (@$list) {
- push @m, "
-all :: $target
- \$(NOECHO) \$(NOOP)
+ my $self = shift;
+ my $pl_files = $self->{PL_FILES};
+
+ return "" unless $pl_files;
+
+ my $m = '';
+ foreach my $plfile (sort keys %$pl_files) {
+ my $list = ref($pl_files->{$plfile})
+ ? $pl_files->{$plfile}
+ : [$pl_files->{$plfile}];
+
+ foreach my $target (@$list) {
+ if( $Is_VMS ) {
+ $plfile = vmsify($plfile);
+ $target = vmsify($target);
+ }
+
+ $m .= sprintf <<'MAKE_FRAG', ($target) x 2, ($plfile) x 2, $target;
+
+all :: %s
+ $(NOECHO) $(NOOP)
+
+%s :: %s
+ $(PERLRUN) %s %s
+MAKE_FRAG
-$target :: $plfile
- \$(PERLRUNINST) $plfile $target
-";
}
}
- join "", @m;
+
+ return $m;
}
=item quote_paren
sub quote_paren {
my $arg = shift;
- $arg =~ s/\$\((.+?)\)/\$\\\\($1\\\\)/g; # protect $(...)
- $arg =~ s/(?<!\\)([()])/\\$1/g; # quote unprotected
- $arg =~ s/\$\\\\\((.+?)\\\\\)/\$($1)/g; # unprotect $(...)
+ $arg =~ s{\$\((.+?)\)}{\$\\\\($1\\\\)}g; # protect $(...)
+ $arg =~ s{(?<!\\)([()])}{\\$1}g; # quote unprotected
+ $arg =~ s{\$\\\\\((.+?)\\\\\)}{\$($1)}g; # unprotect $(...)
return $arg;
}
-=item realclean (o)
-
-Defines the realclean target.
-
-=cut
-
-sub realclean {
- my($self, %attribs) = @_;
- my(@m);
-
- push(@m,'
-# Delete temporary files (via clean) and also delete installed files
-realclean purge :: clean realclean_subdirs
- $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR)
- $(RM_RF) $(DISTVNAME)
-');
-
- if( $self->has_link_code ){
- push(@m, " \$(RM_F) \$(INST_DYNAMIC) \$(INST_BOOT)\n");
- push(@m, " \$(RM_F) \$(INST_STATIC)\n");
- }
-
- my @files = values %{$self->{PM}};
- push @files, $attribs{FILES} if $attribs{FILES};
- push @files, '$(FIRST_MAKEFILE)', '$(MAKEFILE_OLD)';
-
- # Occasionally files are repeated several times from different sources
- { my(%f) = map { ($_,1) } @files; @files = keys %f; }
-
- # Issue a several little RM_RF commands rather than risk creating a
- # very long command line (useful for extensions such as Encode
- # that have many files).
- my $line = "";
- foreach my $file (@files) {
- if (length($line) + length($file) > 200) {
- push @m, "\t\$(RM_RF) $line\n";
- $line = $file;
- }
- else {
- $line .= " $file";
- }
- }
- push @m, "\t\$(RM_RF) $line\n" if $line;
- push(@m, "\t$attribs{POSTOP}\n") if $attribs{POSTOP};
-
- join("", @m);
-}
-
-
-=item realclean_subdirs_target
-
- my $make_frag = $MM->realclean_subdirs_target;
-
-Returns the realclean_subdirs target. This is used by the realclean
-target to call realclean on any subdirectories which contain Makefiles.
-
-=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, $dir;
- -cd %s && $(TEST_F) $(MAKEFILE_OLD) && $(MAKE) -f $(MAKEFILE_OLD) realclean
- -cd %s && $(TEST_F) $(FIRST_MAKEFILE) && $(MAKE) realclean
-RCLEAN
-
- }
-
- return $rclean;
-}
-
-
=item replace_manpage_separator
my $man_name = $MM->replace_manpage_separator($file_path);
}
-=item oneliner (o)
+=item cd
+
+=cut
+
+sub cd {
+ my($self, $dir, @cmds) = @_;
+
+ # No leading tab and no trailing newline makes for easier embedding
+ my $make_frag = join "\n\t", map { "cd $dir && $_" } @cmds;
+
+ return $make_frag;
+}
+
+=item oneliner
=cut
$cmd =~ s{\n+$}{};
my @cmds = split /\n/, $cmd;
- $cmd = join " \n\t-e ", map $self->quote_literal($_), @cmds;
+ $cmd = join " \n\t -e ", map $self->quote_literal($_), @cmds;
$cmd = $self->escape_newlines($cmd);
$switches = join ' ', @$switches;
my(@m);
push(@m, <<'END');
-$(INST_STATIC): $(OBJECT) $(MYEXTLIB) blibdirs.ts
+$(INST_STATIC) : $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(RM_RF) $@
END
sub subdir_x {
my($self, $subdir) = @_;
- return sprintf <<'EOT', $subdir;
+
+ my $subdir_cmd = $self->cd($subdir,
+ '$(MAKE) $(USEMAKEFILE) $(FIRST_MAKEFILE) all $(PASTHRU)'
+ );
+ return sprintf <<'EOT', $subdir_cmd;
subdirs ::
- $(NOECHO)cd %s && $(MAKE) -f $(FIRST_MAKEFILE) all $(PASTHRU)
+ $(NOECHO) %s
EOT
+
}
=item subdirs (o)
test :: \$(TEST_TYPE)
");
- if ($Is_Win95) {
- push(@m, map(qq{\t\$(NOECHO) \$(PERLRUN) -e "exit unless -f shift; chdir '$_'; system q[\$(MAKE) test \$(PASTHRU)]" \$(FIRST_MAKEFILE)\n}, @{$self->{DIR}}));
- }
- else {
- push(@m, map("\t\$(NOECHO) cd $_ && \$(TEST_F) \$(FIRST_MAKEFILE) && \$(MAKE) test \$(PASTHRU)\n", @{$self->{DIR}}));
+ foreach my $dir (@{ $self->{DIR} }) {
+ my $test = $self->oneliner(sprintf <<'CODE', $dir);
+chdir '%s';
+system '$(MAKE) test $(PASTHRU)'
+ if -f '$(FIRST_MAKEFILE)';
+CODE
+
+ push(@m, "\t\$(NOECHO) $test\n");
}
push(@m, "\t\$(NOECHO) \$(ECHO) 'No tests defined for \$(NAME) extension.'\n")
my $make_frag = $MM->tools_other;
-Returns a make fragment containing definitions for:
-
-SHELL, CHMOD, CP, MV, NOOP, NOECHO, RM_F, RM_RF, TEST_F, TOUCH,
-DEV_NULL, UMASK_NULL, MKPATH, EQUALIZE_TIMESTAMP,
-WARN_IF_OLD_PACKLIST, UNINST, VERBINST, MOD_INSTALL, DOC_INSTALL and
-UNINSTALL
-
-init_others() initializes all these values.
+Returns a make fragment containing definitions for the macros init_others()
+initializes.
=cut
my($self) = shift;
my @m;
+ # We set PM_FILTER as late as possible so it can see all the earlier
+ # on macro-order sensitive makes such as nmake.
for my $tool (qw{ SHELL CHMOD CP MV NOOP NOECHO RM_F RM_RF TEST_F TOUCH
UMASK_NULL DEV_NULL MKPATH EQUALIZE_TIMESTAMP
ECHO ECHO_N
UNINST VERBINST
MOD_INSTALL DOC_INSTALL UNINSTALL
WARN_IF_OLD_PACKLIST
+ MACROSTART MACROEND
+ USEMAKEFILE
+ PM_FILTER
+ FIXIN
} )
{
next unless defined $self->{$tool};
unshift( @tmargs, $self->{XSOPT} );
}
+ if ($Is_VMS &&
+ $Config{'ldflags'} &&
+ $Config{'ldflags'} =~ m!/Debug!i &&
+ (!exists($self->{XSOPT}) || $self->{XSOPT} !~ /linenumbers/)
+ )
+ {
+ unshift(@tmargs,'-nolinenumbers');
+ }
+
$self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG};
return qq{
XSUBPPDIR = $xsdir
-XSUBPP = \$(XSUBPPDIR)/xsubpp
+XSUBPP = \$(XSUBPPDIR)\$(DFSEP)xsubpp
+XSUBPPRUN = \$(PERLRUN) \$(XSUBPP)
XSPROTOARG = $self->{XSPROTOARG}
XSUBPPDEPS = @tmdeps \$(XSUBPP)
XSUBPPARGS = @tmargs
push @m, $self->all_target, "\n" unless $self->{SKIPHASH}{'all'};
push @m, '
-pure_all :: config pm_to_blib.ts subdirs linkext
+pure_all :: config pm_to_blib subdirs linkext
$(NOECHO) $(NOOP)
subdirs :: $(MYEXTLIB)
$(NOECHO) $(NOOP)
-config :: $(FIRST_MAKEFILE) blibdirs.ts
+config :: $(FIRST_MAKEFILE) blibdirs
$(NOECHO) $(NOOP)
';
return '' unless $self->needs_linking();
'
.xs.c:
- $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
+ $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
';
}
return '' unless $self->needs_linking();
'
.xs.cpp:
- $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.cpp
+ $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.cpp
';
}
return '' unless $self->needs_linking();
'
.xs$(OBJ_EXT):
- $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
+ $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
$(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c
';
}
-# MM_VMS.pm
-# MakeMaker default methods for VMS
-#
-# Author: Charles Bailey bailey@newman.upenn.edu
-
package ExtUtils::MM_VMS;
use strict;
-use Config;
+use ExtUtils::MakeMaker::Config;
require Exporter;
BEGIN {
}
use File::Basename;
-use vars qw($Revision @ISA $VERSION);
-($VERSION) = '5.71';
-($Revision) = q$Revision: 1.116 $ =~ /Revision:\s+(\S+)/;
+
+# $Revision can't be on the same line or SVN/K gets confused
+use vars qw($Revision
+ $VERSION @ISA);
+$VERSION = '5.73';
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
use ExtUtils::MakeMaker qw($Verbose neatvalue);
+$Revision = $ExtUtils::MakeMaker::Revision;
=head1 NAME
return 0;
}
+
+=item pasthru (override)
+
+VMS has $(MMSQUALIFIERS) which is a listing of all the original command line
+options. This is used in every invokation of make in the VMS Makefile so
+PASTHRU should not be necessary. Using PASTHRU tends to blow commands past
+the 256 character limit.
+
+=cut
+
+sub pasthru {
+ return "PASTHRU=\n";
+}
+
+
+=item pm_to_blib (override)
+
+VMS wants a dot in every file so we can't have one called 'pm_to_blib',
+it becomes 'pm_to_blib.' and MMS/K isn't smart enough to know that when
+you have a target called 'pm_to_blib' it should look for 'pm_to_blib.'.
+
+So in VMS its pm_to_blib.ts.
+
+=cut
+
+sub pm_to_blib {
+ my $self = shift;
+
+ my $make = $self->SUPER::pm_to_blib;
+
+ $make =~ s{^pm_to_blib :}{pm_to_blib.ts :}m;
+ $make =~ s{\$\(TOUCH\) pm_to_blib}{\$(TOUCH) pm_to_blib.ts};
+
+ $make = <<'MAKE' . $make;
+# Dummy target to match Unix target name; we use pm_to_blib.ts as
+# timestamp file to avoid repeated invocations under VMS
+pm_to_blib : pm_to_blib.ts
+ $(NOECHO) $(NOOP)
+
+MAKE
+
+ return $make;
+}
+
+
=item perl_script (override)
If name passed in doesn't specify a readable file, appends F<.com> or
return '';
}
+
=item replace_manpage_separator
Use as separator a character which is legal in a VMS-syntax file name.
$self->{MAKE_APERL_FILE} ||= 'Makeaperl.MMS';
$self->{MAKEFILE_OLD} ||= '$(FIRST_MAKEFILE)_old';
+ $self->{MACROSTART} ||= '/Macro=(';
+ $self->{MACROEND} ||= ')';
+ $self->{USEMAKEFILE} ||= '/Descrip=';
+
$self->{ECHO} ||= '$(ABSPERLRUN) -le "print qq{@ARGV}"';
$self->{ECHO_N} ||= '$(ABSPERLRUN) -e "print qq{@ARGV}"';
$self->{TOUCH} ||= '$(ABSPERLRUN) "-MExtUtils::Command" -e touch';
$self->{SHELL} ||= 'Posix';
- $self->{CP} = 'Copy/NoConfirm';
- $self->{MV} = 'Rename/NoConfirm';
+ $self->SUPER::init_others;
+
+ # So we can copy files into directories with less fuss
+ $self->{CP} = '$(ABSPERLRUN) "-MExtUtils::Command" -e cp';
+ $self->{MV} = '$(ABSPERLRUN) "-MExtUtils::Command" -e mv';
+
$self->{UMASK_NULL} = '! ';
- $self->SUPER::init_others;
+ # Redirection on VMS goes before the command, not after as on Unix.
+ # $(DEV_NULL) is used once and its not worth going nuts over making
+ # it work. However, Unix's DEV_NULL is quite wrong for VMS.
+ $self->{DEV_NULL} = '';
if ($self->{OBJECT} =~ /\s/) {
$self->{OBJECT} =~ s/(\\)?\n+\s+/ /g;
$self->{$macro} = \@tmp;
}
+ # mms/k does not define a $(MAKE) macro.
+ $self->{MAKE} = '$(MMS)$(MMSQUALIFIERS)';
+
return $self->SUPER::constants;
}
}
-=item tool_sxubpp (override)
-
-Use VMS-style quoting on xsubpp command line.
-
-=cut
-
-sub tool_xsubpp {
- my($self) = @_;
- return '' unless $self->needs_linking;
-
- my $xsdir;
- foreach my $dir (@INC) {
- $xsdir = $self->catdir($dir, 'ExtUtils');
- if( -r $self->catfile($xsdir, "xsubpp") ) {
- last;
- }
- }
-
- my $tmdir = File::Spec->catdir($self->{PERL_LIB},"ExtUtils");
- my(@tmdeps) = $self->catfile($tmdir,'typemap');
- if( $self->{TYPEMAPS} ){
- my $typemap;
- foreach $typemap (@{$self->{TYPEMAPS}}){
- if( ! -f $typemap ){
- warn "Typemap $typemap not found.\n";
- }
- else{
- push(@tmdeps, $self->fixpath($typemap,0));
- }
- }
- }
- push(@tmdeps, "typemap") if -f "typemap";
- my(@tmargs) = map("-typemap $_", @tmdeps);
- if( exists $self->{XSOPT} ){
- unshift( @tmargs, $self->{XSOPT} );
- }
-
- if ($Config{'ldflags'} &&
- $Config{'ldflags'} =~ m!/Debug!i &&
- (!exists($self->{XSOPT}) || $self->{XSOPT} !~ /linenumbers/)) {
- unshift(@tmargs,'-nolinenumbers');
- }
-
-
- $self->{XSPROTOARG} = '' unless defined $self->{XSPROTOARG};
-
- return "
-XSUBPPDIR = $xsdir
-XSUBPP = \$(PERLRUN) \$(XSUBPPDIR)xsubpp
-XSPROTOARG = $self->{XSPROTOARG}
-XSUBPPDEPS = @tmdeps
-XSUBPPARGS = @tmargs
-";
-}
-
-
=item tools_other (override)
Throw in some dubious extra macros for Makefile args.
# than just typing the literal string.
my $extra_tools = <<'EXTRA_TOOLS';
-# Assumes $(MMS) invokes MMS or MMK
-# (It is assumed in some cases later that the default makefile name
-# (Descrip.MMS for MM[SK]) is used.)
-USEMAKEFILE = /Descrip=
-USEMACROS = /Macro=(
-MACROEND = )
-
# Just in case anyone is using the old macro.
+USEMACROS = $(MACROSTART)
SAY = $(ECHO)
EXTRA_TOOLS
return '' unless $self->needs_linking();
'
.xs.c :
- $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET)
+ $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET)
';
}
return '' unless $self->needs_linking();
'
.xs$(OBJ_EXT) :
- $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).c
+ $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).c
$(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
';
}
";
push @m, '
-$(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt blibdirs.ts $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
- $(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR)
+$(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
If F$TrnLNm("',$shr,'").eqs."" Then Define/NoLog/User ',"$shr Sys\$Share:$shr.$Config{'dlext'}",'
Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) $(BASEEXT).opt/Option,$(PERL_INC)perlshr_attr.opt/Option
';
join('',@m);
}
-=item dynamic_bs (override)
-
-Use VMS-style quoting on Mkbootstrap command line.
-
-=cut
-
-sub dynamic_bs {
- my($self, %attribs) = @_;
- return '
-BOOTSTRAP =
-' unless $self->has_link_code();
- '
-BOOTSTRAP = '."$self->{BASEEXT}.bs".'
-
-# As MakeMaker mkbootstrap might not write a file (if none is required)
-# we use touch to prevent make continually trying to remake it.
-# The DynaLoader only reads a non-empty file.
-$(BOOTSTRAP) : $(FIRST_MAKEFILE) '."$self->{BOOTDEP}".' blibdirs.ts
- $(NOECHO) $(ECHO) "Running mkbootstrap for $(NAME) ($(BSLOADLIBS))"
- $(NOECHO) $(PERLRUN) -
- -e "use ExtUtils::Mkbootstrap; Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
- $(NOECHO) $(TOUCH) $(MMS$TARGET)
-
-$(INST_BOOT) : $(BOOTSTRAP) blibdirs.ts
- $(NOECHO) $(RM_RF) $(INST_BOOT)
- - $(CP) $(BOOTSTRAP) $(INST_BOOT)
-';
-}
=item static_lib (override)
my(@m,$lib);
push @m,'
# Rely on suffix rule for update action
-$(OBJECT) : blibdirs.ts
+$(OBJECT) : $(INST_ARCHAUTODIR)$(DFSEP).exists
$(INST_STATIC) : $(OBJECT) $(MYEXTLIB)
';
# 'cause it's a library and you can't stick them in other libraries.
# In that case, we use $OBJECT instead and hope for the best
if ($self->{MYEXTLIB}) {
- push(@m,"\t",'Library/Object/Replace $(MMS$TARGET) $(OBJECT)',"\n");
+ push(@m,"\t",'Library/Object/Replace $(MMS$TARGET) $(OBJECT)',"\n");
} else {
push(@m,"\t",'Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)',"\n");
}
}
-=item processPL (override)
-
-Use VMS-style quoting on command line.
-
-=cut
-
-sub processPL {
- my($self) = @_;
- return "" unless $self->{PL_FILES};
- my(@m, $plfile);
- foreach $plfile (sort keys %{$self->{PL_FILES}}) {
- my $list = ref($self->{PL_FILES}->{$plfile})
- ? $self->{PL_FILES}->{$plfile}
- : [$self->{PL_FILES}->{$plfile}];
- foreach my $target (@$list) {
- my $vmsplfile = vmsify($plfile);
- my $vmsfile = vmsify($target);
- push @m, "
-all :: $vmsfile
- \$(NOECHO) \$(NOOP)
-
-$vmsfile :: $vmsplfile
-",' $(PERLRUNINST) '," $vmsplfile $vmsfile
-";
- }
- }
- join "", @m;
-}
-
-=item installbin (override)
-
-Stay under DCL's 255 character command line limit once again by
-splitting potentially long list of files across multiple lines
-in C<realclean> target.
-
-=cut
-
-sub installbin {
- my($self) = @_;
- return '' unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
- return '' unless @{$self->{EXE_FILES}};
- my(@m, $from, $to, %fromto, @to);
- my(@exefiles) = map { vmsify($_) } @{$self->{EXE_FILES}};
- for $from (@exefiles) {
- my($path) = '$(INST_SCRIPT)' . basename($from);
- local($_) = $path; # backward compatibility
- $to = $self->libscan($path);
- print "libscan($from) => '$to'\n" if ($Verbose >=2);
- $fromto{$from} = vmsify($to);
- }
- @to = values %fromto;
- push @m, "
-EXE_FILES = @exefiles
-
-pure_all :: @to
- \$(NOECHO) \$(NOOP)
-
-realclean ::
-";
-
- my $line = '';
- foreach $to (@to) {
- if (length($line) + length($to) > 80) {
- push @m, "\t\$(RM_F) $line\n";
- $line = $to;
- }
- else { $line .= " $to"; }
- }
- push @m, "\t\$(RM_F) $line\n\n" if $line;
-
- while (($from,$to) = each %fromto) {
- last unless defined $from;
- my $todir;
- if ($to =~ m#[/>:\]]#) {
- $todir = dirname($to);
- }
- else {
- ($todir = $to) =~ s/[^\)]+$//;
- }
- $todir = $self->fixpath($todir,1);
- push @m, "
-$to : $from \$(FIRST_MAKEFILE) blibdirs.ts
- \$(CP) $from $to
-
-";
- }
- join "", @m;
-}
-
-=item subdir_x (override)
-
-Use VMS commands to change default directory.
-
-=cut
-
-sub subdir_x {
- my($self, $subdir) = @_;
- my(@m,$key);
- $subdir = $self->fixpath($subdir,1);
- push @m, '
-
-subdirs ::
- olddef = F$Environment("Default")
- Set Default ',$subdir,'
- - $(MMS)$(MMSQUALIFIERS) all $(USEMACROS)$(PASTHRU)$(MACROEND)
- Set Default \'olddef\'
-';
- join('',@m);
-}
-
-=item clean (override)
-
-Split potentially long list of files across multiple commands (in
-order to stay under the magic command line limit). Also use MM[SK]
-commands for handling subdirectories.
-
-=cut
-
-sub clean {
- my($self, %attribs) = @_;
- my(@m,$dir);
- push @m, '
-# Delete temporary files but do not touch installed files. We don\'t delete
-# the Descrip.MMS here so that a later make realclean still has it to use.
-clean :: clean_subdirs
-';
- push @m, ' $(RM_F) *.Map *.Dmp *.Lis *.cpp *.$(DLEXT) *$(OBJ_EXT) *$(LIB_EXT) *.Opt $(BOOTSTRAP) $(BASEEXT).bso .MM_Tmp
-';
-
- my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
- # Unlink realclean, $attribs{FILES} is a string here; it may contain
- # a list or a macro that expands to a list.
- if ($attribs{FILES}) {
- my @filelist = ref $attribs{FILES} eq 'ARRAY'
- ? @{$attribs{FILES}}
- : split /\s+/, $attribs{FILES};
-
- foreach my $word (@filelist) {
- if ($word =~ m#^\$\((.*)\)$# and
- ref $self->{$1} eq 'ARRAY')
- {
- push(@otherfiles, @{$self->{$1}});
- }
- else { push(@otherfiles, $word); }
- }
- }
- push(@otherfiles, qw[ blib $(MAKE_APERL_FILE)
- perlmain.c blibdirs.ts pm_to_blib.ts ]);
- push(@otherfiles, $self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'));
- push(@otherfiles, $self->catfile('$(INST_ARCHAUTODIR)','extralibs.ld'));
-
- # Occasionally files are repeated several times from different sources
- { my(%of) = map { ($_ => 1) } @otherfiles; @otherfiles = keys %of; }
-
- my $line = '';
- foreach my $file (@otherfiles) {
- $file = $self->fixpath($file);
- if (length($line) + length($file) > 80) {
- push @m, "\t\$(RM_RF) $line\n";
- $line = "$file";
- }
- else { $line .= " $file"; }
- }
- push @m, "\t\$(RM_RF) $line\n" if $line;
- push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
- join('', @m);
-}
-
-
-=item clean_subdirs_target
+=item extra_clean_files
- my $make_frag = $MM->clean_subdirs_target;
-
-VMS semantics for changing directories and rerunning make very different.
+Clean up some OS specific files. Plus the temp file used to shorten
+a lot of commands.
=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";
-
- foreach my $dir (@{$self->{DIR}}) { # clean subdirectories first
- $dir = $self->fixpath($dir,1);
-
- $clean .= sprintf <<'MAKE_FRAG', $dir, $dir;
- If F$Search("%s$(FIRST_MAKEFILE)").nes."" Then $(PERLRUN) -e "chdir '%s'; print `$(MMS)$(MMSQUALIFIERS) clean`;"
-MAKE_FRAG
- }
-
- return $clean;
+sub extra_clean_files {
+ return qw(
+ *.Map *.Dmp *.Lis *.cpp *.$(DLEXT) *.Opt $(BASEEXT).bso
+ .MM_Tmp
+ );
}
-=item realclean (override)
-
-Guess what we're working around? Also, use MM[SK] for subdirectories.
-
-=cut
-
-sub realclean {
- my($self, %attribs) = @_;
- my(@m);
- push(@m,'
-# Delete temporary files (via clean) and also delete installed files
-realclean :: clean
-');
- foreach(@{$self->{DIR}}){
- my($vmsdir) = $self->fixpath($_,1);
- push(@m, ' If F$Search("'."$vmsdir".'$(FIRST_MAKEFILE)").nes."" Then \\',"\n\t",
- '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS)$(MMSQUALIFIERS) realclean`;"',"\n");
- }
- push @m, " \$(RM_RF) \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n";
- push @m, " \$(RM_RF) \$(DISTVNAME)\n";
- # We can't expand several of the MMS macros here, since they don't have
- # corresponding %$self keys (i.e. they're defined in Descrip.MMS as a
- # combination of macros). In order to stay below DCL's 255 char limit,
- # we put only 2 on a line.
- my($file,$fcnt);
- my(@files) = values %{$self->{PM}};
- push @files, qw{ $(FIRST_MAKEFILE) $(MAKEFILE_OLD) };
- if ($self->has_link_code) {
- push(@files,qw{ $(INST_DYNAMIC) $(INST_STATIC) $(INST_BOOT) $(OBJECT) });
- }
-
- # Occasionally files are repeated several times from different sources
- { my(%f) = map { ($_,1) } @files; @files = keys %f; }
-
- my $line = '';
- foreach $file (@files) {
- if (length($line) + length($file) > 80 || ++$fcnt >= 2) {
- push @m, "\t\$(RM_F) $line\n";
- $line = "$file";
- $fcnt = 0;
- }
- else { $line .= " $file"; }
- }
- push @m, "\t\$(RM_F) $line\n" if $line;
- if ($attribs{FILES}) {
- my($word,$key,@filist,@allfiles);
- if (ref $attribs{FILES} eq 'ARRAY') { @filist = @{$attribs{FILES}}; }
- else { @filist = split /\s+/, $attribs{FILES}; }
- foreach $word (@filist) {
- if (($key) = $word =~ m#^\$\((.*)\)$# and ref $self->{$key} eq 'ARRAY') {
- push(@allfiles, @{$self->{$key}});
- }
- else { push(@allfiles, $word); }
- }
- $line = '';
- # Occasionally files are repeated several times from different sources
- { my(%af) = map { ($_,1) } @allfiles; @allfiles = keys %af; }
- foreach $file (@allfiles) {
- $file = $self->fixpath($file);
- if (length($line) + length($file) > 80) {
- push @m, "\t\$(RM_RF) $line\n";
- $line = "$file";
- }
- else { $line .= " $file"; }
- }
- push @m, "\t\$(RM_RF) $line\n" if $line;
- }
- push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
- join('', @m);
-}
-
-=item zipfile_target (o)
+=item zipfile_target
-=item tarfile_target (o)
+=item tarfile_target
-=item shdist_target (o)
+=item shdist_target
Syntax for invoking shar, tar and zip differs from that for Unix.
MAKE_FRAG
}
-=item dist_test (override)
-
-Use VMS commands to change default directory, and use VMS-style
-quoting on command line.
-
-=cut
-
-sub dist_test {
- my($self) = @_;
-q{
-disttest : distdir
- startdir = F$Environment("Default")
- Set Default [.$(DISTVNAME)]
- $(ABSPERLRUN) Makefile.PL
- $(MMS)$(MMSQUALIFIERS)
- $(MMS)$(MMSQUALIFIERS) test
- Set Default 'startdir'
-};
-}
# --- Test and Installation Sections ---
sub install {
my($self, %attribs) = @_;
- my(@m,@exe_files);
-
- if ($self->{EXE_FILES}) {
- my($line,$file) = ('','');
- foreach $file (@{$self->{EXE_FILES}}) {
- $line .= "$file ";
- if (length($line) > 128) {
- push(@exe_files,qq[\t\$(NOECHO) \$(ECHO) "$line" >>.MM_tmp\n]);
- $line = '';
- }
- }
- push(@exe_files,qq[\t\$(NOECHO) \$(ECHO) "$line" >>.MM_tmp\n]) if $line;
- }
+ my(@m);
push @m, q[
install :: all pure_install doc_install
$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
$(NOECHO) $(ECHO_N) "installed into|$(INSTALLPRIVLIB)|" >.MM_tmp
$(NOECHO) $(ECHO_N) "LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|$(EXE_FILES) " >>.MM_tmp
-],@exe_files,
-q[ $(NOECHO) $(DOC_INSTALL) "Module" "$(NAME)" <.MM_tmp >>].$self->catfile($self->{DESTINSTALLARCHLIB},'perllocal.pod').q[
+ $(NOECHO) $(DOC_INSTALL) "Module" "$(NAME)" <.MM_tmp >>].$self->catfile($self->{DESTINSTALLARCHLIB},'perllocal.pod').q[
$(NOECHO) $(RM_F) .MM_tmp
# And again
$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
$(NOECHO) $(ECHO_N) "installed into|$(INSTALLSITELIB)|" >.MM_tmp
$(NOECHO) $(ECHO_N) "LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|$(EXE_FILES) " >>.MM_tmp
-],@exe_files,
-q[ $(NOECHO) $(DOC_INSTALL) "Module" "$(NAME)" <.MM_tmp >>].$self->catfile($self->{DESTINSTALLARCHLIB},'perllocal.pod').q[
+ $(NOECHO) $(DOC_INSTALL) "Module" "$(NAME)" <.MM_tmp >>].$self->catfile($self->{DESTINSTALLARCHLIB},'perllocal.pod').q[
$(NOECHO) $(RM_F) .MM_tmp
doc_vendor_install ::
$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
$(NOECHO) $(ECHO_N) "installed into|$(INSTALLVENDORLIB)|" >.MM_tmp
$(NOECHO) $(ECHO_N) "LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|$(EXE_FILES) " >>.MM_tmp
-],@exe_files,
-q[ $(NOECHO) $(DOC_INSTALL) "Module" "$(NAME)" <.MM_tmp >>].$self->catfile($self->{DESTINSTALLARCHLIB},'perllocal.pod').q[
+ $(NOECHO) $(DOC_INSTALL) "Module" "$(NAME)" <.MM_tmp >>].$self->catfile($self->{DESTINSTALLARCHLIB},'perllocal.pod').q[
$(NOECHO) $(RM_F) .MM_tmp
];
join('',@m);
}
-=item makefile (override)
-
-Use VMS commands and quoting.
-
-=cut
-
-sub makefile {
- my($self) = @_;
- my(@m,@cmd);
- # We do not know what target was originally specified so we
- # must force a manual rerun to be sure. But as it should only
- # happen very rarely it is not a significant problem.
- push @m, q[
-$(OBJECT) : $(FIRST_MAKEFILE)
-] if $self->{OBJECT};
-
- push @m,q[
-# We take a very conservative approach here, but it's worth it.
-# We move $(FIRST_MAKEFILE) to $(MAKEFILE_OLD) here to avoid gnu make looping.
-$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
- $(NOECHO) $(ECHO) "$(FIRST_MAKEFILE) out-of-date with respect to $(MMS$SOURCE_LIST)"
- $(NOECHO) $(ECHO) "Cleaning current config before rebuilding $(FIRST_MAKEFILE) ..."
- - $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
- - $(MMS)$(MMSQUALIFIERS) $(USEMAKEFILE)$(MAKEFILE_OLD) clean
- $(PERLRUN) Makefile.PL ],join(' ',map(qq["$_"],@ARGV)),q[
- $(NOECHO) $(ECHO) "$(FIRST_MAKEFILE) has been rebuilt."
- $(NOECHO) $(ECHO) "Please run $(MMS) to build the extension."
-];
-
- join('',@m);
-}
-
-=item find_tests (override)
-
-=cut
-
-sub find_tests {
- my $self = shift;
- return -d 't' ? 't/*.t' : '';
-}
-
-=item test (override)
-
-Use VMS commands for handling subdirectories.
-
-=cut
-
-sub test {
- my($self, %attribs) = @_;
- my($tests) = $attribs{TESTS} || $self->find_tests;
- my(@m);
- push @m,"
-TEST_VERBOSE = 0
-TEST_TYPE = test_\$(LINKTYPE)
-TEST_FILE = test.pl
-TESTDB_SW = -d
-
-test :: \$(TEST_TYPE)
- \$(NOECHO) \$(NOOP)
-
-testdb :: testdb_\$(LINKTYPE)
- \$(NOECHO) \$(NOOP)
-
-";
- foreach(@{$self->{DIR}}){
- my($vmsdir) = $self->fixpath($_,1);
- push(@m, ' If F$Search("',$vmsdir,'$(FIRST_MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
- '; print `$(MMS)$(MMSQUALIFIERS) $(PASTHRU2) test`'."\n");
- }
- push(@m, "\t\$(NOECHO) \$(ECHO) \"No tests defined for \$(NAME) extension.\"\n")
- unless $tests or -f "test.pl" or @{$self->{DIR}};
- push(@m, "\n");
-
- push(@m, "test_dynamic :: pure_all\n");
- push(@m, $self->test_via_harness('$(FULLPERLRUN)', $tests)) if $tests;
- push(@m, $self->test_via_script('$(FULLPERLRUN)', 'test.pl')) if -f "test.pl";
- push(@m, "\t\$(NOECHO) \$(NOOP)\n") if (!$tests && ! -f "test.pl");
- push(@m, "\n");
-
- push(@m, "testdb_dynamic :: pure_all\n");
- push(@m, $self->test_via_script('$(FULLPERLRUN) "$(TESTDB_SW)"', '$(TEST_FILE)'));
- push(@m, "\n");
-
- # Occasionally we may face this degenerate target:
- push @m, "test_ : test_dynamic\n\n";
-
- if ($self->needs_linking()) {
- push(@m, "test_static :: pure_all \$(MAP_TARGET)\n");
- push(@m, $self->test_via_harness('$(MAP_TARGET)', $tests)) if $tests;
- push(@m, $self->test_via_script('$(MAP_TARGET)', 'test.pl')) if -f 'test.pl';
- push(@m, "\n");
- push(@m, "testdb_static :: pure_all \$(MAP_TARGET)\n");
- push(@m, $self->test_via_script('$(MAP_TARGET) $(TESTDB_SW)', '$(TEST_FILE)'));
- push(@m, "\n");
- }
- else {
- push @m, "test_static :: test_dynamic\n\t\$(NOECHO) \$(NOOP)\n\n";
- push @m, "testdb_static :: testdb_dynamic\n\t\$(NOECHO) \$(NOOP)\n";
- }
-
- join('',@m);
-}
=item makeaperl (override)
push @m, map(q[ \\\n\t\t"$_"], @ARGV),q{
$(MAP_TARGET) :: $(MAKE_APERL_FILE)
- $(MMS)$(MMSQUALIFIERS)$(USEMAKEFILE)$(MAKE_APERL_FILE) static $(MMS$TARGET)
+ $(MAKE)$(USEMAKEFILE)$(MAKE_APERL_FILE) static $(MMS$TARGET)
};
push @m, "\n";
$(MAP_TARGET) : $(MAP_SHRTARGET) ',"${tmpdir}perlmain\$(OBJ_EXT) ${tmpdir}PerlShr.Opt",'
$(MAP_LINKCMD) ',"${tmpdir}perlmain\$(OBJ_EXT)",', PerlShr.Opt/Option
$(NOECHO) $(ECHO) "To install the new ""$(MAP_TARGET)"" binary, say"
- $(NOECHO) $(ECHO) " $(MMS)$(MMSQUALIFIERS)$(USEMAKEFILE)$(FIRST_MAKEFILE) inst_perl $(USEMACROS)MAP_TARGET=$(MAP_TARGET)$(ENDMACRO)"
+ $(NOECHO) $(ECHO) " $(MAKE)$(USEMAKEFILE)$(FIRST_MAKEFILE) inst_perl $(USEMACROS)MAP_TARGET=$(MAP_TARGET)$(ENDMACRO)"
$(NOECHO) $(ECHO) "To remove the intermediate files, say
- $(NOECHO) $(ECHO) " $(MMS)$(MMSQUALIFIERS)$(USEMAKEFILE)$(FIRST_MAKEFILE) map_clean"
+ $(NOECHO) $(ECHO) " $(MAKE)$(USEMAKEFILE)$(FIRST_MAKEFILE) map_clean"
';
push @m,"\n${tmpdir}perlmain.c : \$(FIRST_MAKEFILE)\n\t\$(NOECHO) \$(PERL) -e 1 >${tmpdir}Writemain.tmp\n";
push @m, "# More from the 255-char line length limit\n";
}
-=item oneliner (o)
+=item cd
+
+=cut
+
+sub cd {
+ my($self, $dir, @cmds) = @_;
+
+ $dir = vmspath($dir);
+
+ my $cmd = join "\n\t", map "$_", @cmds;
+
+ # No leading tab makes it look right when embedded
+ my $make_frag = sprintf <<'MAKE_FRAG', $dir, $cmd;
+startdir = F$Environment("Default")
+ Set Default %s
+ %s
+ Set Default 'startdir'
+MAKE_FRAG
+
+ # No trailing newline makes this easier to embed
+ chomp $make_frag;
+
+ return $make_frag;
+}
+
+
+=item oneliner
=cut
}
-=item B<echo> (o)
+=item B<echo>
perl trips up on "<foo>" thinking it's an input redirect. So we use the
native Write command instead. Besides, its faster.
return $self->{_MAX_EXEC_LEN} ||= 256;
}
-=item init_linker (o)
+=item init_linker
=cut
=item fixpath
+ my $path = $mm->fixpath($path);
+ my $path = $mm->fixpath($path, $is_dir);
+
Catchall routine to clean up problem MM[SK]/Make macros. Expands macros
in any directory specification, in order to avoid juxtaposing two
VMS-syntax directories when MM[SK] is run. Also expands expressions which
are all macro, so that we can tell how long the expansion is, and avoid
overrunning DCL's command buffer when MM[KS] is running.
-If optional second argument has a TRUE value, then the return string is
-a VMS-syntax directory specification, if it is FALSE, the return string
-is a VMS-syntax file specification, and if it is not specified, fixpath()
-checks to see whether it matches the name of a directory in the current
-default directory, and returns a directory or file specification accordingly.
+fixpath() checks to see whether the result matches the name of a
+directory in the current default directory and returns a directory or
+file specification accordingly. C<$is_dir> can be set to true to
+force fixpath() to consider the path to be a directory or false to force
+it to be a file.
NOTE: This is the canonical version of the method. The version in
File::Spec::VMS is deprecated.
=back
+
+=head1 AUTHOR
+
+Original author Charles Bailey F<bailey@newman.upenn.edu>
+
+Maintained by Michael G Schwern F<schwern@pobox.com>
+
+See L<ExtUtils::MakeMaker> for patching and contact information.
+
+
=cut
1;
--- /dev/null
+package ExtUtils::MM_VOS;
+
+use strict;
+use vars qw($VERSION @ISA);
+$VERSION = '0.02';
+
+require ExtUtils::MM_Unix;
+@ISA = qw(ExtUtils::MM_Unix);
+
+
+=head1 NAME
+
+ExtUtils::MM_VOS - VOS specific subclass of ExtUtils::MM_Unix
+
+=head1 SYNOPSIS
+
+ Don't use this module directly.
+ Use ExtUtils::MM and let it choose.
+
+=head1 DESCRIPTION
+
+This is a subclass of ExtUtils::MM_Unix which contains functionality for
+VOS.
+
+Unless otherwise stated it works just like ExtUtils::MM_Unix
+
+=head2 Overridden methods
+
+=head3 extra_clean_files
+
+Cleanup VOS core files
+
+=cut
+
+sub extra_clean_files {
+ return qw(*.kp);
+}
+
+
+=head1 AUTHOR
+
+Michael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix
+
+=head1 SEE ALSO
+
+L<ExtUtils::MakeMaker>
+
+=cut
+
+
+1;
=cut
-use Config;
+use ExtUtils::MakeMaker::Config;
use File::Basename;
use File::Spec;
use ExtUtils::MakeMaker qw( neatvalue );
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
-$VERSION = '1.10';
+$VERSION = '1.11';
$ENV{EMXSHELL} = 'sh'; # to run `commands`
}
-=item B<find_tests>
-
-The Win9x shell does not expand globs and I'll play it safe and assume
-other Windows variants don't either.
-
-So we do it for them.
-
-=cut
-
-sub find_tests {
- return join(' ', <t\\*.t>);
-}
-
-
=item B<init_DIRFILESEP>
Using \ for Windows.
$self->{TEST_F} ||= '$(ABSPERLRUN) -MExtUtils::Command -e test_f';
$self->{DEV_NULL} ||= '> NUL';
+ $self->{FIXIN} ||= $self->{PERL_CORE} ?
+ '$(PERLRUN) ../../win32/bin/pl2bat.pl' :
+ 'pl2bat.bat';
+
$self->{LD} ||= $Config{ld} || 'link';
$self->{AR} ||= $Config{ar} || 'lib';
}
-=item init_platform (o)
+=item init_platform
Add MM_Win32_VERSION.
-=item platform_constants (o)
+=item platform_constants
=cut
}
-=item special_targets (o)
+=item special_targets
Add .USESHELL target for dmake.
}
-=item static_lib (o)
+=item static_lib
Changes how to run the linker.
my(@m);
push(@m, <<'END');
-$(INST_STATIC): $(OBJECT) $(MYEXTLIB) blibdirs.ts
+$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(RM_RF) $@
END
}
-=item dynamic_lib (o)
+=item dynamic_lib
Complicated stuff for Win32 that I don't understand. :(
OTHERLDFLAGS = '.$otherldflags.'
INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
-$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) blibdirs.ts $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
+$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
');
if ($GCC) {
push(@m,
join('',@m);
}
-=item clean
+=item extra_clean_files
Clean out some extra dll.{base,exp} files which might be generated by
gcc. Otherwise, take out all *.pdb files.
=cut
-sub clean
-{
- my ($self) = shift;
- my $s = $self->SUPER::clean(@_);
- my $clean = $GCC ? 'dll.base dll.exp' : '*.pdb';
- $s .= <<END;
-clean ::
- -\$(RM_F) $clean
+sub extra_clean_files {
+ my $self = shift;
-END
- return $s;
+ return $GCC ? (qw(dll.base dll.exp)) : ('*.pdb');
}
=item init_linker
}
-=item xs_o (o)
+=item xs_o
This target is stubbed out. Not sure why.
}
-=item pasthru (o)
+=item pasthru
All we send is -nologo to nmake to prevent it from printing its damned
banner.
}
-=item oneliner (o)
+=item oneliner
These are based on what command.com does on Win98. They may be wrong
for other Windows shells, I don't know.
}
+=item cd
+
+dmake can handle Unix style cd'ing but nmake (at least 1.5) cannot. It
+wants:
+
+ cd dir
+ command
+ another_command
+ cd ..
+
+B<NOTE> This cd can only go one level down. So far this sufficient for
+what MakeMaker needs.
+
+=cut
+
+sub cd {
+ my($self, $dir, @cmds) = @_;
+
+ return $self->SUPER::cd($dir, @cmds) unless $NMAKE;
+
+ my $cmd = join "\n\t", map "$_", @cmds;
+
+ # No leading tab and no trailing newline makes for easier embedding.
+ my $make_frag = sprintf <<'MAKE_FRAG', $dir, $cmd;
+cd %s
+ %s
+ cd ..
+MAKE_FRAG
+
+ chomp $make_frag;
+
+ return $make_frag;
+}
+
+
=item max_exec_len
nmake 1.50 limits command length to 2048 characters.
package ExtUtils::MM_Win95;
use vars qw($VERSION @ISA);
-$VERSION = 0.03;
+$VERSION = '0.04';
require ExtUtils::MM_Win32;
@ISA = qw(ExtUtils::MM_Win32);
-use Config;
-my $DMAKE = $Config{'make'} =~ /^dmake/i;
-my $NMAKE = $Config{'make'} =~ /^nmake/i;
+use ExtUtils::MakeMaker::Config;
=head1 NAME
=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.
+Most of these make up for limitations in the Win9x/nmake command shell.
+Mostly its lack of &&.
=over 4
-=item dist_test
-
-&& and chdir problem.
-
-=cut
-
-sub dist_test {
- my($self) = shift;
- return q{
-disttest : distdir
- cd $(DISTVNAME)
- $(ABSPERLRUN) Makefile.PL
- $(MAKE) $(PASTHRU)
- $(MAKE) test $(PASTHRU)
- cd ..
-};
-}
-
-=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
return '' unless $self->needs_linking();
'
.xs.c:
- $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
+ $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
'
}
return '' unless $self->needs_linking();
'
.xs.cpp:
- $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp
+ $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp
';
}
return '' unless $self->needs_linking();
'
.xs$(OBJ_EXT):
- $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
+ $(XSUBPPRUN) $(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 max_exec_len
+# $Id: $
package ExtUtils::MakeMaker;
BEGIN {require 5.005_03;}
-$VERSION = '6.25';
-($Revision) = q$Revision: 1.147 $ =~ /Revision:\s+(\S+)/;
-
require Exporter;
-use Config;
+use ExtUtils::MakeMaker::Config;
use Carp ();
use File::Path;
use vars qw(
@ISA @EXPORT @EXPORT_OK
- $Revision $VERSION $Verbose %Config
+ $VERSION $Verbose %Config
@Prepend_parent @Parent
%Recognized_Att_Keys @Get_from_Config @MM_Sections @Overridable
$Filename
);
+
+# Has to be on its own line with no $ after it to avoid being noticed by
+# the version control system
+use vars qw($Revision);
use strict;
+$VERSION = '6.27';
+($Revision = q$Revision: 4357 $) =~ /Revision:\s+(\S+)/;
+
@ISA = qw(Exporter);
@EXPORT = qw(&WriteMakefile &writeMakefile $Verbose &prompt);
@EXPORT_OK = qw($VERSION &neatvalue &mkbootstrap &mksymlists);
INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB INST_MAN1DIR INST_MAN3DIR
INSTALLDIRS
- DESTDIR PREFIX
+ DESTDIR PREFIX INSTALLBASE
PERLPREFIX SITEPREFIX VENDORPREFIX
INSTALLPRIVLIB INSTALLSITELIB INSTALLVENDORLIB
INSTALLARCHLIB INSTALLSITEARCH INSTALLVENDORARCH
dynamic_lib static static_lib manifypods processPL
installbin subdirs
clean_subdirs clean realclean_subdirs realclean
- metafile metafile_addtomanifest
- signature signature_addtomanifest
- dist_basics dist_core distdir dist_test dist_ci
+ metafile signature
+ dist_basics dist_core distdir dist_test dist_ci distmeta distsignature
install force perldepend makefile staticmake test ppd
); # loses section ordering
=item PL_FILES
-Ref to hash of files to be processed as perl programs. MakeMaker
-will default to any found *.PL file (except Makefile.PL) being keys
-and the basename of the file being the value. E.g.
+MakeMaker can run programs to generate files for you at build time.
+By default any file named *.PL (except Makefile.PL and Build.PL) in
+the top level directory will be assumed to be a Perl program and run
+passing its own basename in as an argument. For example...
+
+ perl foo.PL foo
+
+This behavior can be overridden by supplying your own set of files to
+search. PL_FILES accepts a hash ref, the key being the file to run
+and the value is passed in as the first argument when the PL file is run.
+
+ PL_FILES => {'bin/foobar.PL' => 'bin/foobar'}
+
+Would run bin/foobar.PL like this:
+
+ perl bin/foobar.PL bin/foobar
+
+If multiple files from one program are desired an array ref can be used.
+
+ PL_FILES => {'bin/foobar.PL' => [qw(bin/foobar1 bin/foobar2)]}
- {'foobar.PL' => 'foobar'}
+In this case the program will be run multiple times using each target file.
-The *.PL files are expected to produce output to the target files
-themselves. If multiple files can be generated from the same *.PL
-file then the value in the hash can be a reference to an array of
-target file names. E.g.
+ perl bin/foobar.PL bin/foobar1
+ perl bin/foobar.PL bin/foobar2
- {'foobar.PL' => ['foobar1','foobar2']}
=item PM
=item SIGN
-When true, perform the generation and addition to the MANIFEST of
-the SIGNATURE file during 'make distdir', via 'cpansign -s'.
+When true, perform the generation and addition to the MANIFEST of the
+SIGNATURE file in the distdir during 'make distdir', via 'cpansign
+-s'.
Note that you need to install the Module::Signature module to
perform this operation.
$VERSION = '1.00';
*VERSION = \'1.01';
- $VERSION = sprintf "%d.%03d", q$Revision: 1.147 $ =~ /(\d+)/g;
+ $VERSION = sprintf "%d.%03d", q$Revision: 4357 $ =~ /(\d+)/g;
$FOO::VERSION = '1.10';
*FOO::VERSION = \'1.11';
our $VERSION = 1.2.3; # new for perl5.6.0
directory with the name C<$(DISTNAME)-$(VERSION)>. If that directory
exists, it will be removed first.
-Additionally, it will create a META.yml module meta-data file and add
-this to your MANFIEST. You can shut this behavior off with the NO_META
-flag.
+Additionally, it will create a META.yml module meta-data file in the
+distdir and add this to the distdir's MANFIEST. You can shut this
+behavior off with the NO_META flag.
=item make disttest
--- /dev/null
+package ExtUtils::MakeMaker::Config;
+
+$VERSION = '0.02';
+
+use strict;
+use Config ();
+
+# Give us an overridable config.
+use vars qw(%Config);
+%Config = %Config::Config;
+
+sub import {
+ my $caller = caller;
+
+ no strict 'refs';
+ *{$caller.'::Config'} = \%Config;
+}
+
+1;
+
+
+=head1 NAME
+
+ExtUtils::MakeMaker::Config - Wrapper around Config.pm
+
+
+=head1 SYNOPSIS
+
+ use ExtUtils::MakeMaker::Config;
+ print $Config{installbin}; # or whatever
+
+
+=head1 DESCRIPTION
+
+B<FOR INTERNAL USE ONLY>
+
+A very thin wrapper around Config.pm so MakeMaker is easier to test.
+
+=cut
package ExtUtils::MakeMaker::FAQ;
-(our $VERSION) = sprintf "%03d", q$Revision: 1.10 $ =~ /Revision:\s+(\S+)/;
+use vars qw($VERSION);
+$VERSION = '1.11';
1;
__END__
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:
+In CVS, RCS and SVN you use $Revision$ (see the documentation of your
+version control system for details) writing it like so:
- $VERSION = sprintf "%d.%03d", q$Revision: 1.10 $ =~ /(\d+)/g;
+ $VERSION = sprintf "%d.%03d", q$Revision$ =~ /(\d+)/g;
-Every time the file is checked in the $Z<>Revision$ will be updated,
+Every time the file is checked in the $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
+If branches are involved (ie. $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.10 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r };
+ $VERSION = do { my @r = (q$Revision$ =~ /\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>?!
$Is_MacOS $Is_VMS
$Debug $Verbose $Quiet $MANIFEST $DEFAULT_MSKIP);
-$VERSION = 1.44;
+$VERSION = '1.45';
@ISA=('Exporter');
@EXPORT_OK = qw(mkmanifest
manicheck filecheck fullcheck skipcheck
if (-e $to) {
unlink($to) or confess "unlink $to: $!";
}
- STRICT_SWITCH: {
+ STRICT_SWITCH: {
best($from,$to), last STRICT_SWITCH if $how eq 'best';
cp($from,$to), last STRICT_SWITCH if $how eq 'cp';
ln($from,$to), last STRICT_SWITCH if $how eq 'ln';
chmod( $perm | ( $perm & 0100 ? 0111 : 0 ), $file );
}
+# Files that are often modified in the distdir. Don't hard link them.
+my @Exceptions = qw(MANIFEST META.yml SIGNATURE);
sub best {
my ($srcFile, $dstFile) = @_;
- if (!$Config{d_link} or -l $srcFile) {
+
+ my $is_exception = grep $srcFile =~ /$_/, @Exceptions;
+ if ($is_exception or !$Config{d_link} or -l $srcFile) {
cp($srcFile, $dstFile);
} else {
ln($srcFile, $dstFile) or cp($srcFile, $dstFile);
backwacking lots of dollar signs because you have one interpolated
perl variable, like this:
- return <<'EOT'
-
+ return <<EOT;
subdirs ::
\$(NOECHO)cd $subdir && \$(MAKE) -f \$(FIRST_MAKEFILE) all \$(PASTHRU)
+
EOT
or are switching quoting contexts:
- return <<q{
+ 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
Backwards Compatibility
-- MakeMaker must be backwards compatible to 5.5.3 (5.005_03). Avoid any
+- MakeMaker must be backwards compatible to 5.5.4 (5.005_04). 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
+ which didn't come with 5.5.4 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.
+- With the exception of MacOS Classic, MakeMaker must work on all
+ architectures Perl works on (see perlport.pod). This means all Unixen
+ (including Cygwin and MacOS X), Windows (including Win9x and DOS), and VMS.
+
+- Use the available macros rather than shell commands $(MV), $(CP),
+ $(TOUCH), etc...
+
+- MakeMaker must work on many makes. GNU, BSD, Solaris, nmake, dmake, MMS
+ and MMK to name the most common. Keep your make code as simple as
+ possible.
+
+- Avoid special variables (even $@).
+
+- Format targets as "target : dependency", the spacing is important.
+
+- Use $(NOECHO) instead of @.
+
+- Always put a space between $(NOECHO) and the command.
+
+- Always put a space between - (ignore) and the command.
+
+- Always put $(NOECHO) and - together, no space between them.
- 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.
+ Unix, Windows 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).
=begin private
- =item _foo_bar
+ =head3 _foo_bar
$mm->_foo_bar
Windows: nmake or dmake will work. GNU make will *not*.
ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe nmake
-http://search.cpan.org/author/GSAR/dmake-4.1pl1-win32/ dmake
+http://search.cpan.org/dist/dmake/ dmake
VMS: MMS or the free MadGoat MaKe utility (MMK) will work.
http://www.madgoat.com/mmk.html MMK
use ExtUtils::MakeMaker;
use File::Spec;
use TieOut;
-use Config;
+use ExtUtils::MakeMaker::Config;
my $Is_VMS = $^O eq 'VMS';
# 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;
-
_set_config(installman1dir => '');
_set_config(installman3dir => '');
# 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;
-
_set_config(installvendorman1dir => File::Spec->catdir('foo','bar') );
_set_config(installvendorman3dir => '' );
_set_config(usevendorprefix => 1 );
# Check that when installsiteman*dir isn't set in Config it falls back
# to installman*dir
{
- undef *ExtUtils::MM_Unix::Config;
- undef *ExtUtils::MM_Unix::Config_Override;
- %ExtUtils::MM_Unix::Config = %Config;
- *ExtUtils::MM_VMS::Config = \%ExtUtils::MM_Unix::Config;
-
_set_config(installman1dir => File::Spec->catdir('foo', 'bar') );
_set_config(installman3dir => File::Spec->catdir('foo', 'baz') );
_set_config(installsiteman1dir => '' );
# Check that when usevendoprefix and installvendorman*dir aren't set in
# Config it leaves them unset.
{
- undef *ExtUtils::MM_Unix::Config;
- undef *ExtUtils::MM_Unix::Config_Override;
- %ExtUtils::MM_Unix::Config = %Config;
- *ExtUtils::MM_VMS::Config = \%ExtUtils::MM_Unix::Config;
-
_set_config(installman1dir => File::Spec->catdir('foo', 'bar') );
_set_config(installman3dir => File::Spec->catdir('foo', 'baz') );
_set_config(installsiteman1dir => '' );
sub _set_config {
my($k,$v) = @_;
(my $k_no_install = $k) =~ s/^install//i;
- $ExtUtils::MM_Unix::Config{$k} = $v;
+ $Config{$k} = $v;
# Because VMS's config has traditionally been underpopulated, it will
# fall back to the install-less versions in desperation.
- $ExtUtils::MM_Unix::Config{$k_no_install} = $v if $Is_VMS;
+ $Config{$k_no_install} = $v if $Is_VMS;
return;
}
unshift @INC, 't/lib/';
}
}
+chdir 't';
my $Is_VMS = $^O eq 'VMS';
-chdir($Is_VMS ? 'BFD_TEST_ROOT:[t]' : 't');
-
use strict;
BEGIN {
if ($^O =~ /MSWin32/i) {
- plan tests => 42;
+ plan tests => 41;
} else {
plan skip_all => 'This is not Win32';
}
# dynamic_bs() should look into that
# dynamic_lib() should look into that
-# clean()
-{
- my $clean = $Config{cc} =~ /^gcc/i ? 'dll.base dll.exp' : '*.pdb';
- like( $MM->clean(), qr/^clean ::\s+\Q-$(RM_F) $clean\E\s+$/m,
- 'clean() Makefile target' );
-}
-
# init_linker
{
my $libperl = File::Spec->catfile('$(PERL_INC)',
--- /dev/null
+#!/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 strict;
+use Test::More 'no_plan';
+
+use File::Spec;
+use MakeMaker::Test::Setup::PL_FILES;
+use MakeMaker::Test::Utils;
+
+my $perl = which_perl();
+my $make = make_run();
+perl_lib();
+
+setup;
+
+END {
+ ok( chdir File::Spec->updir );
+ ok( teardown );
+}
+
+ok chdir('PL_FILES-Module');
+
+run(qq{$perl Makefile.PL});
+cmp_ok( $?, '==', 0 );
+
+my $make_out = run("$make");
+is( $?, 0 ) || diag $make_out;
+
+foreach my $file (qw(single.out 1.out 2.out)) {
+ ok( -e $file, "$file was created" );
+}
use strict;
use Config;
-use Test::More tests => 79;
+use Test::More tests => 80;
use MakeMaker::Test::Utils;
use MakeMaker::Test::Setup::BFD;
use File::Find;
my $perl = which_perl();
my $Is_VMS = $^O eq 'VMS';
-chdir($Is_VMS ? 'BFD_TEST_ROOT:[t]' : 't');
-
+chdir 't';
perl_lib;
my %files = ();
find( sub {
# do it case-insensitive for non-case preserving OSs
- $files{lc $_} = $File::Find::name;
+ my $file = lc $_;
+
+ # VMS likes to put dots on the end of things that don't have them.
+ $file =~ s/\.$// if $Is_VMS;
+
+ $files{$file} = $File::Find::name;
}, '../dummy-install' );
ok( $files{'dummy.pm'}, ' Dummy.pm installed' );
ok( $files{'liar.pm'}, ' Liar.pm installed' );
+ok( $files{'program'}, ' program 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;
+ skip 'VMS install targets do not preserve $(PREFIX)', 9 if $Is_VMS;
$install_out = run("$make install PREFIX=elsewhere");
is( $?, 0, 'install with PREFIX override' ) || diag $install_out;
find( sub { $files{$_} = $File::Find::name; }, 'elsewhere' );
ok( $files{'Dummy.pm'}, ' Dummy.pm installed' );
ok( $files{'Liar.pm'}, ' Liar.pm installed' );
+ ok( $files{'program'}, ' program 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;
+ skip 'VMS install targets do not preserve $(DESTDIR)', 11 if $Is_VMS;
$install_out = run("$make install PREFIX= DESTDIR=other");
is( $?, 0, 'install with DESTDIR' ) ||
}, 'other' );
ok( $files{'Dummy.pm'}, ' Dummy.pm installed' );
ok( $files{'Liar.pm'}, ' Liar.pm installed' );
+ ok( $files{'program'}, ' program installed' );
ok( $files{'.packlist'}, ' packlist created' );
ok( $files{'perllocal.pod'},' perllocal.pod created' );
SKIP: {
- skip "VMS install targets do not preserve $(PREFIX)", 9 if $Is_VMS;
+ skip 'VMS install targets do not preserve $(PREFIX)', 10 if $Is_VMS;
$install_out = run("$make install PREFIX=elsewhere DESTDIR=other/");
is( $?, 0, 'install with PREFIX override and DESTDIR' ) ||
find( sub { $files{$_} = $File::Find::name; }, 'other/elsewhere' );
ok( $files{'Dummy.pm'}, ' Dummy.pm installed' );
ok( $files{'Liar.pm'}, ' Liar.pm installed' );
+ ok( $files{'program'}, ' program installed' );
ok( $files{'.packlist'}, ' packlist created' );
ok( $files{'perllocal.pod'},' perllocal.pod created' );
rmtree('other');
# Test META.yml generation
use ExtUtils::Manifest qw(maniread);
-ok( -f 'META.yml', 'META.yml written' );
-my $manifest = maniread();
+
+my $distdir = 'Big-Dummy-0.01';
+$distdir =~ s/\./_/g if $Is_VMS;
+my $meta_yml = "$distdir/META.yml";
+
+ok( !-f 'META.yml', 'META.yml not written to source dir' );
+ok( -f $meta_yml, 'META.yml written to dist dir' );
+ok( !-e "META_new.yml", 'temp META.yml file not left around' );
+
+my $manifest = maniread("$distdir/MANIFEST");
# 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)' );
-my $meta_mtime = (stat('META.yml'))[9];
-sleep 1;
-my $metafile_out = run("$make metafile");
-is( $?, 0, 'metafile' ) || diag($metafile_out);
-is( (stat('META.yml'))[9], $meta_mtime, 'META.yml untouched if not changed' );
-ok( !-e 'META_new.yml', 'temp META.yml file not left around' );
# Test NO_META META.yml suppression
-unlink 'META.yml';
-ok( !-f 'META.yml', 'META.yml deleted' );
+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);
-$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);
+my $distdir_out = run("$make distdir");
+is( $?, 0, 'distdir' ) || diag($distdir_out);
+ok( !-f $meta_yml, 'META.yml generation suppressed by NO_META' );
# Make sure init_dirscan doesn't go into the distdir
--- /dev/null
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ('../lib', 'lib/');
+ }
+ else {
+ unshift @INC, 't/lib/';
+ }
+}
+
+use Test::More tests => 3;
+use Config ();
+
+BEGIN { use_ok 'ExtUtils::MakeMaker::Config'; }
+
+is $Config{path_sep}, $Config::Config{path_sep};
+
+eval {
+ $Config{wibble} = 42;
+};
+is $Config{wibble}, 42;
use Test::More tests => 1;
use ExtUtils::MakeMaker;
-# For backwards compat with some Tk modules, dir_target() has to be there.
-can_ok('MM', 'dir_target');
\ No newline at end of file
+# dir_target() was typo'd as dir_targets()
+can_ok('MM', 'dir_target');
--- /dev/null
+#!/usr/bin/perl -w
+
+# Tests INSTALLBASE
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use File::Path;
+use Config;
+
+use Test::More tests => 21;
+use MakeMaker::Test::Utils;
+use MakeMaker::Test::Setup::BFD;
+
+my $Is_VMS = $^O eq 'VMS';
+
+my $perl = which_perl();
+
+chdir 't';
+perl_lib;
+
+ok( setup_recurs(), 'setup' );
+END {
+ ok( chdir File::Spec->updir );
+ ok( teardown_recurs(), 'teardown' );
+}
+
+ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy") || diag("chdir failed; $!");
+
+my @mpl_out = run(qq{$perl Makefile.PL "INSTALLBASE=../dummy-install"});
+END { rmtree '../dummy-install'; }
+
+cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) ||
+ diag(@mpl_out);
+
+my $makefile = makefile_name();
+ok( grep(/^Writing $makefile for Big::Dummy/,
+ @mpl_out) == 1,
+ 'Makefile.PL output looks right');
+
+my $make = make_run();
+run("$make"); # this is necessary due to a dmake bug.
+my $install_out = run("$make install");
+is( $?, 0, ' make install exited normally' ) || diag $install_out;
+like( $install_out, qr/^Installing /m );
+like( $install_out, qr/^Writing /m );
+
+ok( -r '../dummy-install', ' install dir created' );
+
+my @installed_files =
+ ('../dummy-install/lib/perl5/Big/Dummy.pm',
+ '../dummy-install/lib/perl5/Big/Liar.pm',
+ '../dummy-install/bin/program',
+ "../dummy-install/lib/perl5/$Config{archname}/perllocal.pod",
+ "../dummy-install/lib/perl5/$Config{archname}/auto/Big/Dummy/.packlist"
+ );
+
+foreach my $file (@installed_files) {
+ ok( -e $file, " $file installed" );
+ ok( -r $file, " $file readable" );
+}
+
+
+# nmake outputs its damned logo
+# Send STDERR off to oblivion.
+open(SAVERR, ">&STDERR") or die $!;
+open(STDERR, ">".File::Spec->devnull) or die $!;
+
+my $realclean_out = run("$make realclean");
+is( $?, 0, 'realclean' ) || diag($realclean_out);
+
+open(STDERR, ">&SAVERR") or die $!;
+close SAVERR;
else {
plan tests => 3;
}
-use Config;
+use ExtUtils::MakeMaker::Config;
use File::Spec;
use ExtUtils::MM;
SKIP: {
skip "Test for DOSish prefixification", 1 unless $Is_Dosish;
- undef *ExtUtils::MM_Unix::Config;
- $ExtUtils::MM_Unix::Config{wibble} = 'C:\opt\perl\wibble';
+ $Config{wibble} = 'C:\opt\perl\wibble';
$mm->prefixify('wibble', 'C:\opt\perl', 'C:\yarrow');
is( $mm->{WIBBLE}, 'C:\yarrow\wibble', 'prefixify Win32 paths' );
my $Makefile = makefile_name();
my $Is_VMS = $^O eq 'VMS';
-chdir($Is_VMS ? 'BFD_TEST_ROOT:[t]' : 't');
+chdir 't';
perl_lib;
$| = 1;
my $make = make_run();
-run("$make");
-is( $?, 0, 'recursive make exited normally' );
+my $make_out = run("$make");
+is( $?, 0, 'recursive make exited normally' ) || diag $make_out;
ok( chdir File::Spec->updir );
ok( teardown_recurs(), 'cleaning out recurs' );
--- /dev/null
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ('../lib', 'lib/');
+ }
+ else {
+ unshift @INC, 't/lib/';
+ }
+}
+chdir 't';
+
+use Test::More;
+use MakeMaker::Test::Utils;
+
+if( have_compiler() ) {
+ plan tests => 1;
+}
+else {
+ plan skip_all => "ExtUtils::CBuilder not installed or couldn't find a compiler";
+}
+
+pass("You have a compiler, isn't that great?");
use strict;
use File::Path;
use File::Basename;
+use MakeMaker::Test::Utils;
+my $Is_VMS = $^O eq 'VMS';
my %Files = (
'Big-Dummy/lib/Big/Dummy.pm' => <<'END',
WriteMakefile(
NAME => 'Big::Dummy',
VERSION_FROM => 'lib/Big/Dummy.pm',
+ EXE_FILES => [qw(bin/program)],
PREREQ_PM => { strict => 0 },
ABSTRACT_FROM => 'lib/Big/Dummy.pm',
AUTHOR => 'Michael G Schwern <schwern@pobox.com>',
);
END
+ 'Big-Dummy/bin/program' => <<'END',
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+program - this is a program
+
+=cut
+
+1;
+END
+
'Big-Dummy/t/compile.t' => <<'END',
print "1..2\n";
);
-sub _setup_bfd_test_root {
- 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';
- }
-}
-
sub setup_recurs {
- _setup_bfd_test_root();
+ setup_mm_test_root();
+ chdir 'MM_TEST_ROOT:[t]' if $Is_VMS;
while(my($file, $text) = each %Files) {
# Convert to a relative, native file path.
--- /dev/null
+package MakeMaker::Test::Setup::PL_FILES;
+
+@ISA = qw(Exporter);
+require Exporter;
+@EXPORT = qw(setup teardown);
+
+use strict;
+use File::Path;
+use File::Basename;
+use File::Spec;
+use MakeMaker::Test::Utils;
+
+my %Files = (
+ 'PL_FILES-Module/Makefile.PL' => <<'END',
+use ExtUtils::MakeMaker;
+
+# A module for testing PL_FILES
+WriteMakefile(
+ NAME => 'PL_FILES::Module',
+ PL_FILES => { 'single.PL' => 'single.out',
+ 'multi.PL' => [qw(1.out 2.out)]
+ }
+);
+END
+
+ 'PL_FILES-Module/single.PL' => _gen_pl_files(),
+ 'PL_FILES-Module/multi.PL' => _gen_pl_files(),
+);
+
+
+sub _gen_pl_files {
+ my $test = <<'END';
+#!/usr/bin/perl -w
+
+# Had a bug where PL_FILES weren't sent the file to generate
+die "argv empty\n" unless @ARGV;
+die "too many in argv: @ARGV\n" unless @ARGV == 1;
+
+my $file = $ARGV[0];
+open OUT, ">$file" or die $!;
+
+print OUT "Testing\n";
+close OUT
+END
+
+ $test =~ s/^\n//;
+
+ return $test;
+}
+
+
+sub setup {
+ setup_mm_test_root();
+ chdir 'MM_TEST_ROOT:[t]' if $^O eq 'VMS';
+
+ while(my($file, $text) = each %Files) {
+ # Convert to a relative, native file path.
+ $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
+
+ my $dir = dirname($file);
+ mkpath $dir;
+ open(FILE, ">$file") || die "Can't create $file: $!";
+ print FILE $text;
+ close FILE;
+ }
+
+ return 1;
+}
+
+sub teardown {
+ foreach my $file (keys %Files) {
+ my $dir = dirname($file);
+ if( -e $dir ) {
+ rmtree($dir) || return;
+ }
+ }
+ return 1;
+}
use strict;
use File::Path;
use File::Basename;
+use MakeMaker::Test::Utils;
my %Files = (
'Recurs/Makefile.PL' => <<'END',
);
sub setup_recurs {
+ setup_mm_test_root();
+ chdir 'MM_TEST_ROOT:[t]' if $^O eq 'VMS';
+
while(my($file, $text) = each %Files) {
# Convert to a relative, native file path.
$file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
require Exporter;
@ISA = qw(Exporter);
-$VERSION = 0.02;
+$VERSION = 0.03;
@EXPORT = qw(which_perl perl_lib makefile_name makefile_backup
make make_run run make_macro calibrate_mtime
+ setup_mm_test_root
+ have_compiler
);
my $Is_VMS = $^O eq 'VMS';
my $out = run($cmd);
+ my $have_compiler = have_compiler();
+
+
=head1 DESCRIPTION
A consolidation of little utility functions used through out the
sub makefile_backup {
my $makefile = makefile_name;
- return $Is_VMS ? $makefile : "$makefile.old";
+ return $Is_VMS ? "$makefile".'_old' : "$makefile.old";
}
=item B<make>
else {
return `$cmd`;
}
-}
+}
+
+=item B<setup_mm_test_root>
+
+Creates a rooted logical to avoid the 8-level limit on older VMS systems.
+No action taken on non-VMS systems.
+
+=cut
+
+sub setup_mm_test_root {
+ if( $Is_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( MMTMP, '>mmtesttmp.com' ) ||
+ die "Error creating command file; $!";
+ print MMTMP <<'COMMAND';
+$ MM_TEST_ROOT = F$PARSE("SYS$DISK:[-]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]"
+$ DEFINE/JOB/NOLOG/TRANSLATION=CONCEALED MM_TEST_ROOT 'MM_TEST_ROOT'
+COMMAND
+ close MMTMP;
+
+ system '@mmtesttmp.com';
+ 1 while unlink 'mmtesttmp.com';
+ }
+}
+
+=item have_compiler
+
+ $have_compiler = have_compiler;
+
+Returns true if there is a compiler available for XS builds.
+
+=cut
+
+sub have_compiler {
+ my $have_compiler = 0;
+
+ # ExtUtils::CBuilder prints its compilation lines to the screen.
+ # Shut it up.
+ require TieOut;
+ local *STDOUT = *STDOUT;
+ local *STDERR = *STDERR;
+
+ tie *STDOUT, 'TieOut';
+ tie *STDERR, 'TieOut';
+
+ eval {
+ require ExtUtils::CBuilder;
+ my $cb = ExtUtils::CBuilder->new;
+
+ $have_compiler = $cb->have_compiler;
+ };
+
+ return $have_compiler;
+}
+
=back