Gentoo Archives: gentoo-commits

From: Yixun Lan <dlan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-i18n/sunpinyin/, app-i18n/sunpinyin/files/
Date: Tue, 11 Oct 2016 21:56:13
Message-Id: 1476222964.e056277175e3d4033840c60ca6f5ca437f75ffb7.dlan@gentoo
1 commit: e056277175e3d4033840c60ca6f5ca437f75ffb7
2 Author: Yixun Lan <dlan <AT> gentoo <DOT> org>
3 AuthorDate: Tue Oct 11 21:53:54 2016 +0000
4 Commit: Yixun Lan <dlan <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 11 21:56:04 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e0562771
7
8 app-i18n/sunpinyin: fix gcc-6 build err
9
10 thanks Peter Levine for creating the patch
11
12 Gentoo-Bug: 594380
13
14 Package-Manager: portage-2.3.1
15
16 ...unpinyin-2.0.4_pre20130108-gcc6-use-float.patch | 17 ++++++++
17 .../sunpinyin-2.0.4_pre20130108-r1.ebuild | 48 ++++++++++++++++++++++
18 2 files changed, 65 insertions(+)
19
20 diff --git a/app-i18n/sunpinyin/files/sunpinyin-2.0.4_pre20130108-gcc6-use-float.patch b/app-i18n/sunpinyin/files/sunpinyin-2.0.4_pre20130108-gcc6-use-float.patch
21 new file mode 100644
22 index 00000000..77fe283
23 --- /dev/null
24 +++ b/app-i18n/sunpinyin/files/sunpinyin-2.0.4_pre20130108-gcc6-use-float.patch
25 @@ -0,0 +1,17 @@
26 +--- sunpinyin-2.0.4_pre20130108/src/slm/tslmpack/common.h.old 2016-09-20 02:54:15.046257131 -0400
27 ++++ sunpinyin-2.0.4_pre20130108/src/slm/tslmpack/common.h 2016-09-20 02:55:48.041124978 -0400
28 +@@ -53,10 +53,10 @@
29 + typedef std::map<float, int> RealIndexMap; // map real values to their indices
30 + typedef std::map<std::string, unsigned int> TLexicon; // map word to wid
31 +
32 +-#define EffectivePr(a) (float((usingLogPr) ? ((a) / log(2.0)) : (-log2((a)))))
33 +-#define OriginalPr(b) (float((usingLogPr) ? ((b) * log(2.0)) : (exp2(-(b)))))
34 +-#define EffectiveBow(a) (float((usingLogPr) ? (exp(-(a))) : ((a))))
35 +-#define OriginalBow(b) (float((usingLogPr) ? (-log((b))) : ((b))))
36 ++#define EffectivePr(a) (float((usingLogPr) ? ((a) / logf(2.0f)) : (-log2f((a)))))
37 ++#define OriginalPr(b) (float((usingLogPr) ? ((b) * logf(2.0f)) : (exp2f(-(b)))))
38 ++#define EffectiveBow(a) (float((usingLogPr) ? (expf(-(a))) : ((a))))
39 ++#define OriginalBow(b) (float((usingLogPr) ? (-logf((b))) : ((b))))
40 +
41 + #endif //_SLM_PACK_COMMON_H
42 +
43
44 diff --git a/app-i18n/sunpinyin/sunpinyin-2.0.4_pre20130108-r1.ebuild b/app-i18n/sunpinyin/sunpinyin-2.0.4_pre20130108-r1.ebuild
45 new file mode 100644
46 index 00000000..7a97afb
47 --- /dev/null
48 +++ b/app-i18n/sunpinyin/sunpinyin-2.0.4_pre20130108-r1.ebuild
49 @@ -0,0 +1,48 @@
50 +# Copyright 1999-2016 Gentoo Foundation
51 +# Distributed under the terms of the GNU General Public License v2
52 +# $Id$
53 +
54 +EAPI=5
55 +PYTHON_COMPAT=( python2_7 )
56 +inherit eutils multilib python-any-r1 scons-utils toolchain-funcs
57 +
58 +DESCRIPTION="A Statistical Language Model based Chinese input method library"
59 +HOMEPAGE="https://github.com/sunpinyin/sunpinyin"
60 +SRC_URI="https://dev.gentoo.org/~yngwin/distfiles/${P}.tar.xz"
61 +
62 +LICENSE="LGPL-2.1 CDDL"
63 +SLOT="0/1"
64 +KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
65 +IUSE=""
66 +
67 +RDEPEND="dev-db/sqlite:3"
68 +DEPEND="${RDEPEND}
69 + ${PYTHON_DEPS}
70 + dev-util/intltool
71 + sys-devel/gettext
72 + virtual/pkgconfig"
73 +PDEPEND="app-i18n/sunpinyin-data"
74 +
75 +src_prepare() {
76 + epatch "${FILESDIR}"/${PN}-2.0.4-pod2man.patch
77 + epatch "${FILESDIR}"/${P}-gcc6-use-float.patch
78 + epatch_user
79 +}
80 +
81 +src_configure() {
82 + tc-export CXX
83 + myesconsargs=(
84 + --prefix="${EPREFIX}"/usr
85 + --libdir="${EPREFIX}"/usr/$(get_libdir)
86 + )
87 +}
88 +
89 +src_compile() {
90 + escons
91 +}
92 +
93 +src_install() {
94 + escons --install-sandbox="${D}" install
95 + rm -rf "${D}"/usr/share/doc/${PN} || die
96 + dodoc doc/{README,SLM-inst.mk,SLM-train.mk}
97 +}