[kaya] Rewrite ghc76 patch in a more portable way
Jochen Schmitt
s4504kr at fedoraproject.org
Wed Aug 28 10:51:25 UTC 2013
commit 041331232c29eb22324bef9b67ec1e476d29c3cd
Author: Jochen Schmitt <Jochen at herr-schmitt.de>
Date: Wed Aug 28 12:51:11 2013 +0200
Rewrite ghc76 patch in a more portable way
kaya-0.5.2-ghc76.patch | 78 ++++++++++++++++++++++++++++++------------------
kaya.spec | 5 ++-
2 files changed, 53 insertions(+), 30 deletions(-)
---
diff --git a/kaya-0.5.2-ghc76.patch b/kaya-0.5.2-ghc76.patch
index 0d39325..7d21755 100644
--- a/kaya-0.5.2-ghc76.patch
+++ b/kaya-0.5.2-ghc76.patch
@@ -1,16 +1,21 @@
diff -up kaya-0.5.2/compiler/CodegenCPP.hs.ghc76 kaya-0.5.2/compiler/CodegenCPP.hs
---- kaya-0.5.2/compiler/CodegenCPP.hs.ghc76 2013-08-28 10:49:13.712430846 +0200
-+++ kaya-0.5.2/compiler/CodegenCPP.hs 2013-08-28 10:49:13.769427124 +0200
+--- kaya-0.5.2/compiler/CodegenCPP.hs.ghc76 2013-08-28 12:41:20.246909977 +0200
++++ kaya-0.5.2/compiler/CodegenCPP.hs 2013-08-28 12:41:20.251909648 +0200
@@ -17,6 +17,8 @@ import Debug.Trace
import Lib
import Data.List
-+import Control.Exception
++import Control.Exception as E
+
data Output = RawOutput String
| FNOutput (Name, Type, String, [(ArgType, Var)], String)
| ExternOutput (Name, Type)
-@@ -151,7 +153,7 @@ findFile (x:xs) path
+@@ -147,11 +149,11 @@ findFile :: [FilePath] -> FilePath -> IO
+ findFile [] path
+ = fail $ "Can't find " ++ path
+ findFile (x:xs) path
+- = catch
++ = E.catch
(do --putStrLn $ "Trying " ++ x ++ path
f <- readFile (x++path)
return f)
@@ -20,42 +25,53 @@ diff -up kaya-0.5.2/compiler/CodegenCPP.hs.ghc76 kaya-0.5.2/compiler/CodegenCPP.
writecpp :: [CompileResult] -> [Output]
writecpp [] = []
diff -up kaya-0.5.2/compiler/Driver.hs.ghc76 kaya-0.5.2/compiler/Driver.hs
---- kaya-0.5.2/compiler/Driver.hs.ghc76 2013-08-28 10:49:13.719430389 +0200
-+++ kaya-0.5.2/compiler/Driver.hs 2013-08-28 11:36:40.662637353 +0200
+--- kaya-0.5.2/compiler/Driver.hs.ghc76 2013-08-28 12:41:20.247909911 +0200
++++ kaya-0.5.2/compiler/Driver.hs 2013-08-28 12:43:37.995853127 +0200
@@ -37,6 +37,7 @@ import System.Random
import System.IO
import Debug.Trace
import Data.List
-+import Control.Exception
++import Control.Exception as E
import Control.Monad
-- Compile a file, with extra options to gcc, and main options. Returns the
-@@ -68,8 +69,8 @@ compileFile prtype modname fn extra opts
- catch (do startup <- getStartup prtype libdirs
- let pt = addToPT (parse newroot libdirs (prog++startup) fn) pinput
- compile newroot libdirs opts pt extra mainfile)
+@@ -65,11 +66,11 @@ compileFile prtype modname fn extra opts
+ -- Parse properly, using the real module name, and startup code.
+ -- (This is a bit of a hack, but at least the last parse was mostly
+ -- lazy)
+- catch (do startup <- getStartup prtype libdirs
+- let pt = addToPT (parse newroot libdirs (prog++startup) fn) pinput
+- compile newroot libdirs opts pt extra mainfile)
- (\e -> do putStrLn (show e)
- return CompError)
-+ (\ (e :: SomeException) -> do putStrLn (show e)
-+ return CompError)
++ E.catch (do startup <- getStartup prtype libdirs
++ let pt = addToPT (parse newroot libdirs (prog++startup) fn) pinput
++ compile newroot libdirs opts pt extra mainfile)
++ (\ (e :: SomeException) -> do putStrLn (show e)
++ return CompError)
outputfile Module mod = showuser mod ++ ".o"
-- TMP HACK: This should probably be a %extension "cgi" directive in the .ks
diff -up kaya-0.5.2/compiler/Module.hs.ghc76 kaya-0.5.2/compiler/Module.hs
---- kaya-0.5.2/compiler/Module.hs.ghc76 2013-08-28 10:49:13.738429149 +0200
-+++ kaya-0.5.2/compiler/Module.hs 2013-08-28 10:49:13.774426798 +0200
+--- kaya-0.5.2/compiler/Module.hs.ghc76 2013-08-28 12:41:20.248909845 +0200
++++ kaya-0.5.2/compiler/Module.hs 2013-08-28 12:41:20.252909582 +0200
@@ -14,8 +14,9 @@ module Module(importVersion, findFile, f
getAllLibDirs, linkFiles, getObjs) where
import Language
-+import Control.Exception
++import Control.Exception as E
import Debug.Trace
-import System.Directory
-+import System.Directory hiding (findFile)
++import System.Directory as Dir
import Data.List
import Lib
import Options
-@@ -252,7 +253,7 @@ findFile (x:xs) path
+@@ -248,11 +249,11 @@ findFile :: [FilePath] -> FilePath -> IO
+ findFile [] path
+ = return Nothing
+ findFile (x:xs) path
+- = catch
++ = E.catch
(do --putStrLn $ "Trying " ++ x ++ path
f <- readFile (x++path)
return (Just f))
@@ -66,41 +82,45 @@ diff -up kaya-0.5.2/compiler/Module.hs.ghc76 kaya-0.5.2/compiler/Module.hs
-- KAYA_LIBRARY_PATH environment variable.
diff -up kaya-0.5.2/compiler/Portability64.hs.ghc76 kaya-0.5.2/compiler/Portability64.hs
--- kaya-0.5.2/compiler/Portability64.hs.ghc76 2009-04-12 12:02:24.000000000 +0200
-+++ kaya-0.5.2/compiler/Portability64.hs 2013-08-28 10:49:13.777426602 +0200
++++ kaya-0.5.2/compiler/Portability64.hs 2013-08-28 12:41:20.252909582 +0200
@@ -5,12 +5,14 @@ import System.IO
import System.Environment
import qualified Data.Map as Map
-+import Control.Exception
++import Control.Exception as E
+
-- GHC 6.4 and above library incompatibilities.
environment :: String -> IO (Maybe String)
- environment x = catch (do e <- getEnv x
- return (Just e))
+-environment x = catch (do e <- getEnv x
+- return (Just e))
- (\_ -> return Nothing)
-+ ( \ ( _ :: SomeException) -> return Nothing)
++environment x = E.catch (do e <- getEnv x
++ return (Just e))
++ ( \ ( _ :: SomeException) -> return Nothing)
tempfile :: IO (FilePath, Handle)
tempfile = do env <- environment "TMPDIR"
diff -up kaya-0.5.2/compiler/REPL.hs.in.ghc76 kaya-0.5.2/compiler/REPL.hs.in
---- kaya-0.5.2/compiler/REPL.hs.in.ghc76 2013-08-28 10:49:13.750428365 +0200
-+++ kaya-0.5.2/compiler/REPL.hs.in 2013-08-28 10:49:13.780426406 +0200
+--- kaya-0.5.2/compiler/REPL.hs.in.ghc76 2013-08-28 12:41:20.249909780 +0200
++++ kaya-0.5.2/compiler/REPL.hs.in 2013-08-28 12:41:20.252909582 +0200
@@ -35,6 +35,8 @@ import System.IO
import @readlinemodule@
import System.Directory
-+import Control.Exception
++import Control.Exception as E
+
foreign import ccall "repl_load.h" interp_load :: Ptr CChar -> IO ()
foreign import ccall "repl_load.h" interp_close :: IO ()
foreign import ccall "repl_load.h" interp_clear :: IO ()
-@@ -160,7 +162,7 @@ runREPL so mod libdirs ctxt ectxt gctxt
+@@ -159,8 +161,8 @@ runREPL so mod libdirs ctxt ectxt gctxt
+ phi <- mkSubst xeq
xfn <- substTerm mod ctxt phi xrv
let xinft = subst phi ity
- catch (runProg xfn xinft)
+- catch (runProg xfn xinft)
- (\e -> putStrLn(show e))
-+ (\ (e :: SomeException) -> putStrLn(show e))
++ E.catch (runProg xfn xinft)
++ (\ (e :: SomeException) -> putStrLn(show e))
Failure err file line -> do reportError err
processREPL (Failure err file line)
= do reportError err
diff --git a/kaya.spec b/kaya.spec
index d1b07fd..9008a0b 100644
--- a/kaya.spec
+++ b/kaya.spec
@@ -4,7 +4,7 @@
Name: kaya
Version: 0.5.2
-Release: 19%{?dist}
+Release: 20%{?dist}
Summary: A Statically typed, imperative programming-language
Group: Development/Languages
@@ -126,6 +126,9 @@ make test ||:
%doc examples/ docs/
%changelog
+* Wed Aug 28 2013 Jochen Schmitt <Jochen herr-schmitt de> - 0.5.2-20
+- Rewrite ghc76 patch in a more portable way
+
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.5.2-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
- Remove -fstack-protector-stong, Fix BZ #995626
More information about the scm-commits
mailing list