Commit 504d8a4b authored by Rufflewind's avatar Rufflewind Committed by Austin Seipp
Browse files

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
parent 34ba68c2
......@@ -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,24 +94,30 @@ 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 "$(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))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment