From 26d09ce6313b2443c75fdac12ffa8a290d4ba77d Mon Sep 17 00:00:00 2001 From: Jeremy Shaw Date: Mon, 19 Mar 2012 22:19:37 +0000 Subject: [PATCH] create valid DynFlags argument for newHscEnv when using GHC >= 7.2 --- plugins.cabal | 4 ++++ src/System/Plugins/Load.hs | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins.cabal b/plugins.cabal index 56ae246..43e4c3e 100644 --- a/plugins.cabal +++ b/plugins.cabal @@ -57,3 +57,7 @@ library ghc >= 6.10, ghc-prim + if impl(ghc >= 7.2) + build-depends: ghc-paths + + diff --git a/src/System/Plugins/Load.hs b/src/System/Plugins/Load.hs index bb926c7..85d0168 100644 --- a/src/System/Plugins/Load.hs +++ b/src/System/Plugins/Load.hs @@ -86,6 +86,10 @@ import Foreign.C.String ( CString, withCString, peekCString ) #if !MIN_VERSION_ghc(7,2,0) import GHC ( defaultCallbacks ) +#else +import DynFlags (defaultDynFlags, initDynFlags) +import GHC.Paths (libdir) +import SysTools (initSysTools) #endif import GHC.Ptr ( Ptr(..), nullPtr ) #if !MIN_VERSION_ghc(7,4,1) @@ -107,7 +111,9 @@ readBinIface' :: FilePath -> IO ModIface readBinIface' hi_path = do -- kludgy as hell #if MIN_VERSION_ghc(7,2,0) - e <- newHscEnv undefined + mySettings <- initSysTools (Just libdir) -- how should we really set the top dir? + dflags <- initDynFlags (defaultDynFlags mySettings) + e <- newHscEnv dflags #else e <- newHscEnv defaultCallbacks undefined #endif