1 |
commit: c128d1b74954557d0e6d9df085b0a822450bb6e3 |
2 |
Author: Yixun Lan <dlan <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 27 10:00:33 2016 +0000 |
4 |
Commit: Yixun Lan <dlan <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 27 10:20:30 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c128d1b7 |
7 |
|
8 |
app-i18n/pyzy: support opencc-1.0.4 |
9 |
|
10 |
Gentoo-Bug: 580782 |
11 |
|
12 |
Package-Manager: portage-2.2.28 |
13 |
|
14 |
.../pyzy/files/pyzy-support-opencc-1.0.0.patch | 49 ++++++++++++++++++++ |
15 |
app-i18n/pyzy/pyzy-0.1.0-r2.ebuild | 54 ++++++++++++++++++++++ |
16 |
2 files changed, 103 insertions(+) |
17 |
|
18 |
diff --git a/app-i18n/pyzy/files/pyzy-support-opencc-1.0.0.patch b/app-i18n/pyzy/files/pyzy-support-opencc-1.0.0.patch |
19 |
new file mode 100644 |
20 |
index 0000000..055aad1 |
21 |
--- /dev/null |
22 |
+++ b/app-i18n/pyzy/files/pyzy-support-opencc-1.0.0.patch |
23 |
@@ -0,0 +1,49 @@ |
24 |
+commit 344872231b95ce7c2808288101cc563dcd011940 |
25 |
+Author: Hillwood Yang <hillwoodroc@×××××.com> |
26 |
+Date: Thu Feb 26 11:04:29 2015 +0800 |
27 |
+ |
28 |
+diff -urN a/src/SimpTradConverter.cc b/src/SimpTradConverter.cc |
29 |
+--- a/src/SimpTradConverter.cc |
30 |
++++ b/src/SimpTradConverter.cc |
31 |
+@@ -40,7 +41,6 @@ namespace PyZy { |
32 |
+ #ifdef HAVE_OPENCC |
33 |
+ |
34 |
+ class opencc { |
35 |
+- static const int BUFFER_SIZE = 64; |
36 |
+ public: |
37 |
+ opencc (void) |
38 |
+ { |
39 |
+@@ -55,29 +55,13 @@ public: |
40 |
+ |
41 |
+ void convert (const char *in, String &out) |
42 |
+ { |
43 |
+- long n_char; |
44 |
+- unichar *in_ucs4 = g_utf8_to_ucs4_fast (in, -1, &n_char); |
45 |
+- |
46 |
+- ucs4_t *pinbuf = (ucs4_t *)in_ucs4; |
47 |
+- size_t inbuf_left = n_char; |
48 |
+- while (inbuf_left != 0) { |
49 |
+- ucs4_t *poutbuf = (ucs4_t *)m_buffer; |
50 |
+- size_t outbuf_left = BUFFER_SIZE; |
51 |
+- size_t retval = opencc_convert(m_od, &pinbuf, &inbuf_left, &poutbuf, &outbuf_left); |
52 |
+- if (retval == (size_t) -1) { |
53 |
+- /* append left chars in pinbuf */ |
54 |
+- g_warning ("opencc_convert return failed"); |
55 |
+- out << (unichar *) pinbuf; |
56 |
+- break; |
57 |
+- } |
58 |
+- *poutbuf = L'\0'; |
59 |
+- out << m_buffer; |
60 |
+- } |
61 |
+- g_free (in_ucs4); |
62 |
++ char * converted = opencc_convert_utf8 (m_od, in, -1); |
63 |
++ g_assert (converted != NULL); |
64 |
++ out = converted; |
65 |
++ opencc_convert_utf8_free (converted); |
66 |
+ } |
67 |
+ private: |
68 |
+ opencc_t m_od; |
69 |
+- unichar m_buffer[BUFFER_SIZE + 1]; |
70 |
+ }; |
71 |
+ |
72 |
+ void |
73 |
|
74 |
diff --git a/app-i18n/pyzy/pyzy-0.1.0-r2.ebuild b/app-i18n/pyzy/pyzy-0.1.0-r2.ebuild |
75 |
new file mode 100644 |
76 |
index 0000000..22cbf96 |
77 |
--- /dev/null |
78 |
+++ b/app-i18n/pyzy/pyzy-0.1.0-r2.ebuild |
79 |
@@ -0,0 +1,54 @@ |
80 |
+# Copyright 1999-2016 Gentoo Foundation |
81 |
+# Distributed under the terms of the GNU General Public License v2 |
82 |
+# $Id$ |
83 |
+ |
84 |
+EAPI=5 |
85 |
+ |
86 |
+PYTHON_COMPAT=( python2_7 ) |
87 |
+inherit eutils python-any-r1 autotools |
88 |
+ |
89 |
+PY_DATABASE=${PN}-database-1.0.0 |
90 |
+DESCRIPTION="The Chinese PinYin and Bopomofo conversion library" |
91 |
+HOMEPAGE="https://github.com/pyzy/pyzy" |
92 |
+SRC_URI="https://pyzy.googlecode.com/files/${P}.tar.gz |
93 |
+ https://pyzy.googlecode.com/files/${PY_DATABASE}.tar.bz2" |
94 |
+ |
95 |
+LICENSE="LGPL-2.1" |
96 |
+SLOT="0" |
97 |
+KEYWORDS="~amd64 ~x86" |
98 |
+IUSE="boost doc opencc test" |
99 |
+ |
100 |
+RDEPEND="dev-libs/glib:2 |
101 |
+ dev-db/sqlite:3 |
102 |
+ sys-apps/util-linux |
103 |
+ boost? ( dev-libs/boost ) |
104 |
+ opencc? ( app-i18n/opencc )" |
105 |
+ |
106 |
+DEPEND="${RDEPEND} |
107 |
+ ${PYTHON_DEPS} |
108 |
+ doc? ( app-doc/doxygen )" |
109 |
+ |
110 |
+# Currently it fails to build test code |
111 |
+RESTRICT="test" |
112 |
+ |
113 |
+src_prepare() { |
114 |
+ epatch "${FILESDIR}"/${PN}-dont-download-dictionary-file.patch |
115 |
+ epatch "${FILESDIR}"/${PN}-support-opencc-1.0.0.patch |
116 |
+ |
117 |
+ mv ../db ./data/db/open-phrase/ || die |
118 |
+ eautoreconf |
119 |
+} |
120 |
+ |
121 |
+src_configure() { |
122 |
+ econf \ |
123 |
+ --enable-db-open-phrase \ |
124 |
+ --enable-db-android \ |
125 |
+ $(use_enable boost) \ |
126 |
+ $(use_enable opencc) \ |
127 |
+ $(use_enable test tests) |
128 |
+} |
129 |
+ |
130 |
+src_install() { |
131 |
+ default |
132 |
+ use doc && dohtml -r docs/html/* |
133 |
+} |