[m-rev.] diff: Fix the handling of $DESTDIR on Windows.

Paul Bone pbone at csse.unimelb.edu.au
Wed Dec 15 16:28:11 AEDT 2010


On Wed, Dec 15, 2010 at 02:19:56AM +1100, Julien Fischer wrote:
> 
> On Tue, 14 Dec 2010, Paul Bone wrote:
> 
> >Index: Mmake.common.in
> >===================================================================
> >RCS file: /home/mercury1/repository/mercury/Mmake.common.in,v
> >retrieving revision 1.99
> >diff -u -p -b -r1.99 Mmake.common.in
> >--- Mmake.common.in	8 Dec 2010 08:54:29 -0000	1.99
> >+++ Mmake.common.in	14 Dec 2010 06:41:30 -0000
> >@@ -118,7 +118,7 @@ SHARED_LIBS		= @SHARED_LIBS@
> ># Set the installation prefix. This is done here as well as
> ># in scripts/Mmake.vars to avoid accidentally overwriting an
> ># existing installation when using an installed mmake.
> >-INSTALL_PREFIX		= @prefix@
> >+INSTALL_PREFIX          = $(DESTDIR)/@prefix@
> 
> This breaks installation on Windows, e.g. because INSTALL_PREFIX is set
> to
> 	$(DESTDIR)/c:/where/to/install
> 
> and /c:/where/to/install is not a valid path on Windows.
> 

Fixed:

---

Fix the handling of $DESTDIR on Windows.

Mmake.common.in:
    As above.

Index: Mmake.common.in
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.100
diff -u -p -b -r1.100 Mmake.common.in
--- Mmake.common.in	14 Dec 2010 07:01:54 -0000	1.100
+++ Mmake.common.in	15 Dec 2010 05:23:56 -0000
@@ -118,7 +118,18 @@ SHARED_LIBS		= @SHARED_LIBS@
 # Set the installation prefix. This is done here as well as
 # in scripts/Mmake.vars to avoid accidentally overwriting an
 # existing installation when using an installed mmake.
-INSTALL_PREFIX          = $(DESTDIR)/@prefix@
+ifeq ($(DESTDIR),)
+	# DESTDIR is The empty string, DESTDIR_AND_SLASH is therefore empty. since
+	# the slash can change a relative path into an absolute one; or on Windows,
+	# from an invalid path name.
+	DESTDIR_AND_SLASH=
+else
+	# We cannot append paths like this in Windows, but we don't think anyone
+	# will use DESTDIR on Windows.
+	DESTDIR_AND_SLASH=$(DESTDIR)/
+endif
+
+INSTALL_PREFIX          = $(DESTDIR_AND_SLASH)@prefix@
 FINAL_INSTALL_PREFIX    = @prefix@
 
 INSTALLABLE_PREFIX	= @INSTALLABLE_PREFIX@
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 489 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20101215/3009c2cf/attachment.sig>


More information about the reviews mailing list