On Wed, Apr 10, 2013 at 06:39:54PM +0100, Colin Watson wrote:
> Package: kaya
> Version: 0.4.4-6
> Severity: normal
> User: ubuntu-de...@lists.ubuntu.com
> Usertags: origin-ubuntu raring
> 
> kaya fails to build with GHC 7.6, as in Debian experimental (though my
> test was against Ubuntu raring-proposed), as follows:
> 
>   /usr/bin/ghc --make -fglasgow-exts  -O ./Main.hs repl_load.o -pgml 
> i686-linux-gnu-g++ -o kayac -i. -odir .
>   
>   on the commandline: Warning:
>       -fglasgow-exts is deprecated: Use individual extensions instead
>   [ 1 of 31] Compiling KeyGen           ( KeyGen.hs, KeyGen.o )
>   [ 2 of 31] Compiling Lib              ( Lib.hs, Lib.o )
>   [ 3 of 31] Compiling Portability64    ( Portability64.hs, Portability64.o )
>   
>   Portability64.hs:11:17: Not in scope: `catch'
>   make[2]: *** [kayac] Error 1

Here's a patch (again built against raring-proposed, but should work
against experimental) which includes GHC 7.6 fixes (written by me; not
upstream - hopefully you can forward?) and a backport of some upstream
commits for new libgc.

Cheers,

-- 
Iain Lane                                  [ i...@orangesquash.org.uk ]
Debian Developer                                   [ la...@debian.org ]
Ubuntu Developer                                   [ la...@ubuntu.com ]
diff -Nru kaya-0.4.4/debian/changelog kaya-0.4.4/debian/changelog
--- kaya-0.4.4/debian/changelog 2012-10-10 20:35:12.000000000 +0100
+++ kaya-0.4.4/debian/changelog 2013-04-24 10:32:32.000000000 +0100
@@ -1,3 +1,20 @@
+kaya (0.4.4-6ubuntu1) raring; urgency=low
+
+  * FTBFS fixes.
+  * debian/patches/ghc-7.6-fixes: Patches to work with API changes in GHC 7.6,
+    mainly to make use of Control.Exception.
+  * debian/patches/new-gc-api.patch: Backport of upstream commits to work with
+    current boehm GC APIs
+  * Add dh_autoreconf usage for the above patch.
+
+ -- Iain Lane <i...@orangesquash.org.uk>  Wed, 24 Apr 2013 10:30:16 +0100
+
+kaya (0.4.4-6build1) raring; urgency=low
+
+  * Rebuild to pick up the new libgc1c3 dependency.
+
+ -- Matthias Klose <d...@ubuntu.com>  Wed, 27 Feb 2013 13:39:59 +0000
+
 kaya (0.4.4-6) unstable; urgency=low
 
   [ gregor herrmann ]
diff -Nru kaya-0.4.4/debian/control kaya-0.4.4/debian/control
--- kaya-0.4.4/debian/control   2012-10-10 20:30:48.000000000 +0100
+++ kaya-0.4.4/debian/control   2013-04-24 10:34:03.000000000 +0100
@@ -2,7 +2,7 @@
 Section: devel
 Priority: extra
 Maintainer: Stuart Teasdale <s...@debian.org>
-Build-Depends: debhelper (>= 7.0.0), autotools-dev, ghc6 | ghc, 
libghc-mtl-dev, libgc-dev, happy, libpcre3-dev(>= 5.0), libgcrypt11-dev, 
libncurses5-dev, freeglut3-dev, zlib1g-dev, libgnutls-dev, libpq-dev, 
libmysqlclient-dev, libsqlite3-dev, libgd2-xpm-dev, 
libsdl1.2-dev,libncursesw5-dev,libghc-editline-dev, libghc-random-dev
+Build-Depends: debhelper (>= 7.0.0), dh-autoreconf, autotools-dev, ghc6 | ghc, 
libghc-mtl-dev, libgc-dev, happy, libpcre3-dev(>= 5.0), libgcrypt11-dev, 
libncurses5-dev, freeglut3-dev, zlib1g-dev, libgnutls-dev, libpq-dev, 
libmysqlclient-dev, libsqlite3-dev, libgd2-xpm-dev, 
libsdl1.2-dev,libncursesw5-dev,libghc-editline-dev, libghc-random-dev
 Standards-Version: 3.8.3
 Homepage: http://kayalang.org/
 
diff -Nru kaya-0.4.4/debian/patches/ghc-7.6-fixes 
kaya-0.4.4/debian/patches/ghc-7.6-fixes
--- kaya-0.4.4/debian/patches/ghc-7.6-fixes     1970-01-01 01:00:00.000000000 
+0100
+++ kaya-0.4.4/debian/patches/ghc-7.6-fixes     2013-04-24 10:17:07.000000000 
+0100
@@ -0,0 +1,115 @@
+Description: Fix build with changed APIs in GHC 7.6
+Author: Iain Lane <iain.l...@canonical.com>
+Forwarded: yes
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705157
+
+Index: b/compiler/Driver.hs
+===================================================================
+--- a/compiler/Driver.hs
++++ b/compiler/Driver.hs
+@@ -28,6 +28,7 @@
+ import ProgramDump
+ import REPL
+ 
++import Control.Exception
+ import System.Cmd
+ import System.Exit
+ import System.Directory
+@@ -67,8 +68,8 @@
+        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 :: IOException) -> 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
+Index: b/compiler/Module.hs
+===================================================================
+--- a/compiler/Module.hs
++++ b/compiler/Module.hs
+@@ -14,8 +14,9 @@
+               getAllLibDirs, linkFiles, getObjs) where
+ 
+ import Language
++import Control.Exception
+ import Debug.Trace
+-import System.Directory
++import System.Directory (doesFileExist)
+ import Data.List
+ import Lib
+ import Options
+@@ -244,7 +245,7 @@
+          (do --putStrLn $ "Trying " ++ x ++ path
+            f <- readFile (x++path)
+            return (Just f))
+-         (\e -> findFile xs path)
++         (\(e :: IOException) -> findFile xs path)
+ 
+ -- Get all the library directories, looking at the options and the
+ -- KAYA_LIBRARY_PATH environment variable.
+Index: b/compiler/Portability64.hs
+===================================================================
+--- a/compiler/Portability64.hs
++++ b/compiler/Portability64.hs
+@@ -1,6 +1,7 @@
+ module Portability64 where
+ 
+ import Lib
++import Control.Exception
+ import System.IO
+ import System.Environment
+ import qualified Data.Map as Map
+@@ -10,7 +11,7 @@
+ environment :: String -> IO (Maybe String)
+ environment x = catch (do e <- getEnv x
+                         return (Just e))
+-                    (\_ -> return Nothing)
++                    (\(_ :: IOException) -> return Nothing)
+ 
+ tempfile :: IO (FilePath, Handle)
+ tempfile = do env <- environment "TMPDIR"
+Index: b/compiler/CodegenCPP.hs
+===================================================================
+--- a/compiler/CodegenCPP.hs
++++ b/compiler/CodegenCPP.hs
+@@ -11,6 +11,7 @@
+ import Options
+ import TAC
+ import Language
++import Control.Exception
+ import System.IO
+ import Debug.Trace
+ import Lib
+@@ -149,7 +150,7 @@
+          (do --putStrLn $ "Trying " ++ x ++ path
+            f <- readFile (x++path)
+            return f)
+-         (\e -> findFile xs path)
++         (\(e :: IOException) -> findFile xs path)
+ 
+ writecpp :: [CompileResult] -> [Output]
+ writecpp [] = []
+Index: b/compiler/REPL.hs.in
+===================================================================
+--- a/compiler/REPL.hs.in
++++ b/compiler/REPL.hs.in
+@@ -29,6 +29,7 @@
+ import Lib
+ import Data.List
+ 
++import Contol.Exception
+ import Foreign.C
+ import Foreign.Ptr
+ import System.IO
+@@ -154,7 +155,7 @@
+                      xfn <- substTerm mod ctxt phi xrv
+                      let xinft = subst phi ity
+                      catch (runProg xfn xinft)
+-                           (\e -> putStrLn(show e))
++                           (\(e :: IOException) -> putStrLn(show e))
+                   Failure err file line -> do reportError err
+     processREPL (Failure err file line)
+         = do reportError err
diff -Nru kaya-0.4.4/debian/patches/new-gc-api.patch 
kaya-0.4.4/debian/patches/new-gc-api.patch
--- kaya-0.4.4/debian/patches/new-gc-api.patch  1970-01-01 01:00:00.000000000 
+0100
+++ kaya-0.4.4/debian/patches/new-gc-api.patch  2013-04-24 10:30:16.000000000 
+0100
@@ -0,0 +1,123 @@
+Description: Upstream backports:
+  Fri Jan 20 08:54:17 GMT 2012  c.i.mor...@durham.ac.uk
+    * Fix for GCC-4.7 build problem
+    Contributed by Jochen Schmitt
+  Sun May  9 21:57:02 BST 2010  c.i.mor...@durham.ac.uk
+    * Fix for change to GC API
+    Thanks to Jochen Schmitt for identifying the problem and providing the 
./configure check
+Forwarded: yes
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705157
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -169,6 +169,23 @@
+ 
+ AC_CHECK_LIB(gc, GC_malloc, [],         # for garbage collection
+       AC_MSG_ERROR([Can't find libgc]))
++AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <gc.h>
++#include <stdlib.h>],[
++  if (GC_VERSION_MAJOR > 7 || (GC_VERSION_MAJOR == 7 && GC_VERSION_MINOR > 1))
++    exit (0);
++  else
++    exit (1);
++  ])], [AC_MSG_NOTICE([libgc has new API])
++       FSDTYPE="GCNEW";
++       ],[
++       AC_MSG_NOTICE([libgc has old API])
++       FSDTYPE="GCOLD";
++       ],[])
++AC_SUBST(FSDTYPE)
++
++
++
++
+ #AC_CHECK_LIB(cgi, cgi_init, [],         # for cgi gadgetry
+ #     AC_MSG_ERROR([Can't find libcgi]))
+ #AC_CHECK_HEADER([libcgi/cgi.h],[CGIINC="-I/usr/include/libcgi"],
+Index: b/rts/sizes.h.in
+===================================================================
+--- a/rts/sizes.h.in
++++ b/rts/sizes.h.in
+@@ -58,4 +58,7 @@
+ #define UNIMARSHAL L"U[[%d]"
+ #endif
+ 
++
++#define @FSDTYPE@ 1
++
+ #endif
+Index: b/rts/stdfuns.cc
+===================================================================
+--- a/rts/stdfuns.cc
++++ b/rts/stdfuns.cc
+@@ -1762,3 +1762,16 @@
+ {
+     return RTCHECKS;
+ }
++
++kint gc_set_fsd(kint newval) {
++#ifdef GCOLD
++  // GC 7.1 or older
++  return (kint) GC_set_free_space_divisor(newval);
++#endif
++#ifdef GCNEW
++  // GC 7.2 or newer
++  kint old = (kint) GC_get_free_space_divisor();
++  GC_set_free_space_divisor(newval);
++  return old;
++#endif
++}
+Index: b/rts/stdfuns.h
+===================================================================
+--- a/rts/stdfuns.h
++++ b/rts/stdfuns.h
+@@ -13,6 +13,7 @@
+ 
+ #include <errno.h>
+ #include <stdio.h>
++#include <unistd.h>
+ #include <sys/types.h>
+ #include <dirent.h>
+ #include "Heap.h"
+@@ -237,4 +238,6 @@
+ 
+ kint rtchecks();
+ 
++kint gc_set_fsd(kint newval);
++
+ #endif
+Index: b/stdlib/Prelude.k
+===================================================================
+--- a/stdlib/Prelude.k
++++ b/stdlib/Prelude.k
+@@ -156,7 +156,7 @@
+     "<argument name='fsd'>The garbage collection parameter</argument>
+ <summary>Debugging function</summary>
+ <prose>Adjust garbage collector - higher values use less memory but run 
slower (the default value is 4, and a value of 1 disables garbage collection 
entirely). The default is almost always acceptable.</prose>"
+-    public Int gcSetFSD(Int fsd) = GC_set_free_space_divisor;
++    public Int gcSetFSD(Int fsd) = gc_set_fsd;
+     "<summary>Switch off garbage collector.</summary>
+      <prose>You may want this, for example, before executing some 
time-critical
+      code which should not be interrupted by a garbage collection.
+@@ -375,6 +375,7 @@
+ }
+ 
+ 
++
+ "<argument name='text'>The string to print</argument>
+ <summary>Send a string and a newline to standard output.</summary>
+ <prose>Print a string and a newline on standard output.</prose>
+Index: b/compiler/REPL.hs.in
+===================================================================
+--- a/compiler/REPL.hs.in
++++ b/compiler/REPL.hs.in
+@@ -29,7 +29,7 @@
+ import Lib
+ import Data.List
+ 
+-import Contol.Exception
++import Control.Exception
+ import Foreign.C
+ import Foreign.Ptr
+ import System.IO
diff -Nru kaya-0.4.4/debian/patches/series kaya-0.4.4/debian/patches/series
--- kaya-0.4.4/debian/patches/series    2012-10-10 20:30:48.000000000 +0100
+++ kaya-0.4.4/debian/patches/series    2013-04-24 10:09:23.000000000 +0100
@@ -1,3 +1,5 @@
 debian-changes-0.4.4-5
 haskell.patch
 gcc-4.7.patch
+ghc-7.6-fixes
+new-gc-api.patch
diff -Nru kaya-0.4.4/debian/rules kaya-0.4.4/debian/rules
--- kaya-0.4.4/debian/rules     2012-10-10 20:30:48.000000000 +0100
+++ kaya-0.4.4/debian/rules     2013-04-24 10:26:24.000000000 +0100
@@ -27,6 +27,7 @@
 config.status: configure
        dh_testdir
        dh_autotools-dev_updateconfig
+       dh_autoreconf
        # Add here commands to configure the package.
        CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) \
        --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
@@ -56,6 +57,7 @@
 
        dh_autotools-dev_restoreconfig
 
+       dh_autoreconf_clean
        dh_clean 
 
 install: build

Attachment: signature.asc
Description: Digital signature

Reply via email to