pandoc: update to 3.6.

This commit is contained in:
ii8 2025-07-03 17:51:56 +01:00
parent 161e0c76bc
commit ccad8aad51
8 changed files with 543 additions and 174 deletions

View file

@ -1,154 +0,0 @@
cabal-version: 2.0
-- This file has been generated from package.yaml by hpack version 0.34.6.
--
-- see: https://github.com/sol/hpack
--
-- hash: 20655cd6263e9fe7e5737ee81b093c8c6f5eae67e260ddd3a821ac6ef5e35e69
name: pandoc-crossref
version: 0.3.13.0
synopsis: Pandoc filter for cross-references
description: pandoc-crossref is a pandoc filter for numbering figures, equations, tables and cross-references to them.
category: Text
homepage: https://github.com/lierdakil/pandoc-crossref#readme
bug-reports: https://github.com/lierdakil/pandoc-crossref/issues
author: Nikolay Yakimov
maintainer: root@livid.pp.ru
license: GPL-2
license-file: LICENSE
build-type: Simple
source-repository head
type: git
location: https://github.com/lierdakil/pandoc-crossref
flag enable_flaky_tests
description: Some tests rely on specific behaviour of pandoc, which may change between minor versions. These are still useful indicators for the developer, but not necessarily indicating there's a problem with the package itself. Enable if you know what you are doing.
manual: True
default: False
library
exposed-modules:
Text.Pandoc.CrossRef
other-modules:
Text.Pandoc.CrossRef.References
Text.Pandoc.CrossRef.References.Blocks
Text.Pandoc.CrossRef.References.List
Text.Pandoc.CrossRef.References.Refs
Text.Pandoc.CrossRef.References.Types
Text.Pandoc.CrossRef.Util.CodeBlockCaptions
Text.Pandoc.CrossRef.Util.CustomLabels
Text.Pandoc.CrossRef.Util.Meta
Text.Pandoc.CrossRef.Util.ModifyMeta
Text.Pandoc.CrossRef.Util.Options
Text.Pandoc.CrossRef.Util.Settings
Text.Pandoc.CrossRef.Util.Settings.Gen
Text.Pandoc.CrossRef.Util.Settings.Template
Text.Pandoc.CrossRef.Util.Template
Text.Pandoc.CrossRef.Util.Util
hs-source-dirs:
lib
lib-internal
ghc-options: -Wall
build-depends:
base >=4.11 && <5
, containers >=0.1 && <0.7
, data-default >=0.4 && <0.8
, directory >=1 && <1.4
, filepath >=1.1 && <1.5
, microlens >=0.4.12.0 && <0.5.0.0
, microlens-mtl >=0.2.0.1 && <0.3.0.0
, microlens-th >=0.4.3.10 && <0.5.0.0
, mtl >=1.1 && <2.3
, pandoc >=2.10 && <2.18
, pandoc-types >=1.21 && <1.23
, roman-numerals ==0.5.*
, syb >=0.4 && <0.8
, template-haskell >=2.7.0.0 && <3.0.0.0
, text >=1.2.2 && <1.3
, utility-ht >=0.0.11 && <0.1.0
default-language: Haskell2010
executable pandoc-crossref
main-is: pandoc-crossref.hs
other-modules:
ManData
hs-source-dirs:
src
ghc-options: -Wall -threaded
build-depends:
base >=4.11 && <5
, deepseq ==1.4.*
, gitrev >=1.3.1 && <1.4
, open-browser ==0.2.*
, optparse-applicative >=0.13 && <0.17
, pandoc >=2.10 && <2.18
, pandoc-crossref
, pandoc-types >=1.21 && <1.23
, template-haskell >=2.7.0.0 && <3.0.0.0
, temporary >=1.2 && <1.4
, text >=1.2.2 && <1.3
default-language: Haskell2010
test-suite test-integrative
type: exitcode-stdio-1.0
main-is: test-integrative.hs
hs-source-dirs:
test
ghc-options: -Wall -fno-warn-unused-do-bind -threaded
build-depends:
base >=4.11 && <5
, directory >=1 && <1.4
, filepath >=1.1 && <1.5
, hspec >=2.4.4 && <3
, pandoc >=2.10 && <2.18
, pandoc-crossref
, pandoc-types >=1.21 && <1.23
, text >=1.2.2 && <1.3
if flag(enable_flaky_tests)
cpp-options: -DFLAKY
default-language: Haskell2010
test-suite test-pandoc-crossref
type: exitcode-stdio-1.0
main-is: test-pandoc-crossref.hs
other-modules:
Native
Paths_pandoc_crossref
autogen-modules:
Paths_pandoc_crossref
hs-source-dirs:
test
ghc-options: -Wall -fno-warn-unused-do-bind -threaded
build-depends:
base >=4.11 && <5
, containers >=0.1 && <0.7
, data-default >=0.4 && <0.8
, hspec >=2.4.4 && <3
, microlens >=0.4.12.0 && <0.5.0.0
, mtl >=1.1 && <2.3
, pandoc >=2.10 && <2.18
, pandoc-crossref
, pandoc-types >=1.21 && <1.23
, text >=1.2.2 && <1.3
if flag(enable_flaky_tests)
cpp-options: -DFLAKY
default-language: Haskell2010
benchmark simple
type: exitcode-stdio-1.0
main-is: bench-simple.hs
other-modules:
Native
hs-source-dirs:
test
ghc-options: -Wall -fno-warn-unused-do-bind -threaded
build-depends:
base >=4.11 && <5
, criterion >=1.5.9.0 && <1.6
, pandoc >=2.10 && <2.18
, pandoc-crossref
, pandoc-types >=1.21 && <1.23
, text >=1.2.2 && <1.3
default-language: Haskell2010

View file

@ -0,0 +1,242 @@
From 38be2c93acb6f459d24ed6c626981c35ccf44095 Mon Sep 17 00:00:00 2001
From: Sylvain Henry <sylvain@haskus.fr>
Date: Thu, 16 Feb 2023 15:40:45 +0100
Subject: [PATCH] Fix build on 32-bit architectures
---
basement/Basement/Bits.hs | 4 ++++
basement/Basement/From.hs | 24 -----------------------
basement/Basement/Numerical/Additive.hs | 4 ++++
basement/Basement/Numerical/Conversion.hs | 20 +++++++++++++++++++
basement/Basement/PrimType.hs | 6 +++++-
basement/Basement/Types/OffsetSize.hs | 22 +++++++++++++++++++--
6 files changed, 53 insertions(+), 27 deletions(-)
diff --git a/basement/Basement/Bits.hs b/basement/Basement/Bits.hs
index 7eeea0f5..24520ed7 100644
--- a/basement/Basement/Bits.hs
+++ b/basement/Basement/Bits.hs
@@ -54,8 +54,12 @@ import GHC.Int
import Basement.Compat.Primitive
#if WORD_SIZE_IN_BITS < 64
+#if __GLASGOW_HASKELL__ >= 904
+import GHC.Exts
+#else
import GHC.IntWord64
#endif
+#endif
-- | operation over finite bits
class FiniteBitsOps bits where
diff --git a/basement/Basement/From.hs b/basement/Basement/From.hs
index 7bbe141c..80014b3e 100644
--- a/basement/Basement/From.hs
+++ b/basement/Basement/From.hs
@@ -272,23 +272,11 @@ instance (NatWithinBound (CountOf ty) n, KnownNat n, PrimType ty)
tryFrom = BlockN.toBlockN . UArray.toBlock . BoxArray.mapToUnboxed id
instance (KnownNat n, NatWithinBound Word8 n) => From (Zn64 n) Word8 where
-#if __GLASGOW_HASKELL__ >= 904
- from = narrow . unZn64 where narrow (W64# w) = W8# (wordToWord8# (word64ToWord# (GHC.Prim.word64ToWord# w)))
-#else
from = narrow . unZn64 where narrow (W64# w) = W8# (wordToWord8# (word64ToWord# w))
-#endif
instance (KnownNat n, NatWithinBound Word16 n) => From (Zn64 n) Word16 where
-#if __GLASGOW_HASKELL__ >= 904
- from = narrow . unZn64 where narrow (W64# w) = W16# (wordToWord16# (word64ToWord# (GHC.Prim.word64ToWord# w)))
-#else
from = narrow . unZn64 where narrow (W64# w) = W16# (wordToWord16# (word64ToWord# w))
-#endif
instance (KnownNat n, NatWithinBound Word32 n) => From (Zn64 n) Word32 where
-#if __GLASGOW_HASKELL__ >= 904
- from = narrow . unZn64 where narrow (W64# w) = W32# (wordToWord32# (word64ToWord# (GHC.Prim.word64ToWord# w)))
-#else
from = narrow . unZn64 where narrow (W64# w) = W32# (wordToWord32# (word64ToWord# w))
-#endif
instance From (Zn64 n) Word64 where
from = unZn64
instance From (Zn64 n) Word128 where
@@ -297,23 +285,11 @@ instance From (Zn64 n) Word256 where
from = from . unZn64
instance (KnownNat n, NatWithinBound Word8 n) => From (Zn n) Word8 where
-#if __GLASGOW_HASKELL__ >= 904
- from = narrow . naturalToWord64 . unZn where narrow (W64# w) = W8# (wordToWord8# (word64ToWord# (GHC.Prim.word64ToWord# w)))
-#else
from = narrow . naturalToWord64 . unZn where narrow (W64# w) = W8# (wordToWord8# (word64ToWord# w))
-#endif
instance (KnownNat n, NatWithinBound Word16 n) => From (Zn n) Word16 where
-#if __GLASGOW_HASKELL__ >= 904
- from = narrow . naturalToWord64 . unZn where narrow (W64# w) = W16# (wordToWord16# (word64ToWord# (GHC.Prim.word64ToWord# w)))
-#else
from = narrow . naturalToWord64 . unZn where narrow (W64# w) = W16# (wordToWord16# (word64ToWord# w))
-#endif
instance (KnownNat n, NatWithinBound Word32 n) => From (Zn n) Word32 where
-#if __GLASGOW_HASKELL__ >= 904
- from = narrow . naturalToWord64 . unZn where narrow (W64# w) = W32# (wordToWord32# (word64ToWord# (GHC.Prim.word64ToWord# w)))
-#else
from = narrow . naturalToWord64 . unZn where narrow (W64# w) = W32# (wordToWord32# (word64ToWord# w))
-#endif
instance (KnownNat n, NatWithinBound Word64 n) => From (Zn n) Word64 where
from = naturalToWord64 . unZn
instance (KnownNat n, NatWithinBound Word128 n) => From (Zn n) Word128 where
diff --git a/basement/Basement/Numerical/Additive.hs b/basement/Basement/Numerical/Additive.hs
index d0dfb973..8ab65aa0 100644
--- a/basement/Basement/Numerical/Additive.hs
+++ b/basement/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__ >= 904
+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/Basement/Numerical/Conversion.hs b/basement/Basement/Numerical/Conversion.hs
index db502c07..fddc8232 100644
--- a/basement/Basement/Numerical/Conversion.hs
+++ b/basement/Basement/Numerical/Conversion.hs
@@ -26,8 +26,12 @@ import GHC.Word
import Basement.Compat.Primitive
#if WORD_SIZE_IN_BITS < 64
+#if __GLASGOW_HASKELL__ >= 904
+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__ >= 904
+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/Basement/PrimType.hs b/basement/Basement/PrimType.hs
index f8ca2926..a888ec91 100644
--- a/basement/Basement/PrimType.hs
+++ b/basement/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__ >= 904
+import GHC.Exts
+#else
+import GHC.IntWord64
+#endif
#endif
#ifdef FOUNDATION_BOUNDS_CHECK
diff --git a/basement/Basement/Types/OffsetSize.hs b/basement/Basement/Types/OffsetSize.hs
index cd944927..1ea80dad 100644
--- a/basement/Basement/Types/OffsetSize.hs
+++ b/basement/Basement/Types/OffsetSize.hs
@@ -70,8 +70,12 @@ import Data.List (foldl')
import qualified Prelude
#if WORD_SIZE_IN_BITS < 64
+#if __GLASGOW_HASKELL__ >= 904
+import GHC.Exts
+#else
import GHC.IntWord64
#endif
+#endif
-- | File size in bytes
newtype FileSize = FileSize Word64
@@ -225,20 +229,26 @@ countOfRoundUp alignment (CountOf n) = CountOf ((n + (alignment-1)) .&. compleme
csizeOfSize :: CountOf Word8 -> CSize
#if WORD_SIZE_IN_BITS < 64
+#if __GLASGOW_HASKELL__ >= 904
+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)))
-
#else
csizeOfSize (CountOf (I# sz)) = CSize (W64# (int2Word# sz))
-
#endif
#endif
csizeOfOffset :: Offset8 -> CSize
#if WORD_SIZE_IN_BITS < 64
+#if __GLASGOW_HASKELL__ >= 904
+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 +260,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__ >= 904
+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 +275,11 @@ sizeOfCSSize (CSsize (I64# sz)) = CountOf (I# sz)
sizeOfCSize :: CSize -> CountOf Word8
#if WORD_SIZE_IN_BITS < 64
+#if __GLASGOW_HASKELL__ >= 904
+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)))

View file

@ -0,0 +1,11 @@
--- a/cborg/cborg.cabal 2025-07-06 20:31:00.307574779 +0100
+++ b/cborg/cborg.cabal 2025-07-06 20:31:05.085962403 +0100
@@ -164,7 +164,7 @@
scientific >= 0.3 && < 0.4,
tasty >= 0.11 && < 1.6,
tasty-hunit >= 0.9 && < 0.11,
- tasty-quickcheck >= 0.8 && < 0.11,
+ tasty-quickcheck >= 0.8 && < 0.12,
vector >= 0.10 && < 0.14
if !impl(ghc >= 8.0)
build-depends:

View file

@ -0,0 +1,212 @@
commit 9d1418bb8b38cb9a438d7f18835b1ef7ef12b234
Author: amesgen <amesgen@amesgen.de>
Date: Sun Sep 10 20:03:40 2023 +0200
Fix compilation and support GHC >=9.2 on 32bit
diff --git a/cborg/src/Codec/CBOR/Decoding.hs b/cborg/src/Codec/CBOR/Decoding.hs
index a7d774c..bf68e68 100644
--- a/cborg/src/Codec/CBOR/Decoding.hs
+++ b/cborg/src/Codec/CBOR/Decoding.hs
@@ -315,11 +315,16 @@ getDecodeAction (Decoder k) = k (\x -> return (Done x))
toInt8 :: Int# -> Int8
toInt16 :: Int# -> Int16
toInt32 :: Int# -> Int32
-toInt64 :: Int# -> Int64
toWord8 :: Word# -> Word8
toWord16 :: Word# -> Word16
toWord32 :: Word# -> Word32
+#if defined(ARCH_64bit)
+toInt64 :: Int# -> Int64
toWord64 :: Word# -> Word64
+#else
+toInt64 :: Int64# -> Int64
+toWord64 :: Word64# -> Word64
+#endif
#if MIN_VERSION_ghc_prim(0,8,0)
toInt8 n = I8# (intToInt8# n)
toInt16 n = I16# (intToInt16# n)
@@ -327,8 +332,7 @@ toInt32 n = I32# (intToInt32# n)
toWord8 n = W8# (wordToWord8# n)
toWord16 n = W16# (wordToWord16# n)
toWord32 n = W32# (wordToWord32# n)
-#if WORD_SIZE_IN_BITS == 64
-#if MIN_VERSION_base(4,17,0)
+#if MIN_VERSION_base(4,17,0) && defined(ARCH_64bit)
toInt64 n = I64# (intToInt64# n)
toWord64 n = W64# (wordToWord64# n)
#else
@@ -336,10 +340,6 @@ toInt64 n = I64# n
toWord64 n = W64# n
#endif
#else
-toInt64 n = I64# (intToInt64# n)
-toWord64 n = W64# (wordToWord64# n)
-#endif
-#else
toInt8 n = I8# n
toInt16 n = I16# n
toInt32 n = I32# n
@@ -986,7 +986,7 @@ type ByteOffset = Int64
-- @since 0.2.2.0
peekByteOffset :: Decoder s ByteOffset
peekByteOffset = Decoder (\k -> return (PeekByteOffset (\off# -> k (I64#
-#if MIN_VERSION_base(4,17,0)
+#if MIN_VERSION_base(4,17,0) && !defined(ARCH_32bit)
(intToInt64# off#)
#else
off#
diff --git a/cborg/src/Codec/CBOR/Magic.hs b/cborg/src/Codec/CBOR/Magic.hs
index cdeb455..bfae638 100644
--- a/cborg/src/Codec/CBOR/Magic.hs
+++ b/cborg/src/Codec/CBOR/Magic.hs
@@ -120,7 +120,7 @@ import qualified Numeric.Half as Half
import Data.Bits ((.|.), unsafeShiftL)
#endif
-#if defined(ARCH_32bit)
+#if defined(ARCH_32bit) && !MIN_VERSION_ghc_prim(0,8,0)
import GHC.IntWord64 (wordToWord64#, word64ToWord#,
intToInt64#, int64ToInt#,
leWord64#, ltWord64#, word64ToInt64#)
@@ -173,7 +173,7 @@ grabWord64 (Ptr ip#) = W64# (wordToWord64# (byteSwap# (word64ToWord# (indexWord6
grabWord64 (Ptr ip#) = W64# (byteSwap# (indexWord64OffAddr# ip# 0#))
#endif
#else
-grabWord64 (Ptr ip#) = W64# (byteSwap64# (word64ToWord# (indexWord64OffAddr# ip# 0#)))
+grabWord64 (Ptr ip#) = W64# (byteSwap64# (indexWord64OffAddr# ip# 0#))
#endif
#elif defined(MEM_UNALIGNED_OPS) && \
@@ -484,7 +484,7 @@ word16ToInt (W16# w#) = I# (word2Int# (word16ToWord# w#))
word32ToInt (W32# w#) = I# (word2Int# (word32ToWord# w#))
#else
word32ToInt (W32# w#) =
- case isTrue# (w# `ltWord#` 0x80000000##) of
+ case isTrue# (word32ToWord# w# `ltWord#` 0x80000000##) of
True -> Just (I# (word2Int# (word32ToWord# w#)))
False -> Nothing
#endif
@@ -530,6 +530,19 @@ word64ToInt (W64# w#) =
{-# INLINE word64ToInt #-}
#if defined(ARCH_32bit)
+#if MIN_VERSION_ghc_prim(0,8,0)
+word8ToInt64 (W8# w#) = I64# (intToInt64# (word2Int# (word8ToWord# w#)))
+word16ToInt64 (W16# w#) = I64# (intToInt64# (word2Int# (word16ToWord# w#)))
+word32ToInt64 (W32# w#) = I64# (word64ToInt64# (wordToWord64# (word32ToWord# w#)))
+word64ToInt64 (W64# w#) =
+ case isTrue# (w# `ltWord64#` uncheckedShiftL64# (wordToWord64# 1##) 63#) of
+ True -> Just (I64# (word64ToInt64# w#))
+ False -> Nothing
+
+word8ToWord64 (W8# w#) = W64# (wordToWord64# (word8ToWord# w#))
+word16ToWord64 (W16# w#) = W64# (wordToWord64# (word16ToWord# w#))
+word32ToWord64 (W32# w#) = W64# (wordToWord64# (word32ToWord# w#))
+#else
word8ToInt64 (W8# w#) = I64# (intToInt64# (word2Int# w#))
word16ToInt64 (W16# w#) = I64# (intToInt64# (word2Int# w#))
word32ToInt64 (W32# w#) = I64# (word64ToInt64# (wordToWord64# w#))
@@ -541,6 +554,7 @@ word64ToInt64 (W64# w#) =
word8ToWord64 (W8# w#) = W64# (wordToWord64# w#)
word16ToWord64 (W16# w#) = W64# (wordToWord64# w#)
word32ToWord64 (W32# w#) = W64# (wordToWord64# w#)
+#endif
{-# INLINE word8ToInt64 #-}
{-# INLINE word16ToInt64 #-}
diff --git a/cborg/src/Codec/CBOR/Read.hs b/cborg/src/Codec/CBOR/Read.hs
index 6546575..c4dc761 100644
--- a/cborg/src/Codec/CBOR/Read.hs
+++ b/cborg/src/Codec/CBOR/Read.hs
@@ -63,7 +63,7 @@ import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import Data.Word
import GHC.Word
-#if defined(ARCH_32bit)
+#if defined(ARCH_32bit) && !MIN_VERSION_ghc_prim(0,8,0)
import GHC.IntWord64
#endif
import GHC.Exts
@@ -510,8 +510,8 @@ go_fast !bs da@(ConsumeNegWord64Canonical k) =
go_fast !bs da@(ConsumeInt64Canonical k) =
case tryConsumeInt64 (BS.unsafeHead bs) bs of
DecodeFailure -> go_fast_end bs da
- DecodedToken sz i@(I64# i#)
- | isInt64Canonical sz i -> k i# >>= go_fast (BS.unsafeDrop sz bs)
+ DecodedToken sz (I64# i#)
+ | isInt64Canonical sz i# -> k i# >>= go_fast (BS.unsafeDrop sz bs)
| otherwise -> go_fast_end bs da
go_fast !bs da@(ConsumeListLen64Canonical k) =
@@ -994,8 +994,8 @@ go_fast_end !bs (ConsumeNegWord64Canonical k) =
go_fast_end !bs (ConsumeInt64Canonical k) =
case tryConsumeInt64 (BS.unsafeHead bs) bs of
DecodeFailure -> return $! SlowFail bs "expected int64"
- DecodedToken sz i@(I64# i#)
- | isInt64Canonical sz i -> k i# >>= go_fast_end (BS.unsafeDrop sz bs)
+ DecodedToken sz (I64# i#)
+ | isInt64Canonical sz i# -> k i# >>= go_fast_end (BS.unsafeDrop sz bs)
| otherwise -> return $! SlowFail bs "non-canonical int64"
go_fast_end !bs (ConsumeListLen64Canonical k) =
@@ -1271,7 +1271,7 @@ go_slow da bs !offset = do
SlowPeekByteOffset bs' k ->
lift
-#if MIN_VERSION_base(4,17,0)
+#if MIN_VERSION_base(4,17,0) && !defined(ARCH_32bit)
(k (int64ToInt# off#))
#else
(k off#)
@@ -1381,7 +1381,7 @@ go_slow_overlapped da sz bs_cur bs_next !offset =
SlowPeekByteOffset bs_empty k ->
assert (BS.null bs_empty) $ do
lift
-#if MIN_VERSION_base(4,17,0)
+#if MIN_VERSION_base(4,17,0) && !defined(ARCH_32bit)
(k (int64ToInt# off#))
#else
(k off#)
@@ -1565,17 +1565,17 @@ isIntCanonical sz i
{-# INLINE isWord64Canonical #-}
isWord64Canonical :: Int -> Word64 -> Bool
isWord64Canonical sz w
- | sz == 2 = w > 0x17)
- | sz == 3 = w > 0xff)
- | sz == 5 = w > 0xffff)
- | sz == 9 = w > 0xffffffff)
+ | sz == 2 = w > 0x17
+ | sz == 3 = w > 0xff
+ | sz == 5 = w > 0xffff
+ | sz == 9 = w > 0xffffffff
| otherwise = True
{-# INLINE isInt64Canonical #-}
isInt64Canonical :: Int -> Int64# -> Bool
isInt64Canonical sz i#
- | isTrue# (i# `ltInt64#` intToInt64# 0#) = isWord64Canonical sz (not64# w#)
- | otherwise = isWord64Canonical sz w#
+ | isTrue# (i# `ltInt64#` intToInt64# 0#) = isWord64Canonical sz (W64# (not64# w#))
+ | otherwise = isWord64Canonical sz (W64# w#)
where
w# = int64ToWord64# i#
#endif
@@ -1796,7 +1796,7 @@ tryConsumeInteger hdr !bs = case word8ToWord hdr of
0x1b -> let !w = eatTailWord64 bs
sz = 9
#if defined(ARCH_32bit)
- in DecodedToken sz (BigIntToken (isWord64Canonical sz (word64ToWord w)) $! toInteger w)
+ in DecodedToken sz (BigIntToken (isWord64Canonical sz w) $! toInteger w)
#else
in DecodedToken sz (BigIntToken (isWordCanonical sz (word64ToWord w)) $! toInteger w)
#endif
@@ -1838,7 +1838,7 @@ tryConsumeInteger hdr !bs = case word8ToWord hdr of
0x3b -> let !w = eatTailWord64 bs
sz = 9
#if defined(ARCH_32bit)
- in DecodedToken sz (BigIntToken (isWord64Canonical sz (word64ToWord w)) $! (-1 - toInteger w))
+ in DecodedToken sz (BigIntToken (isWord64Canonical sz w) $! (-1 - toInteger w))
#else
in DecodedToken sz (BigIntToken (isWordCanonical sz (word64ToWord w)) $! (-1 - toInteger w))
#endif

View file

@ -1,8 +1,8 @@
# See https://github.com/lierdakil/pandoc-crossref/issues/342#issuecomment-1073256586
--- a/pandoc-crossref-0.3.17.0/pandoc-crossref.cabal 2001-09-08 22:46:40.000000000 -0300
+++ b/pandoc-crossref-0.3.17.0/pandoc-crossref.cabal 2024-03-26 17:16:02.918173738 -0300
@@ -127,20 +127,6 @@
--- a/pandoc-crossref-0.3.18.1/pandoc-crossref.cabal 2001-09-09 02:46:40.000000000 +0100
+++ a/pandoc-crossref-0.3.18.1/pandoc-crossref.cabal 2025-07-03 17:23:13.941135615 +0100
@@ -133,20 +133,6 @@
library
exposed-modules:
Text.Pandoc.CrossRef
@ -12,10 +12,10 @@
- build-depends:
- base >=4.11 && <5
- , mtl >=1.1 && <2.4
- , pandoc >=3.1.8 && <3.2
- , pandoc >=3.1.8 && <3.7
- , pandoc-crossref-internal
- , pandoc-types ==1.23.*
- , text >=1.2.2 && <2.1
- , text >=1.2.2 && <2.2
- default-language: Haskell2010
-
-library pandoc-crossref-internal
@ -23,21 +23,19 @@
Text.Numeral.Roman
Text.Pandoc.CrossRef.References
Text.Pandoc.CrossRef.References.Blocks
@@ -165,7 +151,9 @@
@@ -171,6 +157,7 @@
Text.Pandoc.CrossRef.Util.Template
Text.Pandoc.CrossRef.Util.Util
hs-source-dirs:
+ lib
lib-internal
+ ghc-options: -Wall
build-depends:
base >=4.11 && <5
, containers >=0.1 && <0.7
@@ -247,7 +235,6 @@
@@ -253,7 +240,6 @@
, mtl >=1.1 && <2.4
, pandoc >=3.1.8 && <3.2
, pandoc >=3.1.8 && <3.7
, pandoc-crossref
- , pandoc-crossref-internal
, pandoc-types ==1.23.*
, text >=1.2.2 && <2.1
if flag(enable_flaky_tests)
, text >=1.2.2 && <2.2
default-language: Haskell2010

View file

@ -0,0 +1,36 @@
From 2738929ce15b4c8704bbbac24a08539b5d4bf30e Mon Sep 17 00:00:00 2001
From: sternenseemann <sternenseemann@systemli.org>
Date: Mon, 14 Aug 2023 10:51:30 +0200
Subject: [PATCH] Data.Memory.Internal.CompatPrim64: fix 32 bit with GHC >= 9.4
Since 9.4, GHC.Prim exports Word64# operations like timesWord64# even on
i686 whereas GHC.IntWord64 no longer exists. Therefore, we can just use
the ready made solution.
Closes #98, as it should be the better solution.
---
Data/Memory/Internal/CompatPrim64.hs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Data/Memory/Internal/CompatPrim64.hs b/Data/Memory/Internal/CompatPrim64.hs
index b9eef8a..a134c88 100644
--- a/memory/Data/Memory/Internal/CompatPrim64.hs
+++ b/memory/Data/Memory/Internal/CompatPrim64.hs
@@ -150,6 +150,7 @@ w64# :: Word# -> Word# -> Word# -> Word64#
w64# w _ _ = w
#elif WORD_SIZE_IN_BITS == 32
+#if __GLASGOW_HASKELL__ < 904
import GHC.IntWord64
import GHC.Prim (Word#)
@@ -158,6 +159,9 @@ timesWord64# a b =
let !ai = word64ToInt64# a
!bi = word64ToInt64# b
in int64ToWord64# (timesInt64# ai bi)
+#else
+import GHC.Prim
+#endif
w64# :: Word# -> Word# -> Word# -> Word64#
w64# _ hw lw =

View file

@ -0,0 +1,11 @@
--- a/pandoc-3.6/pandoc.cabal
+++ b/pandoc-3.6/pandoc.cabal
@@ -866,7 +866,7 @@
main-is: benchmark-pandoc.hs
hs-source-dirs: benchmark
build-depends: bytestring,
- tasty-bench >= 0.2 && <= 0.4,
+ tasty-bench >= 0.2 && <= 0.4.1,
mtl >= 2.2 && < 2.4,
text >= 1.1.1.0 && < 2.2,
deepseq

View file

@ -1,16 +1,16 @@
# Template file for 'pandoc'
pkgname=pandoc
# Keep in sync with http://www.stackage.org/lts
version=3.1.11.1
version=3.6
revision=1
_sidenote_version=0.23.0.0
_crossref_version=0.3.17.0
_crossref_version=0.3.18.1
create_wrksrc=yes
build_style=haskell-stack
stackage="lts-22.13"
stackage="lts-23.26"
make_build_args="
--flag pandoc:embed_data_files
--flag=lua:pkg-config"
--flag lua:pkg-config"
hostmakedepends="pkg-config unzip wget"
makedepends="zlib-devel lua54-devel tar"
short_desc="Universal converter between markup formats"
@ -20,16 +20,29 @@ homepage="http://johnmacfarlane.net/pandoc/"
distfiles="https://hackage.haskell.org/package/pandoc-${version}/pandoc-${version}.tar.gz
https://hackage.haskell.org/package/pandoc-cli-${version}/pandoc-cli-${version}.tar.gz
https://hackage.haskell.org/package/pandoc-sidenote-${_sidenote_version}/pandoc-sidenote-${_sidenote_version}.tar.gz
https://hackage.haskell.org/package/pandoc-crossref-${_crossref_version}/pandoc-crossref-${_crossref_version}.tar.gz"
checksum="ef968d654000e5b21943573039fee92b132b547790fb1471f363abeb09dbcf79
b7c8200012e22059410c70c1dab522eed151ca276c0a0d50c825c06df8d0c249
https://hackage.haskell.org/package/pandoc-crossref-${_crossref_version}/pandoc-crossref-${_crossref_version}.tar.gz
https://hackage.haskell.org/package/basement-0.0.16/basement-0.0.16.tar.gz
https://hackage.haskell.org/package/memory-0.18.0/memory-0.18.0.tar.gz
https://hackage.haskell.org/package/cborg-0.2.10.0/cborg-0.2.10.0.tar.gz"
checksum="da963bfd49852fd1364604f616f71168fd4558606f265159bf1f42da1f97f9b8
07dccd028aff2e5d8c4e4a970a9d0ec33ee941d574e3b84e29af249a81a83833
2722ca9cf7bed62658f669a3ec2026de0e0e80941b499a25e660adcf977eec2d
8eb1fab686654cbbb7d2aa651d08b194a9634c3645df1d8d081a7e463db76f9a"
e4353c29af9db8c2b898254c5146aa922c221d9b2ec2becbbc9e58294fbbfaaf
7fb77e249aef76ba5aed3059d556800ce02b614597c488ba01f0a16449146300
fd4eb6f638e24b81b4e6cdd68772a531726f2f67686c8969d3407d82f7862e3e
17fe070c38fc498cab49bcb9d6215b7747d53bedf96502e9bcce9cad73b9c797"
nocross=yes
nopie_files="
/usr/bin/pandoc
/usr/bin/pandoc-sidenote
/usr/bin/pandoc-crossref"
skip_extraction="basement-0.0.16.tar.gz memory-0.18.0.tar.gz cborg-0.2.10.0.tar.gz"
post_extract() {
vsrcextract -C basement basement-0.0.16.tar.gz
vsrcextract -C memory memory-0.18.0.tar.gz
vsrcextract -C cborg cborg-0.2.10.0.tar.gz
}
post_install() {
vman pandoc-cli-${version}/man/pandoc.1