my %opts;
GetOptions( \%opts,
qw( man1dir=s man1ext=s man3dir=s man3ext=s batchlimit=i
- notify n help silent S verbose V))
+ destdir=s notify n help silent S verbose V))
|| die $usage;
die $usage if $opts{help};
-$opts{man1dir} = $Config{'installman1dir'}
+$opts{man1dir} = "$opts{destdir}$Config{'installman1dir'}"
unless defined($opts{man1dir});
$opts{man1ext} = $Config{'man1ext'}
unless defined($opts{man1ext});
-$opts{man3dir} = $Config{'installman3dir'}
+$opts{man3dir} = "$opts{destdir}$Config{'installman3dir'}"
unless defined($opts{man3dir});
$opts{man3ext} = $Config{'man3ext'}
unless defined($opts{man3ext});
-x "./perl$Config{exe_ext}"
or warn "./perl$Config{exe_ext} not found! Have you run make?\n";
--d $Config{'installprivlib'}
+-d "$opts{destdir}$Config{'installprivlib'}"
|| warn "Perl library directory $Config{'installprivlib'} not found.
Have you run make install?. (Installing anyway.)\n";
-x "t/perl$Config{exe_ext}" || warn "WARNING: You've never run 'make test'!!!",
" (Installing anyway.)\n";
-$packlist = ExtUtils::Packlist->new("$Config{installarchlib}/.packlist");
+$packlist = ExtUtils::Packlist->new("$opts{destdir}/$Config{installarchlib}/.packlist");
# Install the main pod pages.
foreach my $page (@to_process) {
my($pod, $tmp, $manpage) = @$page;
- print " $manpage\n";
+ my $xmanpage = $manpage;
+ $xmanpage =~ s/^\Q$opts{'destdir'}\E// if $opts{'destdir'};
+ print " $xmanpage\n";
if (!$opts{notify} && $parser->parse_from_file($pod, $tmp)) {
if (-s $tmp) {
if (rename($tmp, $manpage)) {
- $packlist->{$manpage} = { type => 'file' };
+ $packlist->{$xmanpage} = { type => 'file' };
next;
}
}
: $perl;
$otherperls = 1;
+my $destdir = '';
while (@ARGV) {
$nonono = 1 if $ARGV[0] eq '-n';
$dostrip = 1 if $ARGV[0] eq '-s';
$archname = 1 if $ARGV[0] eq '-A';
$nwinstall = 1 if $ARGV[0] eq '-netware';
$nopods = 1 if $ARGV[0] eq '-p';
+ $destdir = $1 if $ARGV[0] =~ /^-?-destdir=(.*)$/;
if ($ARGV[0] eq '-?' or $ARGV[0] =~ /^-?-h/) {
print <<"EOT";
Usage $0: [switches]
if $patchlevel != $Config{'PERL_VERSION'};
# Fetch some frequently-used items from %Config
-my $installbin = $Config{installbin};
-my $installscript = $Config{installscript};
-my $installprivlib = $Config{installprivlib};
-my $installarchlib = $Config{installarchlib};
-my $installsitelib = $Config{installsitelib};
-my $installsitearch = $Config{installsitearch};
-my $installman1dir = $Config{installman1dir};
+my $installbin = "$destdir$Config{installbin}";
+my $installscript = "$destdir$Config{installscript}";
+my $installprivlib = "$destdir$Config{installprivlib}";
+my $installarchlib = "$destdir$Config{installarchlib}";
+my $installsitelib = "$destdir$Config{installsitelib}";
+my $installsitearch = "$destdir$Config{installsitearch}";
+my $installman1dir = "$destdir$Config{installman1dir}";
my $man1ext = $Config{man1ext};
my $libperl = $Config{libperl};
# Shared library and dynamic loading suffixes.
my($from,$to) = @_;
my($success) = 0;
- print $verbose ? " ln $from $to\n" : " $to\n" unless $silent;
+ my $xfrom = $from;
+ $xfrom =~ s/^\Q$destdir\E// if $destdir;
+ my $xto = $to;
+ $xto =~ s/^\Q$destdir\E// if $destdir;
+ print $verbose ? " ln $xfrom $xto\n" : " $xto\n" unless $silent;
eval {
CORE::link($from, $to)
? $success++
? die "AFS" # okay inside eval {}
: die "Couldn't link $from to $to: $!\n"
unless $nonono;
- $packlist->{$to} = { from => $from, type => 'link' };
+ $packlist->{$xto} = { from => $xfrom, type => 'link' };
};
if ($@) {
warn $@;
- print $verbose ? " cp $from $to\n" : " $to\n" unless $silent;
- print " creating new version of $to\n"
+ print $verbose ? " cp $from $xto\n" : " $xto\n" unless $silent;
+ print " creating new version of $xto\n"
if $Is_VMS and -e $to and !$silent;
File::Copy::copy($from, $to)
? $success++
: warn "Couldn't copy $from to $to: $!\n"
unless $nonono;
- $packlist->{$to} = { type => 'file' };
+ $packlist->{$xto} = { type => 'file' };
}
$success;
}
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;
+ my $xto = $to;
+ $xto =~ s/^\Q$destdir\E// if $destdir;
+ print $verbose ? " cp $from $xto\n" : " $xto\n" unless $silent;
+ print " creating new version of $xto\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' };
+ $packlist->{$xto} = { type => 'file' };
}
sub samepath {
#This might not work because $archname might have changed.
unlink("$installarchlib/$name");
}
- $packlist->{"$installlib/$name"} = { type => 'file' };
+ my $xname = "$installlib/$name";
+ $xname =~ s/^\Q$destdir\E// if $destdir;
+ $packlist->{$xname} = { type => 'file' };
if ($force || compare($_, "$installlib/$name") || $nonono) {
unlink("$installlib/$name");
mkpath("$installlib/$dir", $verbose, 0777);
sub copy_if_diff {
my($from,$to)=@_;
return 1 if (($^O eq 'VMS') && (-d $from));
+ my $xto = $to;
+ $xto =~ s/^\Q$destdir\E// if $destdir;
my $perlpodbadsymlink;
if ($from =~ m!^pod/perl[\w-]+\.pod$! &&
-l $from &&
$perlpodbadsymlink = 1;
}
-f $from || $perlpodbadsymlink || warn "$0: $from not found";
- $packlist->{$to} = { type => 'file' };
+ $packlist->{$xto} = { type => 'file' };
if ($force || compare($from, $to) || $nonono) {
safe_unlink($to); # In case we don't have write permissions.
if ($nonono) {