aboutsummaryrefslogtreecommitdiff
path: root/src/CabalHelper
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2020-01-11 07:50:43 +0100
committerDaniel Gröber <dxld@darkboxed.org>2020-01-11 07:51:18 +0100
commitc1ad9e3ab1df78359b188cb9740d8297bdb16e25 (patch)
treecf9872835b2a997bcbd693fa4939f68f35526426 /src/CabalHelper
parent04c2d34f1874bc198288d33c784bc26f89280ee2 (diff)
Fix invokeGhc when using relative paths
Diffstat (limited to 'src/CabalHelper')
-rw-r--r--src/CabalHelper/Compiletime/Program/GHC.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/CabalHelper/Compiletime/Program/GHC.hs b/src/CabalHelper/Compiletime/Program/GHC.hs
index 3baf6d9..95293fb 100644
--- a/src/CabalHelper/Compiletime/Program/GHC.hs
+++ b/src/CabalHelper/Compiletime/Program/GHC.hs
@@ -134,12 +134,16 @@ cabalVersionExistsInPkgDb cabalVer db@(PackageDbDir db_path) = do
invokeGhc :: Env => GhcInvocation -> IO (Either ExitCode FilePath)
invokeGhc GhcInvocation {..} = do
+ giOutDirAbs <- makeAbsolute giOutDir
+ giOutputAbs <- makeAbsolute giOutput
+ giIncludeDirsAbs <- mapM makeAbsolute giIncludeDirs
+ giInputsAbs <- mapM makeAbsolute giInputs
-- We unset some interferring envvars here for stack, see:
-- https://github.com/DanielG/cabal-helper/issues/78#issuecomment-557860898
let eos = [("GHC_ENVIRONMENT", EnvUnset), ("GHC_PACKAGE_PATH", EnvUnset)]
rv <- callProcessStderr' (Just "/") eos (ghcProgram ?progs) $ concat
- [ [ "-outputdir", giOutDir
- , "-o", giOutput
+ [ [ "-outputdir", giOutDirAbs
+ , "-o", giOutputAbs
]
, map ("-optP"++) giCPPOptions
, if giHideAllPackages then ["-hide-all-packages"] else []
@@ -151,10 +155,10 @@ invokeGhc GhcInvocation {..} = do
, packageFlags
]
GPSPackageEnv env -> [ "-package-env=" ++ unPackageEnvFile env ]
- , map ("-i"++) $ nub $ "" : giIncludeDirs
+ , map ("-i"++) $ nub $ "" : giIncludeDirsAbs
, giWarningFlags
, ["--make"]
- , giInputs
+ , giInputsAbs
]
return $
case rv of