Subject: [PATCH] gnu: libb2: Fix cross-compilation for non x86_64 systems

From: Christoph Buck <[email-masked]>
Date: Fri, 28 Jun 2024 14:33:11 +0200

* gnu/packages/crypto.scm (libb2): Disable fat-binary compile time option for
non x86_64 target systems.

Change-Id: Ibdf009960fecae4ffc033a36b3abf28c2f8935aa
---
 gnu/packages/crypto.scm | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/crypto.scm b/gnu/packages/crypto.scm
index 9c62689d18..1d376fb43c 100644
--- a/gnu/packages/crypto.scm
+++ b/gnu/packages/crypto.scm
@@ -809,12 +809,14 @@ (define-public libb2
     (arguments
      `(#:configure-flags
        (list
-        ,@(if (any (cute string-prefix? <> (or (%current-system)
-                                               (%current-target-system)))
-                   '("x86_64" "i686"))
-              ;; fat only checks for Intel optimisations
-              '("--enable-fat")
-              '())
+        ,@(let ((check-x86 (lambda (triplet) (any (cute string-prefix? <> triplet) '("x86_64" "i868")))))
+            (if (%current-target-system)
+                (if (check-x86 (%current-target-system))
+                    '("--enable-fat")
+                    '())
+                (if (check-x86 (%current-system))
+                    '("--enable-fat")
+                    '())))
         "--disable-native")))           ;don't optimise at build time
     (home-page "https://blake2.net/")
     (synopsis "Library implementing the BLAKE2 family of hash functions")

base-commit: 6a7d5cda17fd9d4bd99c58f7a5dbdd2d021354f9
-- 
2.45.1