Source: hedgewars
Version: 0.9.22-dfsg-11
Severity: important
Tags: patch

Hi,

On architectures which do not have a freepascal compiler (such as mips*,
ppc64el, s390x, etc), hedgewars FTBFS with this error:

> /«PKGBUILDDIR»/tools/pas2c/Pas2C.hs:300:5: error:
>     * Non type-variable argument
>         in the constraint: MonadState RenderState m
>       (Use FlexibleContexts to permit this)
>     * When checking the inferred type
>         injectNamespace :: forall (m :: * -> *).
>                            MonadState RenderState m =>
>                            Identifier -> m ()
>       In an equation for `uses2C':
>           uses2C uses@(Uses unitIds)
>             = do { mapM_
>                      injectNamespace (Identifier "pas2cSystem" undefined : 
> unitIds);
>                    mapM_ injectNamespace (Identifier "pas2cRedo" undefined : 
> unitIds);
>                    mapM_ (id2C IOInsert . setBaseType BTUnit) unitIds;
>                    .... }
>             where
>                 injectNamespace (Identifier i _)
>                   = do { getNS <- gets (flip Map.lookup . namespaces);
>                          .... }
> tools/pas2c/CMakeFiles/pas2c.dir/build.make:63: recipe for target 'bin/pas2c' 
> failed

This is a bug in the Pas2C script which does not compile with newer
version of GHC. It's fixed by these 2 upstream commits:
 6f45bb989ab48671cd6cedc820fde9dee94d3960
  ("pas2c: Tentatively fix the build")
 83f87ace0bcaf9112773fd918254f500624819b6
  ("Use less weird options")

I applied the attached combined patch and hedgewars now builds on mips64el.

Unfortunately I have no mips64el machines with graphics cards. I tried
to run hedgewars using X11 forwarding and I could start playing a game
for about 10 seconds before my X server crashed :/ (unlikely to be a bug
in hedgewars).

Thanks,
James
--- a/tools/pas2c/Pas2C.hs
+++ b/tools/pas2c/Pas2C.hs
@@ -297,6 +297,7 @@ uses2C uses@(Uses unitIds) = do
     mapM_ (id2C IOInsert . setBaseType BTUnit) unitIds
     return $ vcat . map (\i -> text $ "#include \"" ++ i ++ ".h\"") $ uses2List uses
     where
+    injectNamespace :: Identifier -> State RenderState ()
     injectNamespace (Identifier i _) = do
         getNS <- gets (flip Map.lookup . namespaces)
         modify (\s -> s{currentScope = Map.unionWith (++) (fromMaybe Map.empty (getNS i)) $ currentScope s})
--- a/tools/pas2c/PascalParser.hs
+++ b/tools/pas2c/PascalParser.hs
@@ -239,10 +239,10 @@ rangeDecl = choice [
     ] <?> "range declaration"
     where
     rangeft = do
-    e1 <- initExpression
-    string' ".."
-    e2 <- initExpression
-    return $ RangeFromTo e1 e2
+        e1 <- initExpression
+        string' ".."
+        e2 <- initExpression
+        return $ RangeFromTo e1 e2
 
 typeVarDeclaration :: Bool -> Parsec String u [TypeVarDeclaration]
 typeVarDeclaration isImpl = (liftM concat . many . choice) [

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to