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-22 16:43:23 -0500
commitda9233887ee4c919a895d83b01221011981a47de (patch)
tree8546f0c25f96228fc0ecb8174801b96b9d77af58
parenta5373c1fe172dee31e07bcb7c7f6caff1035e6ba (diff)
downloadhaskell-wip/T16120.tar.gz
hadrian: use new-exec to make sure alex & happy are in PATH (#16120)wip/T16120
-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.