From f6e429f8f5a533d699a69ffc733a56be5ddff5a9 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 25 Oct 2007 08:42:22 +0000 Subject: [PATCH] default to installing runhaskell and hsc2hs again, but provide knobs to turn them off --- ghc.spec.in | 6 ++++++ mk/config.mk.in | 13 +++++++++++++ utils/hsc2hs/Makefile | 7 ++++++- utils/runghc/Makefile | 15 ++++++++++++++- 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/ghc.spec.in b/ghc.spec.in index 331fdd4..5d3fa1f 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 eaefe4a..3c0b312 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 b9bcaf1..70d027f 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 7ea6c09..16e9724 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 -- 1.7.10.4