guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/09: gnu: ghc-basement: Fix build on i686-linux.


From: guix-commits
Subject: 02/09: gnu: ghc-basement: Fix build on i686-linux.
Date: Wed, 15 Nov 2023 11:04:14 -0500 (EST)

efraim pushed a commit to branch mesa-updates
in repository guix.

commit 4c46dc9a4a698ca705e089245d334c731615717a
Author: Efraim Flashner <efraim@flashner.co.il>
AuthorDate: Wed Nov 15 11:26:30 2023 +0200

    gnu: ghc-basement: Fix build on i686-linux.
    
    * gnu/packages/haskell-xyz.scm (ghc-basement)[source]: Add patch.
    * gnu/packages/patches/ghc-basement-fix-32bit.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Register it.
    
    Change-Id: Ife75c651d4b9cffa14ec1c5165a9254cfee3f09f
---
 gnu/local.mk                                      |   1 +
 gnu/packages/haskell-xyz.scm                      |   3 +-
 gnu/packages/patches/ghc-basement-fix-32bit.patch | 177 ++++++++++++++++++++++
 3 files changed, 180 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index fcd9024ce3..a7dff407e1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1269,6 +1269,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/ghc-9.2-grep-warnings.patch \
   %D%/packages/patches/ghc-testsuite-dlopen-pie.patch          \
   %D%/packages/patches/ghc-testsuite-grep-compat.patch         \
+  %D%/packages/patches/ghc-basement-fix-32bit.patch            \
   %D%/packages/patches/ghc-bloomfilter-ghc9.2.patch    \
   %D%/packages/patches/ghc-bytestring-handle-ghc9.patch        \
   %D%/packages/patches/ghc-language-haskell-extract-ghc-8.10.patch     \
diff --git a/gnu/packages/haskell-xyz.scm b/gnu/packages/haskell-xyz.scm
index b1a038bb09..da6060bdc2 100644
--- a/gnu/packages/haskell-xyz.scm
+++ b/gnu/packages/haskell-xyz.scm
@@ -781,7 +781,8 @@ than @code{base-compat}, which has no dependencies.")
               (uri (hackage-uri "basement" version))
               (sha256
                (base32
-                "1d2xj5dmjps7nc7rwp5s0kyjcg9v8xfql6ik4yk1d3affnvazhjn"))))
+                "1d2xj5dmjps7nc7rwp5s0kyjcg9v8xfql6ik4yk1d3affnvazhjn"))
+              (patches (search-patches "ghc-basement-fix-32bit.patch"))))
     (build-system haskell-build-system)
     (properties '((upstream-name . "basement")))
     (home-page "https://github.com/haskell-foundation/foundation#readme";)
diff --git a/gnu/packages/patches/ghc-basement-fix-32bit.patch 
b/gnu/packages/patches/ghc-basement-fix-32bit.patch
new file mode 100644
index 0000000000..7407b2ef75
--- /dev/null
+++ b/gnu/packages/patches/ghc-basement-fix-32bit.patch
@@ -0,0 +1,177 @@
+https://github.com/haskell-foundation/foundation/pull/573
+https://github.com/haskell-foundation/foundation/commit/38be2c93acb6f459d24ed6c626981c35ccf44095.patch
+
+Changes made:
+Changed '904' to '902' to use the fix with GHC-9.2.
+
+diff --git a/Basement/Bits.hs b/Basement/Bits.hs
+index 7eeea0f..b1e9afd 100644
+--- a/Basement/Bits.hs
++++ b/Basement/Bits.hs
+@@ -54,8 +54,12 @@ import GHC.Int
+ import Basement.Compat.Primitive
+ 
+ #if WORD_SIZE_IN_BITS < 64
++#if __GLASGOW_HASKELL__ >= 902
++import GHC.Exts
++#else
+ import GHC.IntWord64
+ #endif
++#endif
+ 
+ -- | operation over finite bits
+ class FiniteBitsOps bits where
+diff --git a/Basement/Numerical/Additive.hs b/Basement/Numerical/Additive.hs
+index d0dfb97..79b7033 100644
+--- a/Basement/Numerical/Additive.hs
++++ b/Basement/Numerical/Additive.hs
+@@ -30,8 +30,12 @@ import qualified Basement.Types.Word128 as Word128
+ import qualified Basement.Types.Word256 as Word256
+ 
+ #if WORD_SIZE_IN_BITS < 64
++#if __GLASGOW_HASKELL__ >= 902
++import           GHC.Exts
++#else
+ import           GHC.IntWord64
+ #endif
++#endif
+ 
+ -- | Represent class of things that can be added together,
+ -- contains a neutral element and is commutative.
+diff --git a/Basement/Numerical/Conversion.hs 
b/Basement/Numerical/Conversion.hs
+index db502c0..abb6d93 100644
+--- a/Basement/Numerical/Conversion.hs
++++ b/Basement/Numerical/Conversion.hs
+@@ -26,8 +26,12 @@ import GHC.Word
+ import Basement.Compat.Primitive
+ 
+ #if WORD_SIZE_IN_BITS < 64
++#if __GLASGOW_HASKELL__ >= 902
++import GHC.Exts
++#else
+ import GHC.IntWord64
+ #endif
++#endif
+ 
+ intToInt64 :: Int -> Int64
+ #if WORD_SIZE_IN_BITS == 64
+@@ -96,11 +100,22 @@ int64ToWord64 (I64# i) = W64# (int64ToWord64# i)
+ #endif
+ 
+ #if WORD_SIZE_IN_BITS == 64
++#if __GLASGOW_HASKELL__ >= 904
++word64ToWord# :: Word64# -> Word#
++word64ToWord# i = word64ToWord# i
++#else
+ word64ToWord# :: Word# -> Word#
+ word64ToWord# i = i
++#endif
+ {-# INLINE word64ToWord# #-}
+ #endif
+ 
++#if WORD_SIZE_IN_BITS < 64
++word64ToWord32# :: Word64# -> Word32#
++word64ToWord32# i = wordToWord32# (word64ToWord# i)
++{-# INLINE word64ToWord32# #-}
++#endif
++
+ -- | 2 Word32s
+ data Word32x2 = Word32x2 {-# UNPACK #-} !Word32
+                          {-# UNPACK #-} !Word32
+@@ -113,9 +128,14 @@ word64ToWord32s (W64# w64) = Word32x2 (W32# 
(wordToWord32# (uncheckedShiftRL# (G
+ word64ToWord32s (W64# w64) = Word32x2 (W32# (wordToWord32# (uncheckedShiftRL# 
w64 32#))) (W32# (wordToWord32# w64))
+ #endif
+ #else
++#if __GLASGOW_HASKELL__ >= 902
++word64ToWord32s :: Word64 -> Word32x2
++word64ToWord32s (W64# w64) = Word32x2 (W32# (word64ToWord32# 
(uncheckedShiftRL64# w64 32#))) (W32# (word64ToWord32# w64))
++#else
+ word64ToWord32s :: Word64 -> Word32x2
+ word64ToWord32s (W64# w64) = Word32x2 (W32# (word64ToWord# 
(uncheckedShiftRL64# w64 32#))) (W32# (word64ToWord# w64))
+ #endif
++#endif
+ 
+ wordToChar :: Word -> Char
+ wordToChar (W# word) = C# (chr# (word2Int# word))
+diff --git a/Basement/PrimType.hs b/Basement/PrimType.hs
+index f8ca292..b8fbaf7 100644
+--- a/Basement/PrimType.hs
++++ b/Basement/PrimType.hs
+@@ -54,7 +54,11 @@ import           Basement.Nat
+ import qualified Prelude (quot)
+ 
+ #if WORD_SIZE_IN_BITS < 64
+-import           GHC.IntWord64
++#if __GLASGOW_HASKELL__ >= 902
++import GHC.Exts
++#else
++import GHC.IntWord64
++#endif
+ #endif
+ 
+ #ifdef FOUNDATION_BOUNDS_CHECK
+diff --git a/Basement/Types/OffsetSize.hs b/Basement/Types/OffsetSize.hs
+index cd94492..b2903ba 100644
+--- a/Basement/Types/OffsetSize.hs
++++ b/Basement/Types/OffsetSize.hs
+@@ -70,8 +70,12 @@ import Data.List (foldl')
+ import qualified Prelude
+ 
+ #if WORD_SIZE_IN_BITS < 64
++#if __GLASGOW_HASKELL__ >= 902
++import GHC.Exts
++#else
+ import GHC.IntWord64
+ #endif
++#endif
+ 
+ -- | File size in bytes
+ newtype FileSize = FileSize Word64
+@@ -225,7 +229,11 @@ countOfRoundUp alignment (CountOf n) = CountOf ((n + 
(alignment-1)) .&. compleme
+ 
+ csizeOfSize :: CountOf Word8 -> CSize
+ #if WORD_SIZE_IN_BITS < 64
++#if __GLASGOW_HASKELL__ >= 902
++csizeOfSize (CountOf (I# sz)) = CSize (W32# (wordToWord32# (int2Word# sz)))
++#else
+ csizeOfSize (CountOf (I# sz)) = CSize (W32# (int2Word# sz))
++#endif
+ #else
+ #if __GLASGOW_HASKELL__ >= 904
+ csizeOfSize (CountOf (I# sz)) = CSize (W64# (wordToWord64# (int2Word# sz)))
+@@ -238,7 +246,11 @@ csizeOfSize (CountOf (I# sz)) = CSize (W64# (int2Word# 
sz))
+ 
+ csizeOfOffset :: Offset8 -> CSize
+ #if WORD_SIZE_IN_BITS < 64
++#if __GLASGOW_HASKELL__ >= 902
++csizeOfOffset (Offset (I# sz)) = CSize (W32# (wordToWord32# (int2Word# sz)))
++#else
+ csizeOfOffset (Offset (I# sz)) = CSize (W32# (int2Word# sz))
++#endif
+ #else
+ #if __GLASGOW_HASKELL__ >= 904
+ csizeOfOffset (Offset (I# sz)) = CSize (W64# (wordToWord64# (int2Word# sz)))
+@@ -250,7 +262,11 @@ csizeOfOffset (Offset (I# sz)) = CSize (W64# (int2Word# 
sz))
+ sizeOfCSSize :: CSsize -> CountOf Word8
+ sizeOfCSSize (CSsize (-1))      = error "invalid size: CSSize is -1"
+ #if WORD_SIZE_IN_BITS < 64
++#if __GLASGOW_HASKELL__ >= 902
++sizeOfCSSize (CSsize (I32# sz)) = CountOf (I# (int32ToInt# sz))
++#else
+ sizeOfCSSize (CSsize (I32# sz)) = CountOf (I# sz)
++#endif
+ #else
+ #if __GLASGOW_HASKELL__ >= 904
+ sizeOfCSSize (CSsize (I64# sz)) = CountOf (I# (int64ToInt# sz))
+@@ -261,7 +277,11 @@ sizeOfCSSize (CSsize (I64# sz)) = CountOf (I# sz)
+ 
+ sizeOfCSize :: CSize -> CountOf Word8
+ #if WORD_SIZE_IN_BITS < 64
++#if __GLASGOW_HASKELL__ >= 902
++sizeOfCSize (CSize (W32# sz)) = CountOf (I# (word2Int# (word32ToWord# sz)))
++#else
+ sizeOfCSize (CSize (W32# sz)) = CountOf (I# (word2Int# sz))
++#endif
+ #else
+ #if __GLASGOW_HASKELL__ >= 904
+ sizeOfCSize (CSize (W64# sz)) = CountOf (I# (word2Int# (word64ToWord# sz)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]