File u_Cabal_update.patch of Package ghc.openSUSE_Leap_42.2_Update

diff --git a/ghc-7.10.3.orig/libraries/Cabal/Cabal/Cabal.cabal b/ghc-7.10.3/libraries/Cabal/Cabal/Cabal.cabal
index b498ca0..e8bfb00 100644
--- a/ghc-7.10.3.orig/libraries/Cabal/Cabal/Cabal.cabal
+++ b/ghc-7.10.3/libraries/Cabal/Cabal/Cabal.cabal
@@ -1,5 +1,5 @@
 name: Cabal
-version: 1.22.5.0
+version: 1.22.8.0
 copyright: 2003-2006, Isaac Jones
            2005-2011, Duncan Coutts
 license: BSD3
@@ -19,7 +19,7 @@ description:
   organizing, and cataloging Haskell libraries and tools.
 category: Distribution
 cabal-version: >=1.10
-build-type: Custom
+build-type: Simple
 -- Even though we do use the default Setup.lhs it's vital to bootstrapping
 -- that we build Setup.lhs using our own local Cabal source code.
 
@@ -145,7 +145,7 @@ library
   if flag(bundled-binary-generic)
     build-depends: binary >= 0.5 && < 0.7
   else
-    build-depends: binary >= 0.7 && < 0.8
+    build-depends: binary >= 0.7 && < 0.9
 
   -- Needed for GHC.Generics before GHC 7.6
   if impl(ghc < 7.6)
@@ -265,7 +265,7 @@ test-suite unit-tests
     test-framework-hunit,
     test-framework-quickcheck2,
     HUnit,
-    QuickCheck < 2.8,
+    QuickCheck < 2.9,
     Cabal
   ghc-options: -Wall
   default-language: Haskell98
@@ -312,7 +312,7 @@ test-suite package-tests
     test-framework-quickcheck2 >= 0.2.12,
     test-framework-hunit,
     HUnit,
-    QuickCheck >= 2.1.0.1 && < 2.8,
+    QuickCheck >= 2.1.0.1 && < 2.9,
     Cabal,
     process,
     directory,
diff --git a/ghc-7.10.3.orig/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs b/ghc-7.10.3/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs
index 444c851..fa6d8a8 100644
--- a/ghc-7.10.3.orig/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs
+++ b/ghc-7.10.3/libraries/Cabal/Cabal/Distribution/Simple/GHC.hs
@@ -542,19 +542,22 @@ buildOrReplLib forRepl verbosity numJobs pkg_descr lbi lib clbi = do
                                }
                odir          = fromFlag (ghcOptObjDir vanillaCcOpts)
            createDirectoryIfMissingVerbose verbosity True odir
-           needsRecomp <- checkNeedsRecompilation filename vanillaCcOpts
-           when needsRecomp $ do
-               runGhcProg vanillaCcOpts
-               unless forRepl $
-                 whenSharedLib forceSharedLib (runGhcProg sharedCcOpts)
-               unless forRepl $ whenProfLib (runGhcProg profCcOpts)
+           let runGhcProgIfNeeded ccOpts = do
+                 needsRecomp <- checkNeedsRecompilation filename ccOpts
+                 when needsRecomp $ runGhcProg ccOpts
+           runGhcProgIfNeeded vanillaCcOpts
+           unless forRepl $
+             whenSharedLib forceSharedLib (runGhcProgIfNeeded sharedCcOpts)
+           unless forRepl $ whenProfLib (runGhcProgIfNeeded profCcOpts)
       | filename <- cSources libBi]
 
   -- TODO: problem here is we need the .c files built first, so we can load them
   -- with ghci, but .c files can depend on .h files generated by ghc by ffi
   -- exports.
-  unless (null (libModules lib)) $
-     ifReplLib (runGhcProg replOpts)
+
+  ifReplLib $ do
+    when (null (libModules lib)) $ warn verbosity "No exposed modules"
+    ifReplLib (runGhcProg replOpts)
 
   -- link:
   unless forRepl $ do
@@ -766,7 +769,9 @@ buildOrReplExe forRepl verbosity numJobs _pkg_descr lbi
                       ghcOptLinkLibPath    = toNubListR $ extraLibDirs exeBi,
                       ghcOptLinkFrameworks = toNubListR $ PD.frameworks exeBi,
                       ghcOptInputFiles     = toNubListR
-                                             [exeDir </> x | x <- cObjs],
+                                             [exeDir </> x | x <- cObjs]
+                    }
+      dynLinkerOpts = mempty {
                       ghcOptRPaths         = rpaths
                    }
       replOpts   = baseOpts {
@@ -812,9 +817,9 @@ buildOrReplExe forRepl verbosity numJobs _pkg_descr lbi
         | otherwise    = doingTH && (withProfExe lbi || withDynExe lbi)
 
       linkOpts = commonOpts `mappend`
-                 linkerOpts `mappend` mempty {
-                      ghcOptLinkNoHsMain   = toFlag (not isHaskellMain)
-                 }
+                 linkerOpts `mappend`
+                 mempty { ghcOptLinkNoHsMain   = toFlag (not isHaskellMain) } `mappend`
+                 (if withDynExe lbi then dynLinkerOpts else mempty)
 
   -- Build static/dynamic object files for TH, if needed.
   when compileForTH $
diff --git a/ghc-7.10.3.orig/libraries/Cabal/Cabal/Distribution/Simple/Haddock.hs b/ghc-7.10.3/libraries/Cabal/Cabal/Distribution/Simple/Haddock.hs
index 095d6b8..2d09292 100644
--- a/ghc-7.10.3.orig/libraries/Cabal/Cabal/Distribution/Simple/Haddock.hs
+++ b/ghc-7.10.3/libraries/Cabal/Cabal/Distribution/Simple/Haddock.hs
@@ -84,14 +84,16 @@ import Language.Haskell.Extension
 
 
 import Control.Monad    ( when, forM_ )
+import Data.Char        ( isSpace )
 import Data.Either      ( rights )
 import Data.Monoid
+import Data.Foldable    ( foldl' )
 import Data.Maybe       ( fromMaybe, listToMaybe )
 
 import System.Directory (doesFileExist)
 import System.FilePath  ( (</>), (<.>)
                         , normalise, splitPath, joinPath, isAbsolute )
-import System.IO        (hClose, hPutStrLn, hSetEncoding, utf8)
+import System.IO        (hClose, hPutStr, hPutStrLn, hSetEncoding, utf8)
 import Distribution.Version
 
 -- ------------------------------------------------------------------------------
@@ -467,7 +469,7 @@ renderArgs :: Verbosity
               -> IO a
 renderArgs verbosity tmpFileOpts version comp args k = do
   let haddockSupportsUTF8          = version >= Version [2,14,4] []
-      haddockSupportsResponseFiles = version >  Version [2,16,1] []
+      haddockSupportsResponseFiles = version >  Version [2,16,2] []
   createDirectoryIfMissingVerbose verbosity True outputDir
   withTempFileEx tmpFileOpts outputDir "haddock-prologue.txt" $
     \prologueFileName h -> do
@@ -482,7 +484,7 @@ renderArgs verbosity tmpFileOpts version comp args k = do
                  withTempFileEx tmpFileOpts outputDir "haddock-response.txt" $
                     \responseFileName hf -> do
                          when haddockSupportsUTF8 (hSetEncoding hf utf8)
-                         mapM_ (hPutStrLn hf) renderedArgs
+                         hPutStr hf $ unlines $ map escapeArg renderedArgs
                          hClose hf
                          let respFile = "@" ++ responseFileName
                          k ([respFile], result)
@@ -500,6 +502,19 @@ renderArgs verbosity tmpFileOpts version comp args k = do
               pkgstr = display $ packageName pkgid
               pkgid = arg argPackageName
       arg f = fromFlag $ f args
+      -- Support a gcc-like response file syntax.  Each separate
+      -- argument and its possible parameter(s), will be separated in the
+      -- response file by an actual newline; all other whitespace,
+      -- single quotes, double quotes, and the character used for escaping
+      -- (backslash) are escaped.  The called program will need to do a similar
+      -- inverse operation to de-escape and re-constitute the argument list.
+      escape cs c
+        |    isSpace c
+          || '\\' == c
+          || '\'' == c
+          || '"'  == c = c:'\\':cs -- n.b., our caller must reverse the result
+        | otherwise    = c:cs
+      escapeArg = reverse . foldl' escape []
 
 renderPureArgs :: Version -> Compiler -> HaddockArgs -> [String]
 renderPureArgs version comp args = concat
diff --git a/ghc-7.10.3.orig/libraries/Cabal/Cabal/Distribution/Simple/Setup.hs b/ghc-7.10.3/libraries/Cabal/Cabal/Distribution/Simple/Setup.hs
index b87b567..abda3c7 100644
--- a/ghc-7.10.3.orig/libraries/Cabal/Cabal/Distribution/Simple/Setup.hs
+++ b/ghc-7.10.3/libraries/Cabal/Cabal/Distribution/Simple/Setup.hs
@@ -2099,7 +2099,6 @@ optionNumJobs get set =
         _        -> case reads s of
           [(n, "")]
             | n < 1     -> Left "The number of jobs should be 1 or more."
-            | n > 64    -> Left "You probably don't want that many jobs."
             | otherwise -> Right (Just n)
           _             -> Left "The jobs value should be a number or '$ncpus'"
 
diff --git a/ghc-7.10.3.orig/libraries/Cabal/Cabal/Distribution/Version.hs b/ghc-7.10.3/libraries/Cabal/Cabal/Distribution/Version.hs
index 1123749..e5c2e28 100644
--- a/ghc-7.10.3.orig/libraries/Cabal/Cabal/Distribution/Version.hs
+++ b/ghc-7.10.3/libraries/Cabal/Cabal/Distribution/Version.hs
@@ -3,7 +3,25 @@
 #if __GLASGOW_HASKELL__ < 707
 {-# LANGUAGE StandaloneDeriving #-}
 #endif
+
+-- Hack approach to support bootstrapping
+-- Assume binary <0.8 when MIN_VERSION_binary macro is not available.
+-- Starting with GHC>=8.0, compiler will hopefully provide this macros too.
+-- https://ghc.haskell.org/trac/ghc/ticket/10970
+--
+-- Otherwise, one can specify -DMIN_VERSION_binary_0_8_0=1, when bootstrapping
+-- with binary >=0.8.0.0
+#ifdef MIN_VERSION_binary
+#define MIN_VERSION_binary_0_8_0 MIN_VERSION_binary(0,8,0)
+#else
+#ifndef MIN_VERSION_binary_0_8_0
+#define MIN_VERSION_binary_0_8_0 0
+#endif
+#endif
+
+#if !MIN_VERSION_binary_0_8_0
 {-# OPTIONS_GHC -fno-warn-orphans #-}
+#endif
 
 -----------------------------------------------------------------------------
 -- |
@@ -109,6 +127,7 @@ instance Binary VersionRange
 deriving instance Data Version
 #endif
 
+#if !(MIN_VERSION_binary_0_8_0)
 -- Deriving this instance from Generic gives trouble on GHC 7.2 because the
 -- Generic instance has to be standalone-derived. So, we hand-roll our own.
 -- We can't use a generic Binary instance on later versions because we must
@@ -119,6 +138,7 @@ instance Binary Version where
         tags <- get
         return $ Version br tags
     put (Version br tags) = put br >> put tags
+#endif
 
 {-# DEPRECATED AnyVersion "Use 'anyVersion', 'foldVersionRange' or 'asVersionIntervals'" #-}
 {-# DEPRECATED ThisVersion "use 'thisVersion', 'foldVersionRange' or 'asVersionIntervals'" #-}
diff --git a/ghc-7.10.3.orig/libraries/Cabal/Cabal/changelog b/ghc-7.10.3/libraries/Cabal/Cabal/changelog
index f5fb8ff..45c15f9 100644
--- a/ghc-7.10.3.orig/libraries/Cabal/Cabal/changelog
+++ b/ghc-7.10.3/libraries/Cabal/Cabal/changelog
@@ -1,3 +1,17 @@
+1.22.8.0 Ryan Thomas <ryan@ryant.org> March 2016
+	* Distribution.Simple.Setup: remove job cap. Fixes #3191.
+	* Check all object file suffixes for recompilation. Fixes #3128.
+	* Move source files under 'src/'. Fixes #3003.
+
+1.22.7.0 Ryan Thomas <ryan@ryant.org> January 2016
+	* Backport #3012 to the 1.22 branch
+	* Cabal.cabal: change build-type to Simple
+	* Add foldl' import
+	* The Cabal part for fully gcc-like response files
+
+1.22.6.0
+	* Relax upper bound to allow upcoming binary-0.8
+
 1.22.5.0
 	* Don't recompile C sources unless needed (#2601). (Luke Iannini)
 	* Support Haddock response files.
openSUSE Build Service is sponsored by