aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cabal-helper.cabal1
-rw-r--r--src/CabalHelper/Compiletime/Program/GHC.hs4
-rw-r--r--tests/GhcSession.hs13
3 files changed, 11 insertions, 7 deletions
diff --git a/cabal-helper.cabal b/cabal-helper.cabal
index b1ed388..4a55585 100644
--- a/cabal-helper.cabal
+++ b/cabal-helper.cabal
@@ -184,7 +184,6 @@ test-suite ghc-session
hs-source-dirs: tests
ghc-options: -Wall
build-depends: ghc < 8.9 && >= 8.0.2
- , ghc-paths < 0.2 && >= 0.1.0.9
, pretty-show < 1.9 && >= 1.8.1
, cabal-helper
, c-h-internal
diff --git a/src/CabalHelper/Compiletime/Program/GHC.hs b/src/CabalHelper/Compiletime/Program/GHC.hs
index 293d0af..b24222f 100644
--- a/src/CabalHelper/Compiletime/Program/GHC.hs
+++ b/src/CabalHelper/Compiletime/Program/GHC.hs
@@ -64,6 +64,10 @@ ghcVersion :: (Verbose, Progs) => IO GhcVersion
ghcVersion = GhcVersion .
parseVer . trim <$> readProcess' (ghcProgram ?progs) ["--numeric-version"] ""
+ghcLibdir :: (Verbose, Progs) => IO FilePath
+ghcLibdir = do
+ trim <$> readProcess' (ghcProgram ?progs) ["--print-libdir"] ""
+
ghcPkgVersion :: (Verbose, Progs) => IO Version
ghcPkgVersion =
parseVer . trim . dropWhile (not . isDigit)
diff --git a/tests/GhcSession.hs b/tests/GhcSession.hs
index 58b3755..f9f4e04 100644
--- a/tests/GhcSession.hs
+++ b/tests/GhcSession.hs
@@ -10,7 +10,6 @@ module Main where
import GHC
import Config
-import GHC.Paths (libdir)
import Outputable
import DynFlags
@@ -38,7 +37,7 @@ import CabalHelper.Shared.Common
import CabalHelper.Compiletime.Types (Env)
import CabalHelper.Compiletime.Process (readProcess, callProcessStderr)
import CabalHelper.Compiletime.Program.GHC
- (GhcVersion(..), ghcVersion)
+ (GhcVersion(..), ghcVersion, ghcLibdir)
import CabalHelper.Compiletime.Program.CabalInstall
(CabalInstallVersion(..), cabalInstallVersion)
@@ -295,6 +294,8 @@ test modProgs (psdImpl -> ProjSetupImpl{..}) topdir tmpdir projdir cabal_file
let progs = modProgs (qePrograms qe')
qe = qe' { qePrograms = progs }
+ ghc_libdir <- let ?progs = progs; ?verbose = const False in ghcLibdir
+
psiSdist progs topdir tmpdir
cs <- concat <$> runQuery (allUnits (Map.elems . uiComponents)) qe
@@ -318,7 +319,7 @@ test modProgs (psdImpl -> ProjSetupImpl{..}) topdir tmpdir projdir cabal_file
putStrLn sopts
hFlush stdout
- tr <- compileModule pkgdir ciEntrypoints ciSourceDirs opts'
+ tr <- compileModule ghc_libdir pkgdir ciEntrypoints ciSourceDirs opts'
return $ tr ciComponentName
where
formatArg x
@@ -330,9 +331,9 @@ addCabalProject dir = do
writeFile (dir </> "cabal.project") "packages: .\n"
compileModule
- :: FilePath -> ChEntrypoint -> [FilePath] -> [String]
+ :: FilePath -> FilePath -> ChEntrypoint -> [FilePath] -> [String]
-> IO (ChComponentName -> FilePath -> String -> String -> TestResult)
-compileModule pkgdir ep srcdirs opts = do
+compileModule ghc_libdir pkgdir ep srcdirs opts = do
cwd_before <- getCurrentDirectory
setCurrentDirectory pkgdir
flip E.finally (setCurrentDirectory cwd_before) $ do
@@ -342,7 +343,7 @@ compileModule pkgdir ep srcdirs opts = do
E.handle (\(ec :: ExitCode) -> print ec >> return (TestResult False)) $ do
defaultErrorHandler defaultFatalMessager defaultFlushOut $ do
- runGhc (Just libdir) $ do
+ runGhc (Just ghc_libdir) $ do
let printGhcEx e = GHC.printException e >> return (TestResult False)
handleSourceError printGhcEx $ do