Subject: [bug#64218] [PATCH 6/7] gnu: ldc: Enable building on more architectures.

From: Efraim Flashner <[email-masked]>
Date: Thu, 22 Jun 2023 12:19:13 +0300

* gnu/packages/dlang.scm (ldc)[arguments]: In the custom phase
'fix-compiler-rt-library-discovery rewrite gnu-triplet->clang-arch to
pass-through unmatched architectures.
---
 gnu/packages/dlang.scm | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 3103e629d9..92600f759e 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -234,19 +234,12 @@ (define-public ldc
                      (system ,(or (%current-target-system)
                                   (%current-system))))
                  (define (gnu-triplet->clang-arch system)
-                   (letrec-syntax
-                       ((matches (syntax-rules (=>)
-                                   ((_ (system-prefix => target) rest ...)
-                                    (if (string-prefix? system-prefix system)
-                                        target
-                                        (matches rest ...)))
-                                   ((_)
-                                    (error "Clang target for system is unknown"
-                                           system)))))
-                     (matches ("x86_64"      => "x86_64")
-                              ("i686"        => "i386")
-                              ("armhf"       => "armhf")
-                              ("aarch64"     => "aarch64"))))
+                   (let ((system-prefix
+                           (car (string-tokenize
+                                  system (char-set-complement (char-set #\-))))))
+                     (cond
+                       ((equal? system-prefix "i686") "i386")
+                       (#t system-prefix))))
                  ;; Coax LLVM into agreeing with Clang about system target
                  ;; naming.
                  (substitute* "driver/linker-gcc.cpp"
-- 
Efraim Flashner   <[email-masked]>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted