[commit: ghc] master: ghc.mk: rename installed ghc-stage1 on non-windows (1076010)

git at git.haskell.org git at git.haskell.org
Tue May 23 09:31:43 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/107601058b6189521c379f7ed7a2b0694792acbf/ghc

>---------------------------------------------------------------

commit 107601058b6189521c379f7ed7a2b0694792acbf
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date:   Tue May 23 09:45:50 2017 +0100

    ghc.mk: rename installed ghc-stage1 on non-windows
    
    When user installs _native_ build ghc executable is renamed
    from '$(libexec)/bin/ghc-stage<N>' to '$(libexec)/bin/ghc'.
    But not on windows!
    
    In case of _cross-compiler_ rename should happen only
    for '$(libexec)/bin/ghc-stage<N>' runnable on non-windows
    platform.
    
    Before the change '$(libexec)/bin/ghc-stage<N>' rename happened
    for any compiler not targeting windows.
    
    After the patch rename also happens for '$(libexec)/bin/ghc-stage1'
    cross-compiler built for linux targeting windows (Stage1Only=YES case).
    
    Or on a concrete example:
    
       # host is x86_64-pc-linux-gnu
       $ ./configure --target=i686-w64-mingw32
       $ make install Stage1Only=YES
    
    Before the change the layout was:
       - '$(libexec)/bin/ghc-stage1' was installed
       - bin/ghc contained 'exec $(libexec)/bin/ghc' # missing file!
    After the change:
       - '$(libexec)/bin/ghc' was installed
       - bin/ghc contained 'exec $(libexec)/bin/ghc' # present file
    
    Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>


>---------------------------------------------------------------

107601058b6189521c379f7ed7a2b0694792acbf
 ghc.mk | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/ghc.mk b/ghc.mk
index ea02191..2272569 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -921,15 +921,25 @@ endif
 install_libs: $(INSTALL_LIBS)
 	$(call installLibsTo, $(INSTALL_LIBS), "$(DESTDIR)$(ghclibdir)")
 
+# We rename ghc-stage2, so that the right program name is used in error
+# messages etc. But not on windows.
+RENAME_LIBEXEC_GHC_STAGE_TO_GHC = YES
+ifeq "$(Stage1Only) $(Windows_Host)" "YES YES"
+# resulting ghc-stage1 is built to run on windows
+RENAME_LIBEXEC_GHC_STAGE_TO_GHC = NO
+endif
+ifeq "$(Stage1Only) $(Windows_Target)" "NO YES"
+# resulting ghc-stage1 is built to run on windows
+RENAME_LIBEXEC_GHC_STAGE_TO_GHC = NO
+endif
+
 install_libexecs:  $(INSTALL_LIBEXECS)
 ifneq "$(INSTALL_LIBEXECS)" ""
 	$(INSTALL_DIR) "$(DESTDIR)$(ghclibexecdir)/bin"
 	for i in $(INSTALL_LIBEXECS); do \
 		$(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(ghclibexecdir)/bin"; \
 	done
-# We rename ghc-stage2, so that the right program name is used in error
-# messages etc.
-ifeq "$(Windows_Target)" "NO"
+ifeq "$(RENAME_LIBEXEC_GHC_STAGE_TO_GHC)" "YES"
 	"$(MV)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc-stage$(INSTALL_GHC_STAGE)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc"
 endif
 endif



More information about the ghc-commits mailing list