Package:haskell-nettle
Version: 0.1.0-1
Tags: sid patch
Severity: important
Justification: FTBFS
User: debian-mips-dev-disc...@lists.alioth.debian.org
Usertags: mips-patch


While trying to build haskell-nettle on mips/mipsel architecture,
build fails on testing with an error:

> Building nettle-0.1.0...
> Preprocessing library nettle-0.1.0...
> [ 1 of 11] Compiling Crypto.Nettle.Hash.Types ( 
> src/Crypto/Nettle/Hash/Types.hs, dist-ghc/build/Crypto/Nettle/Hash/Types.o )
> [ 2 of 11] Compiling Crypto.Nettle.KeyedHash ( 
> src/Crypto/Nettle/KeyedHash.hs, dist-ghc/build/Crypto/Nettle/KeyedHash.o )
> [ 3 of 11] Compiling Crypto.Nettle.HMAC ( src/Crypto/Nettle/HMAC.hs, 
> dist-ghc/build/Crypto/Nettle/HMAC.o )
> [ 4 of 11] Compiling Nettle.Utils     ( src/Nettle/Utils.hs, 
> dist-ghc/build/Nettle/Utils.o )
> [ 5 of 11] Compiling Crypto.Nettle.Hash.ForeignImports ( 
> dist-ghc/build/Crypto/Nettle/Hash/ForeignImports.hs, 
> dist-ghc/build/Crypto/Nettle/Hash/ForeignImports.o )
> ghc: panic! (the 'impossible' happened)
>   (GHC version 7.6.3 for mipsel-unknown-linux):
>       Cant do annotations without GHCi
>     {src/Crypto/Nettle/Hash/ForeignImports.hsc:138:16-44}
>     "HLint: ignore Use camelCase"
> 
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
> 
> make: *** [build-ghc-stamp] Error 1


The reason for this error is that ANN pragmas used in haskell-nettle
source code.  Some architectures like mips, do not have support for
GHCi and without GHCi support, these parts of code are
treated as errors.

A patch that adds DEBIAN_NO_GHCI switch
in order to enable successful build of haskell-nettle for mips/mipsel, 
is attached.


Could you please consider including this patch?

Best regards,
Dejan
diff -uNr haskell-nettle-0.1.0.orig/nettle.cabal haskell-nettle-0.1.0/nettle.cabal
--- haskell-nettle-0.1.0.orig/nettle.cabal	2013-10-19 14:01:14.000000000 +0000
+++ haskell-nettle-0.1.0/nettle.cabal	2014-06-18 15:36:32.000000000 +0000
@@ -42,12 +42,16 @@
                      Crypto.Nettle.Hash.Types
                      Nettle.Utils
   ghc-options:       -Wall -optc-O3 -fno-cse
+  if arch(mips) || arch(mipsel)
+    cpp-options:       -DDEBIAN_NO_GHCI
+
   include-dirs:      src
   C-sources:         src/nettle-ciphers.c
   if flag(UsePkgConfig)
     PkgConfig-Depends: nettle
   else
     Extra-libraries: nettle
+  Extensions: CPP
 
 Test-Suite test-ciphers
   type:              exitcode-stdio-1.0
@@ -61,6 +65,7 @@
                    , crypto-cipher-types
                    , crypto-cipher-tests
                    , nettle
+  Extensions: CPP
 
 Test-Suite test-hashes
   type:              exitcode-stdio-1.0
@@ -74,6 +79,7 @@
                    , HUnit
                    , test-framework-hunit
                    , nettle
+  Extensions: CPP
 
 Test-Suite test-hmac
   type:              exitcode-stdio-1.0
@@ -87,6 +93,7 @@
                    , HUnit
                    , test-framework-hunit
                    , nettle
+  Extensions: CPP
 
 Test-Suite test-umac
   type:              exitcode-stdio-1.0
@@ -100,6 +107,7 @@
                    , HUnit
                    , test-framework-hunit
                    , nettle
+  Extensions: CPP
 
 source-repository head
   type:     git
diff -uNr haskell-nettle-0.1.0.orig/src/Crypto/Nettle/CCM.hs haskell-nettle-0.1.0/src/Crypto/Nettle/CCM.hs
--- haskell-nettle-0.1.0.orig/src/Crypto/Nettle/CCM.hs	2013-10-19 14:01:14.000000000 +0000
+++ haskell-nettle-0.1.0/src/Crypto/Nettle/CCM.hs	2014-06-18 15:35:12.000000000 +0000
@@ -46,7 +46,9 @@
 import Nettle.Utils
 
 -- internal functions are not camelCase on purpose
+#ifndef DEBIAN_NO_GHCI
 {-# ANN module "HLint: ignore Use camelCase" #-}
+#endif
 
 -- ccm needs a 128-bit block cipher
 
diff -uNr haskell-nettle-0.1.0.orig/src/Crypto/Nettle/Ciphers/ForeignImports.hsc haskell-nettle-0.1.0/src/Crypto/Nettle/Ciphers/ForeignImports.hsc
--- haskell-nettle-0.1.0.orig/src/Crypto/Nettle/Ciphers/ForeignImports.hsc	2013-10-19 14:01:14.000000000 +0000
+++ haskell-nettle-0.1.0/src/Crypto/Nettle/Ciphers/ForeignImports.hsc	2014-06-18 15:35:12.000000000 +0000
@@ -103,7 +103,9 @@
 import Nettle.Utils
 
 -- internal functions are not camelCase on purpose
+#ifndef DEBIAN_NO_GHCI
 {-# ANN module "HLint: ignore Use camelCase" #-}
+#endif
 
 #include "nettle-ciphers.h"
 
diff -uNr haskell-nettle-0.1.0.orig/src/Crypto/Nettle/Ciphers/Internal.hs haskell-nettle-0.1.0/src/Crypto/Nettle/Ciphers/Internal.hs
--- haskell-nettle-0.1.0.orig/src/Crypto/Nettle/Ciphers/Internal.hs	2013-10-19 14:01:14.000000000 +0000
+++ haskell-nettle-0.1.0/src/Crypto/Nettle/Ciphers/Internal.hs	2014-06-18 15:35:12.000000000 +0000
@@ -39,7 +39,9 @@
 import Crypto.Nettle.Ciphers.ForeignImports
 
 -- internal functions are not camelCase on purpose
+#ifndef DEBIAN_NO_GHCI
 {-# ANN module "HLint: ignore Use camelCase" #-}
+#endif
 
 class NettleCipher c where
 	-- | pointer to new context, key length, (const) key pointer
diff -uNr haskell-nettle-0.1.0.orig/src/Crypto/Nettle/Ciphers.hs haskell-nettle-0.1.0/src/Crypto/Nettle/Ciphers.hs
--- haskell-nettle-0.1.0.orig/src/Crypto/Nettle/Ciphers.hs	2013-10-19 14:01:14.000000000 +0000
+++ haskell-nettle-0.1.0/src/Crypto/Nettle/Ciphers.hs	2014-06-18 15:35:12.000000000 +0000
@@ -73,7 +73,9 @@
 import Nettle.Utils
 
 -- internal functions are not camelCase on purpose
+#ifndef DEBIAN_NO_GHCI
 {-# ANN module "HLint: ignore Use camelCase" #-}
+#endif
 
 #define INSTANCE_CIPHER(Typ) \
 instance Cipher Typ where \
diff -uNr haskell-nettle-0.1.0.orig/src/Crypto/Nettle/Hash/ForeignImports.hsc haskell-nettle-0.1.0/src/Crypto/Nettle/Hash/ForeignImports.hsc
--- haskell-nettle-0.1.0.orig/src/Crypto/Nettle/Hash/ForeignImports.hsc	2013-10-19 14:01:14.000000000 +0000
+++ haskell-nettle-0.1.0/src/Crypto/Nettle/Hash/ForeignImports.hsc	2014-06-18 15:35:12.000000000 +0000
@@ -135,7 +135,9 @@
 import Nettle.Utils
 
 -- internal functions are not camelCase on purpose
+#ifndef DEBIAN_NO_GHCI
 {-# ANN module "HLint: ignore Use camelCase" #-}
+#endif
 
 #include "nettle-hash.h"
 
diff -uNr haskell-nettle-0.1.0.orig/src/Crypto/Nettle/Hash.hs haskell-nettle-0.1.0/src/Crypto/Nettle/Hash.hs
--- haskell-nettle-0.1.0.orig/src/Crypto/Nettle/Hash.hs	2013-10-19 14:01:14.000000000 +0000
+++ haskell-nettle-0.1.0/src/Crypto/Nettle/Hash.hs	2014-06-18 15:35:12.000000000 +0000
@@ -69,7 +69,9 @@
 import qualified Data.ByteString.Internal as B
 
 -- internal functions are not camelCase on purpose
+#ifndef DEBIAN_NO_GHCI
 {-# ANN module "HLint: ignore Use camelCase" #-}
+#endif
 
 nettleHashBlockSize  :: NettleHashAlgorithm a => Tagged a Int
 nettleHashBlockSize = nha_block_size
diff -uNr haskell-nettle-0.1.0.orig/src/Crypto/Nettle/UMAC.hs haskell-nettle-0.1.0/src/Crypto/Nettle/UMAC.hs
--- haskell-nettle-0.1.0.orig/src/Crypto/Nettle/UMAC.hs	2013-10-19 14:01:14.000000000 +0000
+++ haskell-nettle-0.1.0/src/Crypto/Nettle/UMAC.hs	2014-06-18 15:35:12.000000000 +0000
@@ -38,7 +38,9 @@
 import Crypto.Nettle.Hash.ForeignImports
 
 -- internal functions are not camelCase on purpose
+#ifndef DEBIAN_NO_GHCI
 {-# ANN module "HLint: ignore Use camelCase" #-}
+#endif
 
 {-|
 'UMAC' is a class of keyed hash algorithms that take an additional nonce.
diff -uNr haskell-nettle-0.1.0.orig/src/Tests/Ciphers.hs haskell-nettle-0.1.0/src/Tests/Ciphers.hs
--- haskell-nettle-0.1.0.orig/src/Tests/Ciphers.hs	2013-10-19 14:01:14.000000000 +0000
+++ haskell-nettle-0.1.0/src/Tests/Ciphers.hs	2014-06-18 15:35:12.000000000 +0000
@@ -76,7 +76,9 @@
 			, label "ctrCombine + ctrCombine unaligned" $ (ctrCombine c iv . ctrCombine c iv) input   == input
 			]
 
+#ifndef DEBIAN_NO_GHCI
 {-# ANN module "HLint: ignore Reduce duplication" #-}
+#endif
 genStreamTest :: StreamCipher c => c -> Test
 genStreamTest c' = testProperty ("generated " ++ cipherName c' ++ " stream cipher test") $ do
 	c <- genCipher c'

Reply via email to