ghc-stage2 is now renamed to ghc when it is installed
authorIan Lynagh <igloo@earth.li>
Sat, 7 Nov 2009 18:36:14 +0000 (18:36 +0000)
committerIan Lynagh <igloo@earth.li>
Sat, 7 Nov 2009 18:36:14 +0000 (18:36 +0000)
This means that we get the right program name in error messages etc.

ghc.mk
ghc/ghc.mk
rules/shell-wrapper.mk

diff --git a/ghc.mk b/ghc.mk
index 2408049..94e9080 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -781,6 +781,9 @@ else
        for i in $(INSTALL_LIBEXECS); do \
                $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(ghclibexecdir)"; \
        done
+# We rename ghc-stage2, so that the right program name is used in error
+# messages etc.
+       "$(MV)" "$(DESTDIR)$(ghclibexecdir)/ghc-stage2" "$(DESTDIR)$(ghclibexecdir)/ghc"
 endif
 
 install_topdir_scripts: $(INSTALL_TOPDIR_SCRIPTS)
@@ -827,7 +830,7 @@ INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf.d
 # Install packages in the right order, so that ghc-pkg doesn't complain.
 # Also, install ghc-pkg first.
 ifeq "$(Windows)" "NO"
-INSTALLED_GHC_REAL=$(DESTDIR)$(ghclibexecdir)/ghc-stage2
+INSTALLED_GHC_REAL=$(DESTDIR)$(ghclibexecdir)/ghc
 INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(ghclibexecdir)/ghc-pkg
 else
 INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe
index 4c78e7f..2f505cf 100644 (file)
@@ -89,6 +89,12 @@ ghc_stage3_SHELL_WRAPPER_NAME = ghc/ghc.wrapper
 ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER = YES
 ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER_NAME = ghc-$(ProjectVersion)
 
+# We override the program name to be ghc, rather than ghc-stage2.
+# This means the right program name is used in error messages etc.
+define ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER_EXTRA
+echo 'executablename="$$$$exedir/ghc"' >> "$$(WRAPPER)"
+endef
+
 # stage 1 is enabled unless $(stage) is set to something other than 1
 ifeq "$(filter-out 1,$(stage))" ""
 $(eval $(call build-prog,ghc,stage1,0))
index dda78aa..503a8d2 100644 (file)
@@ -39,6 +39,8 @@ $$(INPLACE_BIN)/$$($1_$2_PROG): $$($1_$2_INPLACE)
        echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"'       >> $$@
        echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"'        >> $$@
        echo 'topdir="$$(TOP)/$$(INPLACE_TOPDIR)"'     >> $$@
+       $($1_$2_SHELL_WRAPPER_EXTRA)
+       $($1_$2_INPLACE_SHELL_WRAPPER_EXTRA)
        cat $$($1_$2_SHELL_WRAPPER_NAME)               >> $$@
        $$(EXECUTABLE_FILE)                               $$@
 endif
@@ -58,7 +60,7 @@ install: install_$1_$2_wrapper
 .PHONY: install_$1_$2_wrapper
 install_$1_$2_wrapper: WRAPPER=$$(DESTDIR)$$(bindir)/$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)
 install_$1_$2_wrapper:
-       $$(INSTALL_DIR) $$(DESTDIR)$$(bindir)
+       $$(INSTALL_DIR) "$$(DESTDIR)$$(bindir)"
        "$$(RM)" $$(RM_OPTS)                                        "$$(WRAPPER)"
        $$(CREATE_SCRIPT)                                           "$$(WRAPPER)"
        echo '#!$$(SHELL)'                                       >> "$$(WRAPPER)"
@@ -68,6 +70,8 @@ install_$1_$2_wrapper:
        echo 'datadir="$$(datadir)"'                             >> "$$(WRAPPER)"
        echo 'bindir="$$(bindir)"'                               >> "$$(WRAPPER)"
        echo 'topdir="$$(topdir)"'                               >> "$$(WRAPPER)"
+       $($1_$2_SHELL_WRAPPER_EXTRA)
+       $($1_$2_INSTALL_SHELL_WRAPPER_EXTRA)
        cat $$($1_$2_SHELL_WRAPPER_NAME)                         >> "$$(WRAPPER)"
        $$(EXECUTABLE_FILE)                                         "$$(WRAPPER)"