Change 20302 by [EMAIL PROTECTED] on 2003/07/29 11:31:17 Subject: DESTDIR in perl-5.8.1 package? From: Michael Schroeder <[EMAIL PROTECTED]> Date: Fri, 11 Jul 2003 14:48:41 +0200 Message-ID: <[EMAIL PROTECTED]> Subject: Re: DESTDIR in perl-5.8.1 package? From: Michael Schroeder <[EMAIL PROTECTED]> Date: Mon, 14 Jul 2003 12:00:25 +0200 Message-ID: <[EMAIL PROTECTED]> (blindly prepending and s///ing away the $destdir does not work at least in VMS, but the --destdir should help rpm builders and the like)
Affected files ... ... //depot/perl/INSTALL#133 edit ... //depot/perl/Makefile.SH#283 edit ... //depot/perl/installman#43 edit ... //depot/perl/installperl#111 edit Differences ... ==== //depot/perl/INSTALL#133 (text) ==== Index: perl/INSTALL --- perl/INSTALL#132~20251~ Sun Jul 27 21:51:46 2003 +++ perl/INSTALL Tue Jul 29 04:31:17 2003 @@ -650,6 +650,17 @@ 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" ==== //depot/perl/Makefile.SH#283 (text) ==== Index: perl/Makefile.SH --- perl/Makefile.SH#282~20270~ Mon Jul 28 08:12:28 2003 +++ perl/Makefile.SH Tue Jul 29 04:31:17 2003 @@ -788,11 +788,11 @@ 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. ==== //depot/perl/installman#43 (xtext) ==== Index: perl/installman --- perl/installman#42~17408~ Sun Jul 7 11:48:06 2002 +++ perl/installman Tue Jul 29 04:31:17 2003 @@ -41,15 +41,15 @@ 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 @@ -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 @@ 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; } } ==== //depot/perl/installperl#111 (xtext) ==== Index: perl/installperl --- perl/installperl#110~20220~ Sun Jul 27 08:13:10 2003 +++ perl/installperl Tue Jul 29 04:31:17 2003 @@ -62,6 +62,7 @@ : $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 @@ $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 @@ 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 @@ 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 @@ ? 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 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 @@ #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 copy_if_diff { my($from,$to)[EMAIL PROTECTED]; 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 @@ $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) { End of Patch.