X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=installperl;h=5c423241db2a052d4eb914f6534ebbf6e9d31b59;hb=47c8db80932508b6333745f2c283d5a98bf9cccb;hp=c3c4e4a45ead2e263b39a0eb919fab6168f52266;hpb=60ce24170371608f75fb4b2baa8256ab0dec3383;p=p5sagit%2Fp5-mst-13.2.git diff --git a/installperl b/installperl index c3c4e4a..5c42324 100755 --- a/installperl +++ b/installperl @@ -10,7 +10,7 @@ BEGIN { use strict; my ($Is_VMS, $Is_W32, $Is_OS2, $Is_Cygwin, $Is_Darwin, $nonono, $dostrip, $versiononly, $silent, $verbose, - $otherperls, $archname,$Is_NetWare, $nwinstall); + $otherperls, $archname,$Is_NetWare, $nwinstall, $nopods); use vars qw /$depth/; BEGIN { @@ -72,6 +72,26 @@ while (@ARGV) { $verbose = 1 if $ARGV[0] eq '-V' || $ARGV [0] eq '-n'; $archname = 1 if $ARGV[0] eq '-A'; $nwinstall = 1 if $ARGV[0] eq '-netware'; + $nopods = 1 if $ARGV[0] eq '-p'; + if ($ARGV[0] eq '-?' or $ARGV[0] =~ /^-?-h/) { + print <<"EOT"; +Usage $0: [switches] + -n Don't actually run any commands; just print them. + -s Run strip on installed binaries. + -v Only install perl as a binary with the version number in the name. + (Override whatever config.sh says) + +v Install perl as "perl" and as a binary with the version number in + the name. (Override whatever config.sh says) + -S Silent mode. + -o Skip checking for other copies of perl in your PATH. + -V Verbose mode. + -A Also install perl with the architecture's name in the perl binary's + name. + -p Don't install the pod files. [This will break use diagnostics;] + -netware Install correctly on a Netware server. +EOT + exit; + } shift; } @@ -93,17 +113,18 @@ close SCRIPTS; if ($scr_ext) { @scripts = map { "$_$scr_ext" } @scripts; } -my @pods = (); +my @pods = $nopods ? () : (); # Specify here any .pm files that are actually architecture-dependent. # (Those included with XS extensions under ext/ are automatically # added later.) # Now that the default privlib has the full perl version number included, -# we no longer have to play the trick of sticking version-specific .pm +# we no longer have to play the trick of sticking version-specific .pm # files under the archlib directory. my %archpms = ( - Config => 1, - lib => 1, + Config => 1, + lib => 1, + Cwd => 1, ); if ($^O eq 'dos') { @@ -213,7 +234,9 @@ if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) { if ($Is_Cygwin) { $perldll = $libperl; - $perldll =~ s/(\..*)?$/.$dlext/; + my $v_e_r_s = $ver; $v_e_r_s =~ tr/./_/; + $perldll =~ s/(\..*)?$/$v_e_r_s.$dlext/; + $perldll =~ s/^lib/cyg/; if ($Config{useshrplib} eq 'true') { # install ld2 and perlld as well foreach ('ld2', 'perlld') { @@ -221,9 +244,21 @@ if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) { copy("$_", "$installbin/$_"); chmod(0755, "$installbin/$_"); }; + { + open (LD2, ">$installbin/ld2"); + print LD2 "#!/bin/sh\n#\n# ld wrapper, passes all args to perlld;\n#\n" + . "for trythis in $installbin/perl\ndo\n if [ -x \$trythis ]\n" + . " then\n \$trythis $installbin/perlld \"\$\@\"\n" + . " exit \$?\n fi\ndone\n# hard luck!\necho i see no perl" + . " executable around there\necho perl is required to build " + . "dynamic libraries\necho look if the path to perl in /bin/ld2" + . " is correct\nexit 1\n"; + close LD2; + }; + chmod(0755, "$installbin/ld2"); }; } else { - $perldll = 'perl57.' . $dlext; + $perldll = 'perl58.' . $dlext; } if ($dlsrc ne "dl_none.xs") { @@ -234,7 +269,7 @@ if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) { safe_unlink("$installbin/$perldll"); copy("$perldll", "$installbin/$perldll"); chmod(0755, "$installbin/$perldll"); - + } # if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) # This will be used to store the packlist @@ -296,7 +331,7 @@ if ($d_dosuid) { # Install library files. my ($do_installarchlib, $do_installprivlib) = (0, 0); - + mkpath($installprivlib, $verbose, 0777); mkpath($installarchlib, $verbose, 0777); mkpath($installsitelib, $verbose, 0777) if ($installsitelib); @@ -360,12 +395,16 @@ if (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VM # MPE doesn't support hard links, so use a symlink. # We don't want another cloned copy. symlink($Config{perlpath}, "$installbin/perl$exe_ext"); + } elsif ($^O eq 'vos') { + # VOS doesn't support hard links, so use a symlink. + symlink("$installbin/$perl_verbase$ver$exe_ext", + "$installbin/$perl$exe_ext"); } else { link("$installbin/$perl_verbase$ver$exe_ext", "$installbin/$perl$exe_ext"); } link("$installbin/s$perl_verbase$ver$exe_ext", - "$installbin/suid$perl$exe_ext") + "$installbin/suid$perl$exe_ext") if $d_dosuid; } @@ -378,6 +417,10 @@ if ($archname && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) { # MPE doesn't support hard links, so use a symlink. # We don't want another cloned copy. symlink($Config{perlpath}, "$installbin/$archperl"); + } elsif ($^O eq 'vos') { + # VOS doesn't support hard links, so use a symlink. + symlink("$installbin/$perl_verbase$ver$exe_ext", + "$installbin/$archperl"); } else { link("$installbin/$perl_verbase$ver$exe_ext", "$installbin/$archperl"); @@ -407,11 +450,7 @@ if ($Config{installusrbinperl} && $Config{installusrbinperl} eq 'define' && (-l $usrbinperl) && ((readlink $usrbinperl) eq $expinstperl)); } - if ((! $mainperl_is_instperl) && - (yn("Many scripts expect perl to be installed as $usrbinperl.\n" . - "Do you wish to have $usrbinperl be the same as\n" . - "$expinstperl? [y] "))) - { + if (! $mainperl_is_instperl) { unlink($usrbinperl); ( $Config{'d_link'} eq 'define' && eval { CORE::link $instperl, $usrbinperl } ) || @@ -448,7 +487,10 @@ sub script_alias { safe_unlink("$installscript/$alias$scr_ext"); if ($^O eq 'dos' or $Is_VMS or $^O eq 'transit') { copy("$installscript/$orig$scr_ext", - "$installscript/$alias$scr_ext"); + "$installscript/$alias$scr_ext"); + } elsif ($^O eq 'vos') { + symlink("$installscript/$orig$scr_ext", + "$installscript/$alias$scr_ext"); } else { link("$installscript/$orig$scr_ext", "$installscript/$alias$scr_ext"); @@ -465,7 +507,7 @@ if ($versiononly) { chmod(0755, "$installscript/$base"); } - for (@tolink) { + for (@tolink) { my ($from, $to) = map { "$_$ver" } @$_; (my $frbase = $from) =~ s#.*/##; (my $tobase = $to) =~ s#.*/##; @@ -478,7 +520,7 @@ if ($versiononly) { chmod(0755, "$installscript/$base"); } - for (@tolink) { + for (@tolink) { my ($from, $to) = @$_; (my $frbase = $from) =~ s#.*/##; (my $tobase = $to) =~ s#.*/##; @@ -585,7 +627,7 @@ sub unlink { next unless -e $name; chmod 0777, $name if ($Is_OS2 || $Is_W32 || $Is_Cygwin || $Is_NetWare); print " unlink $name\n" if $verbose; - ( CORE::unlink($name) and ++$cnt + ( CORE::unlink($name) and ++$cnt or warn "Couldn't unlink $name: $!\n" ) unless $nonono; } return $cnt; @@ -615,7 +657,7 @@ sub safe_rename { for ($i = 1; $i < 50; $i++) { last if rename($to, "$to.$i"); } - warn("Cannot rename to `$to.$i': $!"), return 0 + warn("Cannot rename to `$to.$i': $!"), return 0 if $i >= 50; # Give up! } link($from,$to) || return 0; @@ -699,10 +741,11 @@ sub installlib { $File::Find::prune = 1; return; } - + # ignore patch backups, RCS files, emacs backup & temp files and the # .exists files, .PL files, and .t files. - return if $name =~ m{\.orig$|~$|^#.+#$|,v$|^\.exists|\.PL$|\.t$}; + return if $name =~ m{\.orig$|~$|^#.+#$|,v$|^\.exists|\.PL$|\.t$} || + $dir =~ m{/t(?:/|$)}; $name = "$dir/$name" if $dir ne ''; @@ -771,13 +814,27 @@ sub installlib { sub copy_if_diff { my($from,$to)=@_; return 1 if (($^O eq 'VMS') && (-d $from)); - -f $from || warn "$0: $from not found"; + my $perlpodbadsymlink; + if ($from =~ m!^pod/perl[\w-]+\.pod$! && + -l $from && + ! -e $from) { + # Some Linux implementations have problems traversing over + # multiple symlinks (when going over NFS?) and fail to read + # the symlink target. Combine this with the fact that some + # of the pod files (the perl$OS.pod) are symlinks (to ../README.$OS), + # and you end up with those pods not getting installed. + $perlpodbadsymlink = 1; + } + -f $from || $perlpodbadsymlink || warn "$0: $from not found"; $packlist->{$to} = { type => 'file' }; if (compare($from, $to) || $nonono) { safe_unlink($to); # In case we don't have write permissions. if ($nonono) { $from = $depth . "/" . $from if $depth; } + if ($perlpodbadsymlink && $from =~ m!^pod/perl(.+)\.pod$!) { + $from = "README.$1"; + } copy($from, $to); # Restore timestamps if it's a .a library or for OS/2. if (!$nonono && ($Is_OS2 || $to =~ /\.a$/)) {