[commit: ghc] wip/T16120: hadrian: use new-exec to make sure alex & happy are in PATH (#16120) (da92338)

git at git.haskell.org git at git.haskell.org
Tue Jan 22 21:49:18 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T16120
Link       : http://ghc.haskell.org/trac/ghc/changeset/da9233887ee4c919a895d83b01221011981a47de/ghc

>---------------------------------------------------------------

commit da9233887ee4c919a895d83b01221011981a47de
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)


>---------------------------------------------------------------

da9233887ee4c919a895d83b01221011981a47de
 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