Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Cabal-syntax/Cabal-syntax.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ library
-Wincomplete-uni-patterns
-Wincomplete-record-updates
-Wno-unticked-promoted-constructors

if impl(ghc >= 8.0)
ghc-options: -Wcompat -Wnoncanonical-monad-instances
-Wcompat
-Wnoncanonical-monad-instances

if impl(ghc >= 8.0) && impl(ghc < 8.8)
ghc-options: -Wnoncanonical-monadfail-instances
Expand Down
4 changes: 2 additions & 2 deletions Cabal/src/Distribution/Simple/Build.hs
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ createInternalPackageDB
createInternalPackageDB verbosity lbi distPref = do
existsAlready <- doesPackageDBExist dbPath
when existsAlready $ deletePackageDB dbPath
createPackageDB verbosity (compiler lbi) (withPrograms lbi) False dbPath
createPackageDB verbosity (compiler lbi) (withPrograms lbi) dbPath
return (SpecificPackageDB dbRelPath)
where
dbRelPath = internalPackageDBPath lbi distPref
Expand Down Expand Up @@ -1188,7 +1188,7 @@ builtinAutogenFiles pkg lbi clbi =
pathsFile = AutogenModule (autogenPathsModuleName pkg) (Suffix "hs")
pathsContents = toUTF8LBS $ generatePathsModule pkg lbi clbi
packageInfoFile = AutogenModule (autogenPackageInfoModuleName pkg) (Suffix "hs")
packageInfoContents = toUTF8LBS $ generatePackageInfoModule pkg lbi
packageInfoContents = toUTF8LBS $ generatePackageInfoModule pkg
cppHeaderFile = AutogenFile $ toShortText cppHeaderName
cppHeaderContents = toUTF8LBS $ generateCabalMacrosHeader pkg lbi clbi

Expand Down
25 changes: 10 additions & 15 deletions Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ import Distribution.Compat.Prelude
import Prelude ()

import Distribution.Package
import Distribution.PackageDescription
import Distribution.Simple.Compiler
import Distribution.Simple.LocalBuildInfo
import Distribution.Utils.ShortText
import Distribution.Version
( PackageName
, packageName
, packageVersion
, unPackageName
)
import Distribution.Types.PackageDescription (PackageDescription (..))
import Distribution.Types.Version (versionNumbers)
import Distribution.Utils.ShortText (fromShortText)

import qualified Distribution.Simple.Build.PackageInfoModule.Z as Z

Expand All @@ -33,24 +36,16 @@ import qualified Distribution.Simple.Build.PackageInfoModule.Z as Z

-- ------------------------------------------------------------

generatePackageInfoModule :: PackageDescription -> LocalBuildInfo -> String
generatePackageInfoModule pkg_descr lbi =
generatePackageInfoModule :: PackageDescription -> String
generatePackageInfoModule pkg_descr =
Z.render
Z.Z
{ Z.zPackageName = showPkgName $ packageName pkg_descr
, Z.zVersionDigits = show $ versionNumbers $ packageVersion pkg_descr
, Z.zSynopsis = fromShortText $ synopsis pkg_descr
, Z.zCopyright = fromShortText $ copyright pkg_descr
, Z.zHomepage = fromShortText $ homepage pkg_descr
, Z.zSupportsNoRebindableSyntax = supports_rebindable_syntax
}
where
supports_rebindable_syntax = ghc_newer_than (mkVersion [7, 0, 1])

ghc_newer_than minVersion =
case compilerCompatVersion GHC (compiler lbi) of
Nothing -> False
Just version -> version `withinRange` orLaterVersion minVersion

showPkgName :: PackageName -> String
showPkgName = map fixchar . unPackageName
Expand Down
10 changes: 2 additions & 8 deletions Cabal/src/Distribution/Simple/Build/PackageInfoModule/Z.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,20 @@

module Distribution.Simple.Build.PackageInfoModule.Z (render, Z (..)) where

import Distribution.ZinzaPrelude
import Distribution.ZinzaPrelude (Generic, execWriter, tell)

data Z = Z
{ zPackageName :: String
, zVersionDigits :: String
, zSynopsis :: String
, zCopyright :: String
, zHomepage :: String
, zSupportsNoRebindableSyntax :: Bool
}
deriving (Generic)

render :: Z -> String
render z_root = execWriter $ do
if (zSupportsNoRebindableSyntax z_root)
then do
tell "{-# LANGUAGE NoRebindableSyntax #-}\n"
return ()
else do
return ()
tell "{-# LANGUAGE NoRebindableSyntax #-}\n"
tell "{-# OPTIONS_GHC -w #-}\n"
tell "\n"
tell "{-|\n"
Expand Down
11 changes: 0 additions & 11 deletions Cabal/src/Distribution/Simple/Build/PathsModule.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ generatePathsModule pkg_descr lbi clbi =
Z.Z
{ Z.zPackageName = packageName pkg_descr
, Z.zVersionDigits = show $ versionNumbers $ packageVersion pkg_descr
, Z.zSupportsCpp = supports_cpp
, Z.zSupportsNoRebindableSyntax = supports_rebindable_syntax
, Z.zAbsolute = absolute
, Z.zRelocatable = relocatable lbi
, Z.zIsWindows = isWindows
Expand All @@ -63,15 +61,6 @@ generatePathsModule pkg_descr lbi clbi =
, Z.zSysconfdir = zSysconfdir
}
where
supports_cpp = supports_language_pragma
supports_rebindable_syntax = ghc_newer_than (mkVersion [7, 0, 1])
supports_language_pragma = ghc_newer_than (mkVersion [6, 6, 1])

ghc_newer_than minVersion =
case compilerCompatVersion GHC (compiler lbi) of
Nothing -> False
Just version -> version `withinRange` orLaterVersion minVersion

-- In several cases we cannot make relocatable installations
absolute =
hasLibs pkg_descr -- we can only make progs relocatable
Expand Down
37 changes: 4 additions & 33 deletions Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import Distribution.ZinzaPrelude
data Z
= Z {zPackageName :: PackageName,
zVersionDigits :: String,
zSupportsCpp :: Bool,
zSupportsNoRebindableSyntax :: Bool,
zAbsolute :: Bool,
zRelocatable :: Bool,
zIsWindows :: Bool,
Expand All @@ -25,18 +23,8 @@ data Z
deriving Generic
render :: Z -> String
render z_root = execWriter $ do
if (zSupportsCpp z_root)
then do
tell "{-# LANGUAGE CPP #-}\n"
return ()
else do
return ()
if (zSupportsNoRebindableSyntax z_root)
then do
tell "{-# LANGUAGE NoRebindableSyntax #-}\n"
return ()
else do
return ()
tell "{-# LANGUAGE CPP #-}\n"
tell "{-# LANGUAGE NoRebindableSyntax #-}\n"
if (zNot z_root (zAbsolute z_root))
then do
tell "{-# LANGUAGE ForeignFunctionInterface #-}\n"
Expand Down Expand Up @@ -91,25 +79,8 @@ render z_root = execWriter $ do
else do
return ()
tell "\n"
if (zSupportsCpp z_root)
then do
tell "#if defined(VERSION_base)\n"
tell "\n"
tell "#if MIN_VERSION_base(4,0,0)\n"
tell "catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a\n"
tell "#else\n"
tell "catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a\n"
tell "#endif\n"
tell "\n"
tell "#else\n"
tell "catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a\n"
tell "#endif\n"
tell "catchIO = Exception.catch\n"
return ()
else do
tell "catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a\n"
tell "catchIO = Exception.catch\n"
return ()
tell "catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a\n"
tell "catchIO = Exception.catch\n"
tell "\n"
tell "-- |The package version.\n"
tell "version :: Version\n"
Expand Down
9 changes: 1 addition & 8 deletions Cabal/src/Distribution/Simple/Compiler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -492,15 +492,8 @@ reexportedAsSupported comp = case compilerFlavor comp of
-- "dynamic-library-dirs"?
libraryDynDirSupported :: Compiler -> Bool
libraryDynDirSupported comp = case compilerFlavor comp of
GHC ->
-- Not just v >= mkVersion [8,0,1,20161022], as there
-- are many GHC 8.1 nightlies which don't support this.
( (v >= mkVersion [8, 0, 1, 20161022] && v < mkVersion [8, 1])
|| v >= mkVersion [8, 1, 20161021]
Comment thread
zlonast marked this conversation as resolved.
)
GHC -> True
_ -> False
where
v = compilerVersion comp

-- | Does this compiler's "ar" command supports response file
-- arguments (i.e. @file-style arguments).
Expand Down
7 changes: 1 addition & 6 deletions Cabal/src/Distribution/Simple/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2922,12 +2922,7 @@ checkForeignLibSupported :: Compiler -> Platform -> ForeignLib -> Maybe String
checkForeignLibSupported comp platform flib = go (compilerFlavor comp)
where
go :: CompilerFlavor -> Maybe String
go GHC
| compilerVersion comp < mkVersion [7, 8] =
unsupported
[ "Building foreign libraries is only supported with GHC >= 7.8"
]
| otherwise = goGhcPlatform platform
go GHC = goGhcPlatform platform
go _ =
unsupported
[ "Building foreign libraries is currently only supported with ghc"
Expand Down
22 changes: 4 additions & 18 deletions Cabal/src/Distribution/Simple/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ configureCompiler verbosity hcPath conf0 = do
++ prettyShow ghcVersion

let implInfo = ghcVersionImplInfo ghcVersion
languages <- Internal.getLanguages verbosity implInfo ghcProg
extensions0 <- Internal.getExtensions verbosity implInfo ghcProg
languages <- Internal.getLanguages implInfo
extensions0 <- Internal.getExtensions verbosity ghcProg

ghcInfo <- Internal.getGhcInfo verbosity implInfo ghcProg

Expand Down Expand Up @@ -1106,23 +1106,9 @@ installLib verbosity lbi targetDir dynlibTargetDir bytecodeTargetDir _builtDir p
-- -----------------------------------------------------------------------------
-- Registering

hcPkgInfo :: ProgramDb -> HcPkg.HcPkgInfo
hcPkgInfo :: ProgramDb -> HcPkg.ConfiguredProgram
hcPkgInfo progdb =
HcPkg.HcPkgInfo
{ HcPkg.hcPkgProgram = ghcPkgProg
, HcPkg.noPkgDbStack = v < [6, 9]
, HcPkg.noVerboseFlag = v < [6, 11]
, HcPkg.flagPackageConf = v < [7, 5]
, HcPkg.supportsDirDbs = v >= [6, 8]
, HcPkg.requiresDirDbs = v >= [7, 10]
, HcPkg.nativeMultiInstance = v >= [7, 10]
, HcPkg.recacheMultiInstance = v >= [6, 12]
, HcPkg.suppressFilesCheck = v >= [6, 6]
}
where
v = versionNumbers ver
ghcPkgProg = fromMaybe (error "GHC.hcPkgInfo: no ghc program") $ lookupProgram ghcPkgProgram progdb
ver = fromMaybe (error "GHC.hcPkgInfo: no ghc version") $ programVersion ghcPkgProg
fromMaybe (error "GHC.hcPkgInfo: no ghc program") $ lookupProgram ghcPkgProgram progdb

registerPackage
:: Verbosity
Expand Down
Loading
Loading