[win32] fix typo in Makefile
[p5sagit/p5-mst-13.2.git] / installperl
index 465b48d..6197e92 100755 (executable)
@@ -2,6 +2,7 @@
 
 BEGIN {
     require 5.004;
+    chdir '..' if !-d 'lib' and -d '..\lib';
     @INC = 'lib';
     $ENV{PERL5LIB} = 'lib';
 }
@@ -37,6 +38,12 @@ umask 022;
 @pods = (<pod/*.pod>);
 
 %archpms = (Config => 1, FileHandle => 1, overload => 1);
+
+if ($^O eq 'dos') {
+    push(@scripts,'djgpp/fixpmain');
+    $archpms{config} = $archpms{filehand} = 1;
+}
+
 find(sub {
        if ("$File::Find::dir/$_" =~ m{^ext/[^/]+/(.*)\.pm$}) {
            (my $pm = $1) =~ s{^lib/}{};
@@ -81,8 +88,9 @@ if ($d_dosuid && $>) { die "You must run as root to install suidperl\n"; }
 -x 'perl' . $exe_ext   || die "perl isn't executable!\n";
 -x 'suidperl' . $exe_ext|| die "suidperl isn't executable!\n" if $d_dosuid;
 
--x 't/TEST'            || warn "WARNING: You've never run 'make test'!!!",
-       "  (Installing anyway.)\n";
+-x 't/TEST'            || $^O eq 'MSWin32'
+                       || warn "WARNING: You've never run 'make test'!!!",
+                               "  (Installing anyway.)\n";
 
 if ($^O eq 'MSWin32') {
 
@@ -97,9 +105,14 @@ chmod(0755, "$installbin/perl.$dlext");
 
 # First we install the version-numbered executables.
 
-safe_unlink("$installbin/perl$ver$exe_ext");
-copy("perl$exe_ext", "$installbin/perl$ver$exe_ext");
-chmod(0755, "$installbin/perl$ver$exe_ext");
+if ($^O ne 'dos') {
+    safe_unlink("$installbin/perl$ver$exe_ext");
+    copy("perl$exe_ext", "$installbin/perl$ver$exe_ext");
+    chmod(0755, "$installbin/perl$ver$exe_ext");
+} else {
+    safe_unlink("$installbin/perl.exe");
+    copy("perl.exe", "$installbin/perl.exe");
+}
 
 safe_unlink("$installbin/sperl$ver$exe_ext");
 if ($d_dosuid) {
@@ -145,11 +158,21 @@ foreach $file (@corefiles) {
                   "$installarchlib/CORE/$file");
 }
 
+# Install main perl executables
+# Make links to ordinary names if installbin directory isn't current directory.
+
+if (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos')) {
+    safe_unlink("$installbin/perl$exe_ext", "$installbin/suidperl$exe_ext");
+    link("$installbin/perl$ver$exe_ext", "$installbin/perl$exe_ext");
+    link("$installbin/sperl$ver$exe_ext", "$installbin/suidperl$exe_ext") 
+      if $d_dosuid;
+}
+
 # Offer to install perl in a "standard" location
 
 $mainperl_is_instperl = 0;
 
-if (!$versiononly && !$nonono && -t STDIN && -t STDERR
+if (!$versiononly && !$nonono && $^O ne 'MSWin32' && -t STDIN && -t STDERR
        && -w $mainperldir && ! samepath($mainperldir, $installbin)) {
     local($usrbinperl) = "$mainperldir/perl$exe_ext";
     local($instperl)   = "$installbin/perl$exe_ext";
@@ -182,13 +205,6 @@ if (!$versiononly && !$nonono && -t STDIN && -t STDERR
 
 # Make links to ordinary names if installbin directory isn't current directory.
 
-if (! $versiononly && ! samepath($installbin, '.')) {
-    safe_unlink("$installbin/perl$exe_ext", "$installbin/suidperl$exe_ext");
-    link("$installbin/perl$ver$exe_ext", "$installbin/perl$exe_ext");
-    link("$installbin/sperl$ver$exe_ext", "$installbin/suidperl$exe_ext") 
-      if $d_dosuid;
-}
-
 if (!$versiononly && ! samepath($installbin, 'x2p')) {
     safe_unlink("$installbin/a2p$exe_ext");
     copy("x2p/a2p$exe_ext", "$installbin/a2p$exe_ext");
@@ -221,7 +237,11 @@ if (! $versiononly) {
 
 if (! $versiononly) {
     safe_unlink("$installscript/pstruct");
-    link("$installscript/c2ph","$installscript/pstruct");
+    if ($^O eq 'dos') {
+        copy("$installscript/c2ph","$installscript/pstruct"); 
+    } else {
+        link("$installscript/c2ph","$installscript/pstruct");
+    }
 }
 
 # Install pod pages.  Where? I guess in $installprivlib/pod.
@@ -255,7 +275,7 @@ if (! $versiononly || !($installprivlib =~ m/\Q$]/)) {
     if (compare($from, $to) || $nonono) {
        mkpath("${installarchlib}/pod", 1, 0777);
        unlink($to);
-       link($from, $to);
+       link($from, $to) if ($^O ne 'dos');
     }
 }
 
@@ -377,6 +397,7 @@ sub link {
 sub chmod {
     local($mode,$name) = @_;
 
+    return if ($^O eq 'dos');
     printf STDERR "  chmod %o %s\n", $mode, $name;
     CORE::chmod($mode,$name)
        || warn sprintf("Couldn't chmod %o %s: $!\n", $mode, $name)