Upstream changes #4

Closed
wants to merge 84 commits into
from
Commits
Jump to file
+1,002 −620
Split
View
@@ -31,31 +31,17 @@ source-repository head
location: https://github.com/haskell/cabal/
subdir: Cabal
-Flag base4
- Description: Choose the even newer, even smaller, split-up base package.
-
-Flag base3
- Description: Choose the new smaller, split-up base package.
-
-Flag bytestring-in-base
-
Library
- build-depends: base >= 2 && < 5,
+ build-depends: base >= 4 && < 5,
deepseq >= 1.3 && < 1.4,
- filepath >= 1 && < 1.4
- if flag(base4) { build-depends: base >= 4 } else { build-depends: base < 4 }
- if flag(base3) { build-depends: base >= 3 } else { build-depends: base < 3 }
- if flag(base3)
- Build-Depends: directory >= 1 && < 1.3,
+ filepath >= 1 && < 1.4,
+ directory >= 1 && < 1.3,
process >= 1 && < 1.2,
- old-time >= 1 && < 1.2,
+ time >= 1.4 && < 1.5,
containers >= 0.1 && < 0.6,
array >= 0.1 && < 0.5,
- pretty >= 1 && < 1.2
- if flag(bytestring-in-base)
- Build-Depends: base >= 2.0 && < 2.2
- else
- Build-Depends: base < 2.0 || >= 3.0, bytestring >= 0.9
+ pretty >= 1 && < 1.2,
+ bytestring >= 0.9
if !os(windows)
Build-Depends: unix >= 2.0 && < 2.7
@@ -22,12 +22,10 @@ import Control.Exception
( bracket, bracketOnError )
import Distribution.Compat.Exception
( catchIO )
-#if __GLASGOW_HASKELL__ >= 608
import Distribution.Compat.Exception
( throwIOIO )
import System.IO.Error
( ioeSetLocation )
-#endif
import System.Directory
( renameFile, removeFile )
import Distribution.Compat.TempFile
@@ -41,22 +39,13 @@ import Foreign
#endif /* __GLASGOW_HASKELL__ */
#ifndef mingw32_HOST_OS
-#if __GLASGOW_HASKELL__ >= 611
import System.Posix.Internals (withFilePath)
-#else
-import Foreign.C (withCString)
-#endif
import System.Posix.Types
( FileMode )
import System.Posix.Internals
( c_chmod )
-#if __GLASGOW_HASKELL__ >= 608
import Foreign.C
( throwErrnoPathIfMinus1_ )
-#else
-import Foreign.C
- ( throwErrnoIfMinus1_ )
-#endif
#endif /* mingw32_HOST_OS */
copyOrdinaryFile, copyExecutableFile :: FilePath -> FilePath -> IO ()
@@ -70,17 +59,9 @@ setFileExecutable path = setFileMode path 0o755 -- file perms -rwxr-xr-x
setFileMode :: FilePath -> FileMode -> IO ()
setFileMode name m =
-#if __GLASGOW_HASKELL__ >= 611
withFilePath name $ \s -> do
-#else
- withCString name $ \s -> do
-#endif
-#if __GLASGOW_HASKELL__ >= 608
throwErrnoPathIfMinus1_ "setFileMode" name (c_chmod s m)
#else
- throwErrnoIfMinus1_ name (c_chmod s m)
-#endif
-#else
setFileOrdinary _ = return ()
setFileExecutable _ = return ()
#endif
@@ -91,9 +72,7 @@ copyFile :: FilePath -> FilePath -> IO ()
#ifdef __GLASGOW_HASKELL__
copyFile fromFPath toFPath =
copy
-#if __GLASGOW_HASKELL__ >= 608
`catchIO` (\ioe -> throwIOIO (ioeSetLocation ioe "copyFile"))
-#endif
where copy = bracket (openBinaryFile fromFPath ReadMode) hClose $ \hFrom ->
bracketOnError openTmp cleanTmp $ \(tmpFPath, hTmp) ->
do allocaBytes bufferSize $ copyContents hFrom hTmp
@@ -5,7 +5,7 @@
{-# OPTIONS_NHC98 -cpp #-}
{-# OPTIONS_JHC -fcpp #-}
-#if !(defined(__HUGS__) || (defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 610))
+#if !defined(__HUGS__)
#define NEW_EXCEPTION
#endif
@@ -28,17 +28,9 @@ import Data.Bits ((.|.))
import System.Posix.Internals (c_open, c_close, o_CREAT, o_EXCL, o_RDWR,
o_BINARY, o_NONBLOCK, o_NOCTTY)
import System.IO.Error (isAlreadyExistsError)
-#if __GLASGOW_HASKELL__ >= 611
import System.Posix.Internals (withFilePath)
-#else
-import Foreign.C (withCString)
-#endif
import Foreign.C (CInt)
-#if __GLASGOW_HASKELL__ >= 611
import GHC.IO.Handle.FD (fdToHandle)
-#else
-import GHC.Handle (fdToHandle)
-#endif
import Distribution.Compat.Exception (onException, tryIO)
#endif
import Foreign.C (getErrno, errnoToIOError)
@@ -128,10 +120,6 @@ openNewBinaryFile dir template = do
oflags = rw_flags .|. o_EXCL .|. o_BINARY
-#if __GLASGOW_HASKELL__ < 611
- withFilePath = withCString
-#endif
-
findTempName x = do
fd <- withFilePath filepath $ \ f ->
c_open f oflags 0o666
@@ -145,17 +133,7 @@ openNewBinaryFile dir template = do
-- TODO: We want to tell fdToHandle what the filepath is,
-- as any exceptions etc will only be able to report the
-- fd currently
- h <-
-#if __GLASGOW_HASKELL__ >= 609
- fdToHandle fd
-#elif __GLASGOW_HASKELL__ <= 606 && defined(mingw32_HOST_OS)
- -- fdToHandle is borked on Windows with ghc-6.6.x
- openFd (fromIntegral fd) Nothing False filepath
- ReadWriteMode True
-#else
- fdToHandle (fromIntegral fd)
-#endif
- `onException` c_close fd
+ h <- fdToHandle fd `onException` c_close fd
return (filepath, h)
where
filename = prefix ++ show x ++ suffix
@@ -91,11 +91,6 @@ import Data.Map ( Map, fromListWith, toList )
import qualified Data.Map as Map
import Data.Monoid
-#if defined(__GLASGOW_HASKELL__) && (__GLASGOW_HASKELL__ < 606)
-import qualified Text.Read as R
-import qualified Text.Read.Lex as L
-#endif
-
------------------------------------------------------------------------------
-- | Simplify the condition and return its free variables.
@@ -315,34 +310,7 @@ resolveWithFlags dom os arch impl constrs trees checkDeps =
-- | A map of dependencies. Newtyped since the default monoid instance is not
-- appropriate. The monoid instance uses 'intersectVersionRanges'.
newtype DependencyMap = DependencyMap { unDependencyMap :: Map PackageName VersionRange }
-#if !defined(__GLASGOW_HASKELL__) || (__GLASGOW_HASKELL__ >= 606)
deriving (Show, Read)
-#else
--- The Show/Read instance for Data.Map in ghc-6.4 is useless
--- so we have to re-implement it here:
-instance Show DependencyMap where
- showsPrec d (DependencyMap m) =
- showParen (d > 10) (showString "DependencyMap" . shows (M.toList m))
-
-instance Read DependencyMap where
- readPrec = parens $ R.prec 10 $ do
- R.Ident "DependencyMap" <- R.lexP
- xs <- R.readPrec
- return (DependencyMap (M.fromList xs))
- where parens :: R.ReadPrec a -> R.ReadPrec a
- parens p = optional
- where
- optional = p R.+++ mandatory
- mandatory = paren optional
-
- paren :: R.ReadPrec a -> R.ReadPrec a
- paren p = do L.Punc "(" <- R.lexP
- x <- R.reset p
- L.Punc ")" <- R.lexP
- return x
-
- readListPrec = R.readListPrecDefault
-#endif
instance Monoid DependencyMap where
mempty = DependencyMap Map.empty
@@ -632,7 +632,7 @@ runConfigureScript verbosity backwardsCompatHack flags lbi = do
rawSystemExitWithEnv verbosity "sh" args' env'
where
- args = "configure" : configureArgs backwardsCompatHack flags
+ args = "./configure" : configureArgs backwardsCompatHack flags
appendToEnvironment (key, val) [] = [(key, val)]
appendToEnvironment (key, val) (kv@(k, v) : rest)
@@ -73,9 +73,9 @@ generate pkg_descr lbi =
"\n"++
foreign_imports++
"import qualified Control.Exception as Exception\n"++
- "import Data.Version (Version(..))\n"++
+ "import Data.Version (Version(Version, versionBranch, versionTags))\n"++
"import System.Environment (getEnv)\n"++
- "import Prelude\n"++
+ "import Prelude ((++), FilePath, IO, return)\n"++
"\n"++
"catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a\n"++
"catchIO = Exception.catch\n" ++
@@ -65,6 +65,8 @@ module Distribution.Simple.Configure (configure,
)
where
+import Distribution.Compiler
+ ( CompilerId(..) )
import Distribution.Simple.Compiler
( CompilerFlavor(..), Compiler(compilerId), compilerFlavor, compilerVersion
, showCompilerId, unsupportedLanguages, unsupportedExtensions
@@ -117,6 +119,10 @@ import Distribution.Version
( Version(..), anyVersion, orLaterVersion, withinRange, isAnyVersion )
import Distribution.Verbosity
( Verbosity, lessVerbose )
+import Distribution.Simple.Program.Db
+ ( lookupProgram )
+import Distribution.Simple.Program.Builtin
+ ( ghcProgram )
import qualified Distribution.Simple.GHC as GHC
import qualified Distribution.Simple.JHC as JHC
@@ -526,6 +532,15 @@ configure (pkg_descr0, pbi) cfg
++ intercalate " depends on "
(map (\(_,k,_) -> "'" ++ k ++ "'") (vs ++ [head vs]))
+ sharedLibsByDefault <-
+ case compilerId comp of
+ CompilerId GHC _ ->
+ case lookupProgram ghcProgram programsConfig''' of
+ Just ghcProg ->
+ GHC.ghcDynamicByDefault verbosity ghcProg
+ Nothing -> return False
+ _ -> return False
+
let lbi = LocalBuildInfo {
configFlags = cfg,
extraConfigArgs = [], -- Currently configure does not
@@ -548,8 +563,8 @@ configure (pkg_descr0, pbi) cfg
withPrograms = programsConfig''',
withVanillaLib = fromFlag $ configVanillaLib cfg,
withProfLib = fromFlag $ configProfLib cfg,
- withSharedLib = fromFlag $ configSharedLib cfg,
- withDynExe = fromFlag $ configDynExe cfg,
+ withSharedLib = fromFlagOrDefault sharedLibsByDefault $ configSharedLib cfg,
+ withDynExe = fromFlagOrDefault sharedLibsByDefault $ configDynExe cfg,
withProfExe = fromFlag $ configProfExe cfg,
withOptimization = fromFlag $ configOptimization cfg,
withGHCiLib = fromFlag $ configGHCiLib cfg,
Oops, something went wrong. Retry.