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

John Paul Adrian Glaubitz <[email protected]>
Newsgroups gmane.linux.debian.ports.sparc
Message-ID <170012243191.1895158.14274680012995935008.reportbug__24003.2718096458$1700122536$gmane$org@nofan.physik.fu-berlin.de>
Source: ghc
Version: 9.4.7-1
Severity: normal
Tags: patch upstream
User: [email protected]
Usertags: sparc64
X-Debbugs-Cc: [email protected]

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
cabal-sparc64-support (text/plain, 2.1 KB)
--- 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"]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.