summaryrefslogtreecommitdiff
path: root/app-i18n/libime
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-12-25 13:34:50 +0000
committerV3n3RiX <venerix@koprulu.sector>2023-12-25 13:34:50 +0000
commit479921825a5c44a5fbcd5441f00ee98e54db9bac (patch)
treea40800c43ce47a1158369633f7d432b2bd365743 /app-i18n/libime
parentfa5cba104ab90ce81be0cb7e9992447a10e76013 (diff)
gentoo auto-resync : 25:12:2023 - 13:34:50
Diffstat (limited to 'app-i18n/libime')
-rw-r--r--app-i18n/libime/Manifest5
-rw-r--r--app-i18n/libime/files/libime-1.1.3-fix-the-nanf-value-issue-on-musl.patch79
-rw-r--r--app-i18n/libime/files/libime-1.1.3-use-c++11-for-kenlm.patch17
-rw-r--r--app-i18n/libime/libime-1.1.3.ebuild54
-rw-r--r--app-i18n/libime/metadata.xml19
5 files changed, 174 insertions, 0 deletions
diff --git a/app-i18n/libime/Manifest b/app-i18n/libime/Manifest
new file mode 100644
index 000000000000..60ddd2dfa909
--- /dev/null
+++ b/app-i18n/libime/Manifest
@@ -0,0 +1,5 @@
+AUX libime-1.1.3-fix-the-nanf-value-issue-on-musl.patch 2635 BLAKE2B d4c4390d030f4120d763d0a57e276609eafb7413048ce345dbb3f48f3eb84fc7407fcb23355bdbbd41891c480432d9d37d97bc8c99344843bdcaae95aebec4e7 SHA512 c1a04fc3dced63e00fbbbd0aafb5986cdebf175ca0a444f47208ee47fd72e166e96b11627b42adf9f12365ccf19f51c23098e05061fbd77da0a3014f7180ad4c
+AUX libime-1.1.3-use-c++11-for-kenlm.patch 800 BLAKE2B b2287dbc983c824fd4e3ba5f63faa2a0b2cd816f659832006c8a434200be46e329a411d37736fbba364c5954e49a97240151e66314aab13ccf0fd86514e5241d SHA512 ac9c1a847340437dafe994ccaa55f0d07f5fca276b4bdaab894ea21a8938c76208a94f27e06badb217965f80ad1f50a193c7d802dc287777c11002ceab9270da
+DIST libime-1.1.3_dict.tar.xz 36438528 BLAKE2B 2577362aeddf398b9ee7d29c71d157f7aef67b30d2463719ed020eaaa98e955c83b8a7df1e90e4519ae13d2146eff440dafdb93d723a2feaeb60f96e70633410 SHA512 5079721651df334292fbcc6275ded55d41c6380183ef5487be558e93b551a6a6d651fb0fa0456c1d40ffdae432bf51375058fdcf631ea8a93c8751530642fc92
+EBUILD libime-1.1.3.ebuild 992 BLAKE2B 5db2d923afe0153d3e3467f279e97c7b93d839ae3f21a4f4ddd006f4f96bd232f70377c161cc5b6a33c15aa77ae314e573f588e7ef0dba28a4fbf640c96e27e6 SHA512 bcad67154d8c12b3e7ff624dbad86aaf84c462c937ee97e1f44695cc0493322d81046206d8e40c34ae1dbe191589ba2fa26fdaa39f8ea60aac3d913938b263d2
+MISC metadata.xml 571 BLAKE2B ad0cb13fbb703f903e91d2ed74eb9ff35db255c93439a61f72b37b0ae5a2b070e22c574899d70290a666be1b1299c614fd6bfe00881c9ab9472c6d35a7defed4 SHA512 a31ab522b9c2e5be9b46d8ee3dd8d736f1fa7bf4ec983f4a7eeb35922dc88b74d02979d4ebf6bf81118df46d933f70b2cd73dfb66e92320b208e6ae844db7e38
diff --git a/app-i18n/libime/files/libime-1.1.3-fix-the-nanf-value-issue-on-musl.patch b/app-i18n/libime/files/libime-1.1.3-fix-the-nanf-value-issue-on-musl.patch
new file mode 100644
index 000000000000..73b94a07cff5
--- /dev/null
+++ b/app-i18n/libime/files/libime-1.1.3-fix-the-nanf-value-issue-on-musl.patch
@@ -0,0 +1,79 @@
+Backport of https://github.com/fcitx/libime/commit/59ae4a3ab4becdab164f29af07c502096c745b94.diff
+
+Backport upstream commit 59ae4a3 to fix the nanf value issue on musl
+
+--- a/src/libime/core/datrie.cpp
++++ b/src/libime/core/datrie.cpp
+@@ -47,12 +47,24 @@ struct NanValue {
+ static inline int32_t NO_PATH() { return -2; }
+ };
+
++// Musl doesn't have nanf implementation we need, just check if they are the
++// same value. If not, prefer old hardcoded value.
++bool isGoodNanf() {
++ int32_t noValue = decodeValue(std::nanf("1"));
++ int32_t noPath = decodeValue(std::nanf("2"));
++ return (noValue != noPath);
++}
++
+ template <>
+ struct NanValue<float> {
+ static_assert(std::numeric_limits<float>::has_quiet_NaN,
+ "Require support for quiet NaN.");
+- static inline int32_t NO_VALUE() { return decodeValue(std::nanf("1")); }
+- static inline int32_t NO_PATH() { return decodeValue(std::nanf("2")); }
++ static inline int32_t NO_VALUE() {
++ return isGoodNanf() ? decodeValue(std::nanf("1")) : 0x7fc00001;
++ }
++ static inline int32_t NO_PATH() {
++ return isGoodNanf() ? decodeValue(std::nanf("2")) : 0x7fc00002;
++ }
+ };
+
+ } // namespace
+@@ -1144,6 +1156,20 @@ bool DATrie<T>::isValid(value_type v) {
+ return !(isNoPath(v) || isNoValue(v));
+ }
+
++template <typename T>
++T DATrie<T>::noPath() {
++ typename DATriePrivate<T>::decorder_type d;
++ d.result = DATriePrivate<value_type>::CEDAR_NO_PATH;
++ return d.result_value;
++}
++
++template <typename T>
++T DATrie<T>::noValue() {
++ typename DATriePrivate<T>::decorder_type d;
++ d.result = DATriePrivate<value_type>::CEDAR_NO_VALUE;
++ return d.result_value;
++}
++
+ template <typename T>
+ size_t DATrie<T>::mem_size() const {
+ // std::cout << "tail" << d->m_tail.size() << std::endl
+--- a/src/libime/core/datrie.h
++++ b/src/libime/core/datrie.h
+@@ -136,6 +136,9 @@ class DATrie {
+ static bool isNoPath(value_type v);
+ static bool isNoValue(value_type v);
+
++ static value_type noPath();
++ static value_type noValue();
++
+ size_t mem_size() const;
+
+ private:
+--- a/test/testtrie.cpp
++++ b/test/testtrie.cpp
+@@ -40,8 +40,8 @@ int main() {
+ FCITX_ASSERT(trie.size() == 4);
+ DATrie<float>::position_type pos = 0;
+ auto result = trie.traverse("aaa", pos);
+- auto nan1 = std::nanf("1");
+- auto nan2 = std::nanf("2");
++ auto nan1 = trie.noValue();
++ auto nan2 = trie.noPath();
+ // NaN != NaN, we must use memcmp to do this.
+ FCITX_ASSERT(memcmp(&nan1, &result, sizeof(float)) == 0);
+ FCITX_ASSERT(trie.isNoValue(result));
diff --git a/app-i18n/libime/files/libime-1.1.3-use-c++11-for-kenlm.patch b/app-i18n/libime/files/libime-1.1.3-use-c++11-for-kenlm.patch
new file mode 100644
index 000000000000..15b0024c4668
--- /dev/null
+++ b/app-i18n/libime/files/libime-1.1.3-use-c++11-for-kenlm.patch
@@ -0,0 +1,17 @@
+Backport of https://github.com/fcitx/libime/commit/95c1433500b089b0c2edbdd17720f66e6eafd5e0
+
+Backport upstream commit 95c1433 in order to fix building with libcxx
+
+--- a/src/libime/core/CMakeLists.txt
++++ b/src/libime/core/CMakeLists.txt
+@@ -13,7 +13,9 @@ add_library(kenlm STATIC ${KENLM_SRCS})
+ target_include_directories(kenlm PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/kenlm>)
+ target_compile_definitions(kenlm PUBLIC -DKENLM_MAX_ORDER=3 PRIVATE -DNDEBUG)
+ target_link_libraries(kenlm PUBLIC Boost::boost PkgConfig::ZSTD)
+-set_target_properties(kenlm PROPERTIES POSITION_INDEPENDENT_CODE ON)
++set_target_properties(kenlm PROPERTIES
++ CXX_STANDARD 11
++ POSITION_INDEPENDENT_CODE ON)
+
+ if(UNIX)
+ check_library_exists(rt clock_gettime "clock_gettime from librt" HAVE_CLOCKGETTIME_RT)
diff --git a/app-i18n/libime/libime-1.1.3.ebuild b/app-i18n/libime/libime-1.1.3.ebuild
new file mode 100644
index 000000000000..3d962ae4153e
--- /dev/null
+++ b/app-i18n/libime/libime-1.1.3.ebuild
@@ -0,0 +1,54 @@
+# Copyright 2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+DESCRIPTION="Fcitx5 Next generation of fcitx "
+HOMEPAGE="https://fcitx-im.org/"
+SRC_URI="https://download.fcitx-im.org/fcitx5/libime/libime-${PV}_dict.tar.xz"
+
+LICENSE="LGPL-2+"
+SLOT="5"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ >=app-i18n/fcitx-5.1.5:5
+ app-arch/zstd:=
+ dev-libs/boost:=
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ kde-frameworks/extra-cmake-modules:0
+ virtual/pkgconfig
+ doc? (
+ app-doc/doxygen
+ dev-texlive/texlive-fontutils
+ )
+"
+
+PATCHES=(
+ "${FILESDIR}/${P}-use-c++11-for-kenlm.patch"
+ "${FILESDIR}/${P}-fix-the-nanf-value-issue-on-musl.patch"
+)
+
+src_configure() {
+ local mycmakeargs=(
+ -DENABLE_DOC=$(usex doc)
+ -DENABLE_TEST=$(usex test)
+ )
+ cmake_src_configure
+}
+
+src_compile() {
+ cmake_src_compile
+ use doc && cmake_src_compile doc
+}
+
+src_install() {
+ cmake_src_install
+ use doc && dodoc -r "${BUILD_DIR}"/doc/*
+}
diff --git a/app-i18n/libime/metadata.xml b/app-i18n/libime/metadata.xml
new file mode 100644
index 000000000000..63181ec1c708
--- /dev/null
+++ b/app-i18n/libime/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person" proxied="yes">
+ <email>tanekliang@gmail.com</email>
+ <name>Yongxiang Liang</name>
+ </maintainer>
+ <maintainer type="project" proxied="proxy">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>cjk@gentoo.org</email>
+ <name>Cjk</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">fcitx/libime</remote-id>
+ </upstream>
+</pkgmetadata>