Bug#1056033: ghc: Please include patch to fix cabal arch detection for sparc64

2023-12-13 Thread Ilias Tsitsimpis
Hi Adrian,

On Wed, Dec 13, 2023 at 04:14PM, John Paul Adrian Glaubitz wrote:
> On Thu, 2023-11-16 at 20:23 +0200, Ilias Tsitsimpis wrote:
> > Thanks for working on this. I fear that applying this patch will change
> > the ABI for Cabal, and hence we will have to rebuild every Haskell
> > package in Debian. Because of that, I plan on waiting for the current
> > transition to finish, and then include this patch in the next GHC
> > upload.
> 
> Are you sure that this actually the case [1]?
> 
> > [1] https://github.com/haskell/cabal/pull/9445#issuecomment-1811780089

In the issue they are discussing something different, whether they need
to bump the version of the API spec for Cabal.

What I meant is that modifying the code of any Haskell library (in our
case Cabal) changes the resulting ABI hash, and then we need to rebuild
any package that depends on it. In general this is not a big issue, we
would just rebuild everything, but I would like to avoid it now that we
are so close to finish this transition.

I have verified that applying your patch results in a different ABI hash
for libghc-cabal-dev. You can verify it yourself, apply the patch,
rebuild and compare the resulting binary packages.

Best,

-- 
Ilias



Bug#1056033: ghc: Please include patch to fix cabal arch detection for sparc64

2023-12-13 Thread John Paul Adrian Glaubitz
Hi Ilias!

On Thu, 2023-11-16 at 20:23 +0200, Ilias Tsitsimpis wrote:
> Thanks for working on this. I fear that applying this patch will change
> the ABI for Cabal, and hence we will have to rebuild every Haskell
> package in Debian. Because of that, I plan on waiting for the current
> transition to finish, and then include this patch in the next GHC
> upload.

Are you sure that this actually the case [1]?

Adrian

> [1] https://github.com/haskell/cabal/pull/9445#issuecomment-1811780089

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#1056033: ghc: Please include patch to fix cabal arch detection for sparc64

2023-11-16 Thread Ilias Tsitsimpis
Hi Adrian,

On Thu, Nov 16, 2023 at 09:13AM, John Paul Adrian Glaubitz wrote:
> The attached patch is a backported version of the patch which applies to GHC 
> 9.4.7.

Thanks for working on this. I fear that applying this patch will change
the ABI for Cabal, and hence we will have to rebuild every Haskell
package in Debian. Because of that, I plan on waiting for the current
transition to finish, and then include this patch in the next GHC
upload.

Best,

-- 
Ilias



Bug#1056033: ghc: Please include patch to fix cabal arch detection for sparc64

2023-11-16 Thread John Paul Adrian Glaubitz
Source: ghc
Version: 9.4.7-1
Severity: normal
Tags: patch upstream
User: debian-sp...@lists.debian.org
Usertags: sparc64
X-Debbugs-Cc: debian-sp...@lists.debian.org

Hi!

As discussed in private, here is a patch which fixes the arch detection for
sparc64 in cabal. Previously, cabal treated "sparc64" as an alias for 32-bit
sparc which results in the GHC build process not being able to find the built
binaries as these are stored in a $ARCH-$OS subfolder.

The patch has already been pushed upstream, approved and should be merged within
the next hours after some more waiting [1].

The attached patch is a backported version of the patch which applies to GHC 
9.4.7.

Thanks,
Adrian

> [1] https://github.com/haskell/cabal/pull/9445

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
--- ghc-9.4.6.orig/libraries/Cabal/Cabal-syntax/src/Distribution/System.hs
+++ ghc-9.4.6/libraries/Cabal/Cabal-syntax/src/Distribution/System.hs
@@ -158,19 +158,17 @@ buildOS = classifyOS Permissive System.I
 -- 
 
 -- | These are the known Arches: I386, X86_64, PPC, PPC64, Sparc,
--- Arm, AArch64, Mips, SH, IA64, S390, S390X, Alpha, Hppa, Rs6000,
--- M68k, Vax, JavaScript and Wasm32.
---
+-- Sparc64, Arm, AArch64, Mips, SH, IA64, S390, S390X, Alpha, Hppa,
+-- Rs6000, M68k, Vax, JavaScript and Wasm32.
 -- The following aliases can also be used:
 --* PPC alias: powerpc
 --* PPC64 alias : powerpc64, powerpc64le
---* Sparc aliases: sparc64, sun4
 --* Mips aliases: mipsel, mipseb
 --* Arm aliases: armeb, armel
 --* AArch64 aliases: arm64
 --
 data Arch = I386  | X86_64  | PPC  | PPC64 | Sparc
-  | Arm   | AArch64 | Mips | SH
+  | Sparc64 | Arm   | AArch64 | Mips | SH
   | IA64  | S390| S390X
   | Alpha | Hppa| Rs6000
   | M68k  | Vax
@@ -185,7 +183,7 @@ instance NFData Arch where rnf = generic
 
 knownArches :: [Arch]
 knownArches = [I386, X86_64, PPC, PPC64, Sparc
-  ,Arm, AArch64, Mips, SH
+  ,Sparc64 ,Arm, AArch64, Mips, SH
   ,IA64, S390, S390X
   ,Alpha, Hppa, Rs6000
   ,M68k, Vax
@@ -197,7 +195,6 @@ archAliases Strict _   = []
 archAliases Compat _   = []
 archAliases _  PPC = ["powerpc"]
 archAliases _  PPC64   = ["powerpc64", "powerpc64le"]
-archAliases _  Sparc   = ["sparc64", "sun4"]
 archAliases _  Mips= ["mipsel", "mipseb"]
 archAliases _  Arm = ["armeb", "armel"]
 archAliases _  AArch64 = ["arm64"]
--- ghc-9.4.6.orig/libraries/Cabal/Cabal/src/Distribution/Simple/PreProcess.hs
+++ ghc-9.4.6/libraries/Cabal/Cabal/src/Distribution/Simple/PreProcess.hs
@@ -717,6 +717,7 @@ platformDefines lbi =
   PPC -> ["powerpc"]
   PPC64   -> ["powerpc64"]
   Sparc   -> ["sparc"]
+  Sparc64 -> ["sparc64"]
   Arm -> ["arm"]
   AArch64 -> ["aarch64"]
   Mips-> ["mips"]