MakeMaker core sync 5.54_01 -> 5.55_02
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / MM_Win32.pm
index 76e1bd1..2d8ccca 100644 (file)
@@ -1,6 +1,5 @@
 package ExtUtils::MM_Win32;
 
-our $VERSION = '1.00_02';
 
 =head1 NAME
 
@@ -21,16 +20,18 @@ the semantics.
 =cut 
 
 use Config;
-#use Cwd;
 use File::Basename;
 use File::Spec;
-require Exporter;
+use ExtUtils::MakeMaker qw( neatvalue );
 
-require ExtUtils::MakeMaker;
-ExtUtils::MakeMaker->import(qw( $Verbose &neatvalue));
+use vars qw(@ISA $VERSION $BORLAND $GCC $DMAKE $NMAKE $PERLMAKE);
+
+require ExtUtils::MM_Any;
+require ExtUtils::MM_Unix;
+@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
+$VERSION = '1.04_01';
 
 $ENV{EMXSHELL} = 'sh'; # to run `commands`
-unshift @MM::ISA, 'ExtUtils::MM_Win32';
 
 $BORLAND = 1 if $Config{'cc'} =~ /^bcc/i;
 $GCC     = 1 if $Config{'cc'} =~ /^gcc/i;
@@ -38,49 +39,6 @@ $DMAKE = 1 if $Config{'make'} =~ /^dmake/i;
 $NMAKE = 1 if $Config{'make'} =~ /^nmake/i;
 $PERLMAKE = 1 if $Config{'make'} =~ /^pmake/i;
 
-# a few workarounds for command.com (very basic)
-{
-    package ExtUtils::MM_Win95;
-
-    # the $^O test may be overkill, but we want to be sure Win32::IsWin95()
-    # exists before we try it
-
-    unshift @MM::ISA, 'ExtUtils::MM_Win95'
-       if ($^O =~ /Win32/ && Win32::IsWin95());
-
-    sub xs_c {
-       my($self) = shift;
-       return '' unless $self->needs_linking();
-       '
-.xs.c:
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\
-           $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
-       '
-    }
-
-    sub xs_cpp {
-       my($self) = shift;
-       return '' unless $self->needs_linking();
-       '
-.xs.cpp:
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\
-           $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp
-       ';
-    }
-
-    # many makes are too dumb to use xs_c then c_o
-    sub xs_o {
-       my($self) = shift;
-       return '' unless $self->needs_linking();
-       '
-.xs$(OBJ_EXT):
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\
-           $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
-       $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
-       ';
-    }
-}      # end of command.com workarounds
-
 sub dlsyms {
     my($self,%attribs) = @_;
 
@@ -95,7 +53,7 @@ sub dlsyms {
        push(@m,"
 $self->{BASEEXT}.def: Makefile.PL
 ",
-     q!        $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Mksymlists \\
+     q!        $(PERLRUN) -MExtUtils::Mksymlists \\
      -e "Mksymlists('NAME'=>\"!, $self->{NAME},
      q!\", 'DLBASE' => '!,$self->{DLBASE},
      # The above two lines quoted differently to work around
@@ -137,10 +95,6 @@ sub maybe_command {
     return;
 }
 
-sub file_name_is_absolute {
-    shift;
-    return File::Spec->file_name_is_absolute(@_);
-}
 
 sub find_perl {
     my($self, $ver, $names, $dirs, $trace) = @_;
@@ -158,17 +112,22 @@ in these dirs:
        next unless defined $dir; # $self->{PERL_SRC} may be undefined
        foreach $name (@$names){
            my ($abs, $val);
-           if (File::Spec->file_name_is_absolute($name)) { # /foo/bar
+           if (File::Spec->file_name_is_absolute($name)) {  # /foo/bar
                $abs = $name;
-           } elsif (File::Spec->canonpath($name) eq File::Spec->canonpath(basename($name))) { # foo
+           } elsif (File::Spec->canonpath($name) eq 
+                     File::Spec->canonpath(basename($name))) # foo
+            {
                $abs = File::Spec->catfile($dir, $name);
-           } else { # foo/bar
-               $abs = File::Spec->canonpath(File::Spec->catfile(File::Spec->curdir, $name));
+           } else {                                         # foo/bar
+               $abs = File::Spec->canonpath(
+                           File::Spec->catfile(File::Spec->curdir, $name)
+                       );
            }
            print "Checking $abs\n" if ($trace >= 2);
            next unless $self->maybe_command($abs);
            print "Executing $abs\n" if ($trace >= 2);
-           $val = `$abs -e "require $ver;" 2>&1`;
+            (my($safe_abs) = $abs) =~ s{(\s)}{\\$1}g;
+           $val = `$safe_abs -e "require $ver;" 2>&1`;
            if ($? == 0) {
                print "Using PERL=$abs\n" if $trace;
                return $abs;
@@ -181,35 +140,18 @@ in these dirs:
     0; # false and not empty
 }
 
-sub catdir {
-    shift;
-    return File::Spec->catdir(@_);
-}
-
-=item catfile
-
-Concatenate one or more directory names and a filename to form a
-complete path ending with a filename
-
-=cut
-
-sub catfile {
-    shift;
-    return File::Spec->catfile(@_);
-}
-
 sub init_others
 {
  my ($self) = @_;
- &ExtUtils::MM_Unix::init_others;
- $self->{'TOUCH'}  = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e touch';
- $self->{'CHMOD'}  = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e chmod'; 
- $self->{'CP'}     = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e cp';
- $self->{'RM_F'}   = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_f';
- $self->{'RM_RF'}  = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_rf';
- $self->{'MV'}     = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mv';
+ $self->SUPER::init_others;
+ $self->{'TOUCH'}  = '$(PERLRUN) -MExtUtils::Command -e touch';
+ $self->{'CHMOD'}  = '$(PERLRUN) -MExtUtils::Command -e chmod'; 
+ $self->{'CP'}     = '$(PERLRUN) -MExtUtils::Command -e cp';
+ $self->{'RM_F'}   = '$(PERLRUN) -MExtUtils::Command -e rm_f';
+ $self->{'RM_RF'}  = '$(PERLRUN) -MExtUtils::Command -e rm_rf';
+ $self->{'MV'}     = '$(PERLRUN) -MExtUtils::Command -e mv';
  $self->{'NOOP'}   = 'rem';
- $self->{'TEST_F'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e test_f';
+ $self->{'TEST_F'} = '$(PERLRUN) -MExtUtils::Command -e test_f';
  $self->{'LD'}     = $Config{'ld'} || 'link';
  $self->{'AR'}     = $Config{'ar'} || 'lib';
  $self->{'LDLOADLIBS'} ||= $Config{'libs'};
@@ -226,7 +168,6 @@ sub init_others
      $self->{'LDDLFLAGS'} .= " $libpath";
  }
  $self->{'DEV_NULL'} = '> NUL';
- # $self->{'NOECHO'} = ''; # till we have it working
 }
 
 
@@ -243,14 +184,15 @@ sub constants {
     for $tmp (qw/
 
              AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION
-             VERSION_SYM XS_VERSION INST_BIN INST_EXE INST_LIB
+             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 PERLRUNINST TEST_LIBS 
-             FULL_AR PERL_CORE
+             PERL_INC PERL FULLPERL PERLRUN FULLPERLRUN PERLRUNINST 
+          FULLPERLRUNINST ABSPERL ABSPERLRUN ABSPERLRUNINST
+          FULL_AR PERL_CORE
 
              / ) {
        next unless defined $self->{$tmp};
@@ -272,7 +214,6 @@ MM_VERSION = $ExtUtils::MakeMaker::VERSION
     push @m, q{
 # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
-# ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD)  !!! Deprecated from MM 5.32  !!!
 # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
 # DLBASE  = Basename part of dynamic library. May be just equal BASEEXT.
 };
@@ -291,17 +232,11 @@ XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})."
 C_FILES = ".join(" \\\n\t", @{$self->{C}})."
 O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})."
 H_FILES = ".join(" \\\n\t", @{$self->{H}})."
-HTMLLIBPODS    = ".join(" \\\n\t", sort keys %{$self->{HTMLLIBPODS}})."
-HTMLSCRIPTPODS = ".join(" \\\n\t", sort keys %{$self->{HTMLSCRIPTPODS}})."
 MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})."
 MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})."
 ";
 
     for $tmp (qw/
-             INST_HTMLPRIVLIBDIR INSTALLHTMLPRIVLIBDIR
-             INST_HTMLSITELIBDIR INSTALLHTMLSITELIBDIR
-             INST_HTMLSCRIPTDIR  INSTALLHTMLSCRIPTDIR
-             INST_HTMLLIBDIR                    HTMLEXT
              INST_MAN1DIR        INSTALLMAN1DIR MAN1EXT
              INST_MAN3DIR        INSTALLMAN3DIR MAN3EXT
              /) {
@@ -369,12 +304,6 @@ EXPORT_LIST = $tmp
 PERL_ARCHIVE = $tmp
 ";
 
-#    push @m, q{
-#INST_PM = }.join(" \\\n\t", sort values %{$self->{PM}}).q{
-#
-#PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
-#};
-
     push @m, q{
 TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{
 
@@ -385,10 +314,6 @@ PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
 }
 
 
-sub path {
-    return File::Spec->path();
-}
-
 =item static_lib (o)
 
 Defines how to produce the *.a (or equivalent) files.
@@ -448,7 +373,7 @@ BOOTSTRAP = '."$self->{BASEEXT}.bs".'
 # The DynaLoader only reads a non-empty file.
 $(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)\.exists
        '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
-       '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
+       '.$self->{NOECHO}.'$(PERLRUN) \
                -MExtUtils::Mkbootstrap \
                -e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
        '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP)
@@ -526,8 +451,8 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists
 
 sub clean
 {
-    my ($self) = @_;
-    my $s = &ExtUtils::MM_Unix::clean;
+    my ($self) = shift;
+    my $s = $self->SUPER::clean(@_);
     my $clean = $GCC ? 'dll.base dll.exp' : '*.pdb';
     $s .= <<END;
 clean ::
@@ -551,26 +476,6 @@ sub export_list
  return "$self->{BASEEXT}.def";
 }
 
-=item canonpath
-
-No physical check on the filesystem, but a logical cleanup of a
-path. On UNIX eliminated successive slashes and successive "/.".
-
-=cut
-
-sub canonpath {
-    my($self,$path) = @_;
-    $path =~ s/^([a-z]:)/\u$1/;
-    $path =~ s|/|\\|g;
-    $path =~ s|(.)\\+|$1\\|g ;                     # xx////xx  -> xx/xx
-    $path =~ s|(\\\.)+\\|\\|g ;                    # xx/././xx -> xx/xx
-    $path =~ s|^(\.\\)+|| unless $path eq ".\\";   # ./xx      -> xx
-    $path =~ s|\\$|| 
-             unless $path =~ m#^([a-z]:)?\\#;      # xx/       -> xx
-    $path .= '.' if $path =~ m#\\$#;
-    $path;
-}
-
 =item perl_script
 
 Takes one argument, a file name, and returns the file name, if the
@@ -599,8 +504,7 @@ sub pm_to_blib {
     my($autodir) = File::Spec->catdir('$(INST_LIB)','auto');
     return q{
 pm_to_blib: $(TO_INST_PM)
-       }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
-       "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
+       }.$self->{NOECHO}.q{$(PERLRUNINST) -MExtUtils::Install \
         -e "pm_to_blib(}.
        ($NMAKE ? 'qw[ <<pmfiles.dat ],'
                : $DMAKE ? 'qw[ $(mktmp,pmfiles.dat $(PM_TO_BLIB:s,\\,\\\\,)\n) ],'
@@ -613,17 +517,6 @@ $(PM_TO_BLIB)
 };
 }
 
-=item test_via_harness (o)
-
-Helper method to write the test targets
-
-=cut
-
-sub test_via_harness {
-    my($self, $perl, $tests) = @_;
-    "\t$perl".q! -Mblib -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e "use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;" !."$tests\n";
-}
-
 
 =item tool_autosplit (override)
 
@@ -637,7 +530,7 @@ sub tool_autosplit{
     $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
     q{
 # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
-AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MAutoSplit }.$asl.q{ -e "autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1);"
+AUTOSPLITFILE = $(PERLRUN) -MAutoSplit }.$asl.q{ -e "autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1);"
 };
 }
 
@@ -666,13 +559,13 @@ SHELL = $bin_sh
     push @m, q{
 # The following is a portable way to say mkdir -p
 # To see which directories are created, change the if 0 to if 1
-MKPATH = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mkpath
+MKPATH = $(PERLRUN) -MExtUtils::Command -e mkpath
 
 # This helps us to minimize the effect of the .exists files A yet
 # better solution would be to have a stable file in the perl
 # distribution with a timestamp of zero. But this solution doesn't
 # need any changes to the core distribution and works with older perls
-EQUALIZE_TIMESTAMP = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e eqtime
+EQUALIZE_TIMESTAMP = $(PERLRUN) -MExtUtils::Command -e eqtime
 };
 
 
@@ -730,12 +623,9 @@ sub top_targets {
 
     my($self) = shift;
     my(@m);
-    push @m, '
-#all ::        config $(INST_PM) subdirs linkext manifypods
-';
 
     push @m, '
-all :: pure_all htmlifypods manifypods
+all :: pure_all manifypods
        '.$self->{NOECHO}.'$(NOOP)
 ' 
          unless $self->{SKIPHASH}{'all'};
@@ -759,24 +649,6 @@ config :: $(INST_AUTODIR)\.exists
 
     push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
 
-    if (%{$self->{HTMLLIBPODS}}) {
-       push @m, qq[
-config :: \$(INST_HTMLLIBDIR)/.exists
-       $self->{NOECHO}\$(NOOP)
-
-];
-       push @m, $self->dir_target(qw[$(INST_HTMLLIBDIR)]);
-    }
-
-    if (%{$self->{HTMLSCRIPTPODS}}) {
-       push @m, qq[
-config :: \$(INST_HTMLSCRIPTDIR)/.exists
-       $self->{NOECHO}\$(NOOP)
-
-];
-       push @m, $self->dir_target(qw[$(INST_HTMLSCRIPTDIR)]);
-    }
-
     if (%{$self->{MAN1PODS}}) {
        push @m, qq[
 config :: \$(INST_MAN1DIR)\\.exists
@@ -803,69 +675,9 @@ help:
        perldoc ExtUtils::MakeMaker
 };
 
-    push @m, q{
-Version_check:
-       }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
-               -MExtUtils::MakeMaker=Version_check \
-               -e "Version_check('$(MM_VERSION)')"
-};
-
     join('',@m);
 }
 
-=item htmlifypods (o)
-
-Defines targets and routines to translate the pods into HTML manpages
-and put them into the INST_HTMLLIBDIR and INST_HTMLSCRIPTDIR
-directories.
-
-Same as MM_Unix version (changes command-line quoting).
-
-=cut
-
-sub htmlifypods {
-    my($self, %attribs) = @_;
-    return "\nhtmlifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n" unless
-       %{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}};
-    my($dist);
-    my($pod2html_exe);
-    if (defined $self->{PERL_SRC}) {
-       $pod2html_exe = File::Spec->catfile($self->{PERL_SRC},'pod','pod2html');
-    } else {
-       $pod2html_exe = File::Spec->catfile($Config{scriptdirexp},'pod2html');
-    }
-    unless ($pod2html_exe = $self->perl_script($pod2html_exe)) {
-       # No pod2html but some HTMLxxxPODS to be installed
-       print <<END;
-
-Warning: I could not locate your pod2html program. Please make sure,
-         your pod2html program is in your PATH before you execute 'make'
-
-END
-        $pod2html_exe = "-S pod2html";
-    }
-    my(@m);
-    push @m,
-qq[POD2HTML_EXE = $pod2html_exe\n],
-qq[POD2HTML = \$(PERL) -we "use File::Basename; use File::Path qw(mkpath); %m=\@ARGV;for (keys %m){" \\\n],
-q[-e "next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M '],
- $self->{MAKEFILE}, q[';" \\
--e "print qq(Htmlifying $$m{$$_}\n);" \\
--e "$$dir = dirname($$m{$$_}); mkpath($$dir) unless -d $$dir;" \\
--e "system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2HTML_EXE) ].qq[$$_>$$m{$$_}])==0 or warn qq(Couldn\\047t install $$m{$$_}\n);" \\
--e "chmod(oct($(PERM_RW))), $$m{$$_} or warn qq(chmod $(PERM_RW) $$m{$$_}: $$!\n);}"
-];
-    push @m, "\nhtmlifypods : pure_all ";
-    push @m, join " \\\n\t", keys %{$self->{HTMLLIBPODS}}, keys %{$self->{HTMLSCRIPTPODS}};
-
-    push(@m,"\n");
-    if (%{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}}) {
-       push @m, "\t$self->{NOECHO}\$(POD2HTML) \\\n\t";
-       push @m, join " \\\n\t", %{$self->{HTMLLIBPODS}}, %{$self->{HTMLSCRIPTPODS}};
-    }
-    join('', @m);
-}
-
 =item manifypods (o)
 
 We don't want manpage process.
@@ -888,7 +700,7 @@ sub dist_ci {
     my @m;
     push @m, q{
 ci :
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=maniread \\
+       $(PERLRUN) -MExtUtils::Manifest=maniread \\
                -e "@all = keys %{ maniread() };" \\
                -e "print(\"Executing $(CI) @all\n\"); system(\"$(CI) @all\");" \\
                -e "print(\"Executing $(RCS_LABEL) ...\n\"); system(\"$(RCS_LABEL) @all\");"
@@ -955,7 +767,6 @@ sub pasthru {
 }
 
 
-
 1;
 __END__