Skip another file in the VERSION comparison program
[p5sagit/p5-mst-13.2.git] / installperl
index 623034e..aede39a 100755 (executable)
@@ -67,6 +67,11 @@ if ( $Is_VMS ) {
 }
 
 $otherperls = 1;
+# This little hack simplifies making the code after the comment "Fetch some
+# frequently-used items from %Config" warning free. With $opts{destdir} always
+# defined, it's also possible to make the s/\Q$opts{destdir}\E unconditional.
+
+$opts{destdir} = '';
 # Consider refactoring this to use Getopt::Long once Getopt::Long's planned
 # feature is implemented, to distinguish + and - options.
 while (@ARGV) {
@@ -148,8 +153,13 @@ if ((-e "testcompile") && (defined($ENV{'COMPILE'}))) {
     push(@scripts, map("$_.exe", @scripts));
 }
 
+# Exclude nonxs extensions that are not architecture dependent
+my @nonxs = grep(!/^Errno$/, split(' ', $Config{'nonxs_ext'}));
+
 find(sub {
-    if ("$File::Find::dir/$_" =~ m{^ext\b(.*)/([^/]+)\.pm$}) {
+    if (($File::Find::name =~ m{^ext\b(.*)/([^/]+)\.pm$}) &&
+        ! grep { $File::Find::name =~ /^ext\/$_/ } @nonxs)
+    {
        my($path, $modname) = ($1,$2);
 
        # strip to optional "/lib", or remove trailing component
@@ -253,11 +263,8 @@ if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) {
 
     if ($Is_Cygwin) {
        $perldll = $libperl;
-       my $v_e_r_s = substr($ver,0,-2); $v_e_r_s =~ tr/./_/;
-       $perldll =~ s/(\..*)?$/$v_e_r_s.$dlext/;
-       $perldll =~ s/^lib/cyg/;
     } else {
-       $perldll = 'perl511.' . $dlext;
+       $perldll = 'perl5'.$Config{patchlevel}.'.'.$dlext;
     }
 
     if ($dlsrc ne "dl_none.xs") {
@@ -338,7 +345,7 @@ if ($d_dosuid) {
 # Install library files.
 
 my ($do_installarchlib, $do_installprivlib) = (0, 0);
-my $vershort = $Is_Cygwin ? substr($ver,0,-2) : $ver;
+my $vershort = ($Is_Cygwin and !$Config{usedevel}) ? substr($ver,0,-2) : $ver;
 
 mkpath($installprivlib, $opts{verbose}, 0777);
 mkpath($installarchlib, $opts{verbose}, 0777);
@@ -367,7 +374,26 @@ if ($Is_VMS) {  # We did core file selection during build
     $coredir =~ tr/./_/;
     map { s|^$coredir/||i; } @corefiles = <$coredir/*.*>;
 }
-else {
+elsif ($Is_Cygwin) { # On Cygwin symlink it to CORE to make Makefile happy
+    @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>;
+    my $coredll = "$installarchlib/CORE/$libperl";
+    safe_unlink($coredll);
+    ( $Config{'d_link'} eq 'define' &&
+      eval {
+          CORE::link("$installbin/$libperl", $coredll);
+          $packlist->{$coredll} = { from => "$installbin/$libperl",
+                                    type => 'link' };
+      }
+    ) ||
+    eval {
+        symlink("$installbin/$libperl", $coredll);
+        $packlist->{$coredll} = { from => "$installbin/$libperl",
+                                  type => 'link' };
+    } ||
+    ( copy("$installbin/$libperl", $coredll) &&
+      push(@corefiles, $coredll)
+    )
+} else {
     # [als] hard-coded 'libperl' name... not good!
     @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>;
 
@@ -665,7 +691,7 @@ sub copy {
     my($from,$to) = @_;
 
     my $xto = $to;
-    $xto =~ s/^\Q$opts{destdir}\E// if $opts{destdir};
+    $xto =~ s/^\Q$opts{destdir}\E//;
     print $opts{verbose} ? "  cp $from $xto\n" : "  $xto\n"
        unless $opts{silent};
     print "  creating new version of $xto\n"
@@ -750,7 +776,7 @@ sub installlib {
            unlink("$installarchlib/$name");
        }
        my $xname = "$installlib/$name";
-       $xname =~ s/^\Q$opts{destdir}\E// if $opts{destdir};
+       $xname =~ s/^\Q$opts{destdir}\E//;
        $packlist->{$xname} = { type => 'file' };
        if ($force || compare($_, "$installlib/$name") || $opts{notify}) {
            unlink("$installlib/$name");
@@ -797,7 +823,7 @@ sub copy_if_diff {
     my($from,$to)=@_;
     return 1 if (($^O eq 'VMS') && (-d $from));
     my $xto = $to;
-    $xto =~ s/^\Q$opts{destdir}\E// if $opts{destdir};
+    $xto =~ s/^\Q$opts{destdir}\E//;
     my $perlpodbadsymlink;
     if ($from =~ m!^pod/perl[\w-]+\.pod$! &&
        -l $from &&