make it work with GHC 7.0
This commit is contained in:
parent
1cb7a494a9
commit
69ce5fea57
@ -71,6 +71,7 @@ devel isCabalDev passThroughArgs = do
|
|||||||
|
|
||||||
diffArgs | isCabalDev = [
|
diffArgs | isCabalDev = [
|
||||||
"--cabal-install-arg=--with-compiler=yesod-ghc-wrapper"
|
"--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-ld=yesod-ld-wrapper"
|
||||||
, "--cabal-install-arg=--with-ar=yesod-ar-wrapper"
|
, "--cabal-install-arg=--with-ar=yesod-ar-wrapper"
|
||||||
, "--cabal-install-arg=-fdevel" -- legacy
|
, "--cabal-install-arg=-fdevel" -- legacy
|
||||||
@ -78,6 +79,7 @@ devel isCabalDev passThroughArgs = do
|
|||||||
]
|
]
|
||||||
| otherwise = [
|
| otherwise = [
|
||||||
"--with-compiler=yesod-ghc-wrapper"
|
"--with-compiler=yesod-ghc-wrapper"
|
||||||
|
, "--with-hc-pkg=ghc-pkg"
|
||||||
, "--with-ld=yesod-ld-wrapper"
|
, "--with-ld=yesod-ld-wrapper"
|
||||||
, "--with-ar=yesod-ar-wrapper"
|
, "--with-ar=yesod-ar-wrapper"
|
||||||
, "-fdevel" -- legacy
|
, "-fdevel" -- legacy
|
||||||
@ -120,8 +122,10 @@ mkRebuild ghcVer cabalFile cabalCmd
|
|||||||
| GHC.cProjectVersion == ghcVer = do
|
| GHC.cProjectVersion == ghcVer = do
|
||||||
bf <- getBuildFlags
|
bf <- getBuildFlags
|
||||||
return $ do
|
return $ do
|
||||||
n <- cabalFile `isNewerThan` "dist/ghcargs.txt"
|
n1 <- cabalFile `isNewerThan` "dist/ghcargs.txt"
|
||||||
if n
|
n2 <- cabalFile `isNewerThan` "dist/arargs.txt"
|
||||||
|
n3 <- cabalFile `isNewerThan` "dist/ldargs.txt"
|
||||||
|
if n1 || n2 || n3
|
||||||
then rebuildCabal cabalCmd
|
then rebuildCabal cabalCmd
|
||||||
else rebuildGhc bf
|
else rebuildGhc bf
|
||||||
| otherwise = return $ do
|
| otherwise = return $ do
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import Data.Char (toLower)
|
|||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
import Panic (panic, ghcError)
|
import Panic (panic, ghcError)
|
||||||
import Data.List (partition, isPrefixOf)
|
import Data.List (partition, isPrefixOf)
|
||||||
|
import qualified DynFlags
|
||||||
|
|
||||||
getBuildFlags :: IO [Located String]
|
getBuildFlags :: IO [Located String]
|
||||||
getBuildFlags = do
|
getBuildFlags = do
|
||||||
@ -60,12 +61,20 @@ buildPackage' argv2 = do
|
|||||||
haskellish (f,Nothing) =
|
haskellish (f,Nothing) =
|
||||||
looksLikeModuleName f || isHaskellSrcFilename f || '.' `notElem` f
|
looksLikeModuleName f || isHaskellSrcFilename f || '.' `notElem` f
|
||||||
haskellish (_,Just phase) =
|
haskellish (_,Just phase) =
|
||||||
|
#if MIN_VERSION_ghc(7,4,0)
|
||||||
phase `notElem` [As, Cc, Cobjc, Cobjcpp, CmmCpp, Cmm, StopLn]
|
phase `notElem` [As, Cc, Cobjc, Cobjcpp, CmmCpp, Cmm, StopLn]
|
||||||
|
#else
|
||||||
|
phase `notElem` [As, Cc, CmmCpp, Cmm, StopLn]
|
||||||
|
#endif
|
||||||
hsc_env <- GHC.getSession
|
hsc_env <- GHC.getSession
|
||||||
-- if (null hs_srcs)
|
-- if (null hs_srcs)
|
||||||
-- then liftIO (oneShot hsc_env StopLn srcs)
|
-- then liftIO (oneShot hsc_env StopLn srcs)
|
||||||
-- else do
|
-- else do
|
||||||
|
#if MIN_VERSION_ghc(7,2,0)
|
||||||
o_files <- mapM (\x -> liftIO $ compileFile hsc_env StopLn x)
|
o_files <- mapM (\x -> liftIO $ compileFile hsc_env StopLn x)
|
||||||
|
#else
|
||||||
|
o_files <- mapM (\x -> compileFile hsc_env StopLn x)
|
||||||
|
#endif
|
||||||
non_hs_srcs
|
non_hs_srcs
|
||||||
liftIO $ mapM_ (consIORef v_Ld_inputs) (reverse o_files)
|
liftIO $ mapM_ (consIORef v_Ld_inputs) (reverse o_files)
|
||||||
targets <- mapM (uncurry GHC.guessTarget) hs_srcs
|
targets <- mapM (uncurry GHC.guessTarget) hs_srcs
|
||||||
@ -290,7 +299,14 @@ showInfoMode = mkPreLoadMode ShowInfo
|
|||||||
printSetting :: String -> Mode
|
printSetting :: String -> Mode
|
||||||
printSetting k = mkPreLoadMode (PrintWithDynFlags f)
|
printSetting k = mkPreLoadMode (PrintWithDynFlags f)
|
||||||
where f dflags = fromMaybe (panic ("Setting not found: " ++ show k))
|
where f dflags = fromMaybe (panic ("Setting not found: " ++ show k))
|
||||||
|
#if MIN_VERSION_ghc(7,2,0)
|
||||||
$ lookup k (compilerInfo dflags)
|
$ 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 :: PreLoadMode -> Mode
|
||||||
mkPreLoadMode = Right . Left
|
mkPreLoadMode = Right . Left
|
||||||
|
|||||||
@ -130,7 +130,7 @@ executable yesod
|
|||||||
, filepath >= 1.1
|
, filepath >= 1.1
|
||||||
, fast-logger >= 0.0.2 && < 0.1
|
, fast-logger >= 0.0.2 && < 0.1
|
||||||
, process
|
, process
|
||||||
, ghc >= 7.4.1
|
, ghc >= 7.0.3
|
||||||
, ghc-paths >= 0.1.0.8
|
, ghc-paths >= 0.1.0.8
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
if flag(threaded)
|
if flag(threaded)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user