summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ghc.spec.in6
-rw-r--r--mk/config.mk.in13
-rw-r--r--utils/hsc2hs/Makefile7
-rw-r--r--utils/runghc/Makefile15
4 files changed, 39 insertions, 2 deletions
diff --git a/ghc.spec.in b/ghc.spec.in
index 331fdd4f09..5d3fa1f1d1 100644
--- a/ghc.spec.in
+++ b/ghc.spec.in
@@ -84,6 +84,12 @@ needed.
%build
test -f configure || sh boot
./configure --prefix=%{_prefix} --mandir=%{_mandir}
+
+# Don't install these tools, we'll use update-alternatives below.
+touch mk/build.mk
+echo "NO_INSTALL_RUNHASKELL=YES" >>mk/build.mk
+echo "NO_INSTALL_HSC2HS=YES" >>mk/build.mk
+
make %{?jobs:-j%jobs}
make html
# Alas, we don't pass make options/arguments down to "libraries", so let's redo make here...
diff --git a/mk/config.mk.in b/mk/config.mk.in
index eaefe4a56e..3c0b312adf 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -641,6 +641,19 @@ INSTALL_HEADER = $(INSTALL) -m 644
INSTALL_MAN = $(INSTALL) -m 644
INSTALL_DIR = $(MKDIRHIER)
+#
+# runhaskell and hsc2hs are special, in that other compilers besides
+# GHC might provide them. Systems with a package manager often come
+# with tools to manage this kind of clash, e.g. RPM's
+# update-alternatives. When building a distribution for such a system,
+# we recommend setting both of the following to 'YES'.
+#
+# NO_INSTALL_RUNHASKELL = YES
+# NO_INSTALL_HSC2HS = YES
+#
+# NB. we use negative tests here because for binary-distributions we cannot
+# test build-time variables at install-time, so they must default to on.
+
# -----------------------------------------------------------------------------
# Utilities programs: flags
diff --git a/utils/hsc2hs/Makefile b/utils/hsc2hs/Makefile
index b9bcaf1c40..70d027f1bb 100644
--- a/utils/hsc2hs/Makefile
+++ b/utils/hsc2hs/Makefile
@@ -54,7 +54,7 @@ ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
INSTALL_PROGS += $(HS_PROG)
else
INSTALL_LIBEXECS += $(HS_PROG)
-LINK = hsc2hs
+LINK = hsc2hs-ghc
LINK_TARGET = $(LINK)-$(ProjectVersion)
INSTALLED_SCRIPT=$(DESTDIR)$(bindir)/$(LINK_TARGET)
install::
@@ -66,6 +66,11 @@ install::
echo "HSC2HS_EXTRA=" >> $(INSTALLED_SCRIPT)
cat hsc2hs.sh >> $(INSTALLED_SCRIPT)
$(EXECUTABLE_FILE) $(INSTALLED_SCRIPT)
+
+ifneq "$(NO_INSTALL_HSC2HS)" "YES"
+install::
+ $(CP) $(INSTALLED_SCRIPT) $(DESTDIR)/$(bindir)/hsc2hs
+endif
endif
# -----------------------------------------------------------------------------
diff --git a/utils/runghc/Makefile b/utils/runghc/Makefile
index 7ea6c09ee3..16e9724f60 100644
--- a/utils/runghc/Makefile
+++ b/utils/runghc/Makefile
@@ -16,9 +16,22 @@ include $(GHC_COMPAT_DIR)/compat.mk
SRC_HC_OPTS += $(GhcHcOpts) $(GhcStage1HcOpts)
SRC_HC_OPTS += -Wall
-binary-dist:
+RUNHASKELL_PROG = runhaskell$(exeext)
+all :: $(RUNHASKELL_PROG)
+
+$(RUNHASKELL_PROG) : $(HS_PROG)
+ $(CP) $< $(RUNHASKELL_PROG)
+
+CLEAN_FILES += $(RUNHASKELL_PROG)
+
+ifneq "$(NO_INSTALL_RUNHASKELL)" "YES"
+INSTALL_PROGS += $(RUNHASKELL_PROG)
+endif
+
+binary-dist::
$(INSTALL_DIR) $(BIN_DIST_DIR)/utils/runghc
$(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/runghc/
$(INSTALL_PROGRAM) $(HS_PROG) $(BIN_DIST_DIR)/utils/runghc/
+ $(INSTALL_PROGRAM) $(RUNHASKELL_PROG) $(BIN_DIST_DIR)/utils/runghc/
include $(TOP)/mk/target.mk