diff options
Diffstat (limited to 'community/libmarisa')
-rw-r--r-- | community/libmarisa/0001-Fix-detection-of-MARISA_WORD_SIZE.patch | 51 | ||||
-rw-r--r-- | community/libmarisa/APKBUILD | 66 | ||||
-rw-r--r-- | community/libmarisa/format-sec.patch | 23 |
3 files changed, 140 insertions, 0 deletions
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 00000000000..344d9146710 --- /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 new file mode 100644 index 00000000000..d3363d359b0 --- /dev/null +++ b/community/libmarisa/APKBUILD @@ -0,0 +1,66 @@ +# Contributor: Eric Tian <thxdaemon+gitlab.alpine@gmail.com> +# Maintainer: Eric Tian <thxdaemon+gitlab.alpine@gmail.com> +pkgname=libmarisa +pkgver=0.2.6 +pkgrel=7 +pkgdesc="MARISA: Matching Algorithm with Recursively Implemented StorAge" +url="https://github.com/s-yata/marisa-trie" +arch="all" +license="BSD-2-Clause OR LGPL-2.1-or-later" +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" + +prepare() { + default_prepare + autoreconf -i + + sed -i "s/^setup.*/\0 version='$pkgver',/" bindings/python/setup.py +} + +build() { + case "$CARCH" in + x86_64|x86) + local configure_options="$configure_options --enable-sse2" ;; + esac + + ./configure \ + --prefix=/usr \ + --host=$CHOST \ + --build=$CBUILD \ + $configure_options + make + + make -j1 -C bindings swig-python + + cd bindings/python + python3 setup.py build_ext \ + --include-dirs="$builddir"/include \ + --library-dirs="$builddir"/lib/marisa/.libs + python3 setup.py build +} + +check() { + make check +} + +package() { + make DESTDIR="$pkgdir" install + cd bindings/python + python3 setup.py install --skip-build --root="$pkgdir" +} + +py() { + pkgdesc="$pkgdesc (python module)" + amove usr/lib/python3* +} + +sha512sums=" +c094e4b22e1457efdd20f2b978ee421b53e36ed94e4fdbd8944136c0ba23da4f6ba9fe3a2c64729c1426aee4dbe8098bfa5eebb943ae7fdaa4eec760485c564d libmarisa-0.2.6.tar.gz +778486421fcda6fbbfb4c61b48ed64f1166ab937361098b405a798b88ce27ad2169c7a5be9d2e66de042bf5a65b5a332183a32a42fd31fbeecb679671c4ab929 format-sec.patch +0a65d6a9ee906be9cc8cefc160e7908280388490c66468e048e3d60f261b8787718a36f95d0d543731236c5c64b3985119cc4ba6e9deab28f0cf1492a3549d70 0001-Fix-detection-of-MARISA_WORD_SIZE.patch +" diff --git a/community/libmarisa/format-sec.patch b/community/libmarisa/format-sec.patch new file mode 100644 index 00000000000..821606aaf98 --- /dev/null +++ b/community/libmarisa/format-sec.patch @@ -0,0 +1,23 @@ +Patch-Source: https://github.com/archlinux/svntogit-community/blob/packages/marisa/trunk/fix-format-security.patch +From 5813d3b189512202b698aa4851e21b382acd003b Mon Sep 17 00:00:00 2001 +From: Xeonacid <h.dwwwwww@gmail.com> +Date: Sat, 5 Feb 2022 08:51:43 +0800 +Subject: [PATCH] Fix format security + +--- + bindings/ruby/marisa-swig_wrap.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/bindings/ruby/marisa-swig_wrap.cxx b/bindings/ruby/marisa-swig_wrap.cxx +index eae2304..ddc346d 100644 +--- a/bindings/ruby/marisa-swig_wrap.cxx ++++ b/bindings/ruby/marisa-swig_wrap.cxx +@@ -1402,7 +1402,7 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) { + /* Error manipulation */ + + #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code) +-#define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), msg) ++#define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg) + #define SWIG_fail goto fail + + |