[m-rev.] for review: Fix #203: installing to temporary location with DESTDIR.

Peter Wang novalazy at gmail.com
Mon Mar 18 13:05:27 AEDT 2013


Branches: main, release
----

Attempting to install Mercury into a temporary location, with DESTDIR
set, would:

- wrongly install libatomic_ops into DESTDIR

- be unable to install library grades because the installed mmc script
  expects files in their final locations, without the DESTDIR prefix.

Thanks to Jeremy Huddleston and Nikolay Orlyuk for reporting and an
earlier version of this patch.

Mmakefile:
	Override MERCURY_COMPILER and MERCURY_CONFIG_DIR when installing
	library grades.

boehm_gc/build_atomic_ops.sh:
	Clear DESTDIR so that libatomic_ops is installed into the
	boehm_gc directory, as intended.
---
 Mmakefile                |    6 +++++-
 boehm_gc/Makefile.direct |    3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Mmakefile b/Mmakefile
index 8e3f6bf..a13a920 100644
--- a/Mmakefile
+++ b/Mmakefile
@@ -613,7 +613,11 @@ install_deep_profiler: deep_profiler
 ifeq ($(CROSS_COMPILING),yes)
 OVERRIDE_MC_FOR_LIBGRADE =
 else
-OVERRIDE_MC_FOR_LIBGRADE = MC=mmc
+	# We must override the paths in the mmc script in case the compiler was
+	# installed to a temporary location, using DESTDIR.
+OVERRIDE_MC_FOR_LIBGRADE = MC=mmc \
+	MERCURY_COMPILER=$(INSTALL_PREFIX)/bin/mercury_compile \
+	MERCURY_CONFIG_DIR=$(INSTALL_PREFIX)/lib/mercury
 endif
 
 .PHONY: install_grades
diff --git a/boehm_gc/Makefile.direct b/boehm_gc/Makefile.direct
index a02f99c..97b1dc9 100644
--- a/boehm_gc/Makefile.direct
+++ b/boehm_gc/Makefile.direct
@@ -232,8 +232,9 @@ all: gc.a gctest
 # if AO_INSTALL_DIR doesn't exist, we assume that it is pointing to
 # the default location, and we need to build
 # Mercury-specific: pass FULLARCH for cross-compilation
+# Mercury-specific: clear DESTDIR
 $(AO_INSTALL_DIR):
-	CC="$(CC)" MAKE=$(MAKE) $(srcdir)/build_atomic_ops.sh --host=$(FULLARCH)
+	CC="$(CC)" MAKE=$(MAKE) DESTDIR= $(srcdir)/build_atomic_ops.sh --host=$(FULLARCH)
 
 LEAKFLAGS=$(CFLAGS) -DFIND_LEAK
 
-- 
1.7.4.4




More information about the reviews mailing list