This commit is contained in:
Murray 2025-07-29 09:14:19 +01:00 committed by GitHub
commit da7c33ebe3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
87 changed files with 5653 additions and 1333 deletions

View file

@ -1138,6 +1138,10 @@ for compiling cargo -sys crates.
It also adds a `cargo` wrapper that detects and passes builds through `cargo-auditable`.
This helper is added by default for packages that use the `cargo` build style.
- `haskell` specifies environment variables for cabal.
This helper is added by default for packages that use the `haskell-stack` or
`cabal` build style.
<a id="functions"></a>
### Functions
@ -1698,21 +1702,45 @@ The path to the package's source inside `$GOPATH` is available as
<a id="pkgs_haskell"></a>
#### Haskell packages
We build Haskell package using `stack` from
[Stackage](http://www.stackage.org/), generally the LTS versions.
Haskell templates need to have host dependencies on `ghc` and `stack`,
and set build style to `haskell-stack`.
Haskell packages can be built either with the `cabal` or `haskell-stack`
build style, use whichever is more convenient or better supported by upstream,
sometimes only one of the two is possible. For packages that have haskell
parts but use a different build style like `gnu-makefile`, make sure to use
the `haskell` build helper.
The following variables influence how Haskell packages are built:
The following variables influence how packages are built with cabal:
- `cabal_index_state`: The state of the hackage cabal index to use for
fetching dependencies. The source package of a haskell project should
come with a freeze file that sets the index state, some also set it in
their cabal project file. If it does not, then this has to be set to an ISO
timestamp in the package template. For example `2025-07-05T14:01:16Z`.
- `configure_args`: Arguments passed to `cabal configure`. The configure step
generates the `cabal.project.local` file.
- `make_build_args`: Arguments passed to `cabal build`.
- `make_build_target`: Target passed to `cabal build`.
- `make_check_args`: Arguments passed to `cabal test`.
- `make_check_target`: Test target passed to cabal instead of "test".
- `make_install_target`: Target passed to `cabal install`.
And these variables influence how packages are built with stack:
- `stackage`: The Stackage version used to build the package, e.g.
`lts-3.5`. Alternatively:
- You can prepare a `stack.yaml` configuration for the project and put it
into `files/stack.yaml`.
- If a `stack.yaml` file is present in the source files, it will be used
- If a `stack.yaml` file is present in the source files, it will be used.
- `make_build_args`: This is passed as-is to `stack build ...`, so
you can add your `--flag ...` parameters there.
To patch dependencies of haskell packages they have to be fetched explicitly
from hackage by adding them to `distfiles` instead of letting cabal or stack
download them. Once extracted and patched, the path to the patched version
can be added to `packages` in `cabal.project` or `stack.yaml`.
Stack will find them automatically if no `stack.yaml` file exists by scanning
the directory. The build tool will then use the patched version of the
depencency instead of downloading it from hackage.
<a id="pkgs_font"></a>
#### Font packages

View file

@ -0,0 +1 @@
export CABAL_DIR=/home/cabal

View file

@ -0,0 +1,66 @@
#
# This helper is for building haskell projects using Cabal.
#
do_configure() {
: ${cabal_cmd:=cabal}
local _cabal_project_file="cabal.project"
if [ -e "${FILESDIR}/${_cabal_project_file}.freeze" ]; then
cp "${FILESDIR}/${_cabal_project_file}.freeze" .
fi
if [ -n "${cabal_index_state}" ]; then
# index-state alone is enough to fully fix a cabal build
configure_args+=" --index-state=${cabal_index_state}"
elif [ -e "${_cabal_project_file}.freeze" ]; then
# With a freeze file we have to make sure that it fixes
# the index also
if ! grep -q '^index-state:' "${_cabal_project_file}.freeze"; then
msg_error "${_cabal_project_file}.freeze is missing index-state\n"
fi
elif [ -e "${_cabal_project_file}" ]; then
if ! grep -q '^index-state:' "${_cabal_project_file}"; then
msg_error "${_cabal_project_file} is missing index-state\n"
fi
else
msg_error "cabal build not fixed, set cabal_index_state or add a freeze file to FILESDIR\n"
fi
${cabal_cmd} update
${cabal_cmd} configure --prefix=/usr ${configure_args}
}
do_build() {
: ${make_cmd:=cabal}
if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
make_build_args+=" --ghc-option=-latomic"
fi
${make_cmd} build ${make_build_target} ${makejobs} ${make_build_args}
}
do_check() {
: ${make_cmd:=cabal}
: ${make_check_target:=test}
${make_check_pre} ${make_cmd} ${make_check_target} ${make_check_args}
}
do_install() {
: ${make_cmd:=cabal}
: ${make_install_target:=all}
if ${make_cmd} list-bin ${make_install_target} >/dev/null 2>&1; then
vbin $(${make_cmd} list-bin ${make_install_target})
else
for name in $(${make_cmd} list-bin ${make_install_target} 2>&1 | tr -d '\n ' | grep -Eo "theexecutable'[^']+'" | tr "'" ' ' | awk '{ print $2 }'); do
local _bin=$(${make_cmd} list-bin exe:$name)
if [ -s "$_bin" ]; then
vbin "$_bin"
fi
done
fi
}

View file

@ -0,0 +1,2 @@
hostmakedepends+=" cabal-install git"
build_helper+=" haskell"

View file

@ -1 +1,2 @@
hostmakedepends+=" ghc stack"
build_helper+=" haskell"

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,427 @@
{
"builtin": [
{
"package": "rts",
"version": "1.0.2"
},
{
"package": "ghc-prim",
"version": "0.11.0"
},
{
"package": "ghc-bignum",
"version": "1.3"
},
{
"package": "base",
"version": "4.19.2.0"
},
{
"package": "array",
"version": "0.5.8.0"
},
{
"package": "deepseq",
"version": "1.5.1.0"
},
{
"package": "ghc-boot-th",
"version": "9.8.4"
},
{
"package": "pretty",
"version": "1.1.3.6"
},
{
"package": "template-haskell",
"version": "2.21.0.0"
},
{
"package": "bytestring",
"version": "0.12.1.0"
},
{
"package": "containers",
"version": "0.6.8"
},
{
"package": "binary",
"version": "0.8.9.1"
},
{
"package": "transformers",
"version": "0.6.1.0"
},
{
"package": "mtl",
"version": "2.3.1"
},
{
"package": "stm",
"version": "2.5.3.1"
},
{
"package": "exceptions",
"version": "0.10.7"
},
{
"package": "filepath",
"version": "1.4.301.0"
},
{
"package": "time",
"version": "1.12.2"
},
{
"package": "unix",
"version": "2.8.6.0"
},
{
"package": "directory",
"version": "1.3.8.5"
},
{
"package": "text",
"version": "2.1.1"
},
{
"package": "parsec",
"version": "3.1.17.0"
},
{
"package": "process",
"version": "1.6.25.0"
}
],
"dependencies": [
{
"cabal_sha256": null,
"flags": [],
"package": "Cabal-syntax",
"revision": null,
"source": "local",
"src_sha256": null,
"version": "3.10.3.0"
},
{
"cabal_sha256": null,
"flags": [],
"package": "Cabal",
"revision": null,
"source": "local",
"src_sha256": null,
"version": "3.10.3.0"
},
{
"cabal_sha256": "e3a1ec8b8dd32f1d5a541679a67de60d6626487a95f20c6bc245268ae7142ab7",
"flags": [
"-devel"
],
"package": "network",
"revision": 0,
"source": "hackage",
"src_sha256": "68548e660632a3c09b230c33fe08cc880273372b485e65cbe7a717936de9728b",
"version": "3.2.7.0"
},
{
"cabal_sha256": "e83d97946f84fe492762ceb3b4753b4770c78b0b70e594078700baa91a5106c2",
"flags": [],
"package": "th-compat",
"revision": 0,
"source": "hackage",
"src_sha256": "b781a0c059872bc95406d00e98f6fa7d9e81e744730f75186583cb4dcea0a4eb",
"version": "0.1.6"
},
{
"cabal_sha256": "6fffb57373962b5651a2db8b0af732098b3bf029a7ced76a9855615de2026588",
"flags": [],
"package": "network-uri",
"revision": 1,
"source": "hackage",
"src_sha256": "9c188973126e893250b881f20e8811dca06c223c23402b06f7a1f2e995797228",
"version": "2.6.4.2"
},
{
"cabal_sha256": "75ada03bd2d2b747319e38877a55bf8be529db4520a07d4e5ffbd24c5e850dcb",
"flags": [
"-conduit10",
"+network-uri",
"-warn-as-error",
"-warp-tests"
],
"package": "HTTP",
"revision": 5,
"source": "hackage",
"src_sha256": "df31d8efec775124dab856d7177ddcba31be9f9e0836ebdab03d94392f2dd453",
"version": "4000.4.1"
},
{
"cabal_sha256": "2efc549644dd418bad537d1601fdd437c440d807265016bd993b6996c679ad2f",
"flags": [],
"package": "os-string",
"revision": 0,
"source": "hackage",
"src_sha256": "339c35fd3a290522f23de4e33528423cfd0b0a8f22946b0b9816a817b926cba0",
"version": "2.0.7"
},
{
"cabal_sha256": "573f3ab242f75465a0d67ce9d84202650a1606575e6dbd6d31ffcf4767a9a379",
"flags": [
"-arch-native",
"+integer-gmp",
"-random-initial-seed"
],
"package": "hashable",
"revision": 0,
"source": "hackage",
"src_sha256": "3baee4c9027a08830d148ec524cbc0471de645e1e8426d46780ef2758df0e8da",
"version": "1.4.7.0"
},
{
"cabal_sha256": "b7648c6165729a973d95cb328f9fd874813a81c727707e8b2552b4f03399763b",
"flags": [
"-bench"
],
"package": "async",
"revision": 3,
"source": "hackage",
"src_sha256": "1818473ebab9212afad2ed76297aefde5fae8b5d4404daf36939aece6a8f16f7",
"version": "2.2.5"
},
{
"cabal_sha256": "81a105aed2ee2f5e479448e44252b24cdfacf81a5a2106aabdd217bad94b6f40",
"flags": [
"-dev",
"-no-cmm"
],
"package": "atomic-counter",
"revision": 0,
"source": "hackage",
"src_sha256": "ce4b63391b3c0d426cbe32af89f483222602a5b43aa5379aa720bf6f45f4cf04",
"version": "0.1.2.3"
},
{
"cabal_sha256": "a694e88f9ec9fc79f0b03f233d3fea592b68f70a34aac2ddb5bcaecb6562e2fd",
"flags": [],
"package": "base16-bytestring",
"revision": 1,
"source": "hackage",
"src_sha256": "1d5a91143ef0e22157536093ec8e59d226a68220ec89378d5dcaeea86472c784",
"version": "1.0.2.0"
},
{
"cabal_sha256": "45305ccf8914c66d385b518721472c7b8c858f1986945377f74f85c1e0d49803",
"flags": [],
"package": "base64-bytestring",
"revision": 1,
"source": "hackage",
"src_sha256": "fbf8ed30edde271eb605352021431d8f1b055f95a56af31fe2eacf6bdfdc49c9",
"version": "1.2.1.0"
},
{
"cabal_sha256": "8f92088f1c51c8d4569279a07565f8aa6b534a6735615b2295d2961dec8f1783",
"flags": [
"-optimised-mixer"
],
"package": "splitmix",
"revision": 0,
"source": "hackage",
"src_sha256": "d678c41a603a62032cf7e5f8336bb8222c93990e4b59c8b291b7ca26c7eb12c7",
"version": "0.1.1"
},
{
"cabal_sha256": "117541ba0a177397a3333f94870f789ef050dca31b0688a19824b2bc401b8823",
"flags": [],
"package": "random",
"revision": 0,
"source": "hackage",
"src_sha256": "e9c81926a7d1e40328f645f73592b31efc9c631589669a7f130687b9cc3051dc",
"version": "1.2.1.3"
},
{
"cabal_sha256": "4d33a49cd383d50af090f1b888642d10116e43809f9da6023d9fc6f67d2656ee",
"flags": [],
"package": "edit-distance",
"revision": 1,
"source": "hackage",
"src_sha256": "3e8885ee2f56ad4da940f043ae8f981ee2fe336b5e8e4ba3f7436cff4f526c4a",
"version": "0.2.2.1"
},
{
"cabal_sha256": null,
"flags": [
"-debug-conflict-sets",
"-debug-expensive-assertions",
"-debug-tracetree"
],
"package": "cabal-install-solver",
"revision": null,
"source": "local",
"src_sha256": null,
"version": "3.10.3.0"
},
{
"cabal_sha256": "0e9de2ccce261e7a5b027e842f6f47f50eb0e6059a0de98a5479f75aa8164107",
"flags": [
"-exe",
"+use-cbits"
],
"package": "cryptohash-sha256",
"revision": 6,
"source": "hackage",
"src_sha256": "73a7dc7163871a80837495039a099967b11f5c4fe70a118277842f7a713c6bf6",
"version": "0.11.102.1"
},
{
"cabal_sha256": "ccce771562c49a2b29a52046ca68c62179e97e8fbeacdae32ca84a85445e8f42",
"flags": [
"-example"
],
"package": "echo",
"revision": 0,
"source": "hackage",
"src_sha256": "c9fe1bf2904825a65b667251ec644f197b71dc5c209d2d254be5de3d496b0e43",
"version": "0.1.4"
},
{
"cabal_sha256": "f1550ddbe3b53f1087a035667364011460896cc2b1ff328b521c05ed5973bb78",
"flags": [
"+no-donna",
"+test-doctests",
"+test-hlint",
"+test-properties"
],
"package": "ed25519",
"revision": 9,
"source": "hackage",
"src_sha256": "d8a5958ebfa9309790efade64275dc5c441b568645c45ceed1b0c6ff36d6156d",
"version": "0.0.5.0"
},
{
"cabal_sha256": "8334a8d810e385e1dc1423dc02945daaa1f1a9ba058e5227f1a3211e4882ca28",
"flags": [
"+ofd-locking"
],
"package": "lukko",
"revision": 1,
"source": "hackage",
"src_sha256": "72d86f8aa625b461f4397f737346f78a1700a7ffbff55cf6375c5e18916e986d",
"version": "0.1.2"
},
{
"cabal_sha256": "8931b9ce6e63bf6202dc0c992ae3e6f2ad8e7f4b6eb69994ac6d512c6c9c0f77",
"flags": [
"-os-string"
],
"package": "directory-ospath-streaming",
"revision": 0,
"source": "hackage",
"src_sha256": "1ade8fbee13db15e8d22a1ecdca54794617cabc69911b51d46a65e12f4554ef7",
"version": "0.2.2"
},
{
"cabal_sha256": "1d68a81fa684d006b1ec73836cebe3de9a54688836915fe3e56a20389846bb4e",
"flags": [
"-os-string"
],
"package": "file-io",
"revision": 0,
"source": "hackage",
"src_sha256": "310a19e4c792de4d30c912bc71ff3becb40818d7c796b9999bcd0979dab87d5b",
"version": "0.1.5"
},
{
"cabal_sha256": "a72549370449fe99e3008744ad2e43685e96bf86aa0db15898189fcbaafcd815",
"flags": [],
"package": "tar",
"revision": 1,
"source": "hackage",
"src_sha256": "7949a50004a80993000512079bc03ebcad4872414fc181f45b3883d743c0f3aa",
"version": "0.6.4.0"
},
{
"cabal_sha256": "a72549370449fe99e3008744ad2e43685e96bf86aa0db15898189fcbaafcd815",
"flags": [],
"package": "tar",
"revision": 1,
"source": "hackage",
"src_sha256": "7949a50004a80993000512079bc03ebcad4872414fc181f45b3883d743c0f3aa",
"version": "0.6.4.0"
},
{
"cabal_sha256": "85e64a75c0b490506a7edaa2d54950c668e66b65758bb08bb14cd31faf53a206",
"flags": [
"-bundled-c-zlib",
"+non-blocking-ffi",
"-pkg-config"
],
"package": "zlib",
"revision": 2,
"source": "hackage",
"src_sha256": "6edd38b6b81df8d274952aa85affa6968ae86b2231e1d429ce8bc9083e6a55bc",
"version": "0.7.1.0"
},
{
"cabal_sha256": "f85f6f1ef55d1f91795f2c7c476db36fd7aedb55c877d47f2a4411f0151040a9",
"flags": [
"+cabal-syntax",
"+lukko"
],
"package": "hackage-security",
"revision": 5,
"source": "hackage",
"src_sha256": "2e4261576b3e11b9f5175392947f56a638cc1a3584b8acbb962b809d7c69db69",
"version": "0.6.2.6"
},
{
"cabal_sha256": "d6c0c6d1136f5046207a331114ff4130e70640452096de7719bf03e3fceb7c7b",
"flags": [],
"package": "regex-base",
"revision": 0,
"source": "hackage",
"src_sha256": "e8ca2dee598c790dd1c1c4359bdd1e495d9b881f5aa1f539c22f0dd5563747bf",
"version": "0.94.0.3"
},
{
"cabal_sha256": "faf170ca5073e8d538a7a18f727a02a96f2a36c5fd53a1696263a70ab81bc6fe",
"flags": [
"-_regex-posix-clib"
],
"package": "regex-posix",
"revision": 0,
"source": "hackage",
"src_sha256": "7e570460c35c5deec54d1ba46305ddb4679c7d4aae84f631dd0c61daaeaa8150",
"version": "0.96.0.2"
},
{
"cabal_sha256": "58a8c6f17dece62891e7534c6f033e1fb1d0685e68dbe5d4fbb71256d45c6132",
"flags": [],
"package": "resolv",
"revision": 5,
"source": "hackage",
"src_sha256": "880d283df9132a7375fa28670f71e86480a4f49972256dc2a204c648274ae74b",
"version": "0.2.0.2"
},
{
"cabal_sha256": "8bb7261bd54bd58acfcb154be6a161fb6d0d31a1852aadc8e927d2ad2d7651d1",
"flags": [],
"package": "safe-exceptions",
"revision": 1,
"source": "hackage",
"src_sha256": "3c51d8d50c9b60ff8bf94f942fd92e3bea9e62c5afa778dfc9f707b79da41ef6",
"version": "0.1.7.4"
},
{
"cabal_sha256": null,
"flags": [
"+lukko",
"+native-dns"
],
"package": "cabal-install",
"revision": null,
"source": "local",
"src_sha256": null,
"version": "3.10.3.0"
}
]
}

View file

@ -1,34 +1,50 @@
# Template file for 'cabal-install'
pkgname=cabal-install
version=3.6.3.0
revision=2
hostmakedepends="ghc curl tar which"
makedepends="gmp-devel libffi-devel zlib-devel python3"
version=3.10.3.0
revision=1
build_helper="haskell"
hostmakedepends="python3 ghc curl tar"
makedepends="zlib-devel"
depends="ghc"
short_desc="Command-line interface for Cabal and Hackage"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://hackage.haskell.org/package/cabal-install"
distfiles="https://github.com/haskell/cabal/archive/Cabal-v${version}.tar.gz"
checksum=dea086acad6d9fe5fe22d838b95b4e988022e8519f38d41609119ea32bfb7466
homepage="https://www.haskell.org/cabal/"
distfiles="https://github.com/haskell/cabal/archive/refs/tags/cabal-install-v${version}.tar.gz"
checksum=075fba81fca61f6957dae3a542a3213415682dd9767f6ccdf3f9059f2cd0f156
nopie_files="/usr/bin/cabal"
nocross=yes
# Keep in sync with ghc
_ghc_ver=9.8.4
post_extract() {
cp "${FILESDIR}/linux-9.0.2.json" bootstrap/
if [ -e ${FILESDIR}/linux-${_ghc_ver}.json ]; then
cp "${FILESDIR}/linux-${_ghc_ver}.json" bootstrap/
fi
}
post_patch() {
case "${XBPS_TARGET_MACHINE}" in
i686*)
# https://github.com/haskell/cabal/issues/7313
vsed -i -e 's/+ofd-locking/-ofd-locking/' bootstrap/linux-9.0.2.json ;;
esac
pre_build() {
if [ -e bootstrap/linux-${_ghc_ver}.json ]; then
if [ "$XBPS_TARGET_WORDSIZE" = 32 ]; then
# https://github.com/haskell/cabal/issues/7313
sed -i 's/+ofd-locking/-ofd-locking/g' bootstrap/linux-${_ghc_ver}.json
fi
else
# To generate a bootstrap plan for a new ghc version ensure a
# cabal binary is available, run this, then move the plan to
# FILESDIR
cabal update
make bootstrap-json-${_ghc_ver}
msg_normal "Please install bootstrap/linux-${_ghc_ver}.json in ${FILESDIR}\n"
exit 1
fi
}
do_build() {
PREFIX=$PWD bootstrap/bootstrap.py -d bootstrap/linux-9.0.2.json
PREFIX=$PWD bootstrap/bootstrap.py -d bootstrap/linux-${_ghc_ver}.json
}
do_install() {
vbin _build/bin/cabal
PREFIX=$PWD _build/bin/cabal man --raw > cabal.1

View file

@ -1,15 +1,16 @@
# Template file for 'cgrep'
pkgname=cgrep
version=7.0.0
version=8.1.2
revision=1
build_style=haskell-stack
stackage="lts-23.26"
makedepends="pcre-devel pkg-config"
short_desc="Context-aware grep for source codes"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="https://awgn.github.io/cgrep/"
distfiles="https://github.com/awgn/cgrep/archive/v${version}.tar.gz"
checksum=87c596447882b3acf0a754ac52ac1b5314961e652708a25ffc49ec5977b1f11a
checksum=1b705013a432e6ea90247f03e4cfeceb5a37f795d879178e4bf0085ce6191316
nocross=yes
nopie_files="/usr/bin/cgrep"
conflicts="codesearch"

View file

@ -1,4 +0,0 @@
resolver: lts-19.0
packages:
- .
allow-newer: true

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

@ -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

@ -1,18 +1,32 @@
# Template file for 'darcs'
pkgname=darcs
version=2.16.5
revision=3
version=2.18.5
revision=1
build_style=haskell-stack
hostmakedepends="unzip"
stackage="lts-23.26"
hostmakedepends="pkg-config unzip"
makedepends="zlib-devel libcurl-devel ncurses-devel"
short_desc="Change-focused cross-platform version control system"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="http://darcs.net/"
distfiles="http://hackage.haskell.org/package/${pkgname}-${version}/${pkgname}-${version}.tar.gz"
checksum=d63c6cd236e31e812e8ad84433d27059387606269fbd953f4c349c3cb3aa242b
distfiles="http://hackage.haskell.org/package/${pkgname}-${version}/${pkgname}-${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="e310692989e313191824f532a26c5eae712217444214266503d5eb5867f951ab
7fb77e249aef76ba5aed3059d556800ce02b614597c488ba01f0a16449146300
fd4eb6f638e24b81b4e6cdd68772a531726f2f67686c8969d3407d82f7862e3e
17fe070c38fc498cab49bcb9d6215b7747d53bedf96502e9bcce9cad73b9c797"
nopie_files="/usr/bin/darcs"
nocross=yes
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() {
vinstall contrib/darcs_completion 644 usr/share/bash-completion/completions

View file

@ -1,6 +0,0 @@
packages:
- '.'
resolver: lts-19.0
extra-deps:
- posix-pty-0.2.1.1
- sandi-0.5@sha256:b278d072ca717706ea38f9bd646e023f7f2576a778fb43565b434f93638849aa,3010

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,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

@ -0,0 +1,20 @@
--- a/debug-me.cabal 2025-07-05 13:11:54.095974453 +0100
+++ b/debug-me.cabal 2025-07-05 13:11:59.253974699 +0100
@@ -55,7 +55,7 @@
Build-Depends:
base (>= 4.9 && < 5.0)
, network (>= 2.6)
- , bytestring < 0.12
+ , bytestring < 0.13
, cryptonite (>= 0.20)
, unix (>= 2.7)
, process (>= 1.4)
@@ -64,7 +64,7 @@
, stm-chans (>= 3.0)
, posix-pty (>= 0.2.1)
, terminal-size (>= 0.3)
- , aeson (>= 0.11 && < 2.1)
+ , aeson (>= 0.11 && < 2.3)
, sandi (>= 0.4)
, text (>= 1.2.2)
, optparse-applicative (>= 0.12)

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

@ -1,19 +1,43 @@
# Template file for 'debug-me'
pkgname=debug-me
version=1.20220324
version=1.20221231
revision=1
build_style=haskell-stack
stackage="lts-19.0"
build_style=cabal
cabal_index_state=2025-07-05T11:40:57Z
makedepends="zlib-devel"
short_desc="Secure remote debugging"
maintainer="Orphaned <orphan@voidlinux.org>"
license="AGPL-3.0-or-later"
homepage="https://debug-me.branchable.com/"
distfiles="https://git.joeyh.name/index.cgi/${pkgname}.git/snapshot/${pkgname}-${version}.tar.gz"
checksum=9fd6256aa34408106ff095e0560850aca3558a774be4ce19de6ab6e81fbfdb9f
distfiles="https://git.joeyh.name/index.cgi/${pkgname}.git/snapshot/${pkgname}-${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="c16b63a99d9cb177f28318e4598debaf974eda791da37fc66e13780959356373
7fb77e249aef76ba5aed3059d556800ce02b614597c488ba01f0a16449146300
fd4eb6f638e24b81b4e6cdd68772a531726f2f67686c8969d3407d82f7862e3e
17fe070c38fc498cab49bcb9d6215b7747d53bedf96502e9bcce9cad73b9c797"
nocross=yes # Can't yet cross compile Haskell
nopie_files="/usr/bin/debug-me"
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_configure() {
# Fix build on i686 by using patched basement, memory and cborg packages
echo 'packages: ./basement ./memory ./cborg' >> cabal.project.local
# Fix build on musl by pretending to be glibc,
# otherwise it thinks we're freebsd
echo 'package posix-pty' >> cabal.project.local
echo ' ghc-options: -optc=-D__GLIBC__' >> cabal.project.local
}
post_install() {
vman debug-me.1
vlicense AGPL
}

View file

@ -1,53 +1,35 @@
# Template file for 'ghc-bin'
pkgname=ghc-bin
version=9.0.2
version=9.8.4
revision=1
archs="i686 x86_64* ppc64le* ppc64 aarch64*"
hostmakedepends="perl libffi libnuma"
depends="ncurses perl gcc libffi-devel gmp-devel"
short_desc="Glorious Haskell Compiler - precompiled binaries"
archs="i686 x86_64* aarch64*"
hostmakedepends="patchelf"
depends="gcc libffi-devel gmp-devel"
short_desc="Glasgow Haskell Compiler - precompiled binaries"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-3-Clause"
homepage="http://www.haskell.org/ghc/"
nocross=yes
nostrip=yes
noshlibprovides=yes
conflicts="ghc>=0 ghc-doc>=0"
conflicts="ghc>=0 ghc-doc>=0 ghc-devel>=0"
case "$XBPS_TARGET_MACHINE" in
x86_64)
distfiles="https://downloads.haskell.org/ghc/${version%[!0-9]}/ghc-${version}-x86_64-deb9-linux.tar.xz"
checksum=805f5628ce6cec678ba77ff48c924831ebdf75ec2c66368e8935a618913a150e
;;
x86_64-musl)
# create with "make binary-dist"
distfiles="https://repo-default.voidlinux.org/distfiles/ghc-${version}-x86_64-void-linux-musl.tar.xz"
checksum=e21eaddeffcd5de7abe43b1f3982a3bc2c5b5f408d2574857cb2b0368106e12c
x86_64*)
distfiles="https://downloads.haskell.org/ghc/${version}/ghc-${version}-x86_64-alpine3_12-linux-static.tar.xz"
checksum=02535eaef4f57aef8b7b272ef6f48d386d186ebd07fa47e227b46b93fa7eb0ab
;;
i686)
distfiles="https://downloads.haskell.org/ghc/${version%[!0-9]}/ghc-${version}-i386-deb9-linux.tar.xz"
checksum=fdeb9f8928fbe994064778a8e1e85bb1a58a6cd3dd7b724fcc2a1dcfda6cad47
;;
ppc64le)
distfiles="https://repo-default.voidlinux.org/distfiles/ghc-${version}-powerpc64le-void-linux.tar.xz"
checksum=7de8114c991f9a2a3b0f5e472da76e3956be6447efec4b1157f14e707049f22d
;;
ppc64le-musl)
distfiles="https://repo-default.voidlinux.org/distfiles/ghc-${version}-powerpc64le-void-linux-musl.tar.xz"
checksum=37de8e069712307c9b2039e92f56e540e80ca1390dd27aa247ebe18c40e0c629
;;
ppc64)
distfiles="https://repo-default.voidlinux.org/distfiles/ghc-${version}-powerpc64-void-linux.tar.xz"
checksum=6eb8684fdbede0cded7e3f7b93574b968f5f66dd2fcd4ec30ac5f0c402af6602
distfiles="https://downloads.haskell.org/ghc/${version}/ghc-${version}-i386-deb10-linux.tar.xz"
checksum=e5efce16c654d5e702986258a87dd9531e1722b8051823c8ce1150ce3c5899ae
;;
aarch64)
distfiles="https://repo-default.voidlinux.org/distfiles/ghc-${version}-aarch64-void-linux.tar.xz"
checksum=44a20a896246dce64392b7d0feedd0a28a9d733245a803e95dbe4b4b7e15b4fd
depends+=" llvm"
distfiles="https://downloads.haskell.org/ghc/${version}/ghc-${version}-aarch64-deb11-linux.tar.xz"
checksum=310204daf2df6ad16087be94b3498ca414a0953b29e94e8ec8eb4a5c9bf603d3
;;
aarch64-musl)
distfiles="https://repo-default.voidlinux.org/distfiles/ghc-${version}-aarch64-void-linux-musl.tar.xz"
checksum=de98e2ff33a25cb32a28c738066fecacb736a33cac12688876eec4eb96d88607
depends+=" llvm"
distfiles="https://downloads.haskell.org/ghc/${version}/ghc-${version}-aarch64-alpine3_18-linux.tar.xz"
checksum=b5c86a0cda0bd62d5eeeb52b1937c3bd00c70cd67dd74226ce787d5c429a4e62
;;
*)
broken="No distfiles available for this target"
@ -59,13 +41,15 @@ do_configure() {
}
do_install() {
ln -sf /usr/lib/libncursesw.so.6 libtinfo.so.5
export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH
make install DESTDIR="$DESTDIR"
# Fake libtinfo into rpath of ghc:
ln -sf /usr/lib/libncursesw.so.6 \
$DESTDIR/usr/lib/ghc-${version%[!0-9]}/rts/libtinfo.so.5
vlicense LICENSE
# quiet lint: vlicense not needed, installed by make
}
post_install() {
if [ "$XBPS_TARGET_MACHINE" = "aarch64-musl" ]; then
for _cur_binary in $(find ${DESTDIR} -type f -exec file {} \; |grep ELF |grep -v static |cut -d ':' -f 1); do
patchelf --replace-needed libc.musl-aarch64.so.1 libc.so $_cur_binary
done
fi
}

1
srcpkgs/ghc-devel Symbolic link
View file

@ -0,0 +1 @@
ghc

View file

@ -0,0 +1,288 @@
{
"builtin": [
{
"package": "rts",
"version": "1.0.2"
},
{
"package": "ghc-prim",
"version": "0.11.0"
},
{
"package": "ghc-bignum",
"version": "1.3"
},
{
"package": "base",
"version": "4.19.2.0"
},
{
"package": "array",
"version": "0.5.8.0"
},
{
"package": "deepseq",
"version": "1.5.1.0"
},
{
"package": "ghc-boot-th",
"version": "9.8.4"
},
{
"package": "pretty",
"version": "1.1.3.6"
},
{
"package": "template-haskell",
"version": "2.21.0.0"
},
{
"package": "bytestring",
"version": "0.12.1.0"
},
{
"package": "containers",
"version": "0.6.8"
},
{
"package": "binary",
"version": "0.8.9.1"
},
{
"package": "transformers",
"version": "0.6.1.0"
},
{
"package": "mtl",
"version": "2.3.1"
},
{
"package": "stm",
"version": "2.5.3.1"
},
{
"package": "exceptions",
"version": "0.10.7"
},
{
"package": "filepath",
"version": "1.4.301.0"
},
{
"package": "time",
"version": "1.12.2"
},
{
"package": "unix",
"version": "2.8.6.0"
},
{
"package": "directory",
"version": "1.3.8.5"
},
{
"package": "text",
"version": "2.1.1"
},
{
"package": "parsec",
"version": "3.1.17.0"
},
{
"package": "Cabal-syntax",
"version": "3.10.3.0"
},
{
"package": "process",
"version": "1.6.25.0"
},
{
"package": "Cabal",
"version": "3.10.3.0"
}
],
"dependencies": [
{
"cabal_sha256": "a694e88f9ec9fc79f0b03f233d3fea592b68f70a34aac2ddb5bcaecb6562e2fd",
"flags": [],
"package": "base16-bytestring",
"revision": 1,
"source": "hackage",
"src_sha256": "1d5a91143ef0e22157536093ec8e59d226a68220ec89378d5dcaeea86472c784",
"version": "1.0.2.0"
},
{
"cabal_sha256": "b938655b00cf204ce69abfff946021bed111d2609a9f7a9c22e28a1a202e9115",
"flags": [
"-llvm"
],
"package": "clock",
"revision": 0,
"source": "hackage",
"src_sha256": "6ae9898afe788a5e334cd5fad5d18a3c2e8e59fa09aaf7b957dbb38a4767df2e",
"version": "0.8.4"
},
{
"cabal_sha256": "0e9de2ccce261e7a5b027e842f6f47f50eb0e6059a0de98a5479f75aa8164107",
"flags": [
"-exe",
"+use-cbits"
],
"package": "cryptohash-sha256",
"revision": 6,
"source": "hackage",
"src_sha256": "73a7dc7163871a80837495039a099967b11f5c4fe70a118277842f7a713c6bf6",
"version": "0.11.102.1"
},
{
"cabal_sha256": "57d9200fbea2e88e05e0be35925511764827b1c86d3214106b0b610f331fc40c",
"flags": [],
"package": "extra",
"revision": 0,
"source": "hackage",
"src_sha256": "2fa4ce5eae50560bba80f1883913cf2ed52b3d87fd290dae27d838c94f5389a1",
"version": "1.8"
},
{
"cabal_sha256": "372c1733d83b90045eb29da9f010fed79bfef8771ce65eb126a1d83ecc54a9a2",
"flags": [],
"package": "filepattern",
"revision": 0,
"source": "hackage",
"src_sha256": "cc445d439ea2f65cac7604d3578aa2c3a62e5a91dc989f4ce5b3390db9e59636",
"version": "0.1.3"
},
{
"cabal_sha256": "2efc549644dd418bad537d1601fdd437c440d807265016bd993b6996c679ad2f",
"flags": [],
"package": "os-string",
"revision": 0,
"source": "hackage",
"src_sha256": "339c35fd3a290522f23de4e33528423cfd0b0a8f22946b0b9816a817b926cba0",
"version": "2.0.7"
},
{
"cabal_sha256": "2f23146cbe0325029927b221647695a4c7d6e97548ff731110979e34361f58ef",
"flags": [
"-arch-native",
"-random-initial-seed"
],
"package": "hashable",
"revision": 1,
"source": "hackage",
"src_sha256": "e58b3a8e18da5f6cd7e937e5fd683e500bb1f8276b3768269759119ca0cddb6a",
"version": "1.5.0.0"
},
{
"cabal_sha256": "74ce60a23b8ef247b8bca71eeb38289e82b3b5e83b2383600b2c838a68218068",
"flags": [],
"package": "heaps",
"revision": 0,
"source": "hackage",
"src_sha256": "8763a4663a2d0b3c912400a547d66ae11b46a954403b6747272148e950aa0382",
"version": "0.4.1"
},
{
"cabal_sha256": "f75cb4fa53c88c65794becdd48eb0d3b2b8abd89a3d5c19e87af91f5225c15e4",
"flags": [],
"package": "js-dgtable",
"revision": 0,
"source": "hackage",
"src_sha256": "e28dd65bee8083b17210134e22e01c6349dc33c3b7bd17705973cd014e9f20ac",
"version": "0.5.2"
},
{
"cabal_sha256": "4c1c447a9a2fba0adba6d30678302a30c32b9dfde9e7aa9e9156483e1545096d",
"flags": [],
"package": "js-flot",
"revision": 0,
"source": "hackage",
"src_sha256": "1ba2f2a6b8d85da76c41f526c98903cbb107f8642e506c072c1e7e3c20fe5e7a",
"version": "0.8.3"
},
{
"cabal_sha256": "fdbdfd4d413848c678a3737f2b985a5db66b796c6847b1ae08246ea3795c0ba2",
"flags": [],
"package": "js-jquery",
"revision": 0,
"source": "hackage",
"src_sha256": "a087fa01a1c52f5386d43f5355f64841c5a4b56b53720090d66b5aa00bfeb106",
"version": "3.7.1"
},
{
"cabal_sha256": "dfdd6572944c11e69208237dd32a2eb9d975b4f4e9064a7b8dc952cb0e256846",
"flags": [],
"package": "primitive",
"revision": 0,
"source": "hackage",
"src_sha256": "44b4de41813c7bc5db8a57f87c3612a069b65086946268ba165097252ebd3d76",
"version": "0.9.1.0"
},
{
"cabal_sha256": "8f92088f1c51c8d4569279a07565f8aa6b534a6735615b2295d2961dec8f1783",
"flags": [
"-optimised-mixer"
],
"package": "splitmix",
"revision": 0,
"source": "hackage",
"src_sha256": "d678c41a603a62032cf7e5f8336bb8222c93990e4b59c8b291b7ca26c7eb12c7",
"version": "0.1.1"
},
{
"cabal_sha256": "0b4f649c3e78713b2ccad1535251ee34b148237fb2229d7058c2b1d9ccc324b8",
"flags": [],
"package": "random",
"revision": 0,
"source": "hackage",
"src_sha256": "d840ac83f265b0cfa2a678f8ec78627eb50cf9be2f067c52c8a4239c29b71a35",
"version": "1.3.1"
},
{
"cabal_sha256": "233cbcdda6c2698932bb391ce0935fb44f80c115621ee815a21ed33ac8ede422",
"flags": [
"-debug"
],
"package": "unordered-containers",
"revision": 4,
"source": "hackage",
"src_sha256": "d9cfb287cf00592d39dc9c3cac8b99627ea08f2c01798e70130fc39f7c90f11d",
"version": "0.2.20"
},
{
"cabal_sha256": "79416292186feeaf1f60e49ac5a1ffae9bf1b120e040a74bf0e81ca7f1d31d3f",
"flags": [],
"package": "utf8-string",
"revision": 0,
"source": "hackage",
"src_sha256": "ee48deada7600370728c4156cb002441de770d0121ae33a68139a9ed9c19b09a",
"version": "1.0.2"
},
{
"cabal_sha256": "03c8f06de478e07ad6fde95984c9206920106d0d8432ecb7ab825ef108d45382",
"flags": [
"-cloud",
"-embed-files",
"-portable",
"+threaded"
],
"package": "shake",
"revision": 0,
"source": "hackage",
"src_sha256": "6384e33a26a2590bf33719e88881076b899ac4b5340c1c9271e4caa37e9d6535",
"version": "0.19.8"
},
{
"cabal_sha256": null,
"flags": [
"-selftest",
"+threaded"
],
"package": "hadrian",
"revision": null,
"source": "local",
"src_sha256": null,
"version": "0.1.0.0"
}
]
}

View file

@ -1,33 +0,0 @@
From c74cdea9e6804d10660035700136975cfd39da8d Mon Sep 17 00:00:00 2001
From: Peter Trommler <ptrommler@acm.org>
Date: Fri, 31 Dec 2021 18:20:45 +0100
Subject: [PATCH] Disable unboxed arrays on big-endian
Unboxed arrays are broken on big-endian architectures, see
https://gitlab.haskell.org/ghc/ghc/-/issues/16998 for details.
This patch makes the use of unboxed arrays conditional on
little-endian architecture.
Fixes #673
diff --git a/libraries/containers/containers/include/containers.h b/libraries/containers/containers/include/containers.h
index cd201ca..fc2a0e8 100644
--- a/libraries/containers/containers/include/containers.h
+++ b/libraries/containers/containers/include/containers.h
@@ -35,7 +35,13 @@
#ifdef __GLASGOW_HASKELL__
# define USE_ST_MONAD 1
+#ifndef WORDS_BIGENDIAN
+/*
+ * Unboxed arrays are broken on big-endian architectures.
+ * See https://gitlab.haskell.org/ghc/ghc/-/issues/16998
+ */
# define USE_UNBOXED_ARRAYS 1
#endif
+#endif
#endif
--
2.31.1

View file

@ -1,66 +0,0 @@
From 00dc51060881df81258ba3b3bdf447294618a4de Mon Sep 17 00:00:00 2001
From: Matthew Pickering <matthewtpickering@gmail.com>
Date: Tue, 3 Jan 2023 15:56:37 +0000
Subject: [PATCH] sphinx: Use modern syntax for extlinks
This fixes the following build error:
```
Command line: /opt/homebrew/opt/sphinx-doc/bin/sphinx-build -b man -d /private/tmp/extra-dir-55768274273/.doctrees-man -n -w /private/tmp/extra-dir-55768274273/.log docs/users_guide /private/tmp/extra-dir-55768274273
===> Command failed with error code: 2
Exception occurred:
File "/opt/homebrew/Cellar/sphinx-doc/6.0.0/libexec/lib/python3.11/site-packages/sphinx/ext/extlinks.py", line 101, in role
title = caption % part
~~~~~~~~^~~~~~
TypeError: not all arguments converted during string formatting
```
I tested on Sphinx-5.1.1 and Sphinx-6.0.0
Thanks for sterni for providing instructions about how to test using
sphinx-6.0.0.
Fixes #22690
---
docs/users_guide/ghc_config.py.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/users_guide/ghc_config.py.in b/docs/users_guide/ghc_config.py.in
index dcc7fbaef624..c9888a13adc5 100644
--- a/docs/users_guide/ghc_config.py.in
+++ b/docs/users_guide/ghc_config.py.in
@@ -1,6 +1,6 @@
extlinks = {
- 'ghc-ticket': ('https://gitlab.haskell.org/ghc/ghc/issues/%s', '#'),
- 'ghc-wiki': ('https://gitlab.haskell.org/ghc/ghc/wikis/%s', '#'),
+ 'ghc-ticket': ('https://gitlab.haskell.org/ghc/ghc/issues/%s', '%s'),
+ 'ghc-wiki': ('https://gitlab.haskell.org/ghc/ghc/wikis/%s', '#%s'),
}
libs_base_uri = '../libraries'
From 52d701b31dc4427b7e321a04be3f5f13a5fc271e Mon Sep 17 00:00:00 2001
From: "mimi.vx" <mimi.vx@gmail.com>
Date: Wed, 24 May 2023 12:42:15 +0000
Subject: [PATCH] Fix for Sphinx 7 removed style key
Fixes https://gitlab.haskell.org/ghc/ghc/-/issues/23444
---
docs/users_guide/rtd-theme/layout.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/users_guide/rtd-theme/layout.html b/docs/users_guide/rtd-theme/layout.html
index 2a61142514a..7ffeff7befc 100644
--- a/docs/users_guide/rtd-theme/layout.html
+++ b/docs/users_guide/rtd-theme/layout.html
@@ -64,7 +64,7 @@
{%- endif %}
{# CSS #}
- <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
+ <link rel="stylesheet" href="{{ pathto('_static/' + styles[-1], 1) }}" type="text/css" />
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
{%- for css in css_files %}
{%- if css|attr("rel") %}
--
GitLab

View file

@ -1,25 +0,0 @@
Since we replace bundled tarball with our own and it's a git
snapshot, it is necessary to generate the build system ourselves
Source: @q66
--- a/libffi/ghc.mk
+++ b/libffi/ghc.mk
@@ -58,16 +58,7 @@ $(libffi_STAMP_CONFIGURE): $(TOUCH_DEP)
$(CP) "$(TOP)/config.guess" libffi/build/config.guess
$(CP) "$(TOP)/config.sub" libffi/build/config.sub
-# We have to fake a non-working ln for configure, so that the fallback
-# option (cp -p) gets used instead. Otherwise the libffi build system
-# will use cygwin symbolic links which cannot be read by mingw gcc.
- chmod +x libffi/ln
-
- # We need to use -MMD rather than -MD, as otherwise we get paths
- # like c:/... in the dependency files on Windows, and the extra
- # colons break make
- mv libffi/build/Makefile.in libffi/build/Makefile.in.orig
- sed "s/-MD/-MMD/" < libffi/build/Makefile.in.orig > libffi/build/Makefile.in
+ cd libffi && cd build && "$(SHELL)" ./autogen.sh
# We attempt to specify the installation directory below with --libdir,
# but libffi installs into 'toolexeclibdir' instead, which may differ

View file

@ -1,168 +0,0 @@
From 587edc0d9786aff3c7a4728ba941f6a993e59bdc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Thu, 28 Apr 2022 00:48:04 +0200
Subject: [PATCH] fix up runtime for ppc64 BE ELFv2 + ensure it's used
---
configure | 2 +-
libraries/ghci/GHCi/InfoTable.hsc | 36 ++++++++++++-------------------
m4/fptools.m4 | 2 +-
rts/AdjustorAsm.S | 2 +-
rts/StgCRun.c | 4 ++--
rts/StgCRunAsm.S | 2 +-
rts/adjustor/NativeIA64.c | 2 +-
rts/adjustor/NativePowerPC.c | 2 +-
8 files changed, 22 insertions(+), 30 deletions(-)
diff --git a/configure b/configure
index 8310e6f..eac1124 100755
--- a/configure
+++ b/configure
@@ -10508,7 +10508,7 @@ printf "%s\n" "no" >&6; }
test -z "$2" || eval "$2=ArchPPC"
;;
powerpc64)
- test -z "$2" || eval "$2=\"ArchPPC_64 {ppc_64ABI = ELF_V1}\""
+ test -z "$2" || eval "$2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\""
;;
powerpc64le)
test -z "$2" || eval "$2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\""
diff --git a/libraries/ghci/GHCi/InfoTable.hsc b/libraries/ghci/GHCi/InfoTable.hsc
index ad4eb4d..e4f1c0c 100644
--- a/libraries/ghci/GHCi/InfoTable.hsc
+++ b/libraries/ghci/GHCi/InfoTable.hsc
@@ -231,30 +231,22 @@ mkJumpToAddr' platform a = case platform of
, fromIntegral w64
, fromIntegral (w64 `shiftR` 32) ]
ArchPPC64 ->
- -- We use the compiler's register r12 to read the function
- -- descriptor and the linker's register r11 as a temporary
- -- register to hold the function entry point.
- -- In the medium code model the function descriptor
- -- is located in the first two gigabytes, i.e. the address
- -- of the function pointer is a non-negative 32 bit number.
- -- 0x0EADBEEF stands for the address of the function pointer:
- -- 0: 3d 80 0e ad lis r12,0x0EAD
- -- 4: 61 8c be ef ori r12,r12,0xBEEF
- -- 8: e9 6c 00 00 ld r11,0(r12)
- -- c: e8 4c 00 08 ld r2,8(r12)
- -- 10: 7d 69 03 a6 mtctr r11
- -- 14: e9 6c 00 10 ld r11,16(r12)
- -- 18: 4e 80 04 20 bctr
- let w32 = fromIntegral (funPtrToInt a)
+ -- The ABI requires r12 to point to the function's entry point.
+ -- We use the medium code model where code resides in the first
+ -- two gigabytes, so loading a non-negative32 bit address
+ -- with lis followed by ori is fine.
+ -- 0x0EADBEEF stands for the address:
+ -- 3D800EAD lis r12,0x0EAD
+ -- 618CBEEF ori r12,r12,0xBEEF
+ -- 7D8903A6 mtctr r12
+ -- 4E800420 bctr
+
+ let w32 = fromIntegral (funPtrToInt a)
hi16 x = (x `shiftR` 16) .&. 0xFFFF
lo16 x = x .&. 0xFFFF
- in Right [ 0x3D800000 .|. hi16 w32,
- 0x618C0000 .|. lo16 w32,
- 0xE96C0000,
- 0xE84C0008,
- 0x7D6903A6,
- 0xE96C0010,
- 0x4E800420]
+ in Right [ 0x3D800000 .|. hi16 w32,
+ 0x618C0000 .|. lo16 w32,
+ 0x7D8903A6, 0x4E800420 ]
ArchPPC64LE ->
-- The ABI requires r12 to point to the function's entry point.
diff --git a/m4/fptools.m4 b/m4/fptools.m4
index 8c6c9b7..eb25c37 100644
--- a/m4/fptools.m4
+++ b/m4/fptools.m4
@@ -201,7 +201,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS],
test -z "[$]2" || eval "[$]2=ArchPPC"
;;
powerpc64)
- test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V1}\""
+ test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\""
;;
powerpc64le)
test -z "[$]2" || eval "[$]2=\"ArchPPC_64 {ppc_64ABI = ELF_V2}\""
diff --git a/rts/AdjustorAsm.S b/rts/AdjustorAsm.S
index 2795b83..63cfe91 100644
--- a/rts/AdjustorAsm.S
+++ b/rts/AdjustorAsm.S
@@ -2,7 +2,7 @@
/* ******************************** PowerPC ******************************** */
-#if defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH)
+#if defined(powerpc_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF != 2))
#if !(defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS))
/* The following code applies, with some differences,
to all powerpc platforms except for powerpc32-linux,
diff --git a/rts/StgCRun.c b/rts/StgCRun.c
index f43227a..927d44a 100644
--- a/rts/StgCRun.c
+++ b/rts/StgCRun.c
@@ -724,7 +724,7 @@ StgRunIsImplementedInAssembler(void)
Everything is in assembler, so we don't have to deal with GCC...
-------------------------------------------------------------------------- */
-#if defined(powerpc64_HOST_ARCH)
+#if defined(powerpc64_HOST_ARCH) && (_CALL_ELF != 2)
/* 64-bit PowerPC ELF ABI 1.9
*
* Stack frame organization (see Figure 3-17, ELF ABI 1.9, p 14)
@@ -792,7 +792,7 @@ StgRunIsImplementedInAssembler(void)
#endif
-#if defined(powerpc64le_HOST_ARCH)
+#if defined(powerpc64le_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF == 2))
/* -----------------------------------------------------------------------------
PowerPC 64 little endian architecture
diff --git a/rts/StgCRunAsm.S b/rts/StgCRunAsm.S
index 60f1bf9..c6794d7 100644
--- a/rts/StgCRunAsm.S
+++ b/rts/StgCRunAsm.S
@@ -5,7 +5,7 @@
* then functions StgRun/StgReturn are implemented in file StgCRun.c */
#if !defined(USE_MINIINTERPRETER)
-#if defined(powerpc64le_HOST_ARCH)
+#if defined(powerpc64le_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF == 2))
# if defined(linux_HOST_OS)
/* 64-bit PowerPC ELF V2 ABI Revision 1.4
*
diff --git a/rts/adjustor/NativeIA64.c b/rts/adjustor/NativeIA64.c
index 9fd1991..816b3ef 100644
--- a/rts/adjustor/NativeIA64.c
+++ b/rts/adjustor/NativeIA64.c
@@ -39,7 +39,7 @@ void*
createAdjustor(int cconv, StgStablePtr hptr,
StgFunPtr wptr,
char *typeString
-#if !defined(powerpc_HOST_ARCH) && !defined(powerpc64_HOST_ARCH) && !defined(x86_64_HOST_ARCH)
+#if !defined(powerpc_HOST_ARCH) && (!defined(powerpc64_HOST_ARCH) || (_CALL_ELF == 2)) && !defined(x86_64_HOST_ARCH)
STG_UNUSED
#endif
)
diff --git a/rts/adjustor/NativePowerPC.c b/rts/adjustor/NativePowerPC.c
index 2e5d605..caef5d3 100644
--- a/rts/adjustor/NativePowerPC.c
+++ b/rts/adjustor/NativePowerPC.c
@@ -29,7 +29,7 @@ __asm__("obscure_ccall_ret_code:\n\t"
extern void obscure_ccall_ret_code(void);
#endif /* defined(linux_HOST_OS) */
-#if defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH)
+#if defined(powerpc_HOST_ARCH) || (defined(powerpc64_HOST_ARCH) && (_CALL_ELF != 2))
#if !(defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS))
/* !!! !!! WARNING: !!! !!!
--
2.35.1

View file

@ -1,38 +1,28 @@
# Template file for 'ghc'
pkgname=ghc
# Keep this synchronized with http://www.stackage.org/lts
version=9.0.2
revision=2
build_style=gnu-configure
hostmakedepends="automake docbook-xsl ghc-bin libxslt libnuma-devel
ncurses-devel python3-Sphinx python3-setuptools"
makedepends="libnuma-devel"
depends="perl gcc libffi-devel gmp-devel libnuma-devel"
short_desc="Glorious Haskell Compiler"
version=9.8.4
revision=1
build_helper="haskell"
_configure_args="--prefix=/usr"
_hadrian_args="--prefix=/usr"
hostmakedepends="ghc-bin python3 tar xz automake"
makedepends="libffi-devel"
depends="gcc libffi-devel gmp-devel libnuma-devel"
short_desc="Glasgow Haskell Compiler"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-3-Clause"
homepage="http://www.haskell.org/ghc/"
distfiles="http://www.haskell.org/ghc/dist/${version%[!0-9]}/${pkgname}-${version%[!0-9]}-src.tar.xz"
checksum=140e42b96346322d1a39eb17602bcdc76e292028ad4a69286b230bab188a9197
distfiles="http://www.haskell.org/ghc/dist/${version}/${pkgname}-${version}-src.tar.xz"
checksum=17e8188f3c8a5c2f73fb4e35d01032e8dc258835ec876d52c8ad8ee3d24b2fc5
_hadrian_cmd="hadrian/bootstrap/_build/bin/hadrian"
nocross=yes # this is conditionally unset for cross bindist
nodebug=yes # work around assembler error "Fatal error: duplicate .debug_line sections"
_bindir="/usr/lib/${pkgname}-${version}/bin"
nopie_files="
${_bindir}/ghc
${_bindir}/ghc-iserv
${_bindir}/ghc-iserv-dyn
${_bindir}/ghc-iserv-prof
${_bindir}/ghc-pkg
${_bindir}/haddock
${_bindir}/hp2ps
${_bindir}/hpc
${_bindir}/hsc2hs
${_bindir}/runghc
${_bindir}/unlit
"
nopie=yes
_ghc_ver="${version//./_}"
build_options="bindist"
build_options="bindist stage3"
desc_option_bindist="Create a binary distribution"
desc_option_stage3="Build a stage3 compiler"
# it is not possible to cross-compile an entire ghc distribution as
# some components rely on stage2 binaries being runnable on the host
@ -40,114 +30,113 @@ desc_option_bindist="Create a binary distribution"
# use them to compile proper bindists on newly bootstrapped targets
if [ -z "$build_option_bindist" ]; then
# final package builds use system libffi as well as gmp and ncurses
configure_args=" --with-system-libffi"
makedepends+=" libffi-devel ncurses-devel gmp-devel"
_configure_args+=" --with-system-libffi"
# --hash-unit-ids is needed because it only became part of the
# release flavour in later GHC versions.
_hadrian_args+=" --flavour=release --hash-unit-ids --docs=no-sphinx-pdfs"
hostmakedepends+=" python3-Sphinx docbook-xsl"
makedepends+=" ncurses-devel gmp-devel libnuma-devel"
elif [ -z "$CROSS_BUILD" ]; then
# native bindist builds use gmp and ncurses, but builtin libffi
# native bindist builds use system libffi as well as gmp and ncurses
_configure_args+=" --with-system-libffi --disable-numa"
_hadrian_args+=" --flavour=quick --docs=none"
makedepends+=" ncurses-devel gmp-devel"
elif [ "${XBPS_MACHINE%-*}" != "${XBPS_TARGET_MACHINE%-*}" ]; then
# ghc's cross mode only works when the actual target arch differs
# i.e. cross-compiling to same arch but different libc does not work
unset nocross
# host must equal build and target must be set when cross-compiling
configure_args+=" --host=${XBPS_TRIPLET} --target=${XBPS_CROSS_TRIPLET}"
fi
case "$XBPS_TARGET_MACHINE" in
aarch64*)
# GHC uses LLVM to generate code on aarch64
hostmakedepends+=" llvm17-devel"
depends+=" llvm17-devel"
;;
esac
# Recent safe to use tarball
# GHC's bundled tarball is from 2017, buggy on some archs
_ffi_rev=4d6d2866ae43e55325e8ee96561221804602cd7a
if [ "$build_option_bindist" ]; then
# Required to make the binary distribution tarball
hostmakedepends+=" tar xz libtool libltdl-devel"
# Fetch a safe libffi tarball
distfiles+=" https://github.com/libffi/libffi/archive/${_ffi_rev}.tar.gz>libffi-${_ffi_rev}.tar.gz"
checksum+=" f7a17fa61261942e93450ec52272b5f09d8f42cfffd147867587f969ee01b739"
skip_extraction+=" libffi-${_ffi_rev}.tar.gz"
_configure_args+=" --with-system-libffi --disable-numa"
_configure_args+=" --target=${XBPS_CROSS_TRIPLET} --enable-unregistered"
_hadrian_args+=" --flavour=quick --docs=none --bignum=native"
fi
post_extract() {
[ "$build_option_bindist" ] || return 0
if [ -e ${FILESDIR}/plan-bootstrap-${_ghc_ver}.json ]; then
cp "${FILESDIR}/plan-bootstrap-${_ghc_ver}.json" hadrian/bootstrap/
fi
}
# update libffi for all bindists
rm -f libffi-tarballs/libffi-*.tar.gz
cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/libffi-${_ffi_rev}.tar.gz \
libffi-tarballs
[ "$CROSS_BUILD" ] || return 0
# create build config for cross bindists
local flav="quick"
echo "BuildFlavour = ${flav}" >> mk/build.mk
cat mk/flavours/${flav}.mk >> mk/build.mk
# gmp segfaults when cross-built
echo "INTEGER_LIBRARY = integer-simple" >> mk/build.mk
# otherwise needs ncurses for target
echo "WITH_TERMINFO = NO" >> mk/build.mk
# cannot be cross-compiled
echo "HADDOCK_DOCS = NO" >> mk/build.mk
# just wastes time
echo "BUILD_SPHINX_HTML = NO" >> mk/build.mk
echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
echo "BUILD_MAN = NO" >> mk/build.mk
do_patch() {
if [ "$build_option_stage3" ]; then
sed -i 's/finalStage = Stage2/finalStage = Stage3/' hadrian/src/UserSettings.hs
fi
}
pre_configure() {
# stage0 and stage1 are built for build/host (which are the
# same in ghc) and stage2 is built for target (when cross)
export CONF_CC_OPTS_STAGE0=$CFLAGS_FOR_BUILD
export CONF_CC_OPTS_STAGE1=$CFLAGS_FOR_BUILD
export CONF_CC_OPTS_STAGE2=$CFLAGS
export CONF_GCC_LINKER_OPTS_STAGE0=$LDFLAGS_FOR_BUILD
export CONF_GCC_LINKER_OPTS_STAGE1=$LDFLAGS_FOR_BUILD
export CONF_GCC_LINKER_OPTS_STAGE2=$LDFLAGS
export CONF_CPP_OPTS_STAGE0=$CPPFLAGS_FOR_BUILD
export CONF_CPP_OPTS_STAGE1=$CPPFLAGS_FOR_BUILD
export CONF_CPP_OPTS_STAGE2=$CPPFLAGS
if [ ! -e hadrian/bootstrap/plan-bootstrap-${_ghc_ver}.json ]; then
# To generate a bootstrap plan for a new ghc version ensure a
# cabal binary is available, run this, then move the plan to
# ${FILESDIR}
cabal update
cd hadrian
cabal build --flags=-selftest --dry-run hadrian
cp dist-newstyle/cache/plan.json bootstrap/plan-${_ghc_ver}.json
cd bootstrap
cabal build hadrian-bootstrap-gen --allow-newer
cabal run -v0 hadrian-bootstrap-gen -- "plan-${_ghc_ver}.json" \
| python3 -m json.tool > "plan-bootstrap-${_ghc_ver}.json"
msg_normal "Please install hadrian/bootstrap/plan-bootstrap-${_ghc_ver}.json in ${FILESDIR}\n"
exit 1
else
cd hadrian/bootstrap
fi
autoreconf -fi
./bootstrap.py -d plan-bootstrap-${_ghc_ver}.json
}
post_install() {
sed -i 's#/usr/lib/ccache/bin/##g' ${DESTDIR}/usr/lib/ghc-${version%[!0-9]}/settings
vlicense LICENSE
do_configure() {
# GNU binutils ld does not work on ARM with haskell, see
# https://sourceware.org/bugzilla/show_bug.cgi?id=16177
# ld.gold works but was removed from binutils in 2.44
# So we set LD to CC and the configure script will set -fuse-ld to lld
export LD="$CC"
./configure ${_configure_args}
}
local arch dest
do_build() {
${_hadrian_cmd} ${makejobs} ${_hadrian_args}
}
do_install() {
local arch targ
if [ "$CROSS_BUILD" ]; then
arch=${XBPS_CROSS_TRIPLET%%-*}
targ=ghc-${version}-${XBPS_CROSS_TRIPLET}
else
arch=${XBPS_TRIPLET%%-*}
fi
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
dest=ghc-${version}-${arch}-void-linux-musl.tar.xz
else
dest=ghc-${version}-${arch}-void-linux.tar.xz
targ=ghc-${version}-${arch}-unknown-linux
fi
if [ "$build_option_bindist" ]; then
msg_normal "Creating binary distribution for ${XBPS_TARGET_MACHINE}...\n"
make ${makejobs} binary-dist
${_hadrian_cmd} ${_hadrian_args} binary-dist
mkdir -p ${XBPS_SRCDISTDIR}/distfiles
mv ghc-${version}-${arch}-unknown-linux.tar.xz ${dest}
install -m 0644 ${dest} ${XBPS_SRCDISTDIR}/distfiles
install -m 0644 _build/bindist/${targ}.tar.xz ${XBPS_SRCDISTDIR}/distfiles
msg_normal "Installed in ${XBPS_SRCDISTDIR}/distfiles\n"
exit 1
else
DESTDIR=${DESTDIR} ${_hadrian_cmd} ${_hadrian_args} install
fi
}
post_install() {
vlicense LICENSE
}
ghc-doc_package() {
short_desc+=" -- documentation"
short_desc+=" - documentation"
pkg_install() {
vmove usr/share/doc
}
}
ghc-devel_package() {
short_desc+=" - development files"
pkg_install() {
cd ${DESTDIR}
find usr/lib \( -type f -o -type l \) \( -name "*.p_*" -o -name "lib*_p.a" \) | while read f; do vmove "$f"; done
}
}

View file

@ -1,30 +0,0 @@
flags:
git-annex:
production: true
assistant: true
pairing: true
torrentparser: true
magicmime: false
dbus: false
debuglocks: false
benchmark: true
gitlfs: true
packages:
- '.'
resolver: lts-19.0
extra-deps:
- IfElse-0.85
- aws-0.22
- bloomfilter-2.0.1.0
- git-lfs-1.2.0
- http-client-restricted-0.0.4
- network-multicast-0.3.2
- sandi-0.5
- torrent-10000.1.1
- base16-bytestring-0.1.1.7
- base64-bytestring-1.0.0.3
- bencode-0.6.1.1
- aeson-1.5.6.0@sha256:5003bb6fd260d2e2d5a51dee2bf5c8e8f29e4e0e0288fef805c22dcc80ecab06,6788
- http-client-0.7.11@sha256:3f59ac8ffe2a3768846cdda040a0d1df2a413960529ba61c839861c948871967,5756
explicit-setup-deps:
git-annex: true

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,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

@ -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

@ -1,32 +1,48 @@
# Template file for 'git-annex'
pkgname=git-annex
version=10.20221103
version=10.20250630
revision=1
build_style=haskell-stack
build_style=gnu-makefile
build_helper=haskell
make_check_target=test
make_use_env=yes
hostmakedepends="cabal-install"
makedepends="curl file-devel gnupg gnutls-devel gsasl-devel libxml2-devel
lsof rsync git ncurses-devel bup borg nocache git-remote-gcrypt"
# depends are utilities required by git-annex
depends="git rsync curl lsof gnupg>=2"
short_desc="Git addon for managing large files"
maintainer="Evan Deaubl <evan@deaubl.name>"
license="AGPL-3.0-or-later, MIT, BSD-2-Clause, GPL-3.0-or-later, custom:Expat, custom:MIT-twitter, GPL-2.0-only, custom:icon-license"
homepage="https://git-annex.branchable.com"
changelog="https://git.joeyh.name/index.cgi/git-annex.git/plain/CHANGELOG"
distfiles="https://hackage.haskell.org/package/${pkgname}-${version}/${pkgname}-${version}.tar.gz"
checksum=f549c31264d6da3bb544755795e7fc29882ebec45014905bc2ea0ade28398f3b
# The hackage distribution is missing the makefile and build tools
distfiles="https://git.joeyh.name/index.cgi/git-annex.git/snapshot/git-annex-${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="f798e07707ab2eb7c8fe76b9821ba6b2878d4bae2a03ae5a8cac69eb315bcd98
7fb77e249aef76ba5aed3059d556800ce02b614597c488ba01f0a16449146300
fd4eb6f638e24b81b4e6cdd68772a531726f2f67686c8969d3407d82f7862e3e
17fe070c38fc498cab49bcb9d6215b7747d53bedf96502e9bcce9cad73b9c797"
nopie_files="/usr/bin/git-annex"
nocross=yes
skip_extraction="basement-0.0.16.tar.gz memory-0.18.0.tar.gz cborg-0.2.10.0.tar.gz"
disable_parallel_build=yes
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
}
export BUILDERCOMMONOPTIONS="-f servant --index-state=2025-07-04T05:45:32Z"
export GHC="cabal exec -- ghc"
pre_configure() {
echo 'packages: ./basement ./memory ./cborg .' > cabal.project
cabal update
}
# These install steps are pulled from the install target in the
# git-annex Makefile. The target can't be called directly because it is
# comingled with the Cabal build, and we're using Stackage instead
# Make sure they are in sync with each version upgrade
post_install() {
ln -sf git-annex ${DESTDIR}/usr/bin/git-annex-shell
ln -sf git-annex ${DESTDIR}/usr/bin/git-remote-tor-annex
vmkdir usr/share/man/man1
vcopy man/*.1 usr/share/man/man1
vlicense doc/license/AGPL
}

View file

@ -1,15 +1,15 @@
# Template file for 'git-mediate'
pkgname=git-mediate
version=1.0.8.1
revision=3
version=1.1.0
revision=1
build_style=haskell-stack
stackage="lts-19.0"
stackage="lts-23.26"
depends="git"
short_desc="Tool to help resolving git conflicts"
maintainer="Peter Wang <novalazy@gmail.com>"
license="GPL-2.0-only"
homepage="https://github.com/Peaker/git-mediate"
distfiles="https://hackage.haskell.org/package/${pkgname}-${version}/${pkgname}-${version}.tar.gz"
checksum=ee44841d37ded70cbcd8edd1e233a344d0118295e0bd2f0c6983ed00f619c467
checksum=7826a1cdbbd20696059c9a2b927916c6e3593be24ac10bd647b6c2d8e13b1124
nocross=yes
nopie_files="/usr/bin/git-mediate"

View file

@ -1,8 +1,9 @@
# Template file for 'glirc'
pkgname=glirc
version=2.41
revision=1
hostmakedepends="cabal-install"
revision=2
build_style=cabal
cabal_index_state=2025-07-04T14:10:45Z
makedepends="ncurses-devel openssl-devel"
short_desc="Console IRC client written in Haskell"
maintainer="Orphaned <orphan@voidlinux.org>"
@ -13,24 +14,15 @@ checksum=fbb5bd030ddce70158c4d5654c8fda93093e68b9fb85df4d6cb91ab72a67a6a6
nocross="cabal does not support cross compilation"
nopie=yes # ghc is currently built without PIE support
_cabal_opts="-g"
if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
_cabal_opts+=" --ghc-option -latomic"
fi
if [ "$XBPS_MAKEJOBS" ]; then
_cabal_opts+=" --jobs=$XBPS_MAKEJOBS"
fi
do_build() {
cabal update $_cabal_opts
cabal build $_cabal_opts
mv dist-newstyle/build/*/*/glirc-${version}/build/glirc/glirc glirc
post_configure() {
echo 'package HsOpenSSL' >> cabal.project.local
echo ' ghc-options:' >> cabal.project.local
echo ' -optc=-Wno-discarded-qualifiers' >> cabal.project.local
echo ' -optc=-Wno-deprecated-declarations' >> cabal.project.local
echo ' -optc=-Wno-incompatible-pointer-types' >> cabal.project.local
}
do_install() {
vbin glirc
post_install() {
vman glirc.1
vlicense LICENSE
}

View file

@ -1,9 +1,10 @@
# Template file for 'haskell-language-server'
pkgname=haskell-language-server
version=1.8.0.0
version=2.11.0.0
revision=1
build_style="haskell-stack"
make_build_args="--stack-yaml stack-lts19.yaml --flag=haskell-language-server:-dynamic"
build_style=cabal
configure_args="--flags=-dynamic --disable-benchmarks --disable-tests"
make_build_target=all:exes
makedepends="ncurses-devel ncurses-libtinfo-devel icu-devel zlib-devel"
short_desc="Integration of ghcide and haskell-ide-engine"
maintainer="Wayne Van Son <waynevanson@gmail.com>"
@ -11,7 +12,7 @@ license="Apache-2.0"
homepage="https://github.com/haskell/haskell-language-server"
changelog="https://raw.githubusercontent.com/haskell/haskell-language-server/master/ChangeLog.md"
distfiles="https://github.com/haskell/haskell-language-server/archive/${version}.tar.gz"
checksum=e1081ac581d21547d835beb8561e815573944aa0babe752a971479da3a207235
checksum=a03b00e37b3a5326adaaa688145160959e78f0fa7a3160eb99babea437fc60f4
nopie_files="
/usr/bin/haskell-language-server
/usr/bin/haskell-language-server-wrapper
@ -21,3 +22,4 @@ nopie_files="
/usr/bin/test-server
"
nocross="Cannot yet cross compile with Haskell"
make_check=no # Tests require dynamic linking of haskell libs which doesn't work on musl

View file

@ -0,0 +1,10 @@
--- a/tools/pas2c/Pas2C.hs 2025-07-07 21:51:17.117166690 +0100
+++ b/tools/pas2c/Pas2C.hs 2025-07-07 21:47:34.842095704 +0100
@@ -6,6 +6,7 @@
import Data.Maybe
import Data.Char
import Text.Parsec.Prim hiding (State)
+import Control.Monad (void, unless, guard, liftM, liftM2)
import Control.Monad.State
import System.IO
import PascalPreprocessor

View file

@ -0,0 +1,81 @@
--- a/tools/pas2c/PascalPreprocessor.hs 2025-07-07 21:31:06.082177207 +0100
+++ b/tools/pas2c/PascalPreprocessor.hs 2025-07-07 21:32:06.163172477 +0100
@@ -11,8 +11,8 @@
char' :: Char -> ParsecT String u IO ()
char' = void . char
-string' :: String -> ParsecT String u IO ()
-string' = void . string
+stringlmao :: String -> ParsecT String u IO ()
+stringlmao = void . string
-- comments are removed
comment :: ParsecT String u IO String
@@ -59,7 +59,7 @@
return $ c:s
switch = do
- try $ string' "{$"
+ try $ stringlmao "{$"
s <- choice [
include
, ifdef
@@ -72,7 +72,7 @@
return s
include = do
- try $ string' "INCLUDE"
+ try $ stringlmao "INCLUDE"
spaces
(char' '"')
ifn <- many1 $ noneOf "\"\n"
@@ -102,7 +102,7 @@
return ""
if' = do
- try (string' "IF" >> notFollowedBy alphaNum)
+ try (stringlmao "IF" >> notFollowedBy alphaNum)
void $ manyTill anyChar (char' '}')
--char '}'
@@ -113,15 +113,15 @@
return ""
elseSwitch = do
- try $ string' "ELSE}"
+ try $ stringlmao "ELSE}"
updateState $ \(m, b:bs) -> (m, (not b):bs)
return ""
endIf = do
- try $ string' "ENDIF}"
+ try $ stringlmao "ENDIF}"
updateState $ \(m, _:bs) -> (m, bs)
return ""
define = do
- try $ string' "DEFINE"
+ try $ stringlmao "DEFINE"
spaces
i <- identifier
d <- ((string ":=" >> return ()) <|> spaces) >> many (noneOf "}")
--- a/tools/pas2c/PascalBasics.hs 2025-07-07 21:34:14.466383776 +0100
+++ b/tools/pas2c/PascalBasics.hs 2025-07-07 21:34:44.872576888 +0100
@@ -13,8 +13,8 @@
char' :: Char -> Parsec String u ()
char' = void . char
-string' :: String -> Parsec String u ()
-string' = void . string
+stringggggggg :: String -> Parsec String u ()
+stringggggggg = void . string
builtin :: [String]
builtin = ["succ", "pred", "low", "high", "ord", "inc", "dec", "exit", "break", "continue", "length", "copy"]
@@ -43,7 +43,7 @@
preprocessorSwitch :: Stream String Identity Char => Parsec String u String
preprocessorSwitch = do
- try $ string' "{$"
+ try $ stringggggggg "{$"
s <- manyTill (noneOf "\n") $ char '}'
return s

View file

@ -1,22 +0,0 @@
resolver: lts-19.0
packages:
- hledger-lib
- hledger
- hledger-ui
- hledger-web
extra-deps:
# for hledger-lib:
- breakpoint-0.1.0.0
# for hledger:
# for hledger-ui:
- brick-1.0
- bimap-0.5.0
- text-zipper-0.12
- vty-5.36
# for hledger-web:
# for Shake.hs:
ghc-options:
"$locals": -fplugin Debug.Breakpoint

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,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

@ -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,12 @@
--- a/stack98.yaml 2025-07-08 09:29:33.086073888 +0100
+++ b/stack98.yaml 2025-07-08 09:29:49.199125121 +0100
@@ -3,6 +3,9 @@
resolver: lts-23.11
packages:
+- basement
+- memory
+- cborg
- hledger-lib
- hledger
- hledger-ui

View file

@ -1,6 +1,6 @@
# Template file for 'hledger'
pkgname=hledger
version=1.27.1
version=1.43.2
revision=1
build_style=haskell-stack
makedepends="zlib-devel ncurses-devel"
@ -9,10 +9,25 @@ maintainer="Inokentiy Babushkin <twk@twki.de>"
license="GPL-3.0-or-later"
homepage="https://hledger.org/"
changelog="https://hackage.haskell.org/package/hledger-${version}/changelog"
distfiles="https://github.com/simonmichael/hledger/archive/${version}.tar.gz"
checksum=218f6005b7b30308cc43523dc7b61c818bb649abc217a6c8803e8f82b408d239
distfiles="https://github.com/simonmichael/hledger/archive/${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="60b74c70ddfc6b84ca87debd2ac302aac754da3c0d9089821182e56796cb841e
7fb77e249aef76ba5aed3059d556800ce02b614597c488ba01f0a16449146300
fd4eb6f638e24b81b4e6cdd68772a531726f2f67686c8969d3407d82f7862e3e
17fe070c38fc498cab49bcb9d6215b7747d53bedf96502e9bcce9cad73b9c797"
nopie_files="/usr/bin/hledger"
nocross=yes # Can't yet cross compile Haskell
skip_extraction="basement-0.0.16.tar.gz memory-0.18.0.tar.gz cborg-0.2.10.0.tar.gz"
export STACK_YAML=stack98.yaml
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 hledger/hledger.1

View file

@ -1,16 +1,16 @@
# Template file for 'hlint'
pkgname=hlint
version=3.3.6
version=3.10
revision=1
build_style=haskell-stack
stackage="lts-19.0"
build_style=cabal
cabal_index_state="2025-02-02T20:29:37Z"
makedepends="ncurses-devel"
short_desc="Haskell source code suggestions"
maintainer="Inokentiy Babushkin <twk@twki.de>"
license="BSD-3-Clause"
homepage="https://github.com/ndmitchell/hlint"
distfiles="https://github.com/ndmitchell/${pkgname}/archive/v${version}.tar.gz"
checksum=7d536c03f77a0c259efb2b00b525ef34578ca8a4a95ccb412708e8c7172e2e6a
checksum=e2a43c6e3981a182fcf4abcb83e2aad948bf8475c570011fb31a902b64bcec4a
nocross=yes # Can't yet cross compile Haskell
nopie_files="/usr/bin/hlint"

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

@ -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

@ -1,18 +1,31 @@
# Template file for 'hoogle'
pkgname=hoogle
version=5.0.18.3
version=5.0.18.4
revision=1
build_style=haskell-stack
stackage="lts-19.0"
stackage="lts-23.26"
makedepends="zlib-devel"
short_desc="Haskell API search engine"
maintainer="Inokentiy Babushkin <twk@twki.de>"
license="BSD-3-Clause"
homepage="https://hoogle.haskell.org/"
distfiles="https://github.com/ndmitchell/${pkgname}/archive/v${version}.tar.gz"
checksum=a2765fcbaf99fe67a64ef29fe50e69fb380cce07807cddeb0836c148b1ae472b
distfiles="https://github.com/ndmitchell/${pkgname}/archive/v${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="f42e1da527d3217e1adbb82c9611b945341b76b1fc85f47f9c04d711c73baf95
7fb77e249aef76ba5aed3059d556800ce02b614597c488ba01f0a16449146300
fd4eb6f638e24b81b4e6cdd68772a531726f2f67686c8969d3407d82f7862e3e
17fe070c38fc498cab49bcb9d6215b7747d53bedf96502e9bcce9cad73b9c797"
nopie_files="/usr/bin/hoogle"
nocross=yes # Can't yet cross compile Haskell
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() {
vlicense LICENSE

View file

@ -1,17 +1,15 @@
# Template file for 'kmonad'
pkgname=kmonad
reverts="65b501defdd0049563752f8af8c8c57f5a1ae38b_1"
_githash=65b501defdd0049563752f8af8c8c57f5a1ae38b
version=0.4.1.20220321
version=0.4.4
revision=1
build_style=haskell-stack
stackage=lts-19.0
stackage=lts-23.26
short_desc="Keyboard remapping utility providing qmk-like functionality"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://github.com/david-janssen/kmonad"
distfiles="${homepage}/archive/${_githash}.tar.gz"
checksum=2b0cb0c5d1575bf61b1c442476ad24103028c309d103fedb56214a3bb30f8c0f
homepage="https://github.com/kmonad/kmonad"
distfiles="https://github.com/kmonad/kmonad/archive/refs/tags/${version}.tar.gz"
checksum=ce8d0a713f26b5ab6a216ea20ef9ec39e317dfa4ec70a51ca2b7df0c13a64786
nopie_files="/usr/bin/kmonad"
nocross=yes

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

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,38 @@
diff -ru data-bword-old/src/Data/BinaryWord.hs data-bword/src/Data/BinaryWord.hs
--- a/data-bword/src/Data/BinaryWord.hs 2001-09-09 02:46:40.000000000 +0100
+++ b/data-bword/src/Data/BinaryWord.hs 2025-07-09 15:54:46.655592632 +0100
@@ -26,7 +26,7 @@
#if __GLASGOW_HASKELL__ >= 705
import GHC.Prim (plusWord2#, timesWord2#)
# if __GLASGOW_HASKELL__ >= 904
-import GHC.Prim (word64ToWord#, wordToWord64#)
+import GHC.Prim (word32ToWord#, wordToWord32#, word64ToWord#, wordToWord64#)
# endif
# if WORD_SIZE_IN_BITS == 32
import GHC.Word (Word32(..))
@@ -217,9 +217,9 @@
{-# INLINE signedWord #-}
#if __GLASGOW_HASKELL__ >= 705 && WORD_SIZE_IN_BITS == 32
unwrappedAdd (W32# x) (W32# y) = hi `seq` lo `seq` (hi, lo)
- where !(# hi', lo' #) = plusWord2# x y
- lo = W32# lo'
- hi = W32# hi'
+ where !(# hi', lo' #) = plusWord2# (word32ToWord# x) (word32ToWord# y)
+ lo = W32# (wordToWord32# lo')
+ hi = W32# (wordToWord32# hi')
#else
unwrappedAdd x y = hi `seq` lo `seq` (hi, lo)
where s = fromIntegral x + fromIntegral y ∷ Word64
@@ -229,9 +229,9 @@
{-# INLINE unwrappedAdd #-}
#if __GLASGOW_HASKELL__ >= 705 && WORD_SIZE_IN_BITS == 32
unwrappedMul (W32# x) (W32# y) = hi `seq` lo `seq` (hi, lo)
- where !(# hi', lo' #) = timesWord2# x y
- lo = W32# lo'
- hi = W32# hi'
+ where !(# hi', lo' #) = timesWord2# (word32ToWord# x) (word32ToWord# y)
+ lo = W32# (wordToWord32# lo')
+ hi = W32# (wordToWord32# hi')
#else
unwrappedMul x y = hi `seq` lo `seq` (hi, lo)
where p = fromIntegral x * fromIntegral y ∷ Word64

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,8 @@
--- a/cabal.project 2025-07-07 17:29:28.447471490 +0100
+++ b/cabal.project 2025-07-07 17:29:48.730469893 +0100
@@ -1,4 +1,4 @@
-packages: postgrest.cabal
+packages: ./basement ./memory ./data-bword postgrest.cabal
tests: true
package *
ghc-options: -split-sections

View file

@ -1,35 +1,32 @@
# Template file for 'postgrest'
pkgname=postgrest
version=10.2.0
version=13.0.4
revision=1
hostmakedepends="cabal-install postgresql-libs-devel"
build_style=cabal
makedepends="zlib-devel postgresql-libs-devel"
short_desc="REST API for any Postgres database"
maintainer="Piotr Wójcik <chocimier@tlen.pl>"
license="MIT"
homepage="https://postgrest.org/"
distfiles="https://github.com/PostgREST/postgrest/archive/v${version}.tar.gz"
checksum=23d63292d50d303bf61154061704f642dd3d699367e2ccb159ec7604f2848487
distfiles="https://github.com/PostgREST/postgrest/archive/v${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/data-bword-0.1.0.2/data-bword-0.1.0.2.tar.gz"
checksum="515ea77c049ef69f4553940ef0f13018dc2b72792195ec11a2020fe8914ceab9
7fb77e249aef76ba5aed3059d556800ce02b614597c488ba01f0a16449146300
fd4eb6f638e24b81b4e6cdd68772a531726f2f67686c8969d3407d82f7862e3e
d64880e7d6c7a2d635d7e79552888f415a417379ee637a29321abf08187e9635"
nocross="cabal does not support cross compilation"
nopie=yes # ghc is currently built without PIE support
skip_extraction="basement-0.0.16.tar.gz memory-0.18.0.tar.gz data-bword-0.1.0.2.tar.gz"
make_check=no # tests require running postgres instance
_cabal_opts="-g"
if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
_cabal_opts+=" --ghc-option -latomic"
fi
if [ "$XBPS_MAKEJOBS" ]; then
_cabal_opts+=" --jobs=$XBPS_MAKEJOBS"
fi
do_build() {
cabal update $_cabal_opts
cabal build $_cabal_opts
mv dist-newstyle/build/*/*/postgrest-${version}/x/postgrest/build/postgrest/postgrest postgrest
post_extract() {
vsrcextract -C basement basement-0.0.16.tar.gz
vsrcextract -C memory memory-0.18.0.tar.gz
vsrcextract -C data-bword data-bword-0.1.0.2.tar.gz
}
do_install() {
vbin postgrest
post_install() {
vlicense LICENSE
}

View file

@ -1,9 +1,9 @@
# Template file for 'shellcheck'
pkgname=shellcheck
version=0.10.0
revision=1
revision=2
build_style=haskell-stack
stackage="lts-19.0"
stackage="lts-23.26"
hostmakedepends="pandoc"
short_desc="Static analysis tool for shell scripts"
maintainer="Orphaned <orphan@voidlinux.org>"

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,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

@ -1,46 +0,0 @@
commit 09e233ed73aa3335642f97c080ef27e42047c527
Author: q66 <daniel@octaforge.org>
Date: Fri Mar 11 04:37:15 2022 +0100
constrain aeson to prevent build failures
diff --git a/stack.cabal b/stack.cabal
index dba5bf0..0195f2c 100644
--- a/stack.cabal
+++ b/stack.cabal
@@ -231,7 +231,7 @@ library
build-depends:
Cabal >=3.2.1.0,
- aeson >=1.5.6.0,
+ aeson >=1.5.6.0 && <1.6,
annotated-wl-pprint >=0.7.0,
ansi-terminal >=0.10.3,
array >=0.5.4.0,
@@ -357,7 +357,7 @@ executable stack
build-depends:
Cabal >=3.2.1.0,
- aeson >=1.5.6.0,
+ aeson >=1.5.6.0 && <1.6,
annotated-wl-pprint >=0.7.0,
ansi-terminal >=0.10.3,
array >=0.5.4.0,
@@ -485,7 +485,7 @@ executable stack-integration-test
build-depends:
Cabal >=3.2.1.0,
- aeson >=1.5.6.0,
+ aeson >=1.5.6.0 && <1.6,
annotated-wl-pprint >=0.7.0,
ansi-terminal >=0.10.3,
array >=0.5.4.0,
@@ -621,7 +621,7 @@ test-suite stack-test
build-depends:
Cabal >=3.2.1.0,
QuickCheck >=2.14.2,
- aeson >=1.5.6.0,
+ aeson >=1.5.6.0 && <1.6,
annotated-wl-pprint >=0.7.0,
ansi-terminal >=0.10.3,
array >=0.5.4.0,

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,20 +0,0 @@
--- a/src/Stack/Build/Execute.hs
+++ b/src/Stack/Build/Execute.hs
@@ -26,7 +26,7 @@ import Control.Concurrent.Exec
import Control.Concurrent.STM (check)
import Stack.Prelude hiding (Display (..))
import Crypto.Hash
-import Data.Attoparsec.Text hiding (try)
+import Data.Attoparsec.Text as P hiding (try)
import qualified Data.ByteArray as Mem (convert)
import qualified Data.ByteString as S
import qualified Data.ByteString.Builder
@@ -2160,7 +2160,7 @@ mungeBuildOutput excludeTHLoading makeAb
lineCol = char ':'
>> choice
[ num >> char ':' >> num >> optional (char '-' >> num) >> return ()
- , char '(' >> num >> char ',' >> num >> string ")-(" >> num >> char ',' >> num >> char ')' >> return ()
+ , char '(' >> num >> char ',' >> num >> P.string ")-(" >> num >> char ',' >> num >> char ')' >> return ()
]
>> char ':'
>> return ()

View file

@ -1,16 +0,0 @@
src/Stack/FileWatch.hs:29:49: error: Not in scope: confUsePolling
|
29 | fileWatchPoll = fileWatchConf $ defaultConfig { confUsePolling = True }
| ^^^^^^^^^^^^^^
--- a/stack.cabal
+++ b/stack.cabal
@@ -256,7 +256,7 @@ library
file-embed >=0.0.14.0,
filelock >=0.1.1.5,
filepath >=1.4.2.1,
- fsnotify >=0.3.0.1,
+ fsnotify >=0.3.0.1 && <0.4.0.0,
generic-deriving >=1.13.1,
hackage-security >=0.6.0.1,
hashable >=1.3.0.0,

View file

@ -1,212 +0,0 @@
From cb7e56842a25f93142545fad21306a7c1750fbbf Mon Sep 17 00:00:00 2001
From: Brandon Chinn <brandon@leapyear.io>
Date: Fri, 4 Jun 2021 16:26:22 -0700
Subject: [PATCH 1/6] Use Cabal 3.4.0.0
---
stack.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/stack.yaml b/stack.yaml
index 005bd19f4..9472509be 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -20,6 +20,9 @@ flags:
ghc-options:
"$locals": -fhide-source-paths
+extra-deps:
+- Cabal-3.4.0.0
+
drop-packages:
# See https://github.com/commercialhaskell/stack/pull/4712
- cabal-install
From 11e11ab0edeba033b40a7fc62434be58dea82ce2 Mon Sep 17 00:00:00 2001
From: Brandon Chinn <brandon@leapyear.io>
Date: Fri, 4 Jun 2021 16:40:56 -0700
Subject: [PATCH 2/6] Fix Flag => PackageFlag
---
src/Stack/BuildPlan.hs | 2 +-
src/Stack/Package.hs | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/Stack/BuildPlan.hs b/src/Stack/BuildPlan.hs
index 36f82236e..c5c80efc6 100644
--- a/src/Stack/BuildPlan.hs
+++ b/src/Stack/BuildPlan.hs
@@ -224,7 +224,7 @@ selectPackageBuildPlan platform compiler pool gpd =
flagCombinations :: NonEmpty [(FlagName, Bool)]
flagCombinations = mapM getOptions (genPackageFlags gpd)
where
- getOptions :: C.Flag -> NonEmpty (FlagName, Bool)
+ getOptions :: C.PackageFlag -> NonEmpty (FlagName, Bool)
getOptions f
| flagManual f = (fname, flagDefault f) :| []
| flagDefault f = (fname, True) :| [(fname, False)]
diff --git a/src/Stack/Package.hs b/src/Stack/Package.hs
index 4db50d2a4..d9bca7af5 100644
--- a/src/Stack/Package.hs
+++ b/src/Stack/Package.hs
@@ -128,7 +128,7 @@ resolvePackage packageConfig gpkg =
(resolvePackageDescription packageConfig gpkg)
packageFromPackageDescription :: PackageConfig
- -> [D.Flag]
+ -> [PackageFlag]
-> PackageDescriptionPair
-> Package
packageFromPackageDescription packageConfig pkgFlags (PackageDescriptionPair pkgNoMod pkg) =
@@ -935,9 +935,9 @@ resolvePackageDescription packageConfig (GenericPackageDescription desc defaultF
-- | Make a map from a list of flag specifications.
--
-- What is @flagManual@ for?
-flagMap :: [Flag] -> Map FlagName Bool
+flagMap :: [PackageFlag] -> Map FlagName Bool
flagMap = M.fromList . map pair
- where pair :: Flag -> (FlagName, Bool)
+ where pair :: PackageFlag -> (FlagName, Bool)
pair = flagName &&& flagDefault
data ResolveConditions = ResolveConditions
@@ -986,7 +986,7 @@ resolveConditions rc addDeps (CondNode lib deps cs) = basic <> children
case v of
OS os -> os == rcOS rc
Arch arch -> arch == rcArch rc
- Flag flag ->
+ PackageFlag flag ->
fromMaybe False $ M.lookup flag (rcFlags rc)
-- NOTE: ^^^^^ This should never happen, as all flags
-- which are used must be declared. Defaulting to
From 8facd731ec3f2bbc15a083750740929167b33bb2 Mon Sep 17 00:00:00 2001
From: Brandon Chinn <brandon@leapyear.io>
Date: Fri, 4 Jun 2021 16:55:30 -0700
Subject: [PATCH 3/6] Fix CabalSpecVersion
---
src/Stack/Package.hs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/Stack/Package.hs b/src/Stack/Package.hs
index d9bca7af5..fca039140 100644
--- a/src/Stack/Package.hs
+++ b/src/Stack/Package.hs
@@ -32,6 +32,7 @@ import Data.List (find, isPrefixOf, unzip)
import qualified Data.Map.Strict as M
import qualified Data.Set as S
import qualified Data.Text as T
+import Distribution.CabalSpecVersion (CabalSpecVersion, cabalSpecMinimumLibraryVersion)
import Distribution.Compiler
import Distribution.ModuleName (ModuleName)
import qualified Distribution.ModuleName as Cabal
@@ -190,7 +191,7 @@ packageFromPackageDescription packageConfig pkgFlags (PackageDescriptionPair pkg
(library pkg)
, packageBuildType = buildType pkg
, packageSetupDeps = msetupDeps
- , packageCabalSpec = either orLaterVersion id $ specVersionRaw pkg
+ , packageCabalSpec = orLaterVersion $ mkVersion $ cabalSpecMinimumLibraryVersion $ specVersion pkg
}
where
extraLibNames = S.union subLibNames foreignLibNames
@@ -696,7 +697,7 @@ packageDescModulesAndFiles pkg = do
-- | Resolve globbing of files (e.g. data files) to absolute paths.
resolveGlobFiles
- :: Version -- ^ cabal file version
+ :: CabalSpecVersion -- ^ cabal file version
-> [String]
-> RIO Ctx (Set (Path Abs File))
resolveGlobFiles cabalFileVersion =
From 004f14652409b7d0645215d354b2e599eb7f76bc Mon Sep 17 00:00:00 2001
From: Brandon Chinn <brandon@leapyear.io>
Date: Fri, 4 Jun 2021 16:55:40 -0700
Subject: [PATCH 4/6] Fix GenericPackageDescription
---
src/Stack/Build.hs | 2 +-
src/Stack/Package.hs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Stack/Build.hs b/src/Stack/Build.hs
index 23b9a9719..856903bed 100644
--- a/src/Stack/Build.hs
+++ b/src/Stack/Build.hs
@@ -358,7 +358,7 @@ checkComponentsBuildable lps =
checkSubLibraryDependencies :: HasLogFunc env => [ProjectPackage] -> RIO env ()
checkSubLibraryDependencies proj = do
forM_ proj $ \p -> do
- C.GenericPackageDescription _ _ lib subLibs foreignLibs exes tests benches <- liftIO $ cpGPD . ppCommon $ p
+ C.GenericPackageDescription _ _ _ lib subLibs foreignLibs exes tests benches <- liftIO $ cpGPD . ppCommon $ p
let dependencies = concatMap getDeps subLibs <>
concatMap getDeps foreignLibs <>
diff --git a/src/Stack/Package.hs b/src/Stack/Package.hs
index fca039140..39aad4d2f 100644
--- a/src/Stack/Package.hs
+++ b/src/Stack/Package.hs
@@ -863,7 +863,7 @@ data PackageDescriptionPair = PackageDescriptionPair
resolvePackageDescription :: PackageConfig
-> GenericPackageDescription
-> PackageDescriptionPair
-resolvePackageDescription packageConfig (GenericPackageDescription desc defaultFlags mlib subLibs foreignLibs' exes tests benches) =
+resolvePackageDescription packageConfig (GenericPackageDescription desc _ defaultFlags mlib subLibs foreignLibs' exes tests benches) =
PackageDescriptionPair
{ pdpOrigBuildable = go False
, pdpModifiedBuildable = go True
From 820797b566ef981936907f4d19658259d4a635a8 Mon Sep 17 00:00:00 2001
From: Brandon Chinn <brandon@leapyear.io>
Date: Fri, 4 Jun 2021 17:01:01 -0700
Subject: [PATCH 5/6] Fix generatePackageVersionMacros
---
src/Stack/Build/Execute.hs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Stack/Build/Execute.hs b/src/Stack/Build/Execute.hs
index 1e381dd21..aedd7fee5 100644
--- a/src/Stack/Build/Execute.hs
+++ b/src/Stack/Build/Execute.hs
@@ -1214,7 +1214,7 @@ withSingleContext ActionContext {..} ee@ExecuteEnv {..} task@Task {..} allDeps m
let macroDeps = mapMaybe snd matchedDeps
cppMacrosFile = setupDir </> relFileSetupMacrosH
cppArgs = ["-optP-include", "-optP" ++ toFilePath cppMacrosFile]
- writeBinaryFileAtomic cppMacrosFile (encodeUtf8Builder (T.pack (C.generatePackageVersionMacros macroDeps)))
+ writeBinaryFileAtomic cppMacrosFile (encodeUtf8Builder (T.pack (C.generatePackageVersionMacros (packageVersion package) macroDeps)))
return (packageDBArgs ++ depsArgs ++ cppArgs)
-- This branch is usually taken for builds, and
From 336ab515e30f03c274f89ebe1cbc6aa1e597c2a4 Mon Sep 17 00:00:00 2001
From: Brandon Chinn <brandon@leapyear.io>
Date: Fri, 4 Jun 2021 17:04:16 -0700
Subject: [PATCH 6/6] Fix ModuleReexport
---
src/Stack/Script.hs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Stack/Script.hs b/src/Stack/Script.hs
index 6bb67c049..9ebd2173d 100644
--- a/src/Stack/Script.hs
+++ b/src/Stack/Script.hs
@@ -18,6 +18,7 @@ import Distribution.Compiler (CompilerFlavor (..))
import Distribution.ModuleName (ModuleName)
import qualified Distribution.PackageDescription as PD
import qualified Distribution.Types.CondTree as C
+import qualified Distribution.Types.ModuleReexport as ModuleReexport
import Distribution.Types.PackageName (mkPackageName)
import Distribution.Types.VersionRange (withinRange)
import Distribution.System (Platform (..))
@@ -280,7 +281,7 @@ allExposedModules gpd = do
mlibrary = snd . C.simplifyCondTree checkCond <$> PD.condLibrary gpd
pure $ case mlibrary of
Just lib -> PD.exposedModules lib ++
- map PD.moduleReexportName (PD.reexportedModules lib)
+ map ModuleReexport.moduleReexportName (PD.reexportedModules lib)
Nothing -> mempty
-- | The Stackage project introduced the concept of hidden packages,

View file

@ -1,26 +0,0 @@
Adapted from: https://github.com/commercialhaskell/stack/commit/4afcf774d2a821e69b6a1afca67bf34341c84e85
--- a/src/Options/Applicative/Complicated.hs
+++ b/src/Options/Applicative/Complicated.hs
@@ -136,20 +136,9 @@ complicatedParser commandMetavar commonP
(,) <$>
commonParser <*>
case runWriter (runExceptT commandParser) of
- (Right (),d) -> hsubparser' commandMetavar d
+ (Right (), m) -> hsubparser (m <> metavar commandMetavar)
(Left b,_) -> pure (b,mempty)
--- | Subparser with @--help@ argument. Borrowed with slight modification
--- from Options.Applicative.Extra.
-hsubparser' :: String -> Mod CommandFields a -> Parser a
-hsubparser' commandMetavar m = mkParser d g rdr
- where
- Mod _ d g = metavar commandMetavar `mappend` m
- (groupName, cmds, subs) = mkCommand m
- rdr = CmdReader groupName cmds (fmap add_helper . subs)
- add_helper pinfo = pinfo
- { infoParser = infoParser pinfo <**> helpOption }
-
-- | Non-hidden help option.
helpOption :: Parser (a -> a)
helpOption =

View file

@ -1,40 +0,0 @@
constrain http-download to prevent build failures
--- a/stack.cabal
+++ b/stack.cabal
@@ -267,7 +267,7 @@ library
http-client >=0.6.4.1,
http-client-tls >=0.3.5.3,
http-conduit >=2.3.8,
- http-download >=0.2.0.0,
+ http-download >=0.2.0.0 && <0.2.1,
http-types >=0.12.3,
memory >=0.15.0,
microlens >=0.4.11.2,
@@ -393,7 +393,7 @@ executable stack
http-client >=0.6.4.1,
http-client-tls >=0.3.5.3,
http-conduit >=2.3.8,
- http-download >=0.2.0.0,
+ http-download >=0.2.0.0 && <0.2.1,
http-types >=0.12.3,
memory >=0.15.0,
microlens >=0.4.11.2,
@@ -522,7 +522,7 @@ executable stack-integration-test
http-client >=0.6.4.1,
http-client-tls >=0.3.5.3,
http-conduit >=2.3.8,
- http-download >=0.2.0.0,
+ http-download >=0.2.0.0 && <0.2.1,
http-types >=0.12.3,
memory >=0.15.0,
microlens >=0.4.11.2,
@@ -658,7 +658,7 @@ test-suite stack-test
http-client >=0.6.4.1,
http-client-tls >=0.3.5.3,
http-conduit >=2.3.8,
- http-download >=0.2.0.0,
+ http-download >=0.2.0.0 && <0.2.1,
http-types >=0.12.3,
memory >=0.15.0,
microlens >=0.4.11.2,

View file

@ -1,40 +0,0 @@
constrain pantry to prevent build failures
--- a/stack.cabal
+++ b/stack.cabal
@@ -279,7 +279,7 @@ library
network-uri >=2.6.4.1,
open-browser >=0.2.1.0,
optparse-applicative >=0.14.3.0,
- pantry >=0.5.3,
+ pantry >=0.5.3 && <0.6.0,
path >=0.7.0,
path-io >=1.6.3,
persistent >=2.11.0.4 && <2.14.0.0,
@@ -405,7 +405,7 @@ executable stack
network-uri >=2.6.4.1,
open-browser >=0.2.1.0,
optparse-applicative >=0.14.3.0,
- pantry >=0.5.3,
+ pantry >=0.5.3 && <0.6.0,
path >=0.7.0,
path-io >=1.6.3,
persistent >=2.11.0.4 && <2.14.0.0,
@@ -535,7 +535,7 @@ executable stack-integration-test
open-browser >=0.2.1.0,
optparse-applicative >=0.14.3.0,
optparse-generic >=1.3.1,
- pantry >=0.5.3,
+ pantry >=0.5.3 && <0.6.0,
path >=0.7.0,
path-io >=1.6.3,
persistent >=2.11.0.4 && <2.14.0.0,
@@ -670,7 +670,7 @@ test-suite stack-test
network-uri >=2.6.4.1,
open-browser >=0.2.1.0,
optparse-applicative >=0.14.3.0,
- pantry >=0.5.3,
+ pantry >=0.5.3 && <0.6.0,
path >=0.7.0,
path-io >=1.6.3,
persistent >=2.11.0.4 && <2.14.0.0,

View file

@ -1,46 +0,0 @@
commit 188d7ece06ee06ed6ccaf0df0c46285bd43898f4
Author: q66 <daniel@octaforge.org>
Date: Thu Apr 28 05:02:09 2022 +0200
constrain persistent to fix build
diff --git a/stack.cabal b/stack.cabal
index dba5bf0..e221321 100644
--- a/stack.cabal
+++ b/stack.cabal
@@ -281,7 +281,7 @@ library
pantry >=0.5.3,
path >=0.7.0,
path-io >=1.6.3,
- persistent >=2.11.0.4,
+ persistent >=2.11.0.4 && <2.14.0.0,
persistent-sqlite >=2.11.1.0,
persistent-template >=2.9.1.0,
pretty >=1.1.3.6,
@@ -407,7 +407,7 @@ executable stack
pantry >=0.5.3,
path >=0.7.0,
path-io >=1.6.3,
- persistent >=2.11.0.4,
+ persistent >=2.11.0.4 && <2.14.0.0,
persistent-sqlite >=2.11.1.0,
persistent-template >=2.9.1.0,
pretty >=1.1.3.6,
@@ -537,7 +537,7 @@ executable stack-integration-test
pantry >=0.5.3,
path >=0.7.0,
path-io >=1.6.3,
- persistent >=2.11.0.4,
+ persistent >=2.11.0.4 && <2.14.0.0,
persistent-sqlite >=2.11.1.0,
persistent-template >=2.9.1.0,
pretty >=1.1.3.6,
@@ -672,7 +672,7 @@ test-suite stack-test
pantry >=0.5.3,
path >=0.7.0,
path-io >=1.6.3,
- persistent >=2.11.0.4,
+ persistent >=2.11.0.4 && <2.14.0.0,
persistent-sqlite >=2.11.1.0,
persistent-template >=2.9.1.0,
pretty >=1.1.3.6,

View file

@ -1,32 +0,0 @@
--- a/src/Stack/Setup.hs
+++ b/src/Stack/Setup.hs
@@ -91,6 +91,7 @@
import System.FilePath (searchPathSeparator)
import qualified System.FilePath as FP
import System.Permissions (setFileExecutable)
+import System.Endian (getSystemEndianness, Endianness (..))
import System.Uname (getRelease)
import Data.List.Split (splitOn)
@@ -1241,6 +1242,11 @@
Platform X86_64 Cabal.Windows -> return "windows64"
Platform Arm Cabal.Linux -> return "linux-armv7"
Platform AArch64 Cabal.Linux -> return "linux-aarch64"
+ Platform PPC Cabal.Linux -> return "linux-powerpc"
+ Platform PPC64 Cabal.Linux ->
+ case getSystemEndianness of
+ LittleEndian -> return "linux-powerpc64le"
+ BigEndian -> return "linux-powerpc64"
Platform Sparc Cabal.Linux -> return "linux-sparc"
Platform arch os -> throwM $ UnsupportedSetupCombo os arch
--- a/stack.cabal
+++ b/stack.cabal
@@ -246,6 +246,7 @@
conduit >=1.3.4.1,
conduit-extra >=1.3.5,
containers >=0.6.2.1,
+ cpu >=0.1.2,
cryptonite >=0.27,
cryptonite-conduit >=0.2.2,
deepseq >=1.4.4.0,

View file

@ -0,0 +1,8 @@
--- a/cabal.project 2025-07-05 18:24:05.053213076 +0100
+++ b/cabal.project 2025-07-05 18:12:23.016337449 +0100
@@ -37,4 +37,4 @@
--
with-compiler: ghc-9.8.4
import: cabal.config
-packages: .
+packages: ./basement ./memory ./cborg .

View file

@ -1,40 +0,0 @@
constrain unix-compat version to prevent build failures
--- a/stack.cabal
+++ b/stack.cabal
@@ -307,7 +308,7 @@ library
transformers >=0.5.6.2,
typed-process >=0.2.6.0,
unicode-transforms >=0.3.7.1,
- unix-compat >=0.5.3,
+ unix-compat >=0.5.3 && < 0.7,
unliftio >=0.2.18,
unordered-containers >=0.2.14.0,
vector >=0.12.1.2,
@@ -434,7 +435,7 @@ executable stack
transformers >=0.5.6.2,
typed-process >=0.2.6.0,
unicode-transforms >=0.3.7.1,
- unix-compat >=0.5.3,
+ unix-compat >=0.5.3 && < 0.7,
unliftio >=0.2.18,
unordered-containers >=0.2.14.0,
vector >=0.12.1.2,
@@ -563,7 +564,7 @@ executable stack-integration-test
transformers >=0.5.6.2,
typed-process >=0.2.6.0,
unicode-transforms >=0.3.7.1,
- unix-compat >=0.5.3,
+ unix-compat >=0.5.3 && < 0.7,
unliftio >=0.2.18,
unordered-containers >=0.2.14.0,
vector >=0.12.1.2,
@@ -701,7 +702,7 @@ test-suite stack-test
transformers >=0.5.6.2,
typed-process >=0.2.6.0,
unicode-transforms >=0.3.7.1,
- unix-compat >=0.5.3,
+ unix-compat >=0.5.3 && < 0.7,
unliftio >=0.2.18,
unordered-containers >=0.2.14.0,
vector >=0.12.1.2,

View file

@ -1,31 +1,38 @@
# Template file for 'stack'
pkgname=stack
version=2.7.5
revision=2
_stackage="lts-19.0"
hostmakedepends="cabal-install pkg-config unzip"
makedepends="zlib-devel pcre-devel"
version=3.7.1
revision=1
build_style=cabal
cabal_index_state="2025-06-29T20:30:08Z"
make_build_args="-f disable-git-info"
makedepends="zlib-devel"
depends="git gmp-devel iana-etc"
short_desc="Cross-platform program for developing Haskell projects"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="BSD-3-Clause"
homepage="https://haskellstack.org"
# cborg will likely be fixed in the next release and can then be removed here.
# https://github.com/well-typed/cborg/pull/322
# The other two are unmaintained and archived, the only way they get fixed
# is if the dependency is removed from stack.
distfiles="https://hackage.haskell.org/package/${pkgname}-${version}/${pkgname}-${version}.tar.gz
https://www.stackage.org/${_stackage}/cabal.config>cabal.config-${_stackage}"
checksum="9ddd44c2a62e9404194d69e7dc1c94e707910620316b66d6ac0b3201a8f37e80
2e836f769693cde2592963f200c97a3e8a87eb58777fa4289d7c3c671f971186"
skip_extraction="cabal.config-${_stackage}"
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="412a7a8d654ba38b29ea88f473c771d612c1836af80c0293fe092faa430ac80e
7fb77e249aef76ba5aed3059d556800ce02b614597c488ba01f0a16449146300
fd4eb6f638e24b81b4e6cdd68772a531726f2f67686c8969d3407d82f7862e3e
17fe070c38fc498cab49bcb9d6215b7747d53bedf96502e9bcce9cad73b9c797"
nocross=yes
nopie_files="/usr/bin/stack"
skip_extraction="basement-0.0.16.tar.gz memory-0.18.0.tar.gz cborg-0.2.10.0.tar.gz"
do_build() {
cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/cabal.config-${_stackage} cabal.config
HOME=$PWD cabal update
HOME=$PWD cabal new-build ${makejobs} --flag disable-git-info \
--constraint 'lukko -ofd-locking' # https://github.com/haskell/cabal/issues/7313
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
}
do_install() {
eval vbin dist-newstyle/build/*/*/*/build/stack/stack
post_install() {
vlicense LICENSE
}

View file

@ -1,6 +0,0 @@
resolver: lts-19.0
packages:
- .
extra-deps:
- iwlib-0.1.0
- netlink-1.1.1.0

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,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

@ -0,0 +1,14 @@
diff -ru gtk2hs-buildtools-old/c2hs/toplevel/C2HSConfig.hs gtk2hs-buildtools/c2hs/toplevel/C2HSConfig.hs
--- a/gtk2hs-buildtools/c2hs/toplevel/C2HSConfig.hs 2025-07-06 12:48:16.827097351 +0100
+++ b/gtk2hs-buildtools/c2hs/toplevel/C2HSConfig.hs 2025-07-06 12:50:54.803997950 +0100
@@ -70,8 +70,8 @@
cppopts :: [String]
cppopts = case (os,cpp) of
("openbsd","cpp") -> ["-xc", "-w"]
- (_,"cpp") -> ["-x", "c", "-w"]
- (_,"gcc") -> ["-E", "-x", "c", "-w"]
+ (_,"cpp") -> ["-x", "c", "-w", "-std=c99", "-D_Noreturn=", "-D_Nullable=", "-D_Nonnull="]
+ (_,"gcc") -> ["-E", "-x", "c", "-w", "-std=c99", "-D_Noreturn=", "-D_Nullable=", "-D_Nonnull="]
_ -> []
-- C preprocessor option for including only definitions (EXPORTED)

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

@ -1,11 +1,12 @@
# Template file for 'xmobar'
pkgname=xmobar
version=0.42
version=0.50
revision=1
build_style=haskell-stack
build_style=cabal
cabal_index_state=2025-07-05T14:01:16Z
hostmakedepends="pkg-config"
makedepends="libX11-devel libXinerama-devel libXrandr-devel libXScrnSaver-devel
$(vopt_if xft libXft-devel)
glib-devel cairo-devel pango-devel
$(vopt_if iwlib wireless_tools-devel)
$(vopt_if xpm libXpm-devel)
$(vopt_if dbus libxml2-devel $(vopt_if mpris libxml2-devel))
@ -14,15 +15,29 @@ short_desc="Minimalistic Text Based Status Bar"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://xmobar.org"
distfiles="https://hackage.haskell.org/package/${pkgname}-${version}/${pkgname}-${version}.tar.gz"
checksum=53f4a06d79c3db32ef1a498ec7b764b17d03ebf9bca3126c6b8259595492769b
build_options="dbus threaded utf8 xft mpd mpris inotify iwlib alsa datezone
distfiles="https://hackage.haskell.org/package/${pkgname}-${version}/${pkgname}-${version}.tar.gz
https://hackage.haskell.org/package/gtk2hs-buildtools-0.13.12.0/gtk2hs-buildtools-0.13.12.0.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="09249e50546f1eb93888bf1e134d0034d486cadb29a8fde4df097d140e06da08
2308f302b1a55376c715778b89b15d0d7e0cc20c8589b803b5f9010ea2f1e495
7fb77e249aef76ba5aed3059d556800ce02b614597c488ba01f0a16449146300
fd4eb6f638e24b81b4e6cdd68772a531726f2f67686c8969d3407d82f7862e3e
17fe070c38fc498cab49bcb9d6215b7747d53bedf96502e9bcce9cad73b9c797"
build_options="dbus threaded mpd mpris inotify iwlib alsa datezone
xpm uvmeter weather nl80211"
build_options_default="threaded utf8 xft inotify nl80211 datezone weather xpm alsa mpris mpd dbus"
build_options_default="threaded inotify nl80211 datezone weather xpm alsa mpris mpd dbus"
nopie_files="/usr/bin/xmobar"
nocross=yes
skip_extraction="
gtk2hs-buildtools-0.13.12.0.tar.gz
basement-0.0.16.tar.gz
memory-0.18.0.tar.gz
cborg-0.2.10.0.tar.gz"
make_check=no # TODO figure out how hspec works
vopt_hflag() {
echo $(vopt_if $1 "--flag ${pkgname}:with_$1" "--flag ${pkgname}:-with_$1")
echo $(vopt_if $1 "--flags=with_$1" "--flags=-with_$1")
}
mk_string_build_args() {
for optn in $1
@ -31,6 +46,18 @@ mk_string_build_args() {
done
}
make_build_args=$(mk_string_build_args "$build_options")
post_extract() {
vsrcextract -C gtk2hs-buildtools gtk2hs-buildtools-0.13.12.0.tar.gz
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
}
pre_configure() {
echo 'packages: ./gtk2hs-buildtools ./basement ./memory ./cborg .' > cabal.project
}
post_install() {
vlicense license
}