diff options
-rw-r--r-- | app-text/sdcv/ChangeLog | 13 | ||||
-rw-r--r-- | app-text/sdcv/files/sdcv-0.4.2-crash.patch | 27 | ||||
-rw-r--r-- | app-text/sdcv/files/sdcv-0.4.2-g-handling.patch | 21 | ||||
-rw-r--r-- | app-text/sdcv/files/sdcv-0.4.2-missing-headers.patch | 42 | ||||
-rw-r--r-- | app-text/sdcv/files/sdcv-0.4.2-respect-HOME.patch | 17 | ||||
-rw-r--r-- | app-text/sdcv/metadata.xml | 6 | ||||
-rw-r--r-- | app-text/sdcv/sdcv-0.4.2.ebuild | 46 |
7 files changed, 172 insertions, 0 deletions
diff --git a/app-text/sdcv/ChangeLog b/app-text/sdcv/ChangeLog new file mode 100644 index 000000000000..363440aad0d2 --- /dev/null +++ b/app-text/sdcv/ChangeLog @@ -0,0 +1,13 @@ +# ChangeLog for app-text/sdcv +# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/app-text/sdcv/ChangeLog,v 1.1 2008/12/16 19:39:34 pva Exp $ + +*sdcv-0.4.2 (16 Dec 2008) + + 16 Dec 2008; Peter Volkov <pva@gentoo.org> +files/sdcv-0.4.2-crash.patch, + +files/sdcv-0.4.2-g-handling.patch, + +files/sdcv-0.4.2-missing-headers.patch, + +files/sdcv-0.4.2-respect-HOME.patch, +metadata.xml, +sdcv-0.4.2.ebuild: + Initial import, bug #118359, thank Qiangning Hong and Andrew Savchenko for + initial ebuild. + diff --git a/app-text/sdcv/files/sdcv-0.4.2-crash.patch b/app-text/sdcv/files/sdcv-0.4.2-crash.patch new file mode 100644 index 000000000000..264cffcf1fca --- /dev/null +++ b/app-text/sdcv/files/sdcv-0.4.2-crash.patch @@ -0,0 +1,27 @@ +Fix unalligned access to buffer. + +On several architectures (arm, armel, sparc and ia64), unalligned access to +integers is not allowed. Buffer in this function is not alligned at all and +attempt to read integer from it causes crash of application on such +architectures. + +Reported upstream at: +https://sourceforge.net/tracker/index.php?func=detail&aid=2149388&group_id=122858&atid=694730 +--- a/src/lib/lib.cpp ++++ b/src/lib/lib.cpp +@@ -496,9 +496,13 @@ + entries[i].keystr=p; + len=strlen(p); + p+=len+1; +- entries[i].off=g_ntohl(*reinterpret_cast<guint32 *>(p)); ++ /* ++ * Can not use typecasting here, because *data does not have ++ * to be alligned and unalligned access fails on some architectures. ++ */ ++ entries[i].off=((unsigned char)p[0] << 24) | ((unsigned char)p[1] << 16) | ((unsigned char)p[2] << 8) | (unsigned char)p[3]; + p+=sizeof(guint32); +- entries[i].size=g_ntohl(*reinterpret_cast<guint32 *>(p)); ++ entries[i].size=((unsigned char)p[0] << 24) | ((unsigned char)p[1] << 16) | ((unsigned char)p[2] << 8) | (unsigned char)p[3]; + p+=sizeof(guint32); + } + } diff --git a/app-text/sdcv/files/sdcv-0.4.2-g-handling.patch b/app-text/sdcv/files/sdcv-0.4.2-g-handling.patch new file mode 100644 index 000000000000..72fb690358ed --- /dev/null +++ b/app-text/sdcv/files/sdcv-0.4.2-g-handling.patch @@ -0,0 +1,21 @@ +https://sourceforge.net/tracker/index.php?func=detail&aid=2125962&group_id=122858&atid=694730 + +Fixes displaying of 'g' (gtk markup) entries. +--- a/src/libwrapper.cpp ++++ b/src/libwrapper.cpp +@@ -118,7 +118,6 @@ + switch (*p++) { + case 'm': + case 'l': //need more work... +- case 'g': + sec_size = strlen(p); + if (sec_size) { + res+="\n"; +@@ -128,6 +127,7 @@ + } + sec_size++; + break; ++ case 'g': + case 'x': + sec_size = strlen(p); + if (sec_size) { diff --git a/app-text/sdcv/files/sdcv-0.4.2-missing-headers.patch b/app-text/sdcv/files/sdcv-0.4.2-missing-headers.patch new file mode 100644 index 000000000000..2011e2637e1e --- /dev/null +++ b/app-text/sdcv/files/sdcv-0.4.2-missing-headers.patch @@ -0,0 +1,42 @@ +Fixes compilation with recent GCC which is more strict about C++. +--- a/src/readline.cpp ++++ b/src/readline.cpp +@@ -23,6 +23,7 @@ + #endif + + #include <cstdio> ++#include <cstdlib> + #ifdef WITH_READLINE + # include <readline/readline.h> + # include <readline/history.h> +--- a/src/libwrapper.cpp ++++ b/src/libwrapper.cpp +@@ -24,6 +24,7 @@ + + #include <glib/gi18n.h> + #include <map> ++#include <cstring> + + #include "utils.hpp" + +--- a/src/utils.cpp ++++ b/src/utils.cpp +@@ -22,6 +22,7 @@ + # include "config.h" + #endif + ++#include <cstdlib> + #include <glib.h> + #include <glib/gi18n.h> + +--- a/src/lib/lib.cpp ++++ b/src/lib/lib.cpp +@@ -513,7 +513,7 @@ + { + fseek(idxfile, wordoffset[page_idx], SEEK_SET); + guint32 page_size=wordoffset[page_idx+1]-wordoffset[page_idx]; +- fread(wordentry_buf, std::min(sizeof(wordentry_buf), page_size), 1, idxfile); //TODO: check returned values, deal with word entry that strlen>255. ++ fread(wordentry_buf, std::min(sizeof(wordentry_buf), (size_t)page_size), 1, idxfile); //TODO: check returned values, deal with word entry that strlen>255. + return wordentry_buf; + } + diff --git a/app-text/sdcv/files/sdcv-0.4.2-respect-HOME.patch b/app-text/sdcv/files/sdcv-0.4.2-respect-HOME.patch new file mode 100644 index 000000000000..5b616500c6ce --- /dev/null +++ b/app-text/sdcv/files/sdcv-0.4.2-respect-HOME.patch @@ -0,0 +1,17 @@ +=== modified file 'src/sdcv.cpp' +--- src/sdcv.cpp 2008-11-18 12:43:28 +0000 ++++ src/sdcv.cpp 2008-11-18 12:43:41 +0000 +@@ -161,7 +161,11 @@ + + strlist_t dicts_dir_list; + +- dicts_dir_list.push_back(std::string(g_get_home_dir())+G_DIR_SEPARATOR+ ++ const char *homedir = g_getenv ("HOME"); ++ if (!homedir) ++ homedir = g_get_home_dir (); ++ ++ dicts_dir_list.push_back(std::string(homedir)+G_DIR_SEPARATOR+ + ".stardict"+G_DIR_SEPARATOR+"dic"); + dicts_dir_list.push_back(data_dir); + + diff --git a/app-text/sdcv/metadata.xml b/app-text/sdcv/metadata.xml new file mode 100644 index 000000000000..683f78428a60 --- /dev/null +++ b/app-text/sdcv/metadata.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>app-dicts</herd> + <longdescription>sdcv - console version of StarDict program.</longdescription> +</pkgmetadata> diff --git a/app-text/sdcv/sdcv-0.4.2.ebuild b/app-text/sdcv/sdcv-0.4.2.ebuild new file mode 100644 index 000000000000..a7b08400e0b6 --- /dev/null +++ b/app-text/sdcv/sdcv-0.4.2.ebuild @@ -0,0 +1,46 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-text/sdcv/sdcv-0.4.2.ebuild,v 1.1 2008/12/16 19:39:34 pva Exp $ + +inherit eutils + +DESCRIPTION="Console version of Stardict program" +HOMEPAGE="http://sdcv.sourceforge.net" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="nls test" + +RDEPEND="sys-libs/zlib + sys-libs/readline + >=dev-libs/glib-2.6.1" +DEPEND="${RDEPEND} + test? ( app-dicts/stardict-quick-ru-en ) + nls? ( >=sys-devel/gettext-0.14.1 )" + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}/${P}-missing-headers.patch" + epatch "${FILESDIR}/${P}-crash.patch" + epatch "${FILESDIR}/${P}-g-handling.patch" + epatch "${FILESDIR}/${P}-respect-HOME.patch" +} + +src_compile() { + econf $(use_enable nls) + emake || die "emake failed" +} + +src_test() { + export HOME=${T} + mkdir -p "${HOME}/.stardict/dic" + emake check || die +} + +src_install() { + emake DESTDIR="${D}" install || die + dodoc AUTHORS BUGS ChangeLog NEWS README TODO +} |