make it work with GHC 7.0

This commit is contained in:
Luite Stegeman 2012-04-03 20:26:20 +02:00
parent 1cb7a494a9
commit 69ce5fea57
3 changed files with 23 additions and 3 deletions

View File

@ -71,6 +71,7 @@ devel isCabalDev passThroughArgs = do
diffArgs | isCabalDev = [
"--cabal-install-arg=--with-compiler=yesod-ghc-wrapper"
, "--cabal-install-arg=--with-hc-pkg=ghc-pkg"
, "--cabal-install-arg=--with-ld=yesod-ld-wrapper"
, "--cabal-install-arg=--with-ar=yesod-ar-wrapper"
, "--cabal-install-arg=-fdevel" -- legacy
@ -78,6 +79,7 @@ devel isCabalDev passThroughArgs = do
]
| otherwise = [
"--with-compiler=yesod-ghc-wrapper"
, "--with-hc-pkg=ghc-pkg"
, "--with-ld=yesod-ld-wrapper"
, "--with-ar=yesod-ar-wrapper"
, "-fdevel" -- legacy
@ -120,8 +122,10 @@ mkRebuild ghcVer cabalFile cabalCmd
| GHC.cProjectVersion == ghcVer = do
bf <- getBuildFlags
return $ do
n <- cabalFile `isNewerThan` "dist/ghcargs.txt"
if n
n1 <- cabalFile `isNewerThan` "dist/ghcargs.txt"
n2 <- cabalFile `isNewerThan` "dist/arargs.txt"
n3 <- cabalFile `isNewerThan` "dist/ldargs.txt"
if n1 || n2 || n3
then rebuildCabal cabalCmd
else rebuildGhc bf
| otherwise = return $ do

View File

@ -26,6 +26,7 @@ import Data.Char (toLower)
import Data.Maybe (fromMaybe)
import Panic (panic, ghcError)
import Data.List (partition, isPrefixOf)
import qualified DynFlags
getBuildFlags :: IO [Located String]
getBuildFlags = do
@ -60,12 +61,20 @@ buildPackage' argv2 = do
haskellish (f,Nothing) =
looksLikeModuleName f || isHaskellSrcFilename f || '.' `notElem` f
haskellish (_,Just phase) =
#if MIN_VERSION_ghc(7,4,0)
phase `notElem` [As, Cc, Cobjc, Cobjcpp, CmmCpp, Cmm, StopLn]
#else
phase `notElem` [As, Cc, CmmCpp, Cmm, StopLn]
#endif
hsc_env <- GHC.getSession
-- if (null hs_srcs)
-- then liftIO (oneShot hsc_env StopLn srcs)
-- else do
#if MIN_VERSION_ghc(7,2,0)
o_files <- mapM (\x -> liftIO $ compileFile hsc_env StopLn x)
#else
o_files <- mapM (\x -> compileFile hsc_env StopLn x)
#endif
non_hs_srcs
liftIO $ mapM_ (consIORef v_Ld_inputs) (reverse o_files)
targets <- mapM (uncurry GHC.guessTarget) hs_srcs
@ -290,7 +299,14 @@ showInfoMode = mkPreLoadMode ShowInfo
printSetting :: String -> Mode
printSetting k = mkPreLoadMode (PrintWithDynFlags f)
where f dflags = fromMaybe (panic ("Setting not found: " ++ show k))
#if MIN_VERSION_ghc(7,2,0)
$ lookup k (compilerInfo dflags)
#else
$ fmap convertPrintable (lookup k compilerInfo)
where
convertPrintable (DynFlags.String s) = s
convertPrintable (DynFlags.FromDynFlags f) = f dflags
#endif
mkPreLoadMode :: PreLoadMode -> Mode
mkPreLoadMode = Right . Left

View File

@ -130,7 +130,7 @@ executable yesod
, filepath >= 1.1
, fast-logger >= 0.0.2 && < 0.1
, process
, ghc >= 7.4.1
, ghc >= 7.0.3
, ghc-paths >= 0.1.0.8
ghc-options: -Wall
if flag(threaded)