Front page | perl.perl5.porters |
Postings from November 2003
[PATCH 5.8.2 @21574] make install: PREFIX and DESTDIR
Thread Next
From:
Ilya Zakharevich
Date:
November 4, 2003 20:19
Subject:
[PATCH 5.8.2 @21574] make install: PREFIX and DESTDIR
Message ID:
20031105041836.GA2649@math.berkeley.edu
It turns out that `make install' does not support specification of
PREFIX= argument - as I think it did before. Actually, it pretends it
supports DESTDIR= (which is not a substitution for PREFIX, btw);
however, there is no way to pass it to a daughter-make-call.
This patch adds options --prefix to installperl and installman (but
not installhtml ;-), and makes DESTDIR working via `make install'.
Since it is not fully tested (e.g., I did not test it without
PREFIX=/foo/bar), it should not be applied to the maintainance branch.
Hope this helps,
Ilya
P.S. This also adds INSTALL_DEPENDENCE macro; setting it to an empty
string allows one to test install without an attempt to rebuild the
world. E.g., I tested this patch by
make install INSTALL_DEPENDENCE= PREFIX=d:/tmp
--- ./Makefile.SH-pre Wed Oct 22 12:53:08 2003
+++ ./Makefile.SH Tue Nov 4 19:53:20 2003
@@ -778,21 +778,24 @@ META.yml: Porting/makemeta Porting/Maint
$(LDLIBPTH) ./miniperl -Ilib Porting/makemeta
install-strip:
- $(MAKE) STRIPFLAGS=-s install
+ $(MAKE) STRIPFLAGS=-s install DESTDIR="$(DESTDIR)" PREFIX="$(PREFIX)"
install install-all:
- $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS)
+ $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) DESTDIR="$(DESTDIR)" PREFIX="$(PREFIX)"
install-verbose:
- $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-V
+ $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-V DESTDIR="$(DESTDIR)" PREFIX="$(PREFIX)"
install-silent:
- $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-S
+ $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-S DESTDIR="$(DESTDIR)" PREFIX="$(PREFIX)"
no-install:
- $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-n
+ $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-n DESTDIR="$(DESTDIR)" PREFIX="$(PREFIX)"
-install.perl: all installperl
+# Set this to an empty string to avoid an attempt of rebuild before install
+INSTALL_DEPENDENCE = all
+
+install.perl: $(INSTALL_DEPENDENCE) installperl
if [ -n "$(COMPILE)" ]; \
then \
cd utils; $(MAKE) compile; \
@@ -800,11 +802,11 @@ install.perl: all installperl
cd ../pod; $(MAKE) compile; \
else :; \
fi
- $(LDLIBPTH) ./perl installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
+ $(LDLIBPTH) ./perl installperl --destdir=$(DESTDIR) --prefix="$(PREFIX)" $(INSTALLFLAGS) $(STRIPFLAGS)
$(MAKE) extras.install
-install.man: all installman
- $(LDLIBPTH) ./perl installman --destdir=$(DESTDIR) $(INSTALLFLAGS)
+install.man: $(INSTALL_DEPENDENCE) installman
+ $(LDLIBPTH) ./perl installman --destdir=$(DESTDIR) --prefix="$(PREFIX)" $(INSTALLFLAGS)
# XXX Experimental. Hardwired values, but useful for testing.
# Eventually Configure could ask for some of these values.
--- ./os2/Makefile.SHs-pre Thu Oct 30 21:49:18 2003
+++ ./os2/Makefile.SHs Tue Nov 4 19:57:04 2003
@@ -288,7 +288,7 @@ aout_clean:
aout_install: perl_ aout_install.perl
aout_install.perl: perl_ installperl
- ./perl_ installperl
+ ./perl_ installperl --destdir="$(DESTDIR)" --prefix="$(PREFIX)"
perlrexx: $(PERLREXX_DLL)
@sh -c true
--- ./installperl-pre Sun Aug 31 09:58:48 2003
+++ ./installperl Tue Nov 4 19:43:10 2003
@@ -73,6 +81,7 @@ if ( $Is_VMS ) {
$otherperls = 1;
my $destdir = '';
+my $prefix = '';
while (@ARGV) {
$nonono = 1 if $ARGV[0] eq '-n';
$dostrip = 1 if $ARGV[0] eq '-s';
@@ -86,6 +95,7 @@ while (@ARGV) {
$nwinstall = 1 if $ARGV[0] eq '-netware';
$nopods = 1 if $ARGV[0] eq '-p';
$destdir = $1 if $ARGV[0] =~ /^-?-destdir=(.*)$/;
+ $prefix = $1 if $ARGV[0] =~ /^-?-prefix=(.*)$/;
if ($ARGV[0] eq '-?' or $ARGV[0] =~ /^-?-h/) {
print <<"EOT";
Usage $0: [switches]
@@ -103,6 +113,8 @@ Usage $0: [switches]
name.
-p Don't install the pod files. [This will break use diagnostics;]
-netware Install correctly on a Netware server.
+ -destdir Prefix installation directories by this string.
+ -prefix Replace "$Config{installprefix}" by this string in installation directories.
EOT
exit;
}
@@ -189,6 +201,13 @@ my $installarchlib = "$destdir$Config{in
my $installsitelib = "$destdir$Config{installsitelib}";
my $installsitearch = "$destdir$Config{installsitearch}";
my $installman1dir = "$destdir$Config{installman1dir}";
+
+if (length $prefix) {
+ s/^\Q$Config{installprefix}/$prefix/
+ for ($installbin, $installscript, $installprivlib, $installarchlib,
+ $installsitelib, $installsitearch, $installman1dir);
+}
+
my $man1ext = $Config{man1ext};
my $libperl = $Config{libperl};
# Shared library and dynamic loading suffixes.
--- ./installman-pre Sun Aug 3 23:33:50 2003
+++ ./installman Tue Nov 4 19:37:08 2003
@@ -27,7 +27,7 @@ die "Patchlevel of perl ($patchlevel)",
my $usage =
"Usage: installman --man1dir=/usr/wherever --man1ext=1
--man3dir=/usr/wherever --man3ext=3
- --batchlimit=40
+ --batchlimit=40 --prefix=/new/usr/wherever --destdir=/prefix
--notify --verbose --silent --help
Defaults are:
man1dir = $Config{'installman1dir'};
@@ -40,7 +40,7 @@ my $usage =
my %opts;
GetOptions( \%opts,
- qw( man1dir=s man1ext=s man3dir=s man3ext=s batchlimit=i
+ qw( man1dir=s man1ext=s man3dir=s man3ext=s batchlimit=i prefix=s
destdir:s notify n help silent S verbose V))
|| die $usage;
die $usage if $opts{help};
@@ -56,6 +56,10 @@ $opts{man3ext} = $Config{'man3ext'}
$opts{silent} ||= $opts{S};
$opts{notify} ||= $opts{n};
$opts{verbose} ||= $opts{V} || $opts{notify};
+
+if (defined $opts{prefix} and $opts{prefix}) {
+ s/^\Q$Config{installprefix}/$opts{prefix}/ for @opts{'man1dir', 'man3dir'};
+}
#Sanity checks
Thread Next
-
[PATCH 5.8.2 @21574] make install: PREFIX and DESTDIR
by Ilya Zakharevich