z572 pushed a commit to branch master
in repository guix.

commit 14d5d988d481f27fdb3a1734621764a4762b5ed3
Author: Zheng Junjie <[email protected]>
AuthorDate: Sat Mar 22 19:19:45 2025 +0800

    gnu: marisa: Fix build on riscv64-linux.
    
    * gnu/packages/patches/marisa-fix-MARISA_WORD_SIZE.patch: New patch.
    * gnu/local.mk (dist_patch_DATA): Register it.
    * gnu/packages/datastructures.scm (marisa)[source]: Add it.
    
    Change-Id: Icd3a8b39663c7951623a374cca0b64b3ba3d255d
---
 gnu/local.mk                                       |  1 +
 gnu/packages/datastructures.scm                    |  1 +
 .../patches/marisa-fix-MARISA_WORD_SIZE.patch      | 42 ++++++++++++++++++++++
 3 files changed, 44 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index 90d57d3733..0f0d9cb624 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1831,6 +1831,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/mandoc-support-zstd-compression.patch   \
   %D%/packages/patches/make-impure-dirs.patch                  \
   %D%/packages/patches/mariadb-rocksdb-atomic-linking.patch    \
+  %D%/packages/patches/marisa-fix-MARISA_WORD_SIZE.patch       \
   %D%/packages/patches/mathjax-disable-webpack.patch                   \
   %D%/packages/patches/mathjax-no-a11y.patch                   \
   %D%/packages/patches/mathjax-3.1.2-no-a11y.patch             \
diff --git a/gnu/packages/datastructures.scm b/gnu/packages/datastructures.scm
index e50d8963db..485cd03b7d 100644
--- a/gnu/packages/datastructures.scm
+++ b/gnu/packages/datastructures.scm
@@ -126,6 +126,7 @@ and heaps.")
              (url "https://github.com/s-yata/marisa-trie";)
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
+       (patches (search-patches "marisa-fix-MARISA_WORD_SIZE.patch"))
        (sha256
         (base32 "1hy8hfksizk1af6kg8z3b9waiz6d5ggd73fiqcvmhfgra36dscyq"))))
     (build-system gnu-build-system)
diff --git a/gnu/packages/patches/marisa-fix-MARISA_WORD_SIZE.patch 
b/gnu/packages/patches/marisa-fix-MARISA_WORD_SIZE.patch
new file mode 100644
index 0000000000..143ab6ac6b
--- /dev/null
+++ b/gnu/packages/patches/marisa-fix-MARISA_WORD_SIZE.patch
@@ -0,0 +1,42 @@
+from https://github.com/s-yata/marisa-trie/pull/58.patch
+
+From 6925413d873cec8fd4cabb360fd512be8abc4551 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <[email protected]>
+Date: Wed, 24 Apr 2024 11:17:09 +0200
+Subject: [PATCH] Fix detection of MARISA_WORD_SIZE
+
+Detect the MARISA_WORD_SIZE independent of architecture.
+
+Fixes: https://github.com/s-yata/marisa-trie/issues/40
+Fixes: https://github.com/s-yata/marisa-trie/issues/57
+Fixes: https://github.com/s-yata/marisa-trie/pull/44
+Fixes: https://github.com/s-yata/marisa-trie/pull/46
+Fixes: https://github.com/s-yata/marisa-trie/pull/56
+---
+ include/marisa/base.h | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/include/marisa/base.h b/include/marisa/base.h
+index ffcdc5b..bddce4a 100644
+--- a/include/marisa/base.h
++++ b/include/marisa/base.h
+@@ -28,14 +28,13 @@ typedef uint32_t marisa_uint32;
+ typedef uint64_t marisa_uint64;
+ #endif  // _MSC_VER
+ 
+-#if defined(_WIN64) || defined(__amd64__) || defined(__x86_64__) || \
+-    defined(__ia64__) || defined(__ppc64__) || defined(__powerpc64__) || \
+-    defined(__sparc64__) || defined(__mips64__) || defined(__aarch64__) || \
+-    defined(__s390x__)
++#if (UINTPTR_MAX == 0xffffffffffffffff)
+  #define MARISA_WORD_SIZE 64
+-#else  // defined(_WIN64), etc.
++#elif (UINTPTR_MAX == 0xffffffff)
+  #define MARISA_WORD_SIZE 32
+-#endif  // defined(_WIN64), etc.
++#else
++ #error Failed to detect MARISA_WORD_SIZE
++#endif
+ 
+ //#define MARISA_WORD_SIZE  (sizeof(void *) * 8)
+ 

Reply via email to