Skip to contentSkip to conversation

install does not obey DESTDIR or --prefix for perl modules

PATCH New Craig Taylor 6 participants 22 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi all

I'm compiling/installing git in a Solaris environment without root. Using 'make DESTDIR=<some path> install' to stage an install to an alternate location.
The perl module component of 'make DESTDIR=<some path> install' installs into the system perl lib path without prepending the forced install destination or my '--prefix'.
This seems counter intuitive and I would consider a bug.

Regards
CraigT

Signature · 6 lines
c^ [c%5e]

The bamboo-shadows move over the stone steps
as if to sweep them, but no dust is stirred;
The moon is reflected deep in the pool, but the
water shows no trace of its penetration.
#1 lore raw
Quoted 9 lines · Craig Taylor

Hi all

I'm compiling/installing git in a Solaris environment without root. Using 'make DESTDIR=<some path> install' to stage an install to an alternate location.
The perl module component of 'make DESTDIR=<some path> install' installs into the system perl lib path without prepending the forced install destination or my '--prefix'.
This seems counter intuitive and I would consider a bug.

Try 'make prefix=<some path>'.

btw, this is in the first paragraph of the INSTALL document.

-brandon

#2 lore raw
Quoted 11 lines · Brandon Casey
Quoted 9 lines · Craig Taylor

Hi all

I'm compiling/installing git in a Solaris environment without root. Using 'make DESTDIR=<some path> install' to stage an install to an alternate location.
The perl module component of 'make DESTDIR=<some path> install' installs into the system perl lib path without prepending the forced install destination or my '--prefix'.
This seems counter intuitive and I would consider a bug.

Quoted 3 lines

Try 'make prefix=<some path>'.

btw, this is in the first paragraph of the INSTALL document.

But is that what Craig is trying to do?

I think he wants to build git to be installed in /usr/bin/git or whatever, and he would say "prefix=/usr". He however wants "make install" to write into /var/tmp/g/usr/bin/git, not /usr/bin/git, so that he can for example make a tarball with "cd /var/tmp/g && tar cf ../git.tar .", and extract it as root under the real '/'. "make DESTDIR=/var/tmp/g" is exactly for that, and if it is not working I would say it is a bug.

#3 lore raw
Quoted 17 lines · Junio C Hamano
Quoted 11 lines · Brandon Casey
Quoted 9 lines · Craig Taylor

Hi all

I'm compiling/installing git in a Solaris environment without root. Using 'make DESTDIR=<some path> install' to stage an install to an alternate location.
The perl module component of 'make DESTDIR=<some path> install' installs into the system perl lib path without prepending the forced install destination or my '--prefix'.
This seems counter intuitive and I would consider a bug.

Quoted 3 lines

Try 'make prefix=<some path>'.

btw, this is in the first paragraph of the INSTALL document.

Quoted 8 lines

But is that what Craig is trying to do?

I think he wants to build git to be installed in /usr/bin/git or whatever, and he would say "prefix=/usr". He however wants "make install" to write into /var/tmp/g/usr/bin/git, not /usr/bin/git, so that he can for example make a tarball with "cd /var/tmp/g && tar cf ../git.tar .", and extract it as root under the real '/'. "make DESTDIR=/var/tmp/g" is exactly for that, and if it is not working I would say it is a bug.

Exactly as you describe here, different paths but same goal. All binaries follow the DESTDIR path except the perl modules.

To register this as a bug do I need to do more than send this email?

Thanks
CraigT

Signature · 3 lines
c^ [c%5e]

No think. No Talk. Train.
#4 lore raw

Excerpts from Craig Taylor's message of Mon Sep 21 15:19:43 -0400 2009:

Quoted 2 lines

Exactly as you describe here, different paths but same goal. All binaries follow the DESTDIR path except the perl modules.

I haven't had this problem and I've been packaging git for solaris (8 or newer) since early 2009. If you're interested in my build notes, feel free to ping me.

Thanks
-Ben

Signature · 7 lines
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.
#5 lore raw
Quoted 11 lines · Ben Walton

Excerpts from Craig Taylor's message of Mon Sep 21 15:19:43 -0400 2009:

Quoted 2 lines

Exactly as you describe here, different paths but same goal. All binaries follow the DESTDIR path except the perl modules.

I haven't had this problem and I've been packaging git for solaris (8 or newer) since early 2009. If you're interested in my build notes, feel free to ping me.

Thanks
-Ben

Will take you up on this. I'll re-raise this if they don't help.

Thanks
CraigT

Signature · 3 lines
c^ [c%5e]

Even when you are standing in front of defeat, do it smiling.
#6 lore raw
In reply to Craig Taylor
Quoted 4 lines · Craig Taylor

Exactly as you describe here, different paths but same goal. All binaries follow the DESTDIR path except the perl modules.

To register this as a bug do I need to do more than send this email?

Do you use NO_PERL_MAKEMAKER in your build?

If not, we need to summon an expert on ExtUtils::MakeMaker to look into this issue, but if you do, perhaps you can try this patch and report how well it works for you.

---
 perl/Makefile |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
perl/Makefile +4 -4
index e3dd1a5..4ab21d6 100644
@@ -29,11 +29,11 @@ $(makfile): ../GIT-CFLAGS Makefile
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
 	echo '	cp private-Error.pm blib/lib/Error.pm' >> $@
 	echo install: >> $@
-	echo '	mkdir -p "$(instdir_SQ)"' >> $@
-	echo '	$(RM) "$(instdir_SQ)/Git.pm"; cp Git.pm "$(instdir_SQ)"' >> $@
-	echo '	$(RM) "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	mkdir -p "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Git.pm"; cp Git.pm "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
-	echo '	cp private-Error.pm "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	cp private-Error.pm "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
 	echo instlibdir: >> $@
 	echo '	echo $(instdir_SQ)' >> $@
 else
#7 lore raw
Quoted 27 lines · Junio C Hamano
Quoted 4 lines · Craig Taylor

Exactly as you describe here, different paths but same goal. All binaries follow the DESTDIR path except the perl modules.

To register this as a bug do I need to do more than send this email?

Do you use NO_PERL_MAKEMAKER in your build?

If not, we need to summon an expert on ExtUtils::MakeMaker to look into this issue, but if you do, perhaps you can try this patch and report how well it works for you.

---
 perl/Makefile |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
perl/Makefile +0 -2
index e3dd1a5..4ab21d6 100644
@@ -29,11 +29,11 @@ $(makfile): ../GIT-CFLAGS Makefile
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
 	echo '	cp private-Error.pm blib/lib/Error.pm' >> $@
 	echo install: >> $@
-	echo '	mkdir -p "$(instdir_SQ)"' >> $@
-	echo '	$(RM) "$(instdir_SQ)/Git.pm"; cp Git.pm "$(instdir_SQ)"' >> $@

perl/Makefile $(makfile): ../GIT-CFLAGS Makefile · line 39

Quoted 10 lines
perl/Makefile +4 -2
-	echo '	$(RM) "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	mkdir -p "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Git.pm"; cp Git.pm "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
-	echo '	cp private-Error.pm "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	cp private-Error.pm "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
 	echo instlibdir: >> $@
 	echo '	echo $(instdir_SQ)' >> $@
 else

I have 2 perl environments available to me on the system (at home now so can't dig further).
Both can pretty stripped which can make thing "challenging" it's possible ExtUtils::MakeMaker doesn't even exist.

Please everyone who is looking at this thread let it sleep for 24h and I shall test further/revive it tomorrow.

Many thanks
CraigT

Signature · 3 lines
c^ [c%5e]

Learn first whatever hardship you may have to endure is but temporary
#8 lore raw
In reply to Junio C Hamano
Quoted 27 lines · Junio C Hamano
Quoted 4 lines · Craig Taylor

Exactly as you describe here, different paths but same goal. All binaries follow the DESTDIR path except the perl modules.

To register this as a bug do I need to do more than send this email?

Do you use NO_PERL_MAKEMAKER in your build?

If not, we need to summon an expert on ExtUtils::MakeMaker to look into this issue, but if you do, perhaps you can try this patch and report how well it works for you.

---
 perl/Makefile |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
perl/Makefile +0 -2
index e3dd1a5..4ab21d6 100644
@@ -29,11 +29,11 @@ $(makfile): ../GIT-CFLAGS Makefile
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
 	echo '	cp private-Error.pm blib/lib/Error.pm' >> $@
 	echo install: >> $@
-	echo '	mkdir -p "$(instdir_SQ)"' >> $@
-	echo '	$(RM) "$(instdir_SQ)/Git.pm"; cp Git.pm "$(instdir_SQ)"' >> $@

perl/Makefile $(makfile): ../GIT-CFLAGS Makefile · line 39

Quoted 10 lines
perl/Makefile +4 -2
-	echo '	$(RM) "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	mkdir -p "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Git.pm"; cp Git.pm "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
-	echo '	cp private-Error.pm "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	cp private-Error.pm "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
 	echo instlibdir: >> $@
 	echo '	echo $(instdir_SQ)' >> $@
 else

ExtUtils::MakeMaker is available and I am using it.

The problem seems to be in the generated perl.mak.

On line 1652 of my git-1.6.4.3/Makefile
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install

I see that it is passing DESTDIR to the makefile in git-1.6.4.3/perl. However, the DESTDIR variable is not seemingly included in perl/perl.mak for use by the perl/Makefile. It is all absolute paths which I think is the main cause.

I have manually manipulated the perl.mak file and install works fine. I'm just updating my build area to 1.6.4.4 and then will try something more permanent. However I am moving outside my knowldge of 'make' now so may request assistance later ;)

CraigT

Signature · 3 lines
c^ [c%5e]

Never talk about your knowledge, it might make it disappear.
#9 lore raw
In reply to Junio C Hamano
Quoted 27 lines · Junio C Hamano
Quoted 4 lines · Craig Taylor

Exactly as you describe here, different paths but same goal. All binaries follow the DESTDIR path except the perl modules.

To register this as a bug do I need to do more than send this email?

Do you use NO_PERL_MAKEMAKER in your build?

If not, we need to summon an expert on ExtUtils::MakeMaker to look into this issue, but if you do, perhaps you can try this patch and report how well it works for you.

---
 perl/Makefile |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
perl/Makefile +0 -2
index e3dd1a5..4ab21d6 100644
@@ -29,11 +29,11 @@ $(makfile): ../GIT-CFLAGS Makefile
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
 	echo '	cp private-Error.pm blib/lib/Error.pm' >> $@
 	echo install: >> $@
-	echo '	mkdir -p "$(instdir_SQ)"' >> $@
-	echo '	$(RM) "$(instdir_SQ)/Git.pm"; cp Git.pm "$(instdir_SQ)"' >> $@

perl/Makefile $(makfile): ../GIT-CFLAGS Makefile · line 39

Quoted 10 lines
perl/Makefile +4 -2
-	echo '	$(RM) "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	mkdir -p "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Git.pm"; cp Git.pm "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
-	echo '	cp private-Error.pm "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	cp private-Error.pm "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
 	echo instlibdir: >> $@
 	echo '	echo $(instdir_SQ)' >> $@
 else

Further to my last email, modifying the perl.mak file as below resolves the problem for me to a satisfactory level.
I will have to leave a more permanent solution to someone more familar with make/makemaker.

perl/perl.mak 2009-09-22 12:21:17.791887000 +0100 renamed from perl/perl.mak_to20090922 2009-09-22 12:07:18.000000000 +0100 +1 -1
@@ -57,7 +57,7 @@
 INST_LIB = blib/lib
 INST_ARCHLIB = blib/arch
 INST_SCRIPT = blib/script
-PREFIX = /usr/local/git-1.6.4.4
+PREFIX = $(DESTDIR)/usr/local/git-1.6.4.4
 INSTALLDIRS = site
 INSTALLPRIVLIB = $(PREFIX)/lib/5.6.1
 INSTALLARCHLIB = $(PREFIX)/lib/5.6.1/sun4-solaris

Many thanks...
CraigT

Signature · 3 lines
c^ [c%5e]

Failure is natural.
#10 lore raw
Quoted 47 lines · Craig Taylor
Quoted 26 lines · Junio C Hamano
Quoted 4 lines · Craig Taylor

Exactly as you describe here, different paths but same goal. All binaries follow the DESTDIR path except the perl modules.

To register this as a bug do I need to do more than send this email?

Do you use NO_PERL_MAKEMAKER in your build?

If not, we need to summon an expert on ExtUtils::MakeMaker to look into this issue, but if you do, perhaps you can try this patch and report how well it works for you.

---
 perl/Makefile |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
perl/Makefile +0 -2
index e3dd1a5..4ab21d6 100644
@@ -29,11 +29,11 @@ $(makfile): ../GIT-CFLAGS Makefile
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
 	echo '	cp private-Error.pm blib/lib/Error.pm' >> $@
 	echo install: >> $@
-	echo '	mkdir -p "$(instdir_SQ)"' >> $@
-	echo '	$(RM) "$(instdir_SQ)/Git.pm"; cp Git.pm "$(instdir_SQ)"' >> $@

perl/Makefile $(makfile): ../GIT-CFLAGS Makefile · line 39

Quoted 10 lines
perl/Makefile +4 -2
-	echo '	$(RM) "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	mkdir -p "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Git.pm"; cp Git.pm "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
-	echo '	cp private-Error.pm "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	cp private-Error.pm "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
 	echo instlibdir: >> $@
 	echo '	echo $(instdir_SQ)' >> $@
 else

Further to my last email, modifying the perl.mak file as below resolves the problem for me to a satisfactory level.
I will have to leave a more permanent solution to someone more familar with make/makemaker.

perl/perl.mak 2009-09-22 12:21:17.791887000 +0100 line 63

Quoted 8 lines
perl/perl.mak 2009-09-22 12:21:17.791887000 +0100 renamed from perl/perl.mak_to20090922 2009-09-22 12:07:18.000000000 +0100 +1 -1
@@ -57,7 +57,7 @@
 INST_LIB = blib/lib
 INST_ARCHLIB = blib/arch
 INST_SCRIPT = blib/script
-PREFIX = /usr/local/git-1.6.4.4
+PREFIX = $(DESTDIR)/usr/local/git-1.6.4.4
 INSTALLDIRS = site
 INSTALLPRIVLIB = $(PREFIX)/lib/5.6.1
 INSTALLARCHLIB = $(PREFIX)/lib/5.6.1/sun4-solaris

I have not been able to reproduce your problem on Solaris. The DESTDIR feature is working for me.

Possibly it is related to the version of MakeMaker? I am using version 6.17 (Revision: 1.133) along with Perl 5.8.4 on Solaris 10 x86. The MakeMaker version should be in the header at the top of the perl.mak file.

The perl.mak snippet that you provided above looks different than mine. In mine, in the vicinity of the 'PREFIX = ' line I also have a 'DESTDIR = ' line. The right hand side of 'DESTDIR = ' is empty even when I specify a DESTDIR on the make command line.

Here's a snippet from my perl.mak file:

   DESTDIR =
   PREFIX = /usr/local/git-1.6.4.4
   PERLPREFIX = $(PREFIX)
   SITEPREFIX = $(PREFIX)
   VENDORPREFIX = $(PREFIX)
   INSTALLPRIVLIB = $(PERLPREFIX)/lib
   DESTINSTALLPRIVLIB = $(DESTDIR)$(INSTALLPRIVLIB)
   INSTALLSITELIB = $(SITEPREFIX)/lib/site_perl
   DESTINSTALLSITELIB = $(DESTDIR)$(INSTALLSITELIB)
   INSTALLVENDORLIB = $(VENDORPREFIX)/lib
   DESTINSTALLVENDORLIB = $(DESTDIR)$(INSTALLVENDORLIB)
   INSTALLARCHLIB = $(PERLPREFIX)/lib/i86pc-solaris-64int
   DESTINSTALLARCHLIB = $(DESTDIR)$(INSTALLARCHLIB)

Notice the variable assignments that begin with 'DEST'. Does your perl.mak file have those? If not, then it seems MakeMaker is not producing them for some reason.

Did you try Junio's patch? If the version of MakeMaker is the problem, then perhaps setting NO_PERL_MAKER=1 on the make command line along with Junio's patch is the best way forward for you.

-brandon

#11 lore raw
Quoted 4 lines · Brandon Casey

Possibly it is related to the version of MakeMaker? I am using version 6.17 (Revision: 1.133) along with Perl 5.8.4 on Solaris 10 x86. The MakeMaker version should be in the header at the top of the perl.mak file.

I think that is it. DESTDIR support in MakeMaker seems to be lacking in medieval versions of Perl. It appears that it started being usable at around its 6.11 (and 6.17 you have is fine).

    http://kobesearch.cpan.org/htdocs/ExtUtils-MakeMaker/Changes.html
    https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6131#c7
#12 lore raw

PATCH 1/1 perl/Makefile.PL: detect MakeMaker versions incompatible with DESTDIR

From: Brandon Casey <[email protected]>

It appears that ExtUtils::MakeMaker versions older than 6.11 do not implement the DESTDIR mechanism. So add a test to the generated perl.mak to detect when DESTDIR is used along with a too old ExtUtils::MakeMaker and abort with a message suggesting the use of NO_PERL_MAKEMAKER.

---

Quoted 7 lines · Junio C Hamano
Quoted 4 lines · Brandon Casey

Possibly it is related to the version of MakeMaker? I am using version 6.17 (Revision: 1.133) along with Perl 5.8.4 on Solaris 10 x86. The MakeMaker version should be in the header at the top of the perl.mak file.

Quoted 6 lines

I think that is it. DESTDIR support in MakeMaker seems to be lacking in medieval versions of Perl. It appears that it started being usable at around its 6.11 (and 6.17 you have is fine).

    http://kobesearch.cpan.org/htdocs/ExtUtils-MakeMaker/Changes.html
    https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6131#c7

How about something like this?

Seems to work correctly for me on IRIX 6.5 and Solaris 7 with ExtUtils::MakeMaker 6.03.

-brandon

 perl/Makefile.PL |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
perl/Makefile.PL +8 -0
index 320253e..8974015 100644
@@ -5,6 +5,14 @@ sub MY::postamble {
 instlibdir:
 	@echo '$(INSTALLSITELIB)'
 
+ifneq (,$(DESTDIR))
+ifeq (1,$(shell expr '$(MM_VERSION)' '<' 6.11))
+$(error ExtUtils::MakeMaker version "$(MM_VERSION)" is older than 6.11 and so \
+	is likely incompatible with the DESTDIR mechanism.  Try setting \
+	NO_PERL_MAKEMAKER=1 instead)
+endif
+endif
+
 MAKE_FRAG
 }
 
Signature · 1 line
1.6.4.3
#13 lore raw

PATCH v2 1/1 perl/Makefile.PL: detect MakeMaker versions incompatible with DESTDIR

From: Brandon Casey <[email protected]>

It appears that ExtUtils::MakeMaker versions older than 6.11 do not implement the DESTDIR mechanism. So add a test to the generated perl.mak to detect when DESTDIR is used along with a too old ExtUtils::MakeMaker and abort with a message suggesting the use of NO_PERL_MAKEMAKER.

---

This just reverses the logic in the test on $(MM_VERSION) so that the test will also fail if MM_VERSION is unset. Who knows if ancient versions set it. Sorry for the quick v2.

-brandon

 perl/Makefile.PL |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
perl/Makefile.PL +8 -0
index 320253e..0b9deca 100644
@@ -5,6 +5,14 @@ sub MY::postamble {
 instlibdir:
 	@echo '$(INSTALLSITELIB)'
 
+ifneq (,$(DESTDIR))
+ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))
+$(error ExtUtils::MakeMaker version "$(MM_VERSION)" is older than 6.11 and so \
+	is likely incompatible with the DESTDIR mechanism.  Try setting \
+	NO_PERL_MAKEMAKER=1 instead)
+endif
+endif
+
 MAKE_FRAG
 }
 
Signature · 1 line
1.6.4.3
#14 lore raw

Re: [PATCH v2] perl/Makefile.PL: detect MakeMaker versions incompatible with DESTDIR

Quoted 26 lines · Brandon Casey

From: Brandon Casey <[email protected]>

It appears that ExtUtils::MakeMaker versions older than 6.11 do not implement the DESTDIR mechanism. So add a test to the generated perl.mak to detect when DESTDIR is used along with a too old ExtUtils::MakeMaker and abort with a message suggesting the use of NO_PERL_MAKEMAKER.

---

This just reverses the logic in the test on $(MM_VERSION) so that the test will also fail if MM_VERSION is unset. Who knows if ancient versions set it. Sorry for the quick v2.

(quoted diff) +0 -1
-brandon
 
 
 perl/Makefile.PL |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
perl/Makefile.PL +0 -0
index 320253e..0b9deca 100644

perl/Makefile.PL sub MY::postamble { · line 9

Quoted 5 lines
perl/Makefile.PL +2 -0
@@ -5,6 +5,14 @@ sub MY::postamble {
 instlibdir:
 	@echo '$(INSTALLSITELIB)'
 
+ifneq (,$(DESTDIR))
+ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))

I don't think the test works as intended, because 6.2 *is* greater than 6.10 (aka 6.1).

(Found while staring at git diff v1.6.5-rc2..v1.6.5-rc3 in a spare minute.)

perl/Makefile.PL sub MY::postamble { · line 17

Quoted 8 lines
perl/Makefile.PL +6 -0
+$(error ExtUtils::MakeMaker version "$(MM_VERSION)" is older than 6.11 and so \
+	is likely incompatible with the DESTDIR mechanism.  Try setting \
+	NO_PERL_MAKEMAKER=1 instead)
+endif
+endif
+
 MAKE_FRAG
 }

-- Hannes

#15 lore raw

Re: [PATCH v2] perl/Makefile.PL: detect MakeMaker versions incompatible with DESTDIR

Quoted 30 lines · Johannes Sixt
Quoted 29 lines · Brandon Casey

From: Brandon Casey <[email protected]>

It appears that ExtUtils::MakeMaker versions older than 6.11 do not implement the DESTDIR mechanism. So add a test to the generated perl.mak to detect when DESTDIR is used along with a too old ExtUtils::MakeMaker and abort with a message suggesting the use of NO_PERL_MAKEMAKER.

---

This just reverses the logic in the test on $(MM_VERSION) so that the test will also fail if MM_VERSION is unset. Who knows if ancient versions set it. Sorry for the quick v2.

(quoted diff) +0 -1
-brandon
 
 
 perl/Makefile.PL |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
perl/Makefile.PL +0 -0
index 320253e..0b9deca 100644
@@ -5,6 +5,14 @@ sub MY::postamble {
 instlibdir:
 	@echo '$(INSTALLSITELIB)'
 
Quoted 5 lines

perl/Makefile.PL sub MY::postamble { · line 9

Quoted 2 lines
perl/Makefile.PL +2 -0
+ifneq (,$(DESTDIR))
+ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))

I don't think the test works as intended, because 6.2 *is* greater than 6.10 (aka 6.1).

Hmm... I think you're right.

-brandon

#16 lore raw

Re: [PATCH v2] perl/Makefile.PL: detect MakeMaker versions incompatible with DESTDIR

Quoted 11 lines · Brandon Casey
Quoted 10 lines · Johannes Sixt
Quoted 8 lines · Brandon Casey
perl/Makefile.PL +0 -0
index 320253e..0b9deca 100644
@@ -5,6 +5,14 @@ sub MY::postamble {
 instlibdir:
 	@echo '$(INSTALLSITELIB)'
 
Quoted 6 lines
Quoted 4 lines

perl/Makefile.PL sub MY::postamble { · line 9

Quoted 2 lines
perl/Makefile.PL +2 -0
+ifneq (,$(DESTDIR))
+ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))

I don't think the test works as intended, because 6.2 *is* greater than 6.10 (aka 6.1).

Hmm... I think you're right.

I think we're safe. Looks like the MakeMaker folks have always used two digits for the minor number. So version 6.2 was written like 6.02.

Here's their repo:

git://github.com/schwern/extutils-makemaker.git

git log -p -- lib/ExtUtils/MakeMaker.pm | grep -- '$VERSION = ' | less

I didn't search exhaustively, but I think all of 6.X has two digit minor numbers, which means all versions should compare correctly since 5.X will always compare less than 6.X and 7.X will be greater, etc.

-brandon

#17 lore raw

Re: [PATCH v2] perl/Makefile.PL: detect MakeMaker versions incompatible with DESTDIR

Quoted 1 line · Brandon Casey

I think we're safe.

Thanks.

#18 lore raw
In reply to Brandon Casey
Quoted 2 lines · Brandon Casey

Did you try Junio's patch? If the version of MakeMaker is the problem, then perhaps setting NO_PERL_MAKER=1 on the make command line along

                       ^^^^^^^^^^^^^

Should be NO_PERL_MAKEMAKER=1

author
#19 lore raw
In reply to Junio C Hamano
Quoted 27 lines · Junio C Hamano
Quoted 4 lines · Craig Taylor

Exactly as you describe here, different paths but same goal. All binaries follow the DESTDIR path except the perl modules.

To register this as a bug do I need to do more than send this email?

Do you use NO_PERL_MAKEMAKER in your build?

If not, we need to summon an expert on ExtUtils::MakeMaker to look into this issue, but if you do, perhaps you can try this patch and report how well it works for you.

---
 perl/Makefile |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
perl/Makefile +0 -2
index e3dd1a5..4ab21d6 100644
@@ -29,11 +29,11 @@ $(makfile): ../GIT-CFLAGS Makefile
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
 	echo '	cp private-Error.pm blib/lib/Error.pm' >> $@
 	echo install: >> $@
-	echo '	mkdir -p "$(instdir_SQ)"' >> $@
-	echo '	$(RM) "$(instdir_SQ)/Git.pm"; cp Git.pm "$(instdir_SQ)"' >> $@

perl/Makefile $(makfile): ../GIT-CFLAGS Makefile · line 39

Quoted 10 lines
perl/Makefile +4 -2
-	echo '	$(RM) "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	mkdir -p "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Git.pm"; cp Git.pm "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
-	echo '	cp private-Error.pm "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	cp private-Error.pm "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
 	echo instlibdir: >> $@
 	echo '	echo $(instdir_SQ)' >> $@
 else

Frustratingly the last change forces the lib referenced in the perl scripts to include the DESTDIR.
I will work around this for now, but would apprieciate it if someone more familair could fix for the future.

CraigT

Signature · 3 lines
c^ [c%5e]

Failure is natural.
#20 lore raw
Quoted 34 lines · c^
Quoted 33 lines · Junio C Hamano
Quoted 4 lines · Craig Taylor

Exactly as you describe here, different paths but same goal. All binaries follow the DESTDIR path except the perl modules.

To register this as a bug do I need to do more than send this email?

Do you use NO_PERL_MAKEMAKER in your build?

If not, we need to summon an expert on ExtUtils::MakeMaker to look into this issue, but if you do, perhaps you can try this patch and report how well it works for you.

---
 perl/Makefile |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
perl/Makefile +4 -4
index e3dd1a5..4ab21d6 100644
@@ -29,11 +29,11 @@ $(makfile): ../GIT-CFLAGS Makefile
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
 	echo '	cp private-Error.pm blib/lib/Error.pm' >> $@
 	echo install: >> $@
-	echo '	mkdir -p "$(instdir_SQ)"' >> $@
-	echo '	$(RM) "$(instdir_SQ)/Git.pm"; cp Git.pm "$(instdir_SQ)"' >> $@
-	echo '	$(RM) "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	mkdir -p "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Git.pm"; cp Git.pm "$$(DESTDIR)$(instdir_SQ)"' >> $@
+	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
 	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
-	echo '	cp private-Error.pm "$(instdir_SQ)/Error.pm"' >> $@
+	echo '	cp private-Error.pm "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
Quoted 8 lines

perl/Makefile $(makfile): ../GIT-CFLAGS Makefile · line 39

Quoted 3 lines
perl/Makefile +0 -0
 	echo instlibdir: >> $@
 	echo '	echo $(instdir_SQ)' >> $@
 else

Frustratingly the last change forces the lib referenced in the perl scripts to include the DESTDIR.
I will work around this for now, but would apprieciate it if someone more familair could fix for the future.

Craig, you're referring to _your_ last change where you hand modified the perl.mak file so that the 'PREFIX =' line contained $(DESTDIR) right? And not something in the above patch?

Junio, your patch looks good and seems to work for me.

-brandon

ps. Craig, it's best to hit 'Reply-All' when replying so that everyone is kept
in the cc list. People often filter their mail based on the 'To:' and 'cc:' fields and are more likely to notice mail that includes their address in one of those fields. I added Junio back to this reply.

#21 lore raw
In reply to Junio C Hamano
Quoted 16 lines · Junio C Hamano
Quoted 10 lines · Brandon Casey
Quoted 9 lines · Craig Taylor

Hi all

I'm compiling/installing git in a Solaris environment without root. Using 'make DESTDIR=<some path> install' to stage an install to an alternate location.
The perl module component of 'make DESTDIR=<some path> install' installs into the system perl lib path without prepending the forced install destination or my '--prefix'.
This seems counter intuitive and I would consider a bug.

Quoted 3 lines

Try 'make prefix=<some path>'.

btw, this is in the first paragraph of the INSTALL document.

Quoted 8 lines

But is that what Craig is trying to do?

I think he wants to build git to be installed in /usr/bin/git or whatever, and he would say "prefix=/usr". He however wants "make install" to write into /var/tmp/g/usr/bin/git, not /usr/bin/git, so that he can for example make a tarball with "cd /var/tmp/g && tar cf ../git.tar .", and extract it as root under the real '/'. "make DESTDIR=/var/tmp/g" is exactly for that, and if it is not working I would say it is a bug.

Ah. I did not realize that that is what DESTDIR is for.

Thanks for the correction.

-brandon