diff options
-rw-r--r-- | INSTALL | 11 | ||||
-rw-r--r-- | Makefile.SH | 4 | ||||
-rwxr-xr-x | installman | 16 | ||||
-rwxr-xr-x | installperl | 46 |
4 files changed, 51 insertions, 26 deletions
@@ -650,6 +650,17 @@ Here's one way to do that: cd /opt/perl # Or wherever you specified as $prefix tar xvf perl5-archive.tar +Alternatively, perl honors the DESTDIR variable in the make install +call. DESTDIR is automatically prepended to all the installation paths. +With DESTDIR, the above example can we written as: + + sh Configure -Dprefix=/opt/perl -des + make + make test + make install DESTDIR=/tmp/perl5 + cd /tmp/perl5/opt/perl + tar cvf /tmp/perl5-archive.tar . + =head2 Site-wide Policy settings After Configure runs, it stores a number of common site-wide "policy" diff --git a/Makefile.SH b/Makefile.SH index 12f381b517..a2a7f768f2 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -788,11 +788,11 @@ install.perl: all installperl cd ../pod; $(MAKE) compile; \ else :; \ fi - $(LDLIBPTH) ./perl installperl $(INSTALLFLAGS) $(STRIPFLAGS) + $(LDLIBPTH) ./perl installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS) $(MAKE) extras.install install.man: all installman - $(LDLIBPTH) ./perl installman $(INSTALLFLAGS) + $(LDLIBPTH) ./perl installman --destdir=$(DESTDIR) $(INSTALLFLAGS) # XXX Experimental. Hardwired values, but useful for testing. # Eventually Configure could ask for some of these values. diff --git a/installman b/installman index 2260c26d42..1a5062dd37 100755 --- a/installman +++ b/installman @@ -41,15 +41,15 @@ my $usage = 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}); @@ -61,13 +61,13 @@ $opts{verbose} ||= $opts{V} || $opts{notify}; -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. @@ -163,11 +163,13 @@ sub pod2man { 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; } } diff --git a/installperl b/installperl index 67d4530ab2..014d1885be 100755 --- a/installperl +++ b/installperl @@ -62,6 +62,7 @@ my $perl_verbase = defined($ENV{PERLNAME_VERBASE}) : $perl; $otherperls = 1; +my $destdir = ''; while (@ARGV) { $nonono = 1 if $ARGV[0] eq '-n'; $dostrip = 1 if $ARGV[0] eq '-s'; @@ -74,6 +75,7 @@ while (@ARGV) { $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] @@ -170,13 +172,13 @@ die "Patchlevel of perl ($patchlevel)", 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. @@ -680,7 +682,11 @@ sub link { 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++ @@ -688,18 +694,18 @@ sub link { ? 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; } @@ -717,12 +723,14 @@ sub chmod { 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 { @@ -785,7 +793,9 @@ sub installlib { #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); @@ -830,6 +840,8 @@ sub installlib { 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 && @@ -842,7 +854,7 @@ sub copy_if_diff { $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) { |