Skip to content

Commit

Permalink
[libmarisa] 0.2.6-2: fix riscv64 build
Browse files Browse the repository at this point in the history
This makes detection of MARISA_WORD_SIZE architecture independent.

Links: s-yata/marisa-trie#58
  • Loading branch information
ziyao233 committed Aug 3, 2024
1 parent ee8103a commit aecabad
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
40 changes: 40 additions & 0 deletions 0001-Fix-detection-of-MARISA_WORD_SIZE.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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)

12 changes: 9 additions & 3 deletions PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@

pkgname=libmarisa
pkgver=0.2.6
pkgrel=1
pkgrel=2
pkgdesc='Matching Algorithm with Recursively Implemented StorAge'
url='https://github.com/s-yata/marisa-trie'
arch=(x86_64 aarch64 riscv64)
license=(BSD)
depends=(musl)
makedepends=(autoconf automake libtool)
provides=(libmarisa.so)
source=("https://github.com/s-yata/marisa-trie/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('1063a27c789e75afa2ee6f1716cc6a5486631dcfcb7f4d56d6485d2462e566de')
source=("https://github.com/s-yata/marisa-trie/archive/refs/tags/v$pkgver.tar.gz"
"0001-Fix-detection-of-MARISA_WORD_SIZE.patch")
sha256sums=('1063a27c789e75afa2ee6f1716cc6a5486631dcfcb7f4d56d6485d2462e566de'
'3df8a4e26b767a1cfde93c862c7d45d685b982d19fa4404c938258e31cba248d')

prepare() {
_patch_ marisa-trie-$pkgver
}

build () {
cd marisa-trie-$pkgver
Expand Down

0 comments on commit aecabad

Please sign in to comment.