From c1ad9e3ab1df78359b188cb9740d8297bdb16e25 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sat, 11 Jan 2020 07:50:43 +0100 Subject: Fix invokeGhc when using relative paths --- src/CabalHelper/Compiletime/Program/GHC.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/CabalHelper/Compiletime/Program') 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 -- cgit v1.2.3