commit: beb002c292228709cf437afc2c31f2b1af1be71b
Author: Andrew Savchenko gentoo org>
AuthorDate: Sat Apr 3 19:14:53 2021 +
Commit: Andrew Savchenko gentoo org>
CommitDate: Sat Apr 3 19:18:43 2021 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=beb002c2
app-text/sdcv: version bump
- Update to 0.5.3
- Bump to EAPI 7
- Migrate to cmake.eclass
- Pick up upstream patchset for binsearch speedup
Closes: https://bugs.gentoo.org/774510
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Andrew Savchenko gentoo.org>
app-text/sdcv/Manifest | 1 +
app-text/sdcv/files/sdcv-0.5.3-t_list.patch| 19
app-text/sdcv/files/sdcv-synonyms-bin-search.patch | 112 +
app-text/sdcv/sdcv-0.5.3.ebuild| 74 ++
4 files changed, 206 insertions(+)
diff --git a/app-text/sdcv/Manifest b/app-text/sdcv/Manifest
index c30f650ef31..3800567f539 100644
--- a/app-text/sdcv/Manifest
+++ b/app-text/sdcv/Manifest
@@ -1 +1,2 @@
DIST sdcv-0.5.2.tar.gz 61541 BLAKE2B
3b86b69c1e781c311ebbd427d09f8e1c8f97a9fc7b72e22f812ec4619fb4f3cd673ea5548cfdd89554e1613877d20676b8830fd5921082d7a13facb761001c00
SHA512
8752a225aebcc28cd8911591333410a0da94db9a7718cee744f8fbc6ceeae14bbf13c6d5a02a05652ff032276765537573e216acd49980f80c06319dac7075fb
+DIST sdcv-0.5.3.tar.gz 62105 BLAKE2B
1424510cff2fa355d17884a31f8136f4c8a7bde071f387dd8a69b1d2d6b9c8e52869cd602b27b9966725370cf128fb62b8628e735f1faa92b78f75215462804f
SHA512
73a305baad74d0584912e115d3de7395c8e88745fb69b4e5f1a345061629b0d4e05898bd589e96ce07948d52ba7c508ec4ab77862c8fadca5a2f19c5244e1442
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 000..c26a93522bd
--- /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 000..e3583b1a5fb
--- /dev/null
+++ b/app-text/sdcv/files/sdcv-synonyms-bin-search.patch
@@ -0,0 +1,112 @@
+ommit 4ae420734990ab9f5ccc038262368256b9323f4a
+Merge: b66799f 994c1c7
+Author: Evgeniy Dushistov
+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 , gulong wc)
+ {
+ struct stat stat_buf;
+ if (!stat(url.c_str(), _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 , gulong wc)
+
+ bool SynFile::lookup(const char *str, glong )
+ {
+-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;