summaryrefslogtreecommitdiff
path: root/installperl
diff options
context:
space:
mode:
authorMichael Schroeder <Michael.Schroeder@informatik.uni-erlangen.de>2003-07-11 16:48:41 +0200
committerJarkko Hietaniemi <jhi@iki.fi>2003-07-29 11:31:17 +0000
commit5a9231b0b3e59b5d3123feacc331e9990c48e062 (patch)
tree294dc69f37001938684d19b8587cd995a490755d /installperl
parente0b4086be61790b6983e8b3e4481fb6ca437ec94 (diff)
downloadperl-5a9231b0b3e59b5d3123feacc331e9990c48e062.tar.gz
DESTDIR in perl-5.8.1 package?
Date: Fri, 11 Jul 2003 14:48:41 +0200 Message-ID: <20030711124841.GA18327@immd4.informatik.uni-erlangen.de> Subject: Re: DESTDIR in perl-5.8.1 package? From: Michael Schroeder <Michael.Schroeder@informatik.uni-erlangen.de> Date: Mon, 14 Jul 2003 12:00:25 +0200 Message-ID: <20030714100025.GA26612@immd4.informatik.uni-erlangen.de> (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) p4raw-id: //depot/perl@20302
Diffstat (limited to 'installperl')
-rwxr-xr-xinstallperl46
1 files changed, 29 insertions, 17 deletions
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) {