installperl revision 7c478bd95313f5f23a4c958a745db2134aa03244
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams#
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# This is a version of the 5.6.1 installperl script that has been modified to
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# work correctly as part of the ON build process. The changes are as follows:
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# * umask set to 022
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# * install locations modified to be relative to $ROOT
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# * check for 'make test' being run before install removed
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# * executables installed with mode 0555
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# * executables only overwritten if different from last build
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# * check for other versions of perl in $PATH removed
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# * .packlist entries cleaned of $ROOT prefix
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# * SCCS directories and .tstamp files ignored on install
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# * The contents of the additional contrib_bin directory are installed
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams#
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsBEGIN {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams require 5.004;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chdir '..' if !-d 'lib' and -d '..\lib';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams @INC = 'lib';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $ENV{PERL5LIB} = 'lib';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsuse strict;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy ($Is_VMS, $Is_W32, $Is_OS2, $Is_Cygwin, $nonono, $dostrip,
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $versiononly, $silent, $verbose, $otherperls);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsuse vars qw /$depth/;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsBEGIN {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $Is_VMS = $^O eq 'VMS';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $Is_W32 = $^O eq 'MSWin32';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $Is_OS2 = $^O eq 'os2';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $Is_Cygwin = $^O eq 'cygwin';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ($Is_VMS) { eval 'use VMS::Filespec;' }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $scr_ext = ($Is_VMS ? '.Com' : $Is_W32 ? '.bat' : '');
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsuse File::Find;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsuse File::Compare;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsuse File::Copy ();
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsuse File::Path ();
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsuse ExtUtils::Packlist;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsuse Config;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsuse subs qw(unlink link chmod);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# override the ones in the rest of the script
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamssub mkpath {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams File::Path::mkpath(@_) unless $nonono;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $mainperldir = "/usr/bin";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $exe_ext = $Config{exe_ext};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Allow ``make install PERLNAME=something_besides_perl'':
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $perl = defined($ENV{PERLNAME}) ? $ENV{PERLNAME} : 'perl';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# This is the base used for versioned names, like "perl5.6.0".
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# It's separate because a common use of $PERLNAME is to install
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# perl as "perl5", if that's used as base for versioned files you
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# get "perl55.6.0".
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $perl_verbase = defined($ENV{PERLNAME_VERBASE})
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams ? $ENV{PERLNAME_VERBASE}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams : $perl;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams$otherperls = 1;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamswhile (@ARGV) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $nonono = 1 if $ARGV[0] eq '-n';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $dostrip = 1 if $ARGV[0] eq '-s';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $versiononly = 1 if $ARGV[0] eq '-v';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $silent = 1 if $ARGV[0] eq '-S';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $otherperls = 0 if $ARGV[0] eq '-o';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $verbose = 1 if $ARGV[0] eq '-V' || $ARGV [0] eq '-n';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams shift;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams$versiononly = 1 if $Config{versiononly};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Added for ON
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsumask(0022) unless $Is_VMS;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy @scripts = qw(utils/c2ph utils/h2ph utils/h2xs utils/perlbug utils/perldoc
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams utils/pl2pm utils/splain utils/perlcc utils/dprofpp
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams x2p/s2p x2p/find2perl
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams pod/pod2man pod/pod2html pod/pod2latex pod/pod2text
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams pod/pod2usage pod/podchecker pod/podselect);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Added for ON - install the scripts (if any) from contrib_bin.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $dh;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif (opendir($dh, 'contrib_bin')) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams push(@scripts,
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams map("contrib_bin/$_", grep($_ !~ /^\./, readdir($dh))));
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams closedir($dh);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif ($scr_ext) { @scripts = map { "$_$scr_ext" } @scripts; }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy @pods = (<pod/*.pod>);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Specify here any .pm files that are actually architecture-dependent.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# (Those included with XS extensions under ext/ are automatically
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# added later.)
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Now that the default privlib has the full perl version number included,
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# we no longer have to play the trick of sticking version-specific .pm
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# files under the archlib directory.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy %archpms = (
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams Config => 1,
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif ($^O eq 'dos') {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams push(@scripts,'djgpp/fixpmain');
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $archpms{config} = $archpms{filehand} = 1;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif ((-e "testcompile") && (defined($ENV{'COMPILE'})))
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams{
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams push(@scripts, map("$_.exe", @scripts));
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsfind(sub {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ("$File::Find::dir/$_" =~ m{^ext\b(.*)/([^/]+)\.pm$}) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my($path, $modname) = ($1,$2);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # strip trailing component first
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $path =~ s{/[^/]*$}{};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # strip optional "/lib";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $path =~ s{/lib\b}{};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # strip any leading /
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $path =~ s{^/}{};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # reconstitute canonical module name
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $modname = "$path/$modname" if length $path;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # remember it
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $archpms{$modname} = 1;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }, 'ext');
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# print "[$_]\n" for sort keys %archpms;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $ver = $Config{version};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $release = substr($],0,3); # Not used currently.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $patchlevel = substr($],3,2);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsdie "Patchlevel of perl ($patchlevel)",
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams "and patchlevel of config.sh ($Config{'PERL_VERSION'}) don't match\n"
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if $patchlevel != $Config{'PERL_VERSION'};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Read $ROOT - location of the proto area for the install.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $root = $ENV{ROOT};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Fetch some frequently-used items from %Config
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $installbin = $root . $Config{installbin};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $installscript = $root . $Config{installscript};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $installprivlib = $root . $Config{installprivlib};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $installarchlib = $root . $Config{installarchlib};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $installsitelib = $root . $Config{installsitelib};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $installsitearch = $root . $Config{installsitearch};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $installman1dir = $root . $Config{installman1dir};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $man1ext = $Config{man1ext};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $libperl = $root . $Config{libperl};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Shared library and dynamic loading suffixes.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $so = $Config{so};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $dlext = $Config{dlext};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $dlsrc = $Config{dlsrc};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif ($^O eq 'os390') {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my $usedl = $Config{usedl};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ($usedl eq 'define') {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my $pwd;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chomp($pwd=`pwd`);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my $archlibexp = $Config{archlibexp};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams `./$^X -p -e 's{$pwd\/libperl.x}{$archlibexp/CORE/libperl.x}' lib/Config.pm`;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $d_dosuid = $Config{d_dosuid};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $binexp = $Config{binexp};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif ($Is_VMS) { # Hang in there until File::Spec hits the big time
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams foreach ( \$installbin, \$installscript, \$installprivlib,
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams \$installarchlib, \$installsitelib, \$installsitearch,
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams \$installman1dir ) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $$_ = unixify($$_); $$_ =~ s:/$::;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Do some quick sanity checks.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif ($d_dosuid && $>) { die "You must run as root to install suidperl\n"; }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $installbin || die "No installbin directory in config.sh\n";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams-d $installbin || mkpath($installbin, $verbose, 0777);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams-d $installbin || $nonono || die "$installbin is not a directory\n";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams-w $installbin || $nonono || die "$installbin is not writable by you\n"
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams unless $installbin =~ m#^/afs/# || $nonono;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams-x 'perl' . $exe_ext || die "perl isn't executable!\n";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams-x 'suidperl' . $exe_ext|| die "suidperl isn't executable!\n" if $d_dosuid;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Removed for ON
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams#-f 't/rantests' || $Is_W32
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# || warn "WARNING: You've never run 'make test'!!!",
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# " (Installing anyway.)\n";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif ($Is_W32 or $Is_Cygwin) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my $perldll;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ($Is_Cygwin) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $perldll = $libperl;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $perldll =~ s/(\..*)?$/.$dlext/;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ($Config{useshrplib} eq 'true') {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # install ld2 and perlld as well
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams foreach ('ld2', 'perlld') {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams safe_unlink("$installbin/$_");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy("$_", "$installbin/$_");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0755, "$installbin/$_");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams };
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams };
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams } else {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $perldll = 'perl56.' . $dlext;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ($dlsrc ne "dl_none.xs") {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams -f $perldll || die "No perl DLL built\n";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # Install the DLL
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams safe_unlink("$installbin/$perldll");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy("$perldll", "$installbin/$perldll");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0755, "$installbin/$perldll");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams} # if ($Is_W32 or $Is_Cygwin)
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# This will be used to store the packlist
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $packlist = ExtUtils::Packlist->new();
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# First we install the version-numbered executables.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif ($Is_VMS) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams safe_unlink("$installbin/$perl$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy("perl$exe_ext", "$installbin/$perl$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0755, "$installbin/$perl$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams safe_unlink("$installbin/${perl}shr$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy("perlshr$exe_ext", "$installbin/${perl}shr$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0755, "$installbin/${perl}shr$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamselsif ($^O eq 'mpeix') {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # MPE lacks hard links and requires that executables with special
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # capabilities reside in the MPE namespace.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams safe_unlink("$installbin/perl$ver$exe_ext", $Config{perlpath});
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # Install the primary executable into the MPE namespace as perlpath.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy("perl$exe_ext", $Config{perlpath});
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0755, $Config{perlpath});
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # Create a backup copy with the version number.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams link($Config{perlpath}, "$installbin/perl$ver$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamselsif ($^O ne 'dos') {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy_if_diff("perl$exe_ext", "$installbin/$perl_verbase$ver$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0755, "$installbin/$perl_verbase$ver$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams strip("$installbin/$perl_verbase$ver$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0555, "$installbin/$perl_verbase$ver$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamselse {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams safe_unlink("$installbin/$perl.exe");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy("perl.exe", "$installbin/$perl.exe");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamssafe_unlink("$installbin/s$perl_verbase$ver$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif ($d_dosuid) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy("suidperl$exe_ext", "$installbin/s$perl_verbase$ver$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(04711, "$installbin/s$perl_verbase$ver$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Install library files.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy ($do_installarchlib, $do_installprivlib) = (0, 0);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmkpath($installprivlib, $verbose, 0777);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmkpath($installarchlib, $verbose, 0777);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmkpath($installsitelib, $verbose, 0777) if ($installsitelib);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmkpath($installsitearch, $verbose, 0777) if ($installsitearch);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif (chdir "lib") {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $do_installarchlib = ! samepath($installarchlib, '.');
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $do_installprivlib = ! samepath($installprivlib, '.');
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$ver/);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ($do_installarchlib || $do_installprivlib) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams find(\&installlib, '.');
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chdir ".." || die "Can't cd back to source directory: $!\n";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamselse {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams warn "Can't cd to lib to install lib files: $!\n";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Install header files and libraries.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmkpath("$installarchlib/CORE", $verbose, 0777);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy @corefiles;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif ($Is_VMS) { # We did core file selection during build
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my $coredir = "lib/$Config{archname}/$ver/CORE";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $coredir =~ tr/./_/;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams map { s|^$coredir/||i; } @corefiles = <$coredir/*.*>;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamselse {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # [als] hard-coded 'libperl' name... not good!
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams @corefiles = <*.h libperl*.*>;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # AIX needs perl.exp installed as well.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams push(@corefiles,'perl.exp') if $^O eq 'aix';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ($^O eq 'mpeix') {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # MPE needs mpeixish.h installed as well.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams mkpath("$installarchlib/CORE/mpeix", $verbose, 0777);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams push(@corefiles,'mpeix/mpeixish.h');
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # If they have built sperl.o...
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams push(@corefiles,'sperl.o') if -f 'sperl.o';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsforeach my $file (@corefiles) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # HP-UX (at least) needs to maintain execute permissions
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # on dynamically-loadable libraries. So we do it for all.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if (copy_if_diff($file,"$installarchlib/CORE/$file")) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ($file =~ /\.(\Q$so\E|\Q$dlext\E)$/) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0555, "$installarchlib/CORE/$file");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams strip("-S", "$installarchlib/CORE/$file") if $^O =~ /^(rhapsody|darwin)$/;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams } else {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0444, "$installarchlib/CORE/$file");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Install main perl executables
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Make links to ordinary names if installbin directory isn't current directory.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams safe_unlink("$installbin/$perl$exe_ext", "$installbin/suid$perl$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ($^O eq 'mpeix') {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # MPE doesn't support hard links, so use a symlink.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # We don't want another cloned copy.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams symlink($Config{perlpath}, "$installbin/perl$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams } else {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams link("$installbin/$perl_verbase$ver$exe_ext",
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams "$installbin/$perl$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams link("$installbin/s$perl_verbase$ver$exe_ext",
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams "$installbin/suid$perl$exe_ext")
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if $d_dosuid;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Offer to install perl in a "standard" location
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $mainperl_is_instperl = 0;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif ($Config{installusrbinperl} && $Config{installusrbinperl} eq 'define' &&
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams !$versiononly && !$nonono && !$Is_W32 && !$Is_VMS && -t STDIN && -t STDERR
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams && -w $mainperldir && ! samepath($mainperldir, $installbin)) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my($usrbinperl) = "$mainperldir/$perl$exe_ext";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my($instperl) = "$installbin/$perl$exe_ext";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my($expinstperl) = "$binexp/$perl$exe_ext";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # First make sure $usrbinperl is not already the same as the perl we
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # just installed.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if (-x $usrbinperl) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # Try to be clever about mainperl being a symbolic link
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # to binexp/perl if binexp and installbin are different.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $mainperl_is_instperl =
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams samepath($usrbinperl, $instperl) ||
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams samepath($usrbinperl, $expinstperl) ||
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams (($binexp ne $installbin) &&
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams (-l $usrbinperl) &&
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams ((readlink $usrbinperl) eq $expinstperl));
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ((! $mainperl_is_instperl) &&
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams (yn("Many scripts expect perl to be installed as $usrbinperl.\n" .
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams "Do you wish to have $usrbinperl be the same as\n" .
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams "$expinstperl? [y] ")))
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams unlink($usrbinperl);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams ( $Config{'d_link'} eq 'define' &&
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams eval { CORE::link $instperl, $usrbinperl } ) ||
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams eval { symlink $expinstperl, $usrbinperl } ||
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy($instperl, $usrbinperl);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $mainperl_is_instperl = 1;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Make links to ordinary names if installbin directory isn't current directory.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif (!$versiononly && ! samepath($installbin, 'x2p')) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams safe_unlink("$installbin/a2p$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy("x2p/a2p$exe_ext", "$installbin/a2p$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0555, "$installbin/a2p$exe_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# cppstdin is just a script, but it is architecture-dependent, so
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# it can't safely be shared. Place it in $installbin.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Note that Configure doesn't build cppstin if it isn't needed, so
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# we skip this if cppstdin doesn't exist.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif (! $versiononly && (-f 'cppstdin') && (! samepath($installbin, '.'))) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams safe_unlink("$installbin/cppstdin");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy("cppstdin", "$installbin/cppstdin");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0555, "$installbin/cppstdin");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif (! $versiononly) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # Install scripts.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams mkpath($installscript, $verbose, 0777);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams for (@scripts) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams (my $base = $_) =~ s#.*/##;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy_if_diff($_, "$installscript/$base");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0555, "$installscript/$base");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # pstruct should be a link to c2ph
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ($^O eq 'dos' or $Is_VMS or $^O eq 'transit') {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams safe_unlink("$installscript/pstruct$scr_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy("$installscript/c2ph$scr_ext",
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams "$installscript/pstruct$scr_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams } elsif (! samepath("$installscript/c2ph$scr_ext",
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams "$installscript/pstruct$scr_ext")) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams safe_unlink("$installscript/pstruct$scr_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams link("$installscript/c2ph$scr_ext",
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams "$installscript/pstruct$scr_ext");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Install pod pages. Where? I guess in $installprivlib/pod
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# ($installprivlib/pods for cygwin).
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $pod = $Is_Cygwin ? 'pods' : 'pod';
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif ( !$versiononly || ($installprivlib =~ m/\Q$ver/)) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams mkpath("${installprivlib}/$pod", $verbose, 0777);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # If Perl 5.003's perldiag.pod is there, rename it.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if (open POD, "${installprivlib}/$pod/perldiag.pod") {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams read POD, $_, 4000;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams close POD;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # Some of Perl 5.003's diagnostic messages ended with periods.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if (/^=.*\.$/m) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my ($from, $to) = ("${installprivlib}/$pod/perldiag.pod",
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams "${installprivlib}/$pod/perldiag-5.003.pod");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams print " rename $from $to";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams rename($from, $to)
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams or warn "Couldn't rename $from to $to: $!\n"
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams unless $nonono;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams for (@pods) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams # $_ is a name like pod/perl.pod
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams (my $base = $_) =~ s#.*/##;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy_if_diff($_, "${installprivlib}/$pod/${base}");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0444, "${installprivlib}/$pod/${base}");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Check to make sure there aren't other perls around in installer's
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# path. This is probably UNIX-specific. Check all absolute directories
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# in the path except for where public executables are supposed to live.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Also skip $mainperl if the user opted to have it be a link to the
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# installed perl.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Note: Removed for ON
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams#if (!$versiononly && $otherperls) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# my ($path, @path);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# my $dirsep = ($Is_OS2 || $Is_W32) ? ';' : ':' ;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# ($path = $ENV{"PATH"}) =~ s:\\:/:g ;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# @path = split(/$dirsep/, $path);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# if ($Is_VMS) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# my $i = 0;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# while (exists $ENV{'DCL$PATH' . $i}) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# my $dir = unixpath($ENV{'DCL$PATH' . $i}); $dir =~ s-/$--;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# push(@path,$dir);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# my @otherperls;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# my %otherperls;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# for (@path) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# next unless m,^/,;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# # Use &samepath here because some systems have other dirs linked
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# # to $mainperldir (like SunOS)
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# next if samepath($_, $binexp);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# next if ($mainperl_is_instperl && samepath($_, $mainperldir));
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# my $otherperl = "$_/$perl$exe_ext";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# next if $otherperls{$otherperl}++;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# push(@otherperls, $otherperl)
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# if (-x $otherperl && ! -d $otherperl);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# if (@otherperls) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# warn "\nWarning: $perl appears in your path in the following " .
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# "locations beyond where\nwe just installed it:\n";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# for (@otherperls) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# warn " ", $_, "\n";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# warn "\n";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams#
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams#}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams# Added for ON - remove $ROOT prefix from the packlist entries.
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsmy $pat = qr{^$root};
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamswhile (my ($k, $v) = each(%{$packlist})) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams delete($packlist->{$k});
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $k =~ s/$pat//;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ($v->{type} eq 'link') {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my $l = delete($v->{from});
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $l =~ s/$pat//;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $v->{from} = $l;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $packlist->{$k} = $v;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsif (! $nonono) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $packlist->write("$installarchlib/.packlist.tmp");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams copy_if_diff("$installarchlib/.packlist.tmp",
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams "$installarchlib/.packlist");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams safe_unlink("$installarchlib/.packlist.tmp");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod(0444, "$installarchlib/.packlist");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsprint " Installation complete\n" if $verbose;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamsexit 0;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams###############################################################################
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamssub yn {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my($prompt) = @_;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my($answer);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my($default) = $prompt =~ m/\[([yn])\]\s*$/i;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams warn $prompt;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chop($answer = <STDIN>);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $answer = $default if $answer =~ m/^\s*$/;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams ($answer =~ m/^[yY]/);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamssub unlink {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my(@names) = @_;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my($cnt) = 0;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams return scalar(@names) if $Is_VMS;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams foreach my $name (@names) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams next unless -e $name;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod 0777, $name if ($Is_OS2 || $Is_W32 || $Is_Cygwin);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams print " unlink $name\n" if $verbose;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams ( CORE::unlink($name) and ++$cnt
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams or warn "Couldn't unlink $name: $!\n" ) unless $nonono;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams return $cnt;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamssub safe_unlink {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams return if $nonono or $Is_VMS;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my @names = @_;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams foreach my $name (@names) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams next unless -e $name;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams chmod 0777, $name if ($Is_OS2 || $Is_W32);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams print " unlink $name\n" if $verbose;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams next if CORE::unlink($name);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams warn "Couldn't unlink $name: $!\n";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ($! =~ /busy/i) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams print " mv $name $name.old\n" if $verbose;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams safe_rename($name, "$name.old")
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams or warn "Couldn't rename $name: $!\n";
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamssub safe_rename {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my($from,$to) = @_;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if (-f $to and not unlink($to)) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my($i);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams for ($i = 1; $i < 50; $i++) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams last if rename($to, "$to.$i");
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams warn("Cannot rename to `$to.$i': $!"), return 0
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if $i >= 50; # Give up!
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams }
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams link($from,$to) || return 0;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams unlink($from);
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williamssub link {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my($from,$to) = @_;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams my($success) = 0;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams print $verbose ? " ln $from $to\n" : " $to\n" unless $silent;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams eval {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams CORE::link($from, $to)
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams ? $success++
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams : ($from =~ m#^/afs/# || $to =~ m#^/afs/#)
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams ? die "AFS" # okay inside eval {}
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams : die "Couldn't link $from to $to: $!\n"
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams unless $nonono;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $packlist->{$to} = { from => $from, type => 'link' };
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams };
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if ($@) {
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams warn $@;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams print $verbose ? " cp $from $to\n" : " $to\n" unless $silent;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams print " creating new version of $to\n"
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams if $Is_VMS and -e $to and !$silent;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams File::Copy::copy($from, $to)
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams ? $success++
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams : warn "Couldn't copy $from to $to: $!\n"
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams unless $nonono;
8fc236b9a04ca8cf4a6ee748cc701210ce4910d6gary.williams $packlist->{$to} = { type => 'file' };
}
$success;
}
sub chmod {
my($mode,$name) = @_;
return if ($^O eq 'dos');
printf " chmod %o %s\n", $mode, $name if $verbose;
CORE::chmod($mode,$name)
|| warn sprintf("Couldn't chmod %o %s: $!\n", $mode, $name)
unless $nonono;
}
sub copy {
my($from,$to) = @_;
print $verbose ? " cp $from $to\n" : " $to\n" unless $silent;
print " creating new version of $to\n" if $Is_VMS and -e $to and !$silent;
File::Copy::copy($from, $to)
|| warn "Couldn't copy $from to $to: $!\n"
unless $nonono;
$packlist->{$to} = { type => 'file' };
}
sub samepath {
my($p1, $p2) = @_;
return (lc($p1) eq lc($p2)) if $Is_W32;
if ($p1 ne $p2) {
my($dev1, $ino1, $dev2, $ino2);
($dev1, $ino1) = stat($p1);
($dev2, $ino2) = stat($p2);
($dev1 == $dev2 && $ino1 == $ino2);
}
else {
1;
}
}
sub installlib {
my $dir = $File::Find::dir;
$dir =~ s#^\.(?![^/])/?##;
local($depth) = $dir ? "lib/$dir" : "lib";
my $name = $_;
# Ignore SCCS, RCS and CVS directories.
if ((($name eq 'SCCS' or $name eq 'CVS' or $name eq 'RCS') and -d $name)
or ($name eq '.tstamp' and -f $name)) {
$File::Find::prune = 1;
return;
}
# ignore patch backups, RCS files, emacs backup & temp files and the
# .exists files.
return if $name =~ m{\.orig$|~$|^#.+#$|,v$|^\.exists};
$name = "$dir/$name" if $dir ne '';
my $installlib = $installprivlib;
if ($dir =~ /^auto/ ||
($name =~ /^(.*)\.(?:pm|pod)$/ && $archpms{$1}) ||
($name =~ /^(.*)\.(?:h|lib)$/i && $Is_W32)
) {
$installlib = $installarchlib;
return unless $do_installarchlib;
} else {
return unless $do_installprivlib;
}
if (-f $_) {
if (/\.(?:al|ix)$/ && !($dir =~ m[^auto/(.*)$] && $archpms{$1})) {
$installlib = $installprivlib;
#We're installing *.al and *.ix files into $installprivlib,
#but we have to delete old *.al and *.ix files from the 5.000
#distribution:
#This might not work because $archname might have changed.
unlink("$installarchlib/$name");
}
$packlist->{"$installlib/$name"} = { type => 'file' };
if (compare($_, "$installlib/$name") || $nonono) {
unlink("$installlib/$name");
mkpath("$installlib/$dir", $verbose, 0777);
# HP-UX (at least) needs to maintain execute permissions
# on dynamically-loaded libraries.
copy_if_diff($_, "$installlib/$name")
and chmod($name =~ /\.(so|$dlext)$/o ? 0555 : 0444,
"$installlib/$name");
}
}
}
# Copy $from to $to, only if $from is different than $to.
# Also preserve modification times for .a libraries.
# On some systems, if you do
# ranlib libperl.a
# cp libperl.a /usr/local/lib/perl5/archlib/CORE/libperl.a
# and then try to link against the installed libperl.a, you might
# get an error message to the effect that the symbol table is older
# than the library.
# Return true if copying occurred.
sub copy_if_diff {
my($from,$to)=@_;
return 1 if (($^O eq 'VMS') && (-d $from));
-f $from || 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;
}
copy($from, $to);
# Restore timestamps if it's a .a library or for OS/2.
if (!$nonono && ($Is_OS2 || $to =~ /\.a$/)) {
my ($atime, $mtime) = (stat $from)[8,9];
utime $atime, $mtime, $to;
}
1;
}
}
sub strip
{
my(@args) = @_;
return unless $dostrip;
my @opts;
while (@args && $args[0] =~ /^(-\w+)$/) {
push @opts, shift @args;
}
foreach my $file (@args) {
if (-f $file) {
print " strip $file\n" if $verbose;
system("strip", @opts, $file);
} else {
print "# file '$file' skipped\n" if $verbose;
}
}
}