commit:     cf7899db70b1379f1633f88e848a0ca3bcd92f62
Author:     matoro <matoro <AT> users <DOT> noreply <DOT> github <DOT> com>
AuthorDate: Fri Aug 19 00:00:22 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Aug 21 02:25:05 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf7899db

dev-lang/ghc: add big-endian ppc64 binary

This requires a patch to work correctly on BE systems.  Apply the patch
unconditionally since it is already includes the appropriate checks in
the code.  Delete a few lines of commented-out obsolete patches.

Closes: https://bugs.gentoo.org/865311
Thanks-to: Marcus Comstedt <marcus <AT> mc.pp.se>
Closes: https://github.com/gentoo/gentoo/pull/26921
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-lang/ghc/Manifest                              |  1 +
 .../files/ghc-9.0.2-disable-unboxed-arrays.patch   | 39 ++++++++++++++++++++++
 dev-lang/ghc/ghc-9.0.2.ebuild                      | 28 ++++------------
 3 files changed, 46 insertions(+), 22 deletions(-)

diff --git a/dev-lang/ghc/Manifest b/dev-lang/ghc/Manifest
index f6130b71837e..370504e5c02c 100644
--- a/dev-lang/ghc/Manifest
+++ b/dev-lang/ghc/Manifest
@@ -5,5 +5,6 @@ DIST ghc-9.0.2-testsuite.tar.xz 2403564 BLAKE2B 
0e7f6fefb9c972f94073aca8b1514791
 DIST ghc-bin-8.10.6-i686-pc-linux-gnu.tbz2 124324289 BLAKE2B 
afb34984872b35fdedbdedeb8756cc7c33e5b943dba57dd86910b076d483bb643265d0ab0027784dec5dc489eabd65b5ab17474f25fb2ce657925aa0efaa9033
 SHA512 
4be13e6dba298d12a4d49ae4633eec83cfaaaf22b5f8cfca5f5952aa294ae52fb3601490beed3bda5a7f7b6a5bd81e0ecc9fc39e8df836cc8fd377a0d0b783a0
 DIST ghc-bin-8.10.6-x86_64-pc-linux-gnu.tbz2 122871118 BLAKE2B 
527b36abf60390c91f91bc650ee25484d39d377739da87b5b6fd1a752705c1f3bc0ce0c68644657c9a7c1fc9a3b858b9dd7d84b25eab1a89125fccb6eb1f6250
 SHA512 
42b7fae339e82a6078fae8920efea8d0992e4774ea66b100e22dd9df168be57d8bce52558b8501c3c567c40776389d94bde3f17d26d63535140ce26ac16c27e1
 DIST ghc-bin-9.0.2-i686-pc-linux-gnu.tbz2 123509908 BLAKE2B 
45614984803a7bfa266f99d4adb4b5f2ab7b9e5e89c6ecd501296fc99a1d96e798ccb9c832f8dcb15fff9725beb918a7b63e62ff13f59b6506a2ef17930c45d2
 SHA512 
e0b7f4474c16f0763a2f787027fbdfeb3125b48c987fa1196bc189fefad9f0bfa2806da62af46d61ca911f5275b578076e2b326acf39e0894a8daa9deda0843a
+DIST ghc-bin-9.0.2-powerpc64-unknown-linux-gnu.tar.gz 235636284 BLAKE2B 
878ac300cca5d2cbc5cb21dbb347da755b4027cbf63ec77464740854fa8010569de5e03acef67cd877da13665c906b2fd04e24e226e9eb39b57ba979093c732b
 SHA512 
28f096e965abdac9cc370c882639f10285b9073ba5332f7af215eccff948e41c01c3d6bb3bc8e3b4e809e12867a95b49f82dd76e0090b974088f75ab9d1bc199
 DIST ghc-bin-9.0.2-powerpc64le-unknown-linux-gnu.tar.gz 275226316 BLAKE2B 
10ade2359432b0ede7431ee543f0ff47f4b203465d81719da579ad63ca467359eb9fcf7336a12feb6ff75a480f349576ff8ea1b4ebe1094fff228ae4fd00d6e0
 SHA512 
64b4c84d149358b8d3a6cb29a6d3a75af11e7b14e6d910c9789c9949262e4ed2a17f8a0d1e5dd297121957061fe2395d6f43acae6b4ab28851e3cd414cd9c89c
 DIST ghc-bin-9.0.2-x86_64-pc-linux-gnu.tbz2 121536759 BLAKE2B 
4433e2d266f065d2b2944b711d622ec26288a2187ac03562257a671744b44da35110ce16ac6d76f7062a563488885326be073e0ff03c7e48250051c3b4763d96
 SHA512 
2de29a9ddbfd0fac797cdd628f3657ff38e6a153151849508bba75d36f84394ed77750435ff5cc1bdfcd30ef2b6e009bde965bd0a83e0496b5027239642f4b6c

diff --git a/dev-lang/ghc/files/ghc-9.0.2-disable-unboxed-arrays.patch 
b/dev-lang/ghc/files/ghc-9.0.2-disable-unboxed-arrays.patch
new file mode 100644
index 000000000000..599762b95454
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-9.0.2-disable-unboxed-arrays.patch
@@ -0,0 +1,39 @@
+https://gitlab.haskell.org/ghc/packages/containers/-/commit/f5a511f1ff2cf16e710342948792cb8d7576e27c
+https://bugs.gentoo.org/865311
+
+From f5a511f1ff2cf16e710342948792cb8d7576e27c Mon Sep 17 00:00:00 2001
+From: Peter Trommler <ptromm...@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
+---
+ libraries/containers/containers/include/containers.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/libraries/containers/containers/include/containers.h 
b/libraries/containers/containers/include/containers.h
+index cd201ca3..fc2a0e84 100644
+--- a/libraries/containers/containers/include/containers.h     2022-08-16 
07:50:42.844217960 +0200
++++ b/libraries/containers/containers/include/containers.h     2022-08-16 
07:50:49.327446486 +0200
+@@ -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
+-- 
+GitLab
+

diff --git a/dev-lang/ghc/ghc-9.0.2.ebuild b/dev-lang/ghc/ghc-9.0.2.ebuild
index 5f55fd44965a..e0cd53611f2c 100644
--- a/dev-lang/ghc/ghc-9.0.2.ebuild
+++ b/dev-lang/ghc/ghc-9.0.2.ebuild
@@ -32,8 +32,10 @@ BIN_PV=${PV}
 arch_binaries="$arch_binaries amd64? ( 
https://eidetic.codes/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
 #arch_binaries="$arch_binaries ia64?  ( 
https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
 #arch_binaries="$arch_binaries ppc? ( 
https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
-#arch_binaries="$arch_binaries ppc64? ( 
https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
-arch_binaries="$arch_binaries ppc64? ( !big-endian? ( 
https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tar.gz
 ) )"
+arch_binaries="$arch_binaries ppc64? (
+       big-endian? ( 
https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64-unknown-linux-gnu.tar.gz
 )
+       !big-endian? ( 
https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tar.gz
 )
+)"
 #arch_binaries="$arch_binaries sparc? ( 
https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
 arch_binaries="$arch_binaries x86? ( 
https://eidetic.codes/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
 
@@ -49,9 +51,7 @@ yet_binary() {
                amd64) return 0 ;;
                #ia64) return 0 ;;
                #ppc) return 0 ;;
-               ppc64)
-                       use big-endian || return 0
-                       ;;
+               ppc64) return 0 ;;
                #sparc) return 0 ;;
                x86) return 0 ;;
                *) return 1 ;;
@@ -506,30 +506,14 @@ src_prepare() {
 
                eapply "${FILESDIR}"/${PN}-9.0.2-CHOST-prefix.patch
                eapply "${FILESDIR}"/${PN}-9.0.2-darwin.patch
-
-               # Incompatible with ghc-9.0.2-modorigin-semigroup.patch
-               # Below patch should not be needed by ghc-9.2
-               #eapply "${FILESDIR}"/${PN}-9.0.2-modorigin.patch
-
-               # ModUnusable pretty-printing should include the reason
-               #eapply "${FILESDIR}/${PN}-9.0.2-verbose-modunusable.patch"
-
                # Fixes panic when compiling some packages
                # 
https://github.com/gentoo-haskell/gentoo-haskell/issues/1250#issuecomment-1044257595
                # https://gitlab.haskell.org/ghc/ghc/-/issues/21097
                eapply "${FILESDIR}/${PN}-9.0.2-modorigin-semigroup.patch"
-
                # Needed for testing with python-3.10
                use test && eapply 
"${FILESDIR}/${PN}-9.0.2-fix-tests-python310.patch"
-
-               #needs a port?
-               #eapply "${FILESDIR}"/${PN}-8.8.1-revert-CPP.patch
                eapply "${FILESDIR}"/${PN}-8.10.1-allow-cross-bootstrap.patch
-               #eapply "${FILESDIR}"/${PN}-8.10.3-C99-typo-ac270.patch
-
-               # a bunch of crosscompiler patches
-               # needs newer version:
-               #eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
+               eapply "${FILESDIR}"/${PN}-9.0.2-disable-unboxed-arrays.patch
 
                # mingw32 target
                pushd "${S}/libraries/Win32"

Reply via email to