[commit: ghc] wip/ghc-8.8-merges: hadrian: use new-exec to make sure alex & happy are in PATH (#16120) (940fc50)
git at git.haskell.org
git at git.haskell.org
Thu Feb 21 15:10:22 UTC 2019
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/ghc-8.8-merges
Link : http://ghc.haskell.org/trac/ghc/changeset/940fc50f33dd89ac848479049c86a678bff7f6fb/ghc
>---------------------------------------------------------------
commit 940fc50f33dd89ac848479049c86a678bff7f6fb
Author: Adam Sandberg Eriksson <adam at sandbergericsson.se>
Date: Wed Jan 2 22:08:49 2019 +0100
hadrian: use new-exec to make sure alex & happy are in PATH (#16120)
(cherry picked from commit 5cb071af5b02b7433b2bb4d06062ac8b6fb387e8)
>---------------------------------------------------------------
940fc50f33dd89ac848479049c86a678bff7f6fb
hadrian/build.cabal.bat | 3 ++-
hadrian/build.cabal.sh | 3 ++-
hadrian/src/Environment.hs | 4 ++++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/hadrian/build.cabal.bat b/hadrian/build.cabal.bat
index 96f2725..3344791 100644
--- a/hadrian/build.cabal.bat
+++ b/hadrian/build.cabal.bat
@@ -31,7 +31,8 @@ if %CABMAJOR% equ 2 (
)
if %_cabal_ok% equ 1 (
"%CABAL%" --project-file=%PROJ% new-build %CABFLAGS% -j exe:hadrian
- "%CABAL%" --project-file=%PROJ% new-run %CABFLAGS% exe:hadrian -- ^
+ rem use new-exec instead of new-run to make sure that the build-tools (alex & happy) are in PATH
+ "%CABAL%" --project-file=%PROJ% new-exec %CABFLAGS% hadrian -- ^
--directory "%CD%" ^
%*
) else (
diff --git a/hadrian/build.cabal.sh b/hadrian/build.cabal.sh
index 8c7b594..f28c3e0 100755
--- a/hadrian/build.cabal.sh
+++ b/hadrian/build.cabal.sh
@@ -24,7 +24,8 @@ CABVER=( ${CABVERSTR//./ } )
if [ "${CABVER[0]}" -gt 2 -o "${CABVER[0]}" -eq 2 -a "${CABVER[1]}" -ge 2 ];
then
"$CABAL" --project-file="$PROJ" new-build $CABFLAGS -j exe:hadrian
- "$CABAL" --project-file="$PROJ" new-run $CABFLAGS exe:hadrian -- \
+ # use new-exec instead of new-run to make sure that the build-tools (alex & happy) are in PATH
+ "$CABAL" --project-file="$PROJ" new-exec $CABFLAGS hadrian -- \
--directory "$PWD" \
"$@"
else
diff --git a/hadrian/src/Environment.hs b/hadrian/src/Environment.hs
index 1666c68..ef98bb1 100644
--- a/hadrian/src/Environment.hs
+++ b/hadrian/src/Environment.hs
@@ -10,6 +10,10 @@ setupEnvironment = do
-- Cabal refuses to work when GHC_PACKAGE_PATH is set (e.g. by Stack)
unsetEnv "GHC_PACKAGE_PATH"
+ -- cabal new-exec sets GHC_ENVIRONMENT, it needs to be unset for GHC
+ -- invocations to work properly
+ unsetEnv "GHC_ENVIRONMENT"
+
-- in MinGW if PWD is set to a Windows "C:\\" style path then configure
-- `pwd` will return the Windows path, and then modifying $PATH will fail.
-- See https://github.com/snowleopard/hadrian/issues/189 for details.
More information about the ghc-commits
mailing list