summaryrefslogtreecommitdiff
path: root/src/Environment.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Environment.hs')
-rw-r--r--src/Environment.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Environment.hs b/src/Environment.hs
new file mode 100644
index 0000000000..de43efa924
--- /dev/null
+++ b/src/Environment.hs
@@ -0,0 +1,16 @@
+module Environment (setupEnvironment) where
+
+import System.Environment
+
+-- | The build system invokes many external builders whose behaviour is
+-- influenced by the environment variables. We need to modify some of them
+-- for better robustness of the build system.
+setupEnvironment :: IO ()
+setupEnvironment = do
+ -- ghc-cabal refuses to work when GHC_PACKAGE_PATH is set (e.g. by Stack)
+ unsetEnv "GHC_PACKAGE_PATH"
+
+ -- 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.
+ unsetEnv "PWD"