diff --git a/dev-libs/marisa/Manifest b/dev-libs/marisa/Manifest index 495a3a8e0f46e..45bbb905d36d3 100644 --- a/dev-libs/marisa/Manifest +++ b/dev-libs/marisa/Manifest @@ -1,2 +1,3 @@ DIST marisa-0.2.6.tar.gz 168332 BLAKE2B 3b8a89a9a0b344d9de96edb5bf17c50db07da373e75eba098f48c9064321d579ac104db622608119377084c79165bf558c804eaff591903b67330b13bc8acf55 SHA512 c094e4b22e1457efdd20f2b978ee421b53e36ed94e4fdbd8944136c0ba23da4f6ba9fe3a2c64729c1426aee4dbe8098bfa5eebb943ae7fdaa4eec760485c564d DIST marisa-0.2.7.tar.gz 214468 BLAKE2B 58a3f5a38099e16aaccd523df4e3fa49a7222d41a3b242dc7d328eca6d3fae09aaaa092b94e5e83d8a21ee36be86abe37007860271369e3de95b722f556e0570 SHA512 5e162d1e4b6e78e60354c19dbb419088d1d832591a701ee5a844f9e61747b0ec0333732d2832a771e2a1bae7cc9e199a9eae5098e430ff331b4de372ccce4798 +DIST marisa-0.3.1.tar.gz 212791 BLAKE2B 130735eb3743a78a32e9e2389da84b8cd251031c8362843d1fb26f32ee2d1a3a0acf1de413e0554959e0488b8f445bac92c41c3fa54b6c1dad5bb245dfe1584f SHA512 60757e354e4f0ff47662930af5c32a762c5f348c60019abb2d502c6c21ec220731edd9be8ea36e3ec68df90a6584eb311fe1e3d4258b3392609a87b0ef427121 diff --git a/dev-libs/marisa/files/marisa-0.3.1-fix-swig-bindings.patch b/dev-libs/marisa/files/marisa-0.3.1-fix-swig-bindings.patch new file mode 100644 index 0000000000000..85c2a9e7c5bc1 --- /dev/null +++ b/dev-libs/marisa/files/marisa-0.3.1-fix-swig-bindings.patch @@ -0,0 +1,353 @@ +https://github.com/s-yata/marisa-trie/pull/123 +https://github.com/s-yata/marisa-trie/commit/cf4602f08df49861d987d122bd85bfdb456fe7a0 + +From cf4602f08df49861d987d122bd85bfdb456fe7a0 Mon Sep 17 00:00:00 2001 +From: Weng Xuetian +Date: Sat, 9 Aug 2025 02:31:06 -0700 +Subject: [PATCH] Fix binding build and add CI to test it on linux. (#123) + +Fix #121 +Fix #122 +--- + .github/workflows/linux.yml | 23 +++++++++++++++++++++++ + bindings/marisa-swig-python3.cxx | 15 +++++---------- + bindings/marisa-swig.cxx | 15 +++++---------- + bindings/perl/marisa-swig.cxx | 15 +++++---------- + bindings/python/marisa-swig.cxx | 17 ++++++----------- + bindings/python3/marisa-swig-python3.cxx | 15 +++++---------- + bindings/ruby/marisa-swig.cxx | 15 +++++---------- + 7 files changed, 54 insertions(+), 61 deletions(-) + +diff --git a/bindings/marisa-swig-python3.cxx b/bindings/marisa-swig-python3.cxx +index 50ab6b0..10bbad3 100644 +--- a/bindings/marisa-swig-python3.cxx ++++ b/bindings/marisa-swig-python3.cxx +@@ -27,8 +27,7 @@ size_t Query::query_id() const { + return query_.id(); + } + +-Keyset::Keyset() : keyset_(new (std::nothrow) marisa::Keyset) { +- MARISA_THROW_IF(keyset_ == NULL, ::MARISA_MEMORY_ERROR); ++Keyset::Keyset() : keyset_(new marisa::Keyset) { + } + + Keyset::~Keyset() { +@@ -82,8 +81,7 @@ void Keyset::clear() { + } + + Agent::Agent() +- : agent_(new (std::nothrow) marisa::Agent), buf_(NULL), buf_size_(0) { +- MARISA_THROW_IF(agent_ == NULL, ::MARISA_MEMORY_ERROR); ++ : agent_(new marisa::Agent), buf_(NULL), buf_size_(0) { + } + + Agent::~Agent() { +@@ -101,8 +99,7 @@ void Agent::set_query(const char *ptr, size_t length) { + new_buf_size *= 2; + } + } +- char *new_buf = new (std::nothrow) char[new_buf_size]; +- MARISA_THROW_IF(new_buf == NULL, MARISA_MEMORY_ERROR); ++ char *new_buf = new char[new_buf_size]; + delete [] buf_; + buf_ = new_buf; + buf_size_ = new_buf_size; +@@ -141,8 +138,7 @@ size_t Agent::query_id() const { + return agent_->query().id(); + } + +-Trie::Trie() : trie_(new (std::nothrow) marisa::Trie) { +- MARISA_THROW_IF(trie_ == NULL, ::MARISA_MEMORY_ERROR); ++Trie::Trie() : trie_(new marisa::Trie) { + } + + Trie::~Trie() { +@@ -195,8 +191,7 @@ void Trie::reverse_lookup(size_t id, + marisa::Agent agent; + agent.set_query(id); + trie_->reverse_lookup(agent); +- char * const buf = new (std::nothrow) char[agent.key().length()]; +- MARISA_THROW_IF(buf == NULL, MARISA_MEMORY_ERROR); ++ char * const buf = new char[agent.key().length()]; + std::memcpy(buf, agent.key().ptr(), agent.key().length()); + *ptr_out_to_be_deleted = buf; + *length_out = agent.key().length(); +diff --git a/bindings/marisa-swig.cxx b/bindings/marisa-swig.cxx +index 6c9037c..593f5f0 100644 +--- a/bindings/marisa-swig.cxx ++++ b/bindings/marisa-swig.cxx +@@ -27,8 +27,7 @@ size_t Query::id() const { + return query_.id(); + } + +-Keyset::Keyset() : keyset_(new (std::nothrow) marisa::Keyset) { +- MARISA_THROW_IF(keyset_ == NULL, ::MARISA_MEMORY_ERROR); ++Keyset::Keyset() : keyset_(new marisa::Keyset) { + } + + Keyset::~Keyset() { +@@ -82,8 +81,7 @@ void Keyset::clear() { + } + + Agent::Agent() +- : agent_(new (std::nothrow) marisa::Agent), buf_(NULL), buf_size_(0) { +- MARISA_THROW_IF(agent_ == NULL, ::MARISA_MEMORY_ERROR); ++ : agent_(new marisa::Agent), buf_(NULL), buf_size_(0) { + } + + Agent::~Agent() { +@@ -101,8 +99,7 @@ void Agent::set_query(const char *ptr, size_t length) { + new_buf_size *= 2; + } + } +- char *new_buf = new (std::nothrow) char[new_buf_size]; +- MARISA_THROW_IF(new_buf == NULL, MARISA_MEMORY_ERROR); ++ char *new_buf = new char[new_buf_size]; + delete [] buf_; + buf_ = new_buf; + buf_size_ = new_buf_size; +@@ -141,8 +138,7 @@ size_t Agent::query_id() const { + return agent_->query().id(); + } + +-Trie::Trie() : trie_(new (std::nothrow) marisa::Trie) { +- MARISA_THROW_IF(trie_ == NULL, ::MARISA_MEMORY_ERROR); ++Trie::Trie() : trie_(new marisa::Trie) { + } + + Trie::~Trie() { +@@ -195,8 +191,7 @@ void Trie::reverse_lookup(size_t id, + marisa::Agent agent; + agent.set_query(id); + trie_->reverse_lookup(agent); +- char * const buf = new (std::nothrow) char[agent.key().length()]; +- MARISA_THROW_IF(buf == NULL, MARISA_MEMORY_ERROR); ++ char * const buf = new char[agent.key().length()]; + std::memcpy(buf, agent.key().ptr(), agent.key().length()); + *ptr_out_to_be_deleted = buf; + *length_out = agent.key().length(); +diff --git a/bindings/perl/marisa-swig.cxx b/bindings/perl/marisa-swig.cxx +index 6c9037c..593f5f0 100644 +--- a/bindings/perl/marisa-swig.cxx ++++ b/bindings/perl/marisa-swig.cxx +@@ -27,8 +27,7 @@ size_t Query::id() const { + return query_.id(); + } + +-Keyset::Keyset() : keyset_(new (std::nothrow) marisa::Keyset) { +- MARISA_THROW_IF(keyset_ == NULL, ::MARISA_MEMORY_ERROR); ++Keyset::Keyset() : keyset_(new marisa::Keyset) { + } + + Keyset::~Keyset() { +@@ -82,8 +81,7 @@ void Keyset::clear() { + } + + Agent::Agent() +- : agent_(new (std::nothrow) marisa::Agent), buf_(NULL), buf_size_(0) { +- MARISA_THROW_IF(agent_ == NULL, ::MARISA_MEMORY_ERROR); ++ : agent_(new marisa::Agent), buf_(NULL), buf_size_(0) { + } + + Agent::~Agent() { +@@ -101,8 +99,7 @@ void Agent::set_query(const char *ptr, size_t length) { + new_buf_size *= 2; + } + } +- char *new_buf = new (std::nothrow) char[new_buf_size]; +- MARISA_THROW_IF(new_buf == NULL, MARISA_MEMORY_ERROR); ++ char *new_buf = new char[new_buf_size]; + delete [] buf_; + buf_ = new_buf; + buf_size_ = new_buf_size; +@@ -141,8 +138,7 @@ size_t Agent::query_id() const { + return agent_->query().id(); + } + +-Trie::Trie() : trie_(new (std::nothrow) marisa::Trie) { +- MARISA_THROW_IF(trie_ == NULL, ::MARISA_MEMORY_ERROR); ++Trie::Trie() : trie_(new marisa::Trie) { + } + + Trie::~Trie() { +@@ -195,8 +191,7 @@ void Trie::reverse_lookup(size_t id, + marisa::Agent agent; + agent.set_query(id); + trie_->reverse_lookup(agent); +- char * const buf = new (std::nothrow) char[agent.key().length()]; +- MARISA_THROW_IF(buf == NULL, MARISA_MEMORY_ERROR); ++ char * const buf = new char[agent.key().length()]; + std::memcpy(buf, agent.key().ptr(), agent.key().length()); + *ptr_out_to_be_deleted = buf; + *length_out = agent.key().length(); +diff --git a/bindings/python/marisa-swig.cxx b/bindings/python/marisa-swig.cxx +index ec7460a..593f5f0 100644 +--- a/bindings/python/marisa-swig.cxx ++++ b/bindings/python/marisa-swig.cxx +@@ -27,8 +27,7 @@ size_t Query::id() const { + return query_.id(); + } + +-Keyset::Keyset() : keyset_(new (std::nothrow) marisa::Keyset) { +- MARISA_THROW_IF(keyset_ == NULL, ::MARISA_MEMORY_ERROR); ++Keyset::Keyset() : keyset_(new marisa::Keyset) { + } + + Keyset::~Keyset() { +@@ -82,8 +81,7 @@ void Keyset::clear() { + } + + Agent::Agent() +- : agent_(new (std::nothrow) marisa::Agent), buf_(NULL), buf_size_(0) { +- MARISA_THROW_IF(agent_ == NULL, ::MARISA_MEMORY_ERROR); ++ : agent_(new marisa::Agent), buf_(NULL), buf_size_(0) { + } + + Agent::~Agent() { +@@ -101,8 +99,7 @@ void Agent::set_query(const char *ptr, size_t length) { + new_buf_size *= 2; + } + } +- char *new_buf = new (std::nothrow) char[new_buf_size]; +- MARISA_THROW_IF(new_buf == NULL, MARISA_MEMORY_ERROR); ++ char *new_buf = new char[new_buf_size]; + delete [] buf_; + buf_ = new_buf; + buf_size_ = new_buf_size; +@@ -141,8 +138,7 @@ size_t Agent::query_id() const { + return agent_->query().id(); + } + +-Trie::Trie() : trie_(new (std::nothrow) marisa::Trie) { +- MARISA_THROW_IF(trie_ == NULL, ::MARISA_MEMORY_ERROR); ++Trie::Trie() : trie_(new marisa::Trie) { + } + + Trie::~Trie() { +@@ -153,7 +149,7 @@ void Trie::build(Keyset &keyset, int config_flags) { + trie_->build(*keyset.keyset_, config_flags); + } + +-void Trie::mmap(const char *filename, , int flags) { ++void Trie::mmap(const char *filename, int flags) { + trie_->mmap(filename, flags); + } + +@@ -195,8 +191,7 @@ void Trie::reverse_lookup(size_t id, + marisa::Agent agent; + agent.set_query(id); + trie_->reverse_lookup(agent); +- char * const buf = new (std::nothrow) char[agent.key().length()]; +- MARISA_THROW_IF(buf == NULL, MARISA_MEMORY_ERROR); ++ char * const buf = new char[agent.key().length()]; + std::memcpy(buf, agent.key().ptr(), agent.key().length()); + *ptr_out_to_be_deleted = buf; + *length_out = agent.key().length(); +diff --git a/bindings/python3/marisa-swig-python3.cxx b/bindings/python3/marisa-swig-python3.cxx +index 50ab6b0..10bbad3 100644 +--- a/bindings/python3/marisa-swig-python3.cxx ++++ b/bindings/python3/marisa-swig-python3.cxx +@@ -27,8 +27,7 @@ size_t Query::query_id() const { + return query_.id(); + } + +-Keyset::Keyset() : keyset_(new (std::nothrow) marisa::Keyset) { +- MARISA_THROW_IF(keyset_ == NULL, ::MARISA_MEMORY_ERROR); ++Keyset::Keyset() : keyset_(new marisa::Keyset) { + } + + Keyset::~Keyset() { +@@ -82,8 +81,7 @@ void Keyset::clear() { + } + + Agent::Agent() +- : agent_(new (std::nothrow) marisa::Agent), buf_(NULL), buf_size_(0) { +- MARISA_THROW_IF(agent_ == NULL, ::MARISA_MEMORY_ERROR); ++ : agent_(new marisa::Agent), buf_(NULL), buf_size_(0) { + } + + Agent::~Agent() { +@@ -101,8 +99,7 @@ void Agent::set_query(const char *ptr, size_t length) { + new_buf_size *= 2; + } + } +- char *new_buf = new (std::nothrow) char[new_buf_size]; +- MARISA_THROW_IF(new_buf == NULL, MARISA_MEMORY_ERROR); ++ char *new_buf = new char[new_buf_size]; + delete [] buf_; + buf_ = new_buf; + buf_size_ = new_buf_size; +@@ -141,8 +138,7 @@ size_t Agent::query_id() const { + return agent_->query().id(); + } + +-Trie::Trie() : trie_(new (std::nothrow) marisa::Trie) { +- MARISA_THROW_IF(trie_ == NULL, ::MARISA_MEMORY_ERROR); ++Trie::Trie() : trie_(new marisa::Trie) { + } + + Trie::~Trie() { +@@ -195,8 +191,7 @@ void Trie::reverse_lookup(size_t id, + marisa::Agent agent; + agent.set_query(id); + trie_->reverse_lookup(agent); +- char * const buf = new (std::nothrow) char[agent.key().length()]; +- MARISA_THROW_IF(buf == NULL, MARISA_MEMORY_ERROR); ++ char * const buf = new char[agent.key().length()]; + std::memcpy(buf, agent.key().ptr(), agent.key().length()); + *ptr_out_to_be_deleted = buf; + *length_out = agent.key().length(); +diff --git a/bindings/ruby/marisa-swig.cxx b/bindings/ruby/marisa-swig.cxx +index 6c9037c..593f5f0 100644 +--- a/bindings/ruby/marisa-swig.cxx ++++ b/bindings/ruby/marisa-swig.cxx +@@ -27,8 +27,7 @@ size_t Query::id() const { + return query_.id(); + } + +-Keyset::Keyset() : keyset_(new (std::nothrow) marisa::Keyset) { +- MARISA_THROW_IF(keyset_ == NULL, ::MARISA_MEMORY_ERROR); ++Keyset::Keyset() : keyset_(new marisa::Keyset) { + } + + Keyset::~Keyset() { +@@ -82,8 +81,7 @@ void Keyset::clear() { + } + + Agent::Agent() +- : agent_(new (std::nothrow) marisa::Agent), buf_(NULL), buf_size_(0) { +- MARISA_THROW_IF(agent_ == NULL, ::MARISA_MEMORY_ERROR); ++ : agent_(new marisa::Agent), buf_(NULL), buf_size_(0) { + } + + Agent::~Agent() { +@@ -101,8 +99,7 @@ void Agent::set_query(const char *ptr, size_t length) { + new_buf_size *= 2; + } + } +- char *new_buf = new (std::nothrow) char[new_buf_size]; +- MARISA_THROW_IF(new_buf == NULL, MARISA_MEMORY_ERROR); ++ char *new_buf = new char[new_buf_size]; + delete [] buf_; + buf_ = new_buf; + buf_size_ = new_buf_size; +@@ -141,8 +138,7 @@ size_t Agent::query_id() const { + return agent_->query().id(); + } + +-Trie::Trie() : trie_(new (std::nothrow) marisa::Trie) { +- MARISA_THROW_IF(trie_ == NULL, ::MARISA_MEMORY_ERROR); ++Trie::Trie() : trie_(new marisa::Trie) { + } + + Trie::~Trie() { +@@ -195,8 +191,7 @@ void Trie::reverse_lookup(size_t id, + marisa::Agent agent; + agent.set_query(id); + trie_->reverse_lookup(agent); +- char * const buf = new (std::nothrow) char[agent.key().length()]; +- MARISA_THROW_IF(buf == NULL, MARISA_MEMORY_ERROR); ++ char * const buf = new char[agent.key().length()]; + std::memcpy(buf, agent.key().ptr(), agent.key().length()); + *ptr_out_to_be_deleted = buf; + *length_out = agent.key().length(); diff --git a/dev-libs/marisa/files/marisa-0.3.1-install-all-configs.patch b/dev-libs/marisa/files/marisa-0.3.1-install-all-configs.patch new file mode 100644 index 0000000000000..eb23fc0e148eb --- /dev/null +++ b/dev-libs/marisa/files/marisa-0.3.1-install-all-configs.patch @@ -0,0 +1,21 @@ +Remove CONFIGURATIONS Release from install() so the library and tools +are installed regardless of the cmake build type (e.g. RelWithDebInfo). + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -258,7 +258,6 @@ + install( + TARGETS marisa + EXPORT MarisaTargets +- CONFIGURATIONS Release + DESTINATION ${LIB_INSTALL_DIR} + COMPONENT Library + ) +@@ -272,7 +271,6 @@ + if(ENABLE_TOOLS) + install( + TARGETS ${MARISA_TOOLS} +- CONFIGURATIONS Release + COMPONENT Binaries + ) + endif() diff --git a/dev-libs/marisa/marisa-0.3.1.ebuild b/dev-libs/marisa/marisa-0.3.1.ebuild new file mode 100644 index 0000000000000..89c23aee77cdc --- /dev/null +++ b/dev-libs/marisa/marisa-0.3.1.ebuild @@ -0,0 +1,90 @@ +# Copyright 2014-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="8" +PYTHON_COMPAT=( python3_{12..14} ) +DISTUTILS_USE_PEP517="setuptools" +DISTUTILS_OPTIONAL="1" +DISTUTILS_EXT=1 + +inherit cmake distutils-r1 + +DESCRIPTION="Matching Algorithm with Recursively Implemented StorAge" +HOMEPAGE="https://github.com/s-yata/marisa-trie" +SRC_URI="https://github.com/s-yata/marisa-trie/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +S="${WORKDIR}/marisa-trie-${PV}" + +LICENSE="|| ( BSD-2 LGPL-2.1+ )" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86" +IUSE="python tools" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" + +BDEPEND="python? ( + ${PYTHON_DEPS} + ${DISTUTILS_DEPS} + dev-lang/swig + )" +DEPEND="python? ( ${PYTHON_DEPS} )" +RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}/${P}-install-all-configs.patch" + "${FILESDIR}/${P}-fix-swig-bindings.patch" +) + +src_prepare() { + cmake_src_prepare + + sed -e "s:^\([[:space:]]*\)libraries=:\1include_dirs=[\"../../include\"],\n\1library_dirs=[\"../../lib/marisa\"],\n&:" \ + -e "s:setup(name = \"marisa\":setup(name = \"marisa\", version = \"${PV}\":" \ + -i bindings/python/setup.py || die + + if use python; then + pushd bindings/python > /dev/null || die + distutils-r1_src_prepare + popd > /dev/null || die + fi +} + +src_configure() { + local mycmakeargs=( + -DLIB_INSTALL_DIR="$(get_libdir)" + -DENABLE_TOOLS=$(usex tools) + -DBUILD_TESTING=OFF + ) + cmake_src_configure + + if use python; then + pushd bindings/python > /dev/null || die + distutils-r1_src_configure + popd > /dev/null || die + fi +} + +src_compile() { + cmake_src_compile + + if use python; then + emake -C bindings swig-python + pushd bindings/python > /dev/null || die + distutils-r1_src_compile + popd > /dev/null || die + fi +} + +src_install() { + cmake_src_install + + ( + docinto html + dodoc docs/* + ) + + if use python; then + pushd bindings/python > /dev/null || die + distutils-r1_src_install + popd > /dev/null || die + fi +} diff --git a/dev-libs/marisa/metadata.xml b/dev-libs/marisa/metadata.xml index c320f1b595b0e..feca2c265f234 100644 --- a/dev-libs/marisa/metadata.xml +++ b/dev-libs/marisa/metadata.xml @@ -13,6 +13,9 @@ proxy-maint@gentoo.org Proxy Maintainers + + Build command-line tools + s-yata/marisa-trie