From da9233887ee4c919a895d83b01221011981a47de Mon Sep 17 00:00:00 2001 From: Adam Sandberg Eriksson Date: Wed, 2 Jan 2019 22:08:49 +0100 Subject: hadrian: use new-exec to make sure alex & happy are in PATH (#16120) --- 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 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. -- cgit v1.2.1