Hello community,

here is the log from the commit of package ghc for openSUSE:Factory checked in 
at 2016-01-08 15:23:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc (Old)
 and      /work/SRC/openSUSE:Factory/.ghc.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc/ghc.changes  2015-12-29 12:59:59.000000000 
+0100
+++ /work/SRC/openSUSE:Factory/.ghc.new/ghc.changes     2016-01-08 
15:23:28.000000000 +0100
@@ -1,0 +2,12 @@
+Tue Jan  5 18:54:25 UTC 2016 - peter.tromm...@ohm-hochschule.de
+
+- update tarball to 7.10.3b
+* some documentation files were missing in the original
+  7.10.3 tarball 
+- add 0001-link-command-line-libs-to-temp-so.patch
+* fix panic in GHCi when linking against C library specified
+  as command line argument (-l<lib>)
+* currently under upstream review
+* fix Haskell trac #10458 
+
+-------------------------------------------------------------------
@@ -9 +21 @@
-Mon Dec 21 08:27:59 UTC 2015 - mimi...@gmail.com
+Mon Dec 21 08:45:50 UTC 2015 - mimi...@gmail.com
@@ -12,0 +25 @@
+- add u_terminfo_0402.patch -- update of terminfo
@@ -29,0 +43,3 @@
+- update to 7.10.3
+- add cabal-show-detail-direct.patch -- Fix testsuites with large output. 
+    Debian patch. Thanks Joachim for suggesting it in Haskell #10870!

Old:
----
  ghc-7.10.2-src.tar.xz

New:
----
  0001-link-command-line-libs-to-temp-so.patch
  cabal-show-detail-direct.patch
  ghc-7.10.3b-src.tar.xz
  u_terminfo_0402.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc.spec ++++++
--- /var/tmp/diff_new_pack.WNl9cU/_old  2016-01-08 15:23:30.000000000 +0100
+++ /var/tmp/diff_new_pack.WNl9cU/_new  2016-01-08 15:23:30.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %global unregisterised_archs aarch64 s390 s390x
 
 Name:           ghc
-Version:        7.10.2
+Version:        7.10.3
 Release:        0
 Url:            
http://haskell.org/ghc/dist/%{version}/%{name}-%{version}-src.tar.bz2
 Summary:        The Glorious Glasgow Haskell Compiler
@@ -56,7 +56,7 @@
 BuildRequires:  binutils-gold
 %endif
 
-# Patch 19 and 22 change build system
+# Patch 19 changes build system
 BuildRequires:  autoconf
 BuildRequires:  automake
 
@@ -64,14 +64,20 @@
 Requires:       ghc-compiler = %{version}-%{release}
 Requires:       ghc-ghc-devel = %{version}-%{release}
 Requires:       ghc-libraries = %{version}-%{release}
-Source:         
http://haskell.org/ghc/dist/%{version}/%{name}-%{version}-src.tar.xz
+Source:         
http://haskell.org/ghc/dist/%{version}/%{name}-%{version}b-src.tar.xz
 Source1:        ghc-rpmlintrc
 # PATCH-FIX-UPSTREAM fix signature of atomic builtins (#10926)
 Patch1:         atomic-cast.patch
+# PATCH-FIX-UPSTREAM cabal-show-detail-direct.patch 
peter.tromm...@ohm-hochschule.de -- Fix testsuites with large output. Debian 
patch. Thanks Joachim for suggesting it in Haskell #10870!
+Patch3:         cabal-show-detail-direct.patch
+# PATCH_FIX-UPSTREAM 0001-link-command-line-libs-to-temp-so.patch -- 
peter.tromm...@ohm-hochschule.de -- Fix panic in GHCi. See Haskell trac #10458.
+Patch4:         0001-link-command-line-libs-to-temp-so.patch
 # PATCH-FEATURE-UPSTREAM 0001-implement-native-code-generator-for-ppc64.patch 
peter.tromm...@ohm-hochschule.de -- Implement native code generator for ppc64. 
Haskell Trac #9863.
 Patch19:        0001-implement-native-code-generator-for-ppc64.patch
 # PATCH-FIX-UPSTREAM ghc.git-b29f20.patch peter.tromm...@ohm-hochschule.de -- 
nativeGen PPC: fix > 16 bit offsets in stack handling. This is a backport of my 
patch for Haskell trac #7830. We do not use erikd's patch because we have 64 
bit native code generation for ppc64[le]. See patch 19.
 Patch20:        ghc.git-b29f20.patch
+# PATCH-FIX-UPSTREAM u_terminfo_0402.patch mimi...@gmail.com -- update 
terminfo to 0.4.0.2
+Patch21:        u_terminfo_0402.patch 
 # PATCH-FIX-UPSTREAM u_Cabal_update.patch mimi...@gmail.com -- update Cabal to 
1.22.6.0
 Patch22:        u_Cabal_update.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -121,7 +127,7 @@
 %if %{defined ghclibdir}
 %ghc_lib_subpackage Cabal 1.22.6.0
 %ghc_lib_subpackage array 0.5.1.0
-%ghc_lib_subpackage -c gmp-devel,libffi-devel base 4.8.1.0
+%ghc_lib_subpackage -c gmp-devel,libffi-devel base 4.8.2.0
 %ghc_lib_subpackage binary 0.7.5.0
 %ghc_lib_subpackage bytestring 0.10.6.0
 %ghc_lib_subpackage containers 0.5.6.2
@@ -163,13 +169,16 @@
 %prep
 %setup -q
 %patch1 -p1
+%patch3 -p1
+%patch4 -p1
 %patch19 -p1
 %patch20 -p1
+%patch21 -p2
 %patch22 -p2
 
 %build
 # Patch 19 modifies build system
-perl boot
+./boot
 
 # Check if bootstrap is required, i.e. version is different from ghc's version
 # Note: Cannot use ghc_version macro here as we defined version override 
earlier

++++++ 0001-implement-native-code-generator-for-ppc64.patch ++++++
++++ 647 lines (skipped)
++++ between 
/work/SRC/openSUSE:Factory/ghc/0001-implement-native-code-generator-for-ppc64.patch
++++ and 
/work/SRC/openSUSE:Factory/.ghc.new/0001-implement-native-code-generator-for-ppc64.patch

++++++ 0001-link-command-line-libs-to-temp-so.patch ++++++
>From 4177e22ecf45b33758d19780dbf4ab32fed6cbac Mon Sep 17 00:00:00 2001
From: Peter Trommler <peter.tromm...@th-nuernberg.de>
Date: Mon, 14 Dec 2015 19:16:22 +0100
Subject: [PATCH 1/1] link command line libs to temp so

Symbols in libraries specified on the GHCis command line are
not available to compiled modules because shared libraries
are loaded with local scope. So we link all libraries specified
on the command line into each temporary shared library.
---
 compiler/ghci/Linker.hs | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Index: ghc-7.10.3/compiler/ghci/Linker.hs
===================================================================
--- ghc-7.10.3.orig/compiler/ghci/Linker.hs
+++ ghc-7.10.3/compiler/ghci/Linker.hs
@@ -818,11 +818,14 @@ dynLoadObjs :: DynFlags -> PersistentLin
 dynLoadObjs _      pls []   = return pls
 dynLoadObjs dflags pls objs = do
     let platform = targetPlatform dflags
+    let minus_ls = [ lib | Option ('-':'l':lib) <- ldInputs dflags ]
+    let minus_big_ls = [ lib | Option ('-':'L':lib) <- ldInputs dflags ]
     (soFile, libPath , libName) <- newTempLibName dflags (soExt platform)
     let -- When running TH for a non-dynamic way, we still need to make
         -- -l flags to link against the dynamic libraries, so we turn
         -- Opt_Static off
         dflags1 = gopt_unset dflags Opt_Static
+
         dflags2 = dflags1 {
                       -- We don't want the original ldInputs in
                       -- (they're already linked in), but we do want
@@ -838,7 +841,16 @@ dynLoadObjs dflags pls objs = do
                                  , Option ("-Wl," ++ lp)
                                  , Option ("-l" ++  l)
                                  ])
-                            (temp_sos pls),
+                            (temp_sos pls)
+                        ++ concatMap
+                             (\lp ->
+                                 [ Option ("-L" ++ lp)
+                                 , Option ("-Wl,-rpath")
+                                 , Option ("-Wl," ++ lp)
+                                 ])
+                             minus_big_ls
+                        ++ map (\l -> Option ("-l" ++ l)) minus_ls,
+                      -- add -l options and -L options from dflags
                       -- Even if we're e.g. profiling, we still want
                       -- the vanilla dynamic libraries, so we set the
                       -- ways / build tag to be just WayDyn.
@@ -1031,6 +1043,7 @@ data LibrarySpec
 
    | Framework String   -- Only used for darwin, but does no harm
 
+
 -- If this package is already part of the GHCi binary, we'll already
 -- have the right DLLs for this package loaded, so don't try to
 -- load them again.
++++++ atomic-cast.patch ++++++
--- /var/tmp/diff_new_pack.WNl9cU/_old  2016-01-08 15:23:30.000000000 +0100
+++ /var/tmp/diff_new_pack.WNl9cU/_new  2016-01-08 15:23:30.000000000 +0100
@@ -42,10 +42,10 @@
  libraries/ghc-prim/cbits/atomic.c | 224 +++++++++++++++++++-------------------
  2 files changed, 148 insertions(+), 148 deletions(-)
 
-Index: ghc-7.10.2/includes/stg/Prim.h
+Index: ghc-7.10.2.20151105/includes/stg/Prim.h
 ===================================================================
---- ghc-7.10.2.orig/includes/stg/Prim.h
-+++ ghc-7.10.2/includes/stg/Prim.h
+--- ghc-7.10.2.20151105.orig/includes/stg/Prim.h
++++ ghc-7.10.2.20151105/includes/stg/Prim.h
 @@ -15,42 +15,42 @@
  #define PRIM_H
  
@@ -74,10 +74,10 @@
 -StgWord hs_atomic_xor16(volatile StgWord16 *x, StgWord val);
 -StgWord hs_atomic_xor32(volatile StgWord32 *x, StgWord val);
 -StgWord64 hs_atomic_xor64(volatile StgWord64 *x, StgWord64 val);
--StgWord hs_cmpxchg8(volatile StgWord8 *x, StgWord old, StgWord new);
--StgWord hs_cmpxchg16(volatile StgWord16 *x, StgWord old, StgWord new);
--StgWord hs_cmpxchg32(volatile StgWord32 *x, StgWord old, StgWord new);
--StgWord hs_cmpxchg64(volatile StgWord64 *x, StgWord64 old, StgWord64 new);
+-StgWord hs_cmpxchg8(volatile StgWord8 *x, StgWord old, StgWord new_);
+-StgWord hs_cmpxchg16(volatile StgWord16 *x, StgWord old, StgWord new_);
+-StgWord hs_cmpxchg32(volatile StgWord32 *x, StgWord old, StgWord new_);
+-StgWord hs_cmpxchg64(volatile StgWord64 *x, StgWord64 old, StgWord64 new_);
 -StgWord hs_atomicread8(volatile StgWord8 *x);
 -StgWord hs_atomicread16(volatile StgWord16 *x);
 -StgWord hs_atomicread32(volatile StgWord32 *x);
@@ -110,10 +110,10 @@
 +StgWord hs_atomic_xor16(StgWord x, StgWord val);
 +StgWord hs_atomic_xor32(StgWord x, StgWord val);
 +StgWord64 hs_atomic_xor64(StgWord x, StgWord64 val);
-+StgWord hs_cmpxchg8(StgWord x, StgWord old, StgWord new);
-+StgWord hs_cmpxchg16(StgWord x, StgWord old, StgWord new);
-+StgWord hs_cmpxchg32(StgWord x, StgWord old, StgWord new);
-+StgWord hs_cmpxchg64(StgWord x, StgWord64 old, StgWord64 new);
++StgWord hs_cmpxchg8(StgWord x, StgWord old, StgWord new_);
++StgWord hs_cmpxchg16(StgWord x, StgWord old, StgWord new_);
++StgWord hs_cmpxchg32(StgWord x, StgWord old, StgWord new_);
++StgWord hs_cmpxchg64(StgWord64 x, StgWord64 old, StgWord64 new_);
 +StgWord hs_atomicread8(StgWord x);
 +StgWord hs_atomicread16(StgWord x);
 +StgWord hs_atomicread32(StgWord x);
@@ -125,10 +125,10 @@
  
  /* libraries/ghc-prim/cbits/bswap.c */
  StgWord16 hs_bswap16(StgWord16 x);
-Index: ghc-7.10.2/libraries/ghc-prim/cbits/atomic.c
+Index: ghc-7.10.2.20151105/libraries/ghc-prim/cbits/atomic.c
 ===================================================================
---- ghc-7.10.2.orig/libraries/ghc-prim/cbits/atomic.c
-+++ ghc-7.10.2/libraries/ghc-prim/cbits/atomic.c
+--- ghc-7.10.2.20151105.orig/libraries/ghc-prim/cbits/atomic.c
++++ ghc-7.10.2.20151105/libraries/ghc-prim/cbits/atomic.c
 @@ -11,97 +11,97 @@
  
  // FetchAddByteArrayOp_Int

++++++ cabal-show-detail-direct.patch ++++++
commit 3792d212a6f60573ef43dd72088a353725d09461
Author: Joachim Breitner <m...@joachim-breitner.de>
Date:   Thu Nov 5 11:31:12 2015 +0100

    test: New mode --show-details=direct
    
    This mode implements #2911, and allows to connect the test runner
    directly to stdout/stdin. This is more reliable in the presence of no
    threading, i.e. a work-arond for #2398.
    
    I make the test suite use this, so that it passes again, despite
    printing lots of stuff. Once #2398 is fixed properly, the test suite
    should probably be extended to test all the various --show-details
    modes.

Index: ghc/libraries/Cabal/Cabal/Distribution/Simple/Setup.hs
===================================================================
--- ghc.orig/libraries/Cabal/Cabal/Distribution/Simple/Setup.hs 2015-11-05 
12:36:38.385252394 +0100
+++ ghc/libraries/Cabal/Cabal/Distribution/Simple/Setup.hs      2015-11-05 
12:36:38.377252228 +0100
@@ -1725,7 +1725,7 @@
 -- * Test flags
 -- ------------------------------------------------------------
 
-data TestShowDetails = Never | Failures | Always | Streaming
+data TestShowDetails = Never | Failures | Always | Streaming | Direct
     deriving (Eq, Ord, Enum, Bounded, Show)
 
 knownTestShowDetails :: [TestShowDetails]
@@ -1813,7 +1813,8 @@
             ("'always': always show results of individual test cases. "
              ++ "'never': never show results of individual test cases. "
              ++ "'failures': show results of failing test cases. "
-             ++ "'streaming': show results of test cases in real time.")
+             ++ "'streaming': show results of test cases in real time."
+             ++ "'direct': send results of test cases in real time; no log 
file.")
             testShowDetails (\v flags -> flags { testShowDetails = v })
             (reqArg "FILTER"
                 (readP_to_E (\_ -> "--show-details flag expects one of "
Index: ghc/libraries/Cabal/Cabal/Distribution/Simple/Test/ExeV10.hs
===================================================================
--- ghc.orig/libraries/Cabal/Cabal/Distribution/Simple/Test/ExeV10.hs   
2015-11-05 12:36:38.385252394 +0100
+++ ghc/libraries/Cabal/Cabal/Distribution/Simple/Test/ExeV10.hs        
2015-11-05 12:36:38.377252228 +0100
@@ -30,7 +30,7 @@
     , getCurrentDirectory, removeDirectoryRecursive )
 import System.Exit ( ExitCode(..) )
 import System.FilePath ( (</>), (<.>) )
-import System.IO ( hGetContents, hPutStr, stdout )
+import System.IO ( hGetContents, hPutStr, stdout, stderr )
 
 runTest :: PD.PackageDescription
         -> LBI.LocalBuildInfo
@@ -63,15 +63,20 @@
     -- Write summary notices indicating start of test suite
     notice verbosity $ summarizeSuiteStart $ PD.testName suite
 
-    (rOut, wOut) <- createPipe
+    (wOut, wErr, logText) <- case details of
+        Direct -> return (stdout, stderr, "")
+        _ -> do
+            (rOut, wOut) <- createPipe
+
+            -- Read test executable's output lazily (returns immediately)
+            logText <- hGetContents rOut
+            -- Force the IO manager to drain the test output pipe
+            void $ forkIO $ length logText `seq` return ()
 
-    -- Read test executable's output lazily (returns immediately)
-    logText <- hGetContents rOut
-    -- Force the IO manager to drain the test output pipe
-    void $ forkIO $ length logText `seq` return ()
+            -- '--show-details=streaming': print the log output in another 
thread
+            when (details == Streaming) $ void $ forkIO $ hPutStr stdout 
logText
 
-    -- '--show-details=streaming': print the log output in another thread
-    when (details == Streaming) $ void $ forkIO $ hPutStr stdout logText
+            return (wOut, wOut, logText)
 
     -- Run the test executable
     let opts = map (testOption pkg_descr lbi suite)
@@ -93,7 +98,7 @@
 
     exit <- rawSystemIOWithEnv verbosity cmd opts Nothing (Just shellEnv')
                                -- these handles are automatically closed
-                               Nothing (Just wOut) (Just wOut)
+                               Nothing (Just wOut) (Just wErr)
 
     -- Generate TestSuiteLog from executable exit code and a machine-
     -- readable test log.
@@ -112,12 +117,10 @@
     -- Show the contents of the human-readable log file on the terminal
     -- if there is a failure and/or detailed output is requested
     let whenPrinting = when $
-            (details > Never)
-            && (not (suitePassed $ testLogs suiteLog) || details == Always)
+            ( details == Always ||
+              details == Failures && not (suitePassed $ testLogs suiteLog))
             -- verbosity overrides show-details
             && verbosity >= normal
-            -- if streaming, we already printed the log
-            && details /= Streaming
     whenPrinting $ putStr $ unlines $ lines logText
 
     -- Write summary notice to terminal indicating end of test suite
++++++ ghc-7.10.2-src.tar.xz -> ghc-7.10.3b-src.tar.xz ++++++
/work/SRC/openSUSE:Factory/ghc/ghc-7.10.2-src.tar.xz 
/work/SRC/openSUSE:Factory/.ghc.new/ghc-7.10.3b-src.tar.xz differ: char 25, 
line 1

++++++ ghc.git-b29f20.patch ++++++
--- /var/tmp/diff_new_pack.WNl9cU/_old  2016-01-08 15:23:30.000000000 +0100
+++ /var/tmp/diff_new_pack.WNl9cU/_new  2016-01-08 15:23:30.000000000 +0100
@@ -35,32 +35,31 @@
  includes/CodeGen.Platform.hs    | 18 +++++++++++++-----
  4 files changed, 86 insertions(+), 18 deletions(-)
 
-Index: ghc-7.10.2/compiler/nativeGen/PPC/Instr.hs
+Index: ghc-7.10.2.20151105/compiler/nativeGen/PPC/Instr.hs
 ===================================================================
---- ghc-7.10.2.orig/compiler/nativeGen/PPC/Instr.hs
-+++ ghc-7.10.2/compiler/nativeGen/PPC/Instr.hs
-@@ -75,19 +75,19 @@ instance Instruction Instr where
+--- ghc-7.10.2.20151105.orig/compiler/nativeGen/PPC/Instr.hs
++++ ghc-7.10.2.20151105/compiler/nativeGen/PPC/Instr.hs
+@@ -75,17 +75,19 @@ instance Instruction Instr where
  
  ppc_mkStackAllocInstr :: Platform -> Int -> Instr
  ppc_mkStackAllocInstr platform amount
 -  = case platformArch platform of
--      ArchPPC    -> -- SUB II32 (OpImm (ImmInt amount)) (OpReg esp)
--                    ADD sp sp (RIImm (ImmInt (-amount)))
+-      ArchPPC -> UPDATE_SP II32 (ImmInt (-amount))
 -      ArchPPC_64 _ -> STU II64 sp (AddrRegImm sp (ImmInt (-amount)))
--      arch       -> panic $ "ppc_mkStackAllocInstr " ++ show arch
+-      arch -> panic $ "ppc_mkStackAllocInstr " ++ show arch
 +  = ppc_mkStackAllocInstr' platform (-amount)
  
  ppc_mkStackDeallocInstr :: Platform -> Int -> Instr
  ppc_mkStackDeallocInstr platform amount
+-  = case platformArch platform of
+-      ArchPPC -> UPDATE_SP II32 (ImmInt amount)
+-      ArchPPC_64 _ -> ADD sp sp (RIImm (ImmInt amount))
+-      arch -> panic $ "ppc_mkStackDeallocInstr " ++ show arch
 +  = ppc_mkStackAllocInstr' platform amount
 +
 +ppc_mkStackAllocInstr' :: Platform -> Int -> Instr
 +ppc_mkStackAllocInstr' platform amount
-   = case platformArch platform of
--      ArchPPC    -> -- ADD II32 (OpImm (ImmInt amount)) (OpReg esp)
--                    ADD sp sp (RIImm (ImmInt amount))
--      ArchPPC_64 _ -> ADD sp sp (RIImm (ImmInt amount))
--      arch       -> panic $ "ppc_mkStackDeallocInstr " ++ show arch
++   = case platformArch platform of
 +    ArchPPC      -> UPDATE_SP II32 (ImmInt amount)
 +    ArchPPC_64 _ -> UPDATE_SP II64 (ImmInt amount)
 +    _            -> panic $ "ppc_mkStackAllocInstr' "
@@ -68,205 +67,13 @@
  
  --
  -- See note [extra spill slots] in X86/Instr.hs
-@@ -187,8 +187,10 @@ data Instr
- 
-     -- Loads and stores.
-     | LD      Size Reg AddrMode     -- Load size, dst, src
-+    | LDFAR   Size Reg AddrMode     -- Load format, dst, src 32 bit offset
-     | LA      Size Reg AddrMode     -- Load arithmetic size, dst, src
-     | ST      Size Reg AddrMode     -- Store size, src, dst
-+    | STFAR   Size Reg AddrMode     -- Store format, src, dst 32 bit offset
-     | STU     Size Reg AddrMode     -- Store with Update size, src, dst
-     | LIS     Reg Imm               -- Load Immediate Shifted dst, src
-     | LI      Reg Imm               -- Load Immediate dst, src
-@@ -278,6 +280,8 @@ data Instr
-     | NOP                       -- no operation, PowerPC 64 bit
-                                 -- needs this as place holder to
-                                 -- reload TOC pointer
-+    | UPDATE_SP Size Imm      -- expand/shrink spill area on C stack
-+                                -- pseudo-instruction
- 
- -- | Get the registers that are being used by this instruction.
- -- regUsage doesn't need to do any trickery for jumps and such.
-@@ -289,8 +293,10 @@ ppc_regUsageOfInstr :: Platform -> Instr
- ppc_regUsageOfInstr platform instr
-  = case instr of
-     LD      _ reg addr       -> usage (regAddr addr, [reg])
-+    LDFAR   _ reg addr       -> usage (regAddr addr, [reg])
-     LA      _ reg addr       -> usage (regAddr addr, [reg])
-     ST      _ reg addr       -> usage (reg : regAddr addr, [])
-+    STFAR   _ reg addr       -> usage (reg : regAddr addr, [])
-     STU     _ reg addr       -> usage (reg : regAddr addr, [])
-     LIS     reg _            -> usage ([], [reg])
-     LI      reg _            -> usage ([], [reg])
-@@ -350,6 +356,7 @@ ppc_regUsageOfInstr platform instr
-     MFLR    reg             -> usage ([], [reg])
-     FETCHPC reg             -> usage ([], [reg])
-     FETCHTOC reg _          -> usage ([], [reg])
-+    UPDATE_SP _ _           -> usage ([], [sp])
-     _                       -> noUsage
-   where
-     usage (src, dst) = RU (filter (interesting platform) src)
-@@ -376,8 +383,10 @@ ppc_patchRegsOfInstr :: Instr -> (Reg ->
- ppc_patchRegsOfInstr instr env
-  = case instr of
-     LD      sz reg addr     -> LD sz (env reg) (fixAddr addr)
-+    LDFAR   sz reg addr     -> LDFAR sz (env reg) (fixAddr addr)
-     LA      sz reg addr     -> LA sz (env reg) (fixAddr addr)
-     ST      sz reg addr     -> ST sz (env reg) (fixAddr addr)
-+    STFAR   sz reg addr     -> STFAR sz (env reg) (fixAddr addr)
-     STU     sz reg addr     -> STU sz (env reg) (fixAddr addr)
-     LIS     reg imm         -> LIS (env reg) imm
-     LI      reg imm         -> LI (env reg) imm
-@@ -505,7 +514,11 @@ ppc_mkSpillInstr dflags reg delta slot
-                                 _       -> II64
-                 RcDouble  -> FF64
-                 _         -> panic "PPC.Instr.mkSpillInstr: no match"
--    in ST sz reg (AddrRegImm sp (ImmInt (off-delta)))
-+        instr = case makeImmediate W32 True (off-delta) of
-+                Just _  -> ST
-+                Nothing -> STFAR -- pseudo instruction: 32 bit offsets
-+
-+    in instr sz reg (AddrRegImm sp (ImmInt (off-delta)))
- 
- 
- ppc_mkLoadInstr
-@@ -526,7 +539,11 @@ ppc_mkLoadInstr dflags reg delta slot
-                                  _       -> II64
-                 RcDouble  -> FF64
-                 _         -> panic "PPC.Instr.mkLoadInstr: no match"
--    in LD sz reg (AddrRegImm sp (ImmInt (off-delta)))
-+        instr = case makeImmediate W32 True (off-delta) of
-+                Just _  -> LD
-+                Nothing -> LDFAR -- pseudo instruction: 32 bit offsets
-+
-+    in instr sz reg (AddrRegImm sp (ImmInt (off-delta)))
- 
- 
- -- | The maximum number of bytes required to spill a register. PPC32
-Index: ghc-7.10.2/compiler/nativeGen/PPC/Ppr.hs
+Index: ghc-7.10.2.20151105/compiler/nativeGen/PPC/Regs.hs
 ===================================================================
---- ghc-7.10.2.orig/compiler/nativeGen/PPC/Ppr.hs
-+++ ghc-7.10.2/compiler/nativeGen/PPC/Ppr.hs
-@@ -437,6 +437,14 @@ pprInstr (LD sz reg addr) = hcat [
-         ptext (sLit ", "),
-         pprAddr addr
-     ]
-+pprInstr (LDFAR fmt reg (AddrRegImm source off)) =
-+   sdocWithPlatform $ \platform -> vcat [
-+         pprInstr (ADDIS (tmpReg platform) source (HA off)),
-+         pprInstr (LD fmt reg (AddrRegImm (tmpReg platform) (LO off)))
-+    ]
-+
-+pprInstr (LDFAR _ _ _) =
-+   panic "PPC.Ppr.pprInstr LDFAR: no match"
- pprInstr (LA sz reg addr) = hcat [
-         char '\t',
-         ptext (sLit "l"),
-@@ -467,6 +475,14 @@ pprInstr (ST sz reg addr) = hcat [
-         ptext (sLit ", "),
-         pprAddr addr
-     ]
-+pprInstr (STFAR fmt reg (AddrRegImm source off)) =
-+   sdocWithPlatform $ \platform -> vcat [
-+         pprInstr (ADDIS (tmpReg platform) source (HA off)),
-+         pprInstr (ST fmt reg (AddrRegImm (tmpReg platform) (LO off)))
-+    ]
-+
-+pprInstr (STFAR _ _ _) =
-+   panic "PPC.Ppr.pprInstr STFAR: no match"
- pprInstr (STU sz reg addr) = hcat [
-         char '\t',
-         ptext (sLit "st"),
-@@ -799,6 +815,22 @@ pprInstr LWSYNC = ptext (sLit "\tlwsync"
- 
- pprInstr NOP = ptext (sLit "\tnop")
- 
-+pprInstr (UPDATE_SP fmt amount@(ImmInt offset))
-+   | fits16Bits offset = vcat [
-+       pprInstr (LD fmt r0 (AddrRegImm sp (ImmInt 0))),
-+       pprInstr (STU fmt r0 (AddrRegImm sp amount))
-+     ]
-+
-+pprInstr (UPDATE_SP fmt amount)
-+   = sdocWithPlatform $ \platform ->
-+       let tmp = tmpReg platform in
-+         vcat [
-+           pprInstr (LD fmt r0 (AddrRegImm sp (ImmInt 0))),
-+           pprInstr (ADDIS tmp sp (HA amount)),
-+           pprInstr (ADD tmp tmp (RIImm (LO amount))),
-+           pprInstr (STU fmt r0 (AddrRegReg sp tmp))
-+         ]
-+
- -- pprInstr _ = panic "pprInstr (ppc)"
- 
- 
-Index: ghc-7.10.2/compiler/nativeGen/PPC/Regs.hs
-===================================================================
---- ghc-7.10.2.orig/compiler/nativeGen/PPC/Regs.hs
-+++ ghc-7.10.2/compiler/nativeGen/PPC/Regs.hs
-@@ -37,7 +37,8 @@ module PPC.Regs (
-         fits16Bits,
-         makeImmediate,
-         fReg,
--        sp, toc, r3, r4, r11, r12, r27, r28, r30,
-+        r0, sp, toc, r3, r4, r11, r12, r27, r28, r30,
-+        tmpReg,
-         f1, f20, f21,
- 
-         allocatableRegs
-@@ -306,7 +307,8 @@ point registers.
- fReg :: Int -> RegNo
- fReg x = (32 + x)
- 
--sp, toc, r3, r4, r11, r12, r27, r28, r30, f1, f20, f21 :: Reg
-+r0, sp, toc, r3, r4, r11, r12, r27, r28, r30, f1, f20, f21 :: Reg
-+r0      = regSingle 0
- sp      = regSingle 1
- toc     = regSingle 2
- r3      = regSingle 3
-@@ -327,3 +329,11 @@ allocatableRegs :: Platform -> [RealReg]
- allocatableRegs platform
-    = let isFree i = isFastTrue (freeReg platform i)
-      in  map RealRegSingle $ filter isFree allMachRegNos
-+
-+-- temporary register for compiler use
-+tmpReg :: Platform -> Reg
-+tmpReg platform =
-+       case platformArch platform of
-+       ArchPPC      -> regSingle 13
+--- ghc-7.10.2.20151105.orig/compiler/nativeGen/PPC/Regs.hs
++++ ghc-7.10.2.20151105/compiler/nativeGen/PPC/Regs.hs
+@@ -335,4 +335,5 @@ tmpReg :: Platform -> Reg
+ tmpReg platform =
+        case platformArch platform of
+        ArchPPC      -> regSingle 13
 +       ArchPPC_64 _ -> regSingle 30
-+       _            -> panic "PPC.Regs.tmpReg: unknowm arch"
-Index: ghc-7.10.2/includes/CodeGen.Platform.hs
-===================================================================
---- ghc-7.10.2.orig/includes/CodeGen.Platform.hs
-+++ ghc-7.10.2/includes/CodeGen.Platform.hs
-@@ -876,16 +876,26 @@ freeRegBase _ = fastBool True
- #elif MACHREGS_powerpc
- 
- freeReg 0 = fastBool False -- Hack: r0 can't be used in all insns,
--                           -- but it's actually free
-+                           -- in stack reallocations on Linux
-+                           -- r0 is not usable in all insns so also reserved
-+                           -- on Darwin.
- freeReg 1 = fastBool False -- The Stack Pointer
- # if !MACHREGS_darwin
- -- most non-darwin powerpc OSes use r2 as a TOC pointer or something like that
- freeReg 2 = fastBool False
- -- TODO: make this conditonal for ppc64 ELF
--freeReg 13 = fastBool False -- reserved for system thread ID
-+freeReg 13 = fastBool False -- reserved for system thread ID on 64 bit
- -- TODO: do not reserve r30 in ppc64 ELF
- -- at least linux in -fPIC relies on r30 in PLT stubs
- freeReg 30 = fastBool False
-+{- TODO: reserve r13 on 64 bit systems only and r30 on 32 bit respectively.
-+   For now we use r30 on 64 bit and r13 on 32 bit as a temporary register
-+   in stack handling code. See compiler/nativeGen/PPC/Ppr.hs.
-+
-+   Later we might want to reserve r13 and r30 only where it is required.
-+   Then use r12 as temporary register, which is also what the C ABI does.
-+-}
-+
- # endif
- # ifdef REG_Base
- freeReg REG_Base = fastBool False
+        _            -> panic "PPC.Regs.tmpReg: unknowm arch"

++++++ u_terminfo_0402.patch ++++++
diff --git a/ghc-7.10.3.old/libraries/terminfo/System/Console/Terminfo/Base.hs 
b/ghc-7.10.3/libraries/terminfo/System/Console/Terminfo/Base.hs
index 87ac774..d2b262c 100644
--- a/ghc-7.10.3.old/libraries/terminfo/System/Console/Terminfo/Base.hs
+++ b/ghc-7.10.3/libraries/terminfo/System/Console/Terminfo/Base.hs
@@ -52,7 +52,7 @@ import Foreign.C
 import Foreign.ForeignPtr
 import Foreign.Ptr
 import Foreign.Marshal
-import Foreign.Storable (peek,poke)
+import Foreign.Storable (peek)
 import System.Environment (getEnv)
 import System.IO.Unsafe (unsafePerformIO)
 import System.IO
@@ -63,8 +63,8 @@ import Data.Typeable
 data TERMINAL
 newtype Terminal = Terminal (ForeignPtr TERMINAL)
 
-foreign import ccall "&" cur_term :: Ptr (Ptr TERMINAL)
-foreign import ccall set_curterm :: Ptr TERMINAL -> IO (Ptr TERMINAL)
+-- Use "unsafe" to make set_curterm faster since it's called quite a bit.
+foreign import ccall unsafe set_curterm :: Ptr TERMINAL -> IO (Ptr TERMINAL)
 foreign import ccall "&" del_curterm :: FunPtr (Ptr TERMINAL -> IO ())
 
 foreign import ccall setupterm :: CString -> CInt -> Ptr CInt -> IO ()
@@ -73,19 +73,15 @@ foreign import ccall setupterm :: CString -> CInt -> Ptr 
CInt -> IO ()
 -- 
 -- Throws a 'SetupTermError' if the terminfo database could not be read.
 setupTerm :: String -> IO Terminal
-setupTerm term = bracket (peek cur_term) (poke cur_term) $ \_ -> 
+setupTerm term =
     withCString term $ \c_term ->
     with 0 $ \ret_ptr -> do
         -- NOTE: I believe that for the way we use terminfo
         -- (i.e. custom output function)
         -- this parameter does not affect anything.
         let stdOutput = 1
-        {-- Force ncurses to return a new struct rather than
-        a copy of the current one (which it would do if the
-        terminal names are the same).  This prevents problems
-        when calling del_term on a struct shared by more than one
-        Terminal. --}
-        poke cur_term nullPtr
+        -- Save the previous terminal to be restored after calling setupterm.
+        old_term <- set_curterm nullPtr
         -- Call setupterm and check the return value.
         setupterm c_term stdOutput ret_ptr
         ret <- peek ret_ptr
@@ -93,7 +89,7 @@ setupTerm term = bracket (peek cur_term) (poke cur_term) $ \_ 
->
             then throwIO $ SetupTermError
                 $ "Couldn't look up terminfo entry " ++ show term
             else do
-                cterm <- peek cur_term
+                cterm <- set_curterm old_term
                 fmap Terminal $ newForeignPtr del_curterm cterm
 
 data SetupTermError = SetupTermError String
@@ -120,14 +116,10 @@ setupTermFromEnv = do
 -- TODO: this isn't really thread-safe...
 withCurTerm :: Terminal -> IO a -> IO a
 withCurTerm (Terminal term) f = withForeignPtr term $ \cterm -> do
-        old_term <- peek cur_term
-        if old_term /= cterm
-            then do
-                    _ <- set_curterm cterm
-                    x <- f
-                    _ <- set_curterm old_term
-                    return x
-            else f
+        old_term <- set_curterm cterm
+        x <- f
+        _ <- set_curterm old_term
+        return x
 
 
 ----------------------
@@ -198,11 +190,11 @@ instance Functor Capability where
     fmap f (Capability g) = Capability $ \t -> fmap (fmap f) (g t)
 
 instance Applicative Capability where
-    pure  = return
+    pure = Capability . const . pure . Just
     (<*>) = ap
 
 instance Monad Capability where
-    return = Capability . const . return . Just
+    return = pure
     Capability f >>= g = Capability $ \t -> do
         mx <- f t
         case mx of
diff --git a/ghc-7.10.3.old/libraries/terminfo/configure 
b/ghc-7.10.3/libraries/terminfo/configure
index be70a46..600e92f 100755
--- a/ghc-7.10.3.old/libraries/terminfo/configure
+++ b/ghc-7.10.3/libraries/terminfo/configure
@@ -656,7 +656,6 @@ infodir
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -730,7 +729,6 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -983,15 +981,6 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1129,7 +1118,7 @@ fi
 for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
                datadir sysconfdir sharedstatedir localstatedir includedir \
                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-               libdir localedir mandir runstatedir
+               libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1282,7 +1271,6 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/ghc-7.10.3.old/libraries/terminfo/terminfo.cabal 
b/ghc-7.10.3/libraries/terminfo/terminfo.cabal
index 31d84fa..2dfbee9 100644
--- a/ghc-7.10.3.old/libraries/terminfo/terminfo.cabal
+++ b/ghc-7.10.3/libraries/terminfo/terminfo.cabal
@@ -1,6 +1,6 @@
 Name:           terminfo
 Cabal-Version:  >=1.10
-Version:        0.4.0.1
+Version:        0.4.0.2
 Category:       User Interfaces
 License:        BSD3
 License-File:   LICENSE
@@ -29,7 +29,7 @@ Library
     other-extensions: CPP, DeriveDataTypeable, FlexibleInstances, 
ScopedTypeVariables
     if impl(ghc>=7.3)
       other-extensions: Safe, Trustworthy
-    build-depends:    base >= 4.3 && < 4.9
+    build-depends:    base >= 4.3 && < 4.10
     ghc-options:      -Wall
     exposed-modules:
                     System.Console.Terminfo

Reply via email to