[commit: ghc] ghc-7.10: Don't assume tools are in same directory as ghc in some cases (1ae8363)

git at git.haskell.org git at git.haskell.org
Mon Jun 1 07:07:30 UTC 2015


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

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/1ae8363c81db13f2f894de45cafe36551e7417c1/ghc

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

commit 1ae8363c81db13f2f894de45cafe36551e7417c1
Author: Phil Ruffwind <rf at rufflewind.com>
Date:   Sat Mar 7 11:04:00 2015 -0600

    Don't assume tools are in same directory as ghc in some cases
    
    Summary: Tools such as `ghc-pkg` and `runghc` are no longer required to
    be in the same directory as `ghc` when running tests, provided that
    `TEST_HC` is not explicitly set and an in-tree compiler is not used.
    Fixes #10126.
    
    Reviewers: thomie, austin
    
    Reviewed By: thomie, austin
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D705
    
    GHC Trac Issues: #10126
    
    (cherry picked from commit 504d8a4b183670830093a81d3c7a6d78416aed20)


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

1ae8363c81db13f2f894de45cafe36551e7417c1
 testsuite/mk/boilerplate.mk | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/testsuite/mk/boilerplate.mk b/testsuite/mk/boilerplate.mk
index 98c9886..43bc4df 100644
--- a/testsuite/mk/boilerplate.mk
+++ b/testsuite/mk/boilerplate.mk
@@ -43,6 +43,7 @@ STAGE3_GHC := $(abspath $(TOP)/../inplace/bin/ghc-stage3)
 
 ifneq "$(wildcard $(STAGE1_GHC) $(STAGE1_GHC).exe)" ""
 
+IMPLICIT_COMPILER = NO
 IN_TREE_COMPILER = YES
 ifeq "$(BINDIST)" "YES"
 TEST_HC := $(abspath $(TOP)/../)/bindisttest/install   dir/bin/ghc
@@ -56,11 +57,17 @@ TEST_HC := $(STAGE2_GHC)
 endif
 
 else
+IMPLICIT_COMPILER = YES
 IN_TREE_COMPILER = NO
 TEST_HC := $(shell which ghc)
 endif
 
 else
+ifeq "$(TEST_HC)" "ghc"
+IMPLICIT_COMPILER = YES
+else
+IMPLICIT_COMPILER = NO
+endif
 IN_TREE_COMPILER = NO
 # We want to support both "ghc" and "/usr/bin/ghc" as values of TEST_HC
 # passed in by the user, but
@@ -87,12 +94,18 @@ endif
 # containing spaces
 BIN_ROOT = $(shell dirname '$(TEST_HC)')
 
+ifeq "$(IMPLICIT_COMPILER)" "YES"
+find_tool = $(shell which $(1))
+else
+find_tool = $(BIN_ROOT)/$(1)
+endif
+
 ifeq "$(GHC_PKG)" ""
-GHC_PKG := $(BIN_ROOT)/ghc-pkg
+GHC_PKG := $(call find_tool,ghc-pkg)
 endif
 
 ifeq "$(RUNGHC)" ""
-RUNGHC := $(BIN_ROOT)/runghc
+RUNGHC := $(call find_tool,runghc)
 endif
 
 ifeq "$(HADDOCK)" ""
@@ -100,15 +113,15 @@ HADDOCK := $(call find_tool,haddock)
 endif
 
 ifeq "$(HSC2HS)" ""
-HSC2HS := $(BIN_ROOT)/hsc2hs
+HSC2HS := $(call find_tool,hsc2hs)
 endif
 
 ifeq "$(HP2PS_ABS)" ""
-HP2PS_ABS := $(BIN_ROOT)/hp2ps
+HP2PS_ABS := $(call find_tool,hp2ps)
 endif
 
 ifeq "$(HPC)" ""
-HPC := $(BIN_ROOT)/hpc
+HPC := $(call find_tool,hpc)
 endif
 
 $(eval $(call canonicaliseExecutable,TEST_HC))



More information about the ghc-commits mailing list