From cdfcf37cebbc317619162b4bf165217eea286538 Mon Sep 17 00:00:00 2001 From: Natanael Copa <ncopa@alpinelinux.org> Date: Wed, 24 Apr 2024 11:24:56 +0200 Subject: [PATCH] community/libmarisa: fix wordsize detection Fixes detection of word size on riscv64 and loongarch64. ref: https://github.com/s-yata/marisa-trie/issues/57 --- ...01-Fix-detection-of-MARISA_WORD_SIZE.patch | 51 +++++++++++++++++++ community/libmarisa/APKBUILD | 4 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 community/libmarisa/0001-Fix-detection-of-MARISA_WORD_SIZE.patch diff --git a/community/libmarisa/0001-Fix-detection-of-MARISA_WORD_SIZE.patch b/community/libmarisa/0001-Fix-detection-of-MARISA_WORD_SIZE.patch new file mode 100644 index 000000000000..344d9146710d --- /dev/null +++ b/community/libmarisa/0001-Fix-detection-of-MARISA_WORD_SIZE.patch @@ -0,0 +1,51 @@ +From 1e167755c04c4816b7c19a985301df81a5b511ca Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +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 | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/include/marisa/base.h b/include/marisa/base.h +index ffcdc5b..f8c0e1c 100644 +--- a/include/marisa/base.h ++++ b/include/marisa/base.h +@@ -1,6 +1,7 @@ + #ifndef MARISA_BASE_H_ + #define MARISA_BASE_H_ + ++#include <limits.h> + // Old Visual C++ does not provide stdint.h. + #ifndef _MSC_VER + #include <stdint.h> +@@ -28,14 +29,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 (ULONG_MAX == 0xffffffffffffffff) + #define MARISA_WORD_SIZE 64 +-#else // defined(_WIN64), etc. ++#elif (ULONG_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) + +-- +2.44.0 + diff --git a/community/libmarisa/APKBUILD b/community/libmarisa/APKBUILD index b557b4151a8e..d3363d359b04 100644 --- a/community/libmarisa/APKBUILD +++ b/community/libmarisa/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Eric Tian <thxdaemon+gitlab.alpine@gmail.com> pkgname=libmarisa pkgver=0.2.6 -pkgrel=6 +pkgrel=7 pkgdesc="MARISA: Matching Algorithm with Recursively Implemented StorAge" url="https://github.com/s-yata/marisa-trie" arch="all" @@ -11,6 +11,7 @@ makedepends="autoconf automake libtool python3-dev swig py3-setuptools" subpackages="$pkgname-dev py3-marisa-pyc py3-marisa:py" source="$pkgname-$pkgver.tar.gz::https://github.com/s-yata/marisa-trie/archive/v$pkgver.tar.gz format-sec.patch + 0001-Fix-detection-of-MARISA_WORD_SIZE.patch " builddir="$srcdir/marisa-trie-$pkgver" @@ -61,4 +62,5 @@ py() { sha512sums=" c094e4b22e1457efdd20f2b978ee421b53e36ed94e4fdbd8944136c0ba23da4f6ba9fe3a2c64729c1426aee4dbe8098bfa5eebb943ae7fdaa4eec760485c564d libmarisa-0.2.6.tar.gz 778486421fcda6fbbfb4c61b48ed64f1166ab937361098b405a798b88ce27ad2169c7a5be9d2e66de042bf5a65b5a332183a32a42fd31fbeecb679671c4ab929 format-sec.patch +0a65d6a9ee906be9cc8cefc160e7908280388490c66468e048e3d60f261b8787718a36f95d0d543731236c5c64b3985119cc4ba6e9deab28f0cf1492a3549d70 0001-Fix-detection-of-MARISA_WORD_SIZE.patch " -- GitLab