summaryrefslogtreecommitdiff
path: root/app-text/sdcv
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-04-28 20:21:43 +0100
committerV3n3RiX <venerix@redcorelinux.org>2021-04-28 20:21:43 +0100
commit40aaaa64e86ba6710bbeb31c4615a6ce80e75e11 (patch)
tree758c221bad35c9288d0bd6df9c7dfc226728e52c /app-text/sdcv
parent8d5dbd847cbc704a6a06405856e94b461011afe3 (diff)
gentoo resync : 28.04.2021
Diffstat (limited to 'app-text/sdcv')
-rw-r--r--app-text/sdcv/Manifest4
-rw-r--r--app-text/sdcv/files/sdcv-0.5.3-t_list.patch19
-rw-r--r--app-text/sdcv/files/sdcv-synonyms-bin-search.patch112
-rw-r--r--app-text/sdcv/sdcv-0.5.3.ebuild74
4 files changed, 209 insertions, 0 deletions
diff --git a/app-text/sdcv/Manifest b/app-text/sdcv/Manifest
index b2e2e9a40a3c..73deea7c2b54 100644
--- a/app-text/sdcv/Manifest
+++ b/app-text/sdcv/Manifest
@@ -1,5 +1,9 @@
+AUX sdcv-0.5.3-t_list.patch 592 BLAKE2B 7f1618750a8d9c452f8db257a2b4791b803f45f10334789dd6f6d13f46335d9daf4a1a070ad03a38d40e6937d5e70371502ba26361c4d62486031888645843c3 SHA512 1aad632517f04423fd0a985256d760a06e5e38c3c9335f814f6997559ed3e3fb33fe1dba25e49b8298eda6570526323c2fdef18be83ab3363caa074cd59db107
+AUX sdcv-synonyms-bin-search.patch 3409 BLAKE2B e40f32a2e0e401ae5b996992fa227ef70a439f928d762285094237871b7dded242928bab8206a146acf1abf716cdbcaa8a8d0ed5a430ec4dff5cae3a3a014b34 SHA512 bf4cf297abed05f4052cbff8decac2069a52657b3cfc21435e72731536ab9605ddde9053fa8b39d9a2f1dc67416126b1b10a1c31cabca37a6fb31d2272ba5e13
AUX sdcv-t_interactive.patch 324 BLAKE2B ecdb0d89c4a26050927272f244e43b28e945e3ef5cb93167eaea7c09912e504af2061ec34c2b5f5a32665c784093e2d35ed92e10a00824b619da71e53049e5dc SHA512 9067330c6fa95910b5dd67716c9bc378d29a9ccc5d60c1eb0c1aca12e58478ea381b91c5122c1951bd2f4c9e8b629243ea885bdbbc87a2f88174340919f5cf8d
AUX sdcv-t_list.patch 588 BLAKE2B ea7106246204d2c18eaecdb05e4bf7a9c1d12d0ef6e1509591ad5afcf529746a6ef3f4a5051add8923c399863f8b56c3144c9d758b7fa2215b6b593eb1e2b305 SHA512 7a2f8fc105988ce6847ce533051ed65ec49b2ac1ffa4ec076a78be59d219d8c18aee7170d965dd429b95b193bf5a4608d20002e9fa58b6abfa5b972bb6879f94
DIST sdcv-0.5.2.tar.gz 61541 BLAKE2B 3b86b69c1e781c311ebbd427d09f8e1c8f97a9fc7b72e22f812ec4619fb4f3cd673ea5548cfdd89554e1613877d20676b8830fd5921082d7a13facb761001c00 SHA512 8752a225aebcc28cd8911591333410a0da94db9a7718cee744f8fbc6ceeae14bbf13c6d5a02a05652ff032276765537573e216acd49980f80c06319dac7075fb
+DIST sdcv-0.5.3.tar.gz 62105 BLAKE2B 1424510cff2fa355d17884a31f8136f4c8a7bde071f387dd8a69b1d2d6b9c8e52869cd602b27b9966725370cf128fb62b8628e735f1faa92b78f75215462804f SHA512 73a305baad74d0584912e115d3de7395c8e88745fb69b4e5f1a345061629b0d4e05898bd589e96ce07948d52ba7c508ec4ab77862c8fadca5a2f19c5244e1442
EBUILD sdcv-0.5.2.ebuild 1609 BLAKE2B 9f3eabd561d63a5d2255cf2efb30d9dbdfe792a65a0c1c6e69be45330e4b5cfc2157bd3d0ea1ea92265b3fbc288c0bad6ba5b9130eecae88531e6bea991ff118 SHA512 6cf930c6fad804bbd6890265183a6c1d2db122ac953f52726cd42f3b223f11a2ba921b81d0935a4a984e03af7a15bc37d700c48571dde050232a255d8f1cd9e4
+EBUILD sdcv-0.5.3.ebuild 1598 BLAKE2B 1ca31bdbf7d04f0b73ab7c815bcdbbee4e3640712f1d51a004a4b5750072337898366b64eabfa054637db6b40f9432eec279d35c8cc3e6454d2706da313912af SHA512 a45d912c38018364f4c210e42cb3d99687639ee5ee709fc773a528e5b0923cd5cacff5cfb60b3be439d0e8c2ce0c9f22ad9fb0d65cc1e05e74d625d5dafc156d
MISC metadata.xml 448 BLAKE2B fd8196b4fb4caf645780c9b9c3170aa2f6148d17c359d2ea5579eff73f91b7eed8507ad8ed99a93c02ea7bae327bf6641dd1b6863539be379f45b4258aee1342 SHA512 f265fa0f3215a1effc00060394e942f10b7f5247bf6c1c55f9cbeb28ae26bc7398bf97acdc877d545a1e90a83b8ce41eb9780beab1267c99061f2b391a59acbb
diff --git a/app-text/sdcv/files/sdcv-0.5.3-t_list.patch b/app-text/sdcv/files/sdcv-0.5.3-t_list.patch
new file mode 100644
index 000000000000..c26a93522bd1
--- /dev/null
+++ b/app-text/sdcv/files/sdcv-0.5.3-t_list.patch
@@ -0,0 +1,19 @@
+diff --git a/tests/t_list b/tests/t_list
+index a8c92c4..c410cf2 100755
+--- a/tests/t_list
++++ b/tests/t_list
+@@ -1,11 +1,10 @@
+ #!/bin/sh
+
+ PATH_TO_SDCV="$1"
+-ndicts=`"$PATH_TO_SDCV" -l | wc -l`
++TEST_DIR="$2"
++ndicts=`"$PATH_TO_SDCV" --data-dir "${TEST_DIR}" -l | wc -l`
+ ndicts=$(($ndicts-1))
+-ncom=`find /usr/share/stardict/dic -name "*.ifo" | wc -l`
+-nspe=`find "${XDG_DATA_HOME:-$HOME/.local/share}"/stardict/dic -name "*.ifo" | wc -l`
+-nmy=$(($ncom+$nspe))
++nmy=`find "${TEST_DIR}" -name "*.ifo" | wc -l`
+
+ if [ $nmy -ne $ndicts ]; then
+ echo "should be: $nmy, we have: $ndicts" >&2
diff --git a/app-text/sdcv/files/sdcv-synonyms-bin-search.patch b/app-text/sdcv/files/sdcv-synonyms-bin-search.patch
new file mode 100644
index 000000000000..e3583b1a5fb6
--- /dev/null
+++ b/app-text/sdcv/files/sdcv-synonyms-bin-search.patch
@@ -0,0 +1,112 @@
+ommit 4ae420734990ab9f5ccc038262368256b9323f4a
+Merge: b66799f 994c1c7
+Author: Evgeniy Dushistov <dushistov@mail.ru>
+Date: Wed Dec 23 04:30:13 2020 +0300
+
+ Merge pull request #67 from doozan/master
+
+ Use binary search for synonyms, fixes #31
+
+diff --git a/src/stardict_lib.cpp b/src/stardict_lib.cpp
+index 0af4304..6b1f92b 100644
+--- a/src/stardict_lib.cpp
++++ b/src/stardict_lib.cpp
+@@ -833,21 +833,23 @@ bool SynFile::load(const std::string &url, gulong wc)
+ {
+ struct stat stat_buf;
+ if (!stat(url.c_str(), &stat_buf)) {
+- MapFile syn;
+- if (!syn.open(url.c_str(), stat_buf.st_size))
++
++ if (!synfile.open(url.c_str(), stat_buf.st_size))
+ return false;
+- const gchar *current = syn.begin();
++
++ synlist.resize(wc + 1);
++ gchar *p1 = synfile.begin();
++
+ for (unsigned long i = 0; i < wc; i++) {
+ // each entry in a syn-file is:
+ // - 0-terminated string
+ // 4-byte index into .dict file in network byte order
+- glib::CharStr lower_string{ g_utf8_casefold(current, -1) };
+- std::string synonym{ get_impl(lower_string) };
+- current += synonym.length() + 1;
+- const guint32 idx = g_ntohl(get_uint32(current));
+- current += sizeof(idx);
+- synonyms[synonym] = idx;
++
++ synlist[i] = p1;
++ p1 += strlen(p1) + 1 + 4;
+ }
++ synlist[wc] = p1;
++
+ return true;
+ } else {
+ return false;
+@@ -856,13 +858,38 @@ bool SynFile::load(const std::string &url, gulong wc)
+
+ bool SynFile::lookup(const char *str, glong &idx)
+ {
+- glib::CharStr lower_string{ g_utf8_casefold(str, -1) };
+- auto it = synonyms.find(get_impl(lower_string));
+- if (it != synonyms.end()) {
+- idx = it->second;
+- return true;
++ bool bFound = false;
++ glong iTo = synlist.size() - 2;
++ if (iTo <0) return false;
++
++ if (stardict_strcmp(str, get_key(0)) < 0) {
++ idx = 0;
++ } else if (stardict_strcmp(str, get_key(iTo)) > 0) {
++ idx = INVALID_INDEX;
++ } else {
++ glong iThisIndex = 0;
++ glong iFrom = 0;
++ gint cmpint;
++ while (iFrom <= iTo) {
++ iThisIndex = (iFrom + iTo) / 2;
++ cmpint = stardict_strcmp(str, get_key(iThisIndex));
++ if (cmpint > 0)
++ iFrom = iThisIndex + 1;
++ else if (cmpint < 0)
++ iTo = iThisIndex - 1;
++ else {
++ bFound = true;
++ break;
++ }
++ }
++ if (!bFound)
++ idx = iFrom; //next
++ else {
++ const gchar *key = get_key(iThisIndex);
++ idx = g_ntohl(get_uint32(key+strlen(key)+1));
++ }
+ }
+- return false;
++ return bFound;
+ }
+
+ bool Dict::Lookup(const char *str, glong &idx)
+diff --git a/src/stardict_lib.hpp b/src/stardict_lib.hpp
+index a629cbe..38f76f4 100644
+--- a/src/stardict_lib.hpp
++++ b/src/stardict_lib.hpp
+@@ -102,11 +102,15 @@ public:
+ class SynFile
+ {
+ public:
++ SynFile() {}
++ ~SynFile() {}
+ bool load(const std::string &url, gulong wc);
+ bool lookup(const char *str, glong &idx);
++ const gchar *get_key(glong idx) { return synlist[idx]; }
+
+ private:
+- std::map<std::string, gulong> synonyms;
++ MapFile synfile;
++ std::vector<gchar *> synlist;
+ };
+
+ class Dict : public DictBase
diff --git a/app-text/sdcv/sdcv-0.5.3.ebuild b/app-text/sdcv/sdcv-0.5.3.ebuild
new file mode 100644
index 000000000000..8b7225b3c9d1
--- /dev/null
+++ b/app-text/sdcv/sdcv-0.5.3.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PLOCALES="cs fr ru sk uk zh_CN zh_TW"
+inherit cmake l10n
+
+DESCRIPTION="Console version of Stardict program"
+HOMEPAGE="https://dushistov.github.io/sdcv/"
+SRC_URI="https://github.com/Dushistov/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="darkterm nls readline test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ >=dev-libs/glib-2.36
+ sys-libs/zlib
+ readline? ( sys-libs/readline:= )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ nls? ( >=sys-devel/gettext-0.14.1 )
+ test? ( app-misc/jq )
+"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-0.5.3-t_list.patch"
+ "${FILESDIR}/${PN}-t_interactive.patch"
+ "${FILESDIR}/${PN}-synonyms-bin-search.patch"
+)
+
+src_prepare() {
+ if use darkterm; then
+ sed -i 's/;34m/;36m/' src/libwrapper.cpp || die
+ fi
+
+ rm_loc() {
+ rm "po/${1}.po" || die
+ }
+ l10n_for_each_disabled_locale_do rm_loc
+
+ # do not install locale-specific man pages unless asked to
+ if ! has uk ${LINGUAS-uk}; then
+ sed -ni '/share\/man\/uk/!p' CMakeLists.txt || die
+ fi
+
+ cmake_src_prepare
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DENABLE_NLS="$(usex nls)"
+ -DWITH_READLINE="$(usex readline)"
+ -DBUILD_TESTS="$(usex test ON OFF)"
+ )
+ cmake_src_configure
+}
+
+src_compile() {
+ cmake_src_compile
+ use nls && cmake_src_compile lang
+}
+
+src_install() {
+ # with USE=nls, but empty intersection of LINGUAS and list of
+ # supported translations, this directory is required, see bug 583386
+ mkdir -p "${BUILD_DIR}/locale"
+ cmake_src_install
+ dodoc doc/DICTFILE_FORMAT
+}