Skip to content

Commit

Permalink
Adds 7.10 support
Browse files Browse the repository at this point in the history
  • Loading branch information
schell committed Apr 6, 2015
1 parent c7acb5a commit b722973
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/dist/
.cabal-sandbox
cabal.sandbox.config
*.sw[a-z]
16 changes: 14 additions & 2 deletions hdevtools.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,26 @@ executable hdevtools
Types,
Util,
Paths_hdevtools

build-depends: base == 4.*,
Cabal >= 1.22,
cmdargs,
directory,
filepath,
ghc >= 7.10,
ghc >= 7.2,
ghc-paths,
syb,
network,
time,
unix

if impl(ghc == 7.6.*)
build-depends: Cabal == 1.16.*
cpp-options: -DENABLE_CABAL

if impl(ghc >= 7.7)
build-depends: Cabal >= 1.18
cpp-options: -DENABLE_CABAL

if impl(ghc >= 7.9)
build-depends: Cabal >= 1.22
cpp-options: -DENABLE_CABAL
12 changes: 11 additions & 1 deletion src/Cabal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..), ComponentLocalBui
componentBuildInfo, foldComponent)
import Distribution.Simple.Compiler (PackageDB(..))
import Distribution.Simple.GHC (componentGhcOptions)
import qualified Distribution.Simple.GHC as GHC(configure)
import Distribution.Simple.Program (defaultProgramConfiguration)
import Distribution.Simple.Program.Db (lookupProgram)
import Distribution.Simple.Program.Types (ConfiguredProgram(programVersion), simpleProgram)
import Distribution.Simple.Program.GHC (GhcOptions(..), renderGhcOptions)
import Distribution.Simple.Setup (ConfigFlags(..), defaultConfigFlags, toFlag)
#if __GLASGOW_HASKELL__ >= 709
import Distribution.Utils.NubList
import qualified Distribution.Simple.GHC as GHC(configure)
#endif
import Distribution.Verbosity (silent)
import Distribution.Version (Version(..))

Expand Down Expand Up @@ -128,6 +130,7 @@ getPackageGhcOpts path = do
let mbLibName = pkgLibName pkgDescr

let ghcOpts' = foldl' mappend mempty $ map (getComponentGhcOptions localBuildInfo) $ flip allComponentsBy (\c -> c) . localPkgDescr $ localBuildInfo
#if __GLASGOW_HASKELL__ >= 709
-- FIX bug in GhcOptions' `mappend`
ghcOpts = ghcOpts' { ghcOptExtra = overNubListR (filter (/= "-Werror")) $ ghcOptExtra ghcOpts'
, ghcOptPackageDBs = sort $ nub (ghcOptPackageDBs ghcOpts')
Expand All @@ -138,6 +141,13 @@ getPackageGhcOpts path = do
(ghcInfo,_,_) <- GHC.configure silent (Just path) Nothing defaultProgramConfiguration

return $ Right $ renderGhcOptions ghcInfo ghcOpts
#else
ghcOpts = ghcOpts' { ghcOptExtra = filter (/= "-Werror") $ nub $ ghcOptExtra ghcOpts'
, ghcOptPackages = filter (\(_, pkgId) -> Just (pkgName pkgId) /= mbLibName) $ nub (ghcOptPackages ghcOpts')
, ghcOptSourcePath = map (baseDir </>) (ghcOptSourcePath ghcOpts')
}
return $ Right $ renderGhcOptions ghcVersion ghcOpts
#endif

pkgLibName :: PackageDescription -> Maybe PackageName
pkgLibName pkgDescr = if hasLibrary pkgDescr
Expand Down
4 changes: 4 additions & 0 deletions src/Info.hs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ everythingStaged stage k z f x
| (const False `extQ` postTcType `extQ` fixity `extQ` nameSet) x = z
| otherwise = foldl k (f x) (gmapQ (everythingStaged stage k z f) x)
where nameSet = const (stage `elem` [Parser,TypeChecker]) :: NameSet.NameSet -> Bool
#if __GLASGOW_HASKELL__ >= 709
postTcType = const (stage<TypeChecker) :: GHC.PostTc GHC.Id GHC.Type -> Bool
#else
postTcType = const (stage<TypeChecker) :: GHC.PostTcType -> Bool
#endif
fixity = const (stage<Renamer) :: GHC.Fixity -> Bool

------------------------------------------------------------------------------
Expand Down

0 comments on commit b722973

Please sign in to comment.