X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/e0678a309fa2965f0728bdee01f05148de03bc0c..aeef272316a199aeddb8b9a9713adffbef5806b1:/lib/ExtUtils/MM_Win32.pm diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 2d8ccca..7a7c60a 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -1,5 +1,7 @@ package ExtUtils::MM_Win32; +use strict; + =head1 NAME @@ -15,8 +17,6 @@ See ExtUtils::MM_Unix for a documentation of the methods provided there. This package overrides the implementation of these methods, not the semantics. -=over 4 - =cut use Config; @@ -24,12 +24,12 @@ use File::Basename; use File::Spec; use ExtUtils::MakeMaker qw( neatvalue ); -use vars qw(@ISA $VERSION $BORLAND $GCC $DMAKE $NMAKE $PERLMAKE); +use vars qw(@ISA $VERSION $BORLAND $GCC $DMAKE $NMAKE); require ExtUtils::MM_Any; require ExtUtils::MM_Unix; @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -$VERSION = '1.04_01'; +$VERSION = '1.10'; $ENV{EMXSHELL} = 'sh'; # to run `commands` @@ -37,7 +37,15 @@ $BORLAND = 1 if $Config{'cc'} =~ /^bcc/i; $GCC = 1 if $Config{'cc'} =~ /^gcc/i; $DMAKE = 1 if $Config{'make'} =~ /^dmake/i; $NMAKE = 1 if $Config{'make'} =~ /^nmake/i; -$PERLMAKE = 1 if $Config{'make'} =~ /^pmake/i; + + +=head2 Overridden methods + +=over 4 + +=item B + +=cut sub dlsyms { my($self,%attribs) = @_; @@ -47,7 +55,6 @@ sub dlsyms { my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || []; my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {}; my(@m); - (my $boot = $self->{NAME}) =~ s/:/_/g; if (not $self->{SKIPHASH}{'dynamic'}) { push(@m," @@ -69,12 +76,30 @@ $self->{BASEEXT}.def: Makefile.PL join('',@m); } +=item replace_manpage_separator + +Changes the path separator with . + +=cut + sub replace_manpage_separator { my($self,$man) = @_; $man =~ s,/+,.,g; $man; } + +=item B + +Since Windows has nothing as simple as an executable bit, we check the +file extension. + +The PATHEXT env variable will be used to get a list of extensions that +might indicate a command, otherwise .com, .exe, .bat and .cmd will be +used by default. + +=cut + sub maybe_command { my($self,$file) = @_; my @e = exists($ENV{'PATHEXT'}) @@ -96,299 +121,184 @@ sub maybe_command { } -sub find_perl { - my($self, $ver, $names, $dirs, $trace) = @_; - $trace ||= 0; +=item B - my($name, $dir); - if ($trace >= 2){ - print "Looking for perl $ver by these names: -@$names -in these dirs: -@$dirs -"; - } - foreach $dir (@$dirs){ - next unless defined $dir; # $self->{PERL_SRC} may be undefined - foreach $name (@$names){ - my ($abs, $val); - if (File::Spec->file_name_is_absolute($name)) { # /foo/bar - $abs = $name; - } elsif (File::Spec->canonpath($name) eq - File::Spec->canonpath(basename($name))) # foo - { - $abs = File::Spec->catfile($dir, $name); - } else { # foo/bar - $abs = File::Spec->canonpath( - File::Spec->catfile(File::Spec->curdir, $name) - ); - } - print "Checking $abs\n" if ($trace >= 2); - next unless $self->maybe_command($abs); - print "Executing $abs\n" if ($trace >= 2); - (my($safe_abs) = $abs) =~ s{(\s)}{\\$1}g; - $val = `$safe_abs -e "require $ver;" 2>&1`; - if ($? == 0) { - print "Using PERL=$abs\n" if $trace; - return $abs; - } elsif ($trace >= 2) { - print "Result: `$val'\n"; - } - } - } - print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; - 0; # false and not empty -} +The Win9x shell does not expand globs and I'll play it safe and assume +other Windows variants don't either. -sub init_others -{ - my ($self) = @_; - $self->SUPER::init_others; - $self->{'TOUCH'} = '$(PERLRUN) -MExtUtils::Command -e touch'; - $self->{'CHMOD'} = '$(PERLRUN) -MExtUtils::Command -e chmod'; - $self->{'CP'} = '$(PERLRUN) -MExtUtils::Command -e cp'; - $self->{'RM_F'} = '$(PERLRUN) -MExtUtils::Command -e rm_f'; - $self->{'RM_RF'} = '$(PERLRUN) -MExtUtils::Command -e rm_rf'; - $self->{'MV'} = '$(PERLRUN) -MExtUtils::Command -e mv'; - $self->{'NOOP'} = 'rem'; - $self->{'TEST_F'} = '$(PERLRUN) -MExtUtils::Command -e test_f'; - $self->{'LD'} = $Config{'ld'} || 'link'; - $self->{'AR'} = $Config{'ar'} || 'lib'; - $self->{'LDLOADLIBS'} ||= $Config{'libs'}; - # -Lfoo must come first for Borland, so we put it in LDDLFLAGS - if ($BORLAND) { - my $libs = $self->{'LDLOADLIBS'}; - my $libpath = ''; - while ($libs =~ s/(?:^|\s)(("?)-L.+?\2)(?:\s|$)/ /) { - $libpath .= ' ' if length $libpath; - $libpath .= $1; - } - $self->{'LDLOADLIBS'} = $libs; - $self->{'LDDLFLAGS'} ||= $Config{'lddlflags'}; - $self->{'LDDLFLAGS'} .= " $libpath"; - } - $self->{'DEV_NULL'} = '> NUL'; +So we do it for them. + +=cut + +sub find_tests { + return join(' ', ); } -=item constants (o) +=item B -Initializes lots of constants and .SUFFIXES and .PHONY +Using \ for Windows. =cut -sub constants { - my($self) = @_; - my(@m,$tmp); - - for $tmp (qw/ - - AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION - VERSION_SYM XS_VERSION INST_BIN INST_LIB - INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS - INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB - INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB - PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB - FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC - PERL_INC PERL FULLPERL PERLRUN FULLPERLRUN PERLRUNINST - FULLPERLRUNINST ABSPERL ABSPERLRUN ABSPERLRUNINST - FULL_AR PERL_CORE - - / ) { - next unless defined $self->{$tmp}; - push @m, "$tmp = $self->{$tmp}\n"; - } +sub init_DIRFILESEP { + my($self) = shift; - push @m, qq{ -VERSION_MACRO = VERSION -DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\" -XS_VERSION_MACRO = XS_VERSION -XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\" -}; + # The ^ makes sure its not interpreted as an escape in nmake + $self->{DIRFILESEP} = $NMAKE ? '^\\' : + $DMAKE ? '\\\\' + : '\\'; +} - push @m, qq{ -MAKEMAKER = $INC{'ExtUtils/MakeMaker.pm'} -MM_VERSION = $ExtUtils::MakeMaker::VERSION -}; +=item B - push @m, q{ -# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle). -# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle) -# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) -# DLBASE = Basename part of dynamic library. May be just equal BASEEXT. -}; +Override some of the Unix specific commands with portable +ExtUtils::Command ones. - for $tmp (qw/ - FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT - LDFROM LINKTYPE - / ) { - next unless defined $self->{$tmp}; - push @m, "$tmp = $self->{$tmp}\n"; - } +Also provide defaults for LD and AR in case the %Config values aren't +set. + +LDLOADLIBS's default is changed to $Config{libs}. - push @m, " -# Handy lists of source code files: -XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})." -C_FILES = ".join(" \\\n\t", @{$self->{C}})." -O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})." -H_FILES = ".join(" \\\n\t", @{$self->{H}})." -MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})." -MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})." -"; - - for $tmp (qw/ - INST_MAN1DIR INSTALLMAN1DIR MAN1EXT - INST_MAN3DIR INSTALLMAN3DIR MAN3EXT - /) { - next unless defined $self->{$tmp}; - push @m, "$tmp = $self->{$tmp}\n"; +Adjustments are made for Borland's quirks needing -L to come first. + +=cut + +sub init_others { + my ($self) = @_; + + # Used in favor of echo because echo won't strip quotes. :( + $self->{ECHO} ||= $self->oneliner('print qq{@ARGV}', ['-l']); + $self->{ECHO_N} ||= $self->oneliner('print qq{@ARGV}'); + + $self->{TOUCH} ||= '$(ABSPERLRUN) -MExtUtils::Command -e touch'; + $self->{CHMOD} ||= '$(ABSPERLRUN) -MExtUtils::Command -e chmod'; + $self->{CP} ||= '$(ABSPERLRUN) -MExtUtils::Command -e cp'; + $self->{RM_F} ||= '$(ABSPERLRUN) -MExtUtils::Command -e rm_f'; + $self->{RM_RF} ||= '$(ABSPERLRUN) -MExtUtils::Command -e rm_rf'; + $self->{MV} ||= '$(ABSPERLRUN) -MExtUtils::Command -e mv'; + $self->{NOOP} ||= 'rem'; + $self->{TEST_F} ||= '$(ABSPERLRUN) -MExtUtils::Command -e test_f'; + $self->{DEV_NULL} ||= '> NUL'; + + $self->{LD} ||= $Config{ld} || 'link'; + $self->{AR} ||= $Config{ar} || 'lib'; + + $self->SUPER::init_others; + + # Setting SHELL from $Config{sh} can break dmake. Its ok without it. + delete $self->{SHELL}; + + $self->{LDLOADLIBS} ||= $Config{libs}; + # -Lfoo must come first for Borland, so we put it in LDDLFLAGS + if ($BORLAND) { + my $libs = $self->{LDLOADLIBS}; + my $libpath = ''; + while ($libs =~ s/(?:^|\s)(("?)-L.+?\2)(?:\s|$)/ /) { + $libpath .= ' ' if length $libpath; + $libpath .= $1; + } + $self->{LDLOADLIBS} = $libs; + $self->{LDDLFLAGS} ||= $Config{lddlflags}; + $self->{LDDLFLAGS} .= " $libpath"; } - push @m, qq{ -.USESHELL : -} if $DMAKE; + return 1; +} - push @m, q{ -.NO_CONFIG_REC: Makefile -} if $ENV{CLEARCASE_ROOT}; - # why not q{} ? -- emacs - push @m, qq{ -# work around a famous dec-osf make(1) feature(?): -makemakerdflt: all +=item init_platform (o) -.SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT) +Add MM_Win32_VERSION. -# Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to -# recall, that some make implementations will delete the Makefile when we -# rebuild it. Because we call false(1) when we rebuild it. So make(1) is -# not completely wrong when it does so. Our milage may vary. -# .PRECIOUS: Makefile # seems to be not necessary anymore +=item platform_constants (o) -.PHONY: all config static dynamic test linkext manifest +=cut -# Where is the Config information that we are using/depend on -CONFIGDEP = \$(PERL_ARCHLIB)\\Config.pm \$(PERL_INC)\\config.h -}; +sub init_platform { + my($self) = shift; - my @parentdir = split(/::/, $self->{PARENT_NAME}); - push @m, q{ -# Where to put things: -INST_LIBDIR = }. File::Spec->catdir('$(INST_LIB)',@parentdir) .q{ -INST_ARCHLIBDIR = }. File::Spec->catdir('$(INST_ARCHLIB)',@parentdir) .q{ + $self->{MM_Win32_VERSION} = $VERSION; +} -INST_AUTODIR = }. File::Spec->catdir('$(INST_LIB)','auto','$(FULLEXT)') .q{ -INST_ARCHAUTODIR = }. File::Spec->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)') .q{ -}; +sub platform_constants { + my($self) = shift; + my $make_frag = ''; - if ($self->has_link_code()) { - push @m, ' -INST_STATIC = $(INST_ARCHAUTODIR)\$(BASEEXT)$(LIB_EXT) -INST_DYNAMIC = $(INST_ARCHAUTODIR)\$(DLBASE).$(DLEXT) -INST_BOOT = $(INST_ARCHAUTODIR)\$(BASEEXT).bs -'; - } else { - push @m, ' -INST_STATIC = -INST_DYNAMIC = -INST_BOOT = -'; + foreach my $macro (qw(MM_Win32_VERSION)) + { + next unless defined $self->{$macro}; + $make_frag .= "$macro = $self->{$macro}\n"; } - $tmp = $self->export_list; - push @m, " -EXPORT_LIST = $tmp -"; - $tmp = $self->perl_archive; - push @m, " -PERL_ARCHIVE = $tmp -"; + return $make_frag; +} - push @m, q{ -TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{ -PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{ -}; +=item special_targets (o) - join('',@m); +Add .USESHELL target for dmake. + +=cut + +sub special_targets { + my($self) = @_; + + my $make_frag = $self->SUPER::special_targets; + + $make_frag .= <<'MAKE_FRAG' if $DMAKE; +.USESHELL : +MAKE_FRAG + + return $make_frag; } =item static_lib (o) -Defines how to produce the *.a (or equivalent) files. +Changes how to run the linker. + +The rest is duplicate code from MM_Unix. Should move the linker code +to its own method. =cut sub static_lib { my($self) = @_; -# Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC -# return '' unless $self->needs_linking(); #might be because of a subdir - return '' unless $self->has_link_code; my(@m); push(@m, <<'END'); -$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)\.exists +$(INST_STATIC): $(OBJECT) $(MYEXTLIB) blibdirs.ts $(RM_RF) $@ END + # If this extension has its own library (eg SDBM_File) # then copy that to $(INST_STATIC) and add $(OBJECT) into it. - push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB}; + push @m, <<'MAKE_FRAG' if $self->{MYEXTLIB}; + $(CP) $(MYEXTLIB) $@ +MAKE_FRAG push @m, q{ $(AR) }.($BORLAND ? '$@ $(OBJECT:^"+")' : ($GCC ? '-ru $@ $(OBJECT)' : '-out:$@ $(OBJECT)')).q{ - }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld - $(CHMOD) 755 $@ + $(CHMOD) $(PERM_RWX) $@ + $(NOECHO) $(ECHO) "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld }; -# Old mechanism - still available: + # Old mechanism - still available: + push @m, <<'MAKE_FRAG' if $self->{PERL_SRC} && $self->{EXTRALIBS}; + $(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs +MAKE_FRAG - push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs}."\n\n" - if $self->{PERL_SRC}; - - push @m, $self->dir_target('$(INST_ARCHAUTODIR)'); - join('', "\n",@m); + join('', @m); } -=item dynamic_bs (o) - -Defines targets for bootstrap files. - -=cut - -sub dynamic_bs { - my($self, %attribs) = @_; - return ' -BOOTSTRAP = -' unless $self->has_link_code(); - - return ' -BOOTSTRAP = '."$self->{BASEEXT}.bs".' - -# As Mkbootstrap might not write a file (if none is required) -# we use touch to prevent make continually trying to remake it. -# The DynaLoader only reads a non-empty file. -$(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)\.exists - '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))" - '.$self->{NOECHO}.'$(PERLRUN) \ - -MExtUtils::Mkbootstrap \ - -e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');" - '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP) - $(CHMOD) 644 $@ - -$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists - '."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT) - -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT) - $(CHMOD) 644 $@ -'; -} =item dynamic_lib (o) -Defines how to produce the *.so (or equivalent) files. +Complicated stuff for Win32 that I don't understand. :( =cut @@ -420,7 +330,7 @@ sub dynamic_lib { OTHERLDFLAGS = '.$otherldflags.' INST_DYNAMIC_DEP = '.$inst_dynamic_dep.' -$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP) +$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) blibdirs.ts $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP) '); if ($GCC) { push(@m, @@ -442,13 +352,19 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists .q{$(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)}); } push @m, ' - $(CHMOD) 755 $@ + $(CHMOD) $(PERM_RWX) $@ '; - push @m, $self->dir_target('$(INST_ARCHAUTODIR)'); join('',@m); } +=item clean + +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; @@ -462,308 +378,134 @@ END return $s; } +=item init_linker +=cut -sub perl_archive -{ - my ($self) = @_; - return '$(PERL_INC)\\'.$Config{'libperl'}; -} +sub init_linker { + my $self = shift; -sub export_list -{ - my ($self) = @_; - return "$self->{BASEEXT}.def"; + $self->{PERL_ARCHIVE} = "\$(PERL_INC)\\$Config{libperl}"; + $self->{PERL_ARCHIVE_AFTER} = ''; + $self->{EXPORT_LIST} = '$(BASEEXT).def'; } + =item perl_script -Takes one argument, a file name, and returns the file name, if the -argument is likely to be a perl script. On MM_Unix this is true for -any ordinary, readable file. +Checks for the perl program under several common perl extensions. =cut sub perl_script { my($self,$file) = @_; return $file if -r $file && -f _; - return "$file.pl" if -r "$file.pl" && -f _; + return "$file.pl" if -r "$file.pl" && -f _; + return "$file.plx" if -r "$file.plx" && -f _; return "$file.bat" if -r "$file.bat" && -f _; return; } -=item pm_to_blib -Defines target that copies all files in the hash PM to their -destination and autosplits them. See L - -=cut - -sub pm_to_blib { - my $self = shift; - my($autodir) = File::Spec->catdir('$(INST_LIB)','auto'); - return q{ -pm_to_blib: $(TO_INST_PM) - }.$self->{NOECHO}.q{$(PERLRUNINST) -MExtUtils::Install \ - -e "pm_to_blib(}. - ($NMAKE ? 'qw[ <{NOECHO}.q{$(TOUCH) $@ -}; -} - - -=item tool_autosplit (override) +=item xs_o (o) -Use Win32 quoting on command line. +This target is stubbed out. Not sure why. =cut -sub tool_autosplit{ - my($self, %attribs) = @_; - my($asl) = ""; - $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN}; - q{ -# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto -AUTOSPLITFILE = $(PERLRUN) -MAutoSplit }.$asl.q{ -e "autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1);" -}; +sub xs_o { + return '' } -=item tools_other (o) -Win32 overrides. +=item pasthru (o) -Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in -the Makefile. Also defines the perl programs MKPATH, -WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL. +All we send is -nologo to nmake to prevent it from printing its damned +banner. =cut -sub tools_other { +sub pasthru { my($self) = shift; - my @m; - my $bin_sh = $Config{sh} || 'cmd /c'; - push @m, qq{ -SHELL = $bin_sh -} unless $DMAKE; # dmake determines its own shell - - for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL/ ) { - push @m, "$_ = $self->{$_}\n"; - } - - push @m, q{ -# The following is a portable way to say mkdir -p -# To see which directories are created, change the if 0 to if 1 -MKPATH = $(PERLRUN) -MExtUtils::Command -e mkpath - -# This helps us to minimize the effect of the .exists files A yet -# better solution would be to have a stable file in the perl -# distribution with a timestamp of zero. But this solution doesn't -# need any changes to the core distribution and works with older perls -EQUALIZE_TIMESTAMP = $(PERLRUN) -MExtUtils::Command -e eqtime -}; - - - return join "", @m if $self->{PARENT}; - - push @m, q{ -# Here we warn users that an old packlist file was found somewhere, -# and that they should call some uninstall routine -WARN_IF_OLD_PACKLIST = $(PERL) -lwe "exit unless -f $$ARGV[0];" \\ --e "print 'WARNING: I have found an old package in';" \\ --e "print ' ', $$ARGV[0], '.';" \\ --e "print 'Please make sure the two installations are not conflicting';" - -UNINST=0 -VERBINST=1 - -MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \ --e "install({ @ARGV },'$(VERBINST)',0,'$(UNINST)');" - -DOC_INSTALL = $(PERL) -e "$$\=\"\n\n\";" \ --e "print '=head2 ', scalar(localtime), ': C<', shift, '>', ' L<', $$arg=shift, '|', $$arg, '>';" \ --e "print '=over 4';" \ --e "while (defined($$key = shift) and defined($$val = shift)) { print '=item *';print 'C<', \"$$key: $$val\", '>'; }" \ --e "print '=back';" - -UNINSTALL = $(PERL) -MExtUtils::Install \ --e "uninstall($$ARGV[0],1,1); print \"\nUninstall is deprecated. Please check the";" \ --e "print \" packlist above carefully.\n There may be errors. Remove the\";" \ --e "print \" appropriate files manually.\n Sorry for the inconveniences.\n\"" -}; - - return join "", @m; + return "PASTHRU = " . ($NMAKE ? "-nologo" : ""); } -=item xs_o (o) - -Defines suffix rules to go from XS to object files directly. This is -only intended for broken make implementations. -=cut - -sub xs_o { # many makes are too dumb to use xs_c then c_o - my($self) = shift; - return '' -} +=item oneliner (o) -=item top_targets (o) - -Defines the targets all, subdirs, config, and O_FILES +These are based on what command.com does on Win98. They may be wrong +for other Windows shells, I don't know. =cut -sub top_targets { -# --- Target Sections --- +sub oneliner { + my($self, $cmd, $switches) = @_; + $switches = [] unless defined $switches; - my($self) = shift; - my(@m); + # Strip leading and trailing newlines + $cmd =~ s{^\n+}{}; + $cmd =~ s{\n+$}{}; - push @m, ' -all :: pure_all manifypods - '.$self->{NOECHO}.'$(NOOP) -' - unless $self->{SKIPHASH}{'all'}; - - push @m, ' -pure_all :: config pm_to_blib subdirs linkext - '.$self->{NOECHO}.'$(NOOP) + $cmd = $self->quote_literal($cmd); + $cmd = $self->escape_newlines($cmd); -subdirs :: $(MYEXTLIB) - '.$self->{NOECHO}.'$(NOOP) + $switches = join ' ', @$switches; -config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)\.exists - '.$self->{NOECHO}.'$(NOOP) - -config :: $(INST_ARCHAUTODIR)\.exists - '.$self->{NOECHO}.'$(NOOP) - -config :: $(INST_AUTODIR)\.exists - '.$self->{NOECHO}.'$(NOOP) -'; + return qq{\$(ABSPERLRUN) $switches -e $cmd}; +} - push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]); - if (%{$self->{MAN1PODS}}) { - push @m, qq[ -config :: \$(INST_MAN1DIR)\\.exists - $self->{NOECHO}\$(NOOP) +sub quote_literal { + my($self, $text) = @_; -]; - push @m, $self->dir_target(qw[$(INST_MAN1DIR)]); - } - if (%{$self->{MAN3PODS}}) { - push @m, qq[ -config :: \$(INST_MAN3DIR)\\.exists - $self->{NOECHO}\$(NOOP) + # I don't know if this is correct, but it seems to work on + # Win98's command.com + $text =~ s{"}{\\"}g; -]; - push @m, $self->dir_target(qw[$(INST_MAN3DIR)]); + # dmake eats '{' inside double quotes and leaves alone { outside double + # quotes; however it transforms {{ into { either inside and outside double + # quotes. It also translates }} into }. The escaping below is not + # 100% correct. + if( $DMAKE ) { + $text =~ s/{/{{/g; + $text =~ s/}}/}}}/g; } - push @m, ' -$(O_FILES): $(H_FILES) -' if @{$self->{O_FILES} || []} && @{$self->{H} || []}; - - push @m, q{ -help: - perldoc ExtUtils::MakeMaker -}; - - join('',@m); + return qq{"$text"}; } -=item manifypods (o) -We don't want manpage process. +sub escape_newlines { + my($self, $text) = @_; -=cut + # Escape newlines + $text =~ s{\n}{\\\n}g; -sub manifypods { - my($self) = shift; - return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n"; + return $text; } -=item dist_ci (o) - -Same as MM_Unix version (changes command-line quoting). - -=cut - -sub dist_ci { - my($self) = shift; - my @m; - push @m, q{ -ci : - $(PERLRUN) -MExtUtils::Manifest=maniread \\ - -e "@all = keys %{ maniread() };" \\ - -e "print(\"Executing $(CI) @all\n\"); system(\"$(CI) @all\");" \\ - -e "print(\"Executing $(RCS_LABEL) ...\n\"); system(\"$(RCS_LABEL) @all\");" -}; - join "", @m; -} -=item dist_core (o) +=item max_exec_len -Same as MM_Unix version (changes command-line quoting). +nmake 1.50 limits command length to 2048 characters. =cut -sub dist_core { - my($self) = shift; - my @m; - push @m, q{ -dist : $(DIST_DEFAULT) - }.$self->{NOECHO}.q{$(PERL) -le "print \"Warning: Makefile possibly out of date with $$vf\" if " \ - -e "-e ($$vf=\"$(VERSION_FROM)\") and -M $$vf < -M \"}.$self->{MAKEFILE}.q{\";" - -tardist : $(DISTVNAME).tar$(SUFFIX) - -zipdist : $(DISTVNAME).zip - -$(DISTVNAME).tar$(SUFFIX) : distdir - $(PREOP) - $(TO_UNIX) - $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) - $(RM_RF) $(DISTVNAME) - $(COMPRESS) $(DISTVNAME).tar - $(POSTOP) - -$(DISTVNAME).zip : distdir - $(PREOP) - $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) - $(RM_RF) $(DISTVNAME) - $(POSTOP) - -uutardist : $(DISTVNAME).tar$(SUFFIX) - uuencode $(DISTVNAME).tar$(SUFFIX) \\ - $(DISTVNAME).tar$(SUFFIX) > \\ - $(DISTVNAME).tar$(SUFFIX)_uu - -shdist : distdir - $(PREOP) - $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar - $(RM_RF) $(DISTVNAME) - $(POSTOP) -}; - join "", @m; +sub max_exec_len { + my $self = shift; + + return $self->{_MAX_EXEC_LEN} ||= 2 * 1024; } -=item pasthru (o) -Defines the string that is passed to recursive make calls in -subdirectories. +=item os_flavor + +Windows is Win32. =cut -sub pasthru { - my($self) = shift; - return "PASTHRU = " . ($NMAKE ? "-nologo" : ""); +sub os_flavor { + return('Win32'); }