summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Sandberg Eriksson <adam@sandbergericsson.se>2019-01-02 22:08:49 +0100
committerBen Gamari <ben@smart-cactus.org>2019-01-27 08:32:12 -0500
commit5cb071af5b02b7433b2bb4d06062ac8b6fb387e8 (patch)
tree7ac2a837b65e743041eff789e952a732cc6811f9
parentd0b8a16e388480306c5a07f8bd5172cff84138d4 (diff)
downloadhaskell-5cb071af5b02b7433b2bb4d06062ac8b6fb387e8.tar.gz
hadrian: use new-exec to make sure alex & happy are in PATH (#16120)
-rw-r--r--hadrian/build.cabal.bat3
-rwxr-xr-xhadrian/build.cabal.sh3
-rw-r--r--hadrian/src/Environment.hs4
3 files changed, 8 insertions, 2 deletions
diff --git a/hadrian/build.cabal.bat b/hadrian/build.cabal.bat
index 96f27251ca..3344791bc8 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 8c7b59492e..f28c3e0d14 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 1666c68322..ef98bb100b 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.