Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-i18n/mozc/, app-i18n/mozc/files/
Date: Thu, 28 Sep 2017 17:18:54
Message-Id: 1506618660.ab7a7c7c7ca7b03d914d8106a5462f726e8d0a0b.floppym@gentoo
1 commit: ab7a7c7c7ca7b03d914d8106a5462f726e8d0a0b
2 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
3 AuthorDate: Thu Sep 28 15:52:59 2017 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 28 17:11:00 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab7a7c7c
7
8 app-i18n/mozc: Version bump (2.20.2673.102).
9
10 Upstream migrated from Qt 4 to Qt 5.
11 "qt4" / "qt5" USE flag renamed to "gui".
12
13 "fcitx" USE flag renamed to "fcitx4".
14 ("fcitx5" USE flag will be used to control support for Fcitx 5.)
15
16 "handwriting-tegaki" and "handwriting-tomoe" USE flags introduced to select usage
17 of handwriting recognition model from app-i18n/tegaki-zinnia-japanese or
18 app-i18n/zinnia-tomoe. "handwriting-tegaki" is enabled by default in accordance
19 with upstream default for Mozc.
20
21 Test suite unrestricted and fixed to build.
22
23 app-i18n/mozc/Manifest | 3 +
24 .../mozc-2.20.2673.102-system_libraries.patch | 133 +++++++++
25 .../files/mozc-2.20.2673.102-tests_build.patch | 27 ++
26 .../files/mozc-2.20.2673.102-tests_skipping.patch | 70 +++++
27 app-i18n/mozc/metadata.xml | 6 +-
28 app-i18n/mozc/mozc-2.20.2673.102.ebuild | 309 +++++++++++++++++++++
29 6 files changed, 547 insertions(+), 1 deletion(-)
30
31 diff --git a/app-i18n/mozc/Manifest b/app-i18n/mozc/Manifest
32 index c88789227fd..ee7002187dc 100644
33 --- a/app-i18n/mozc/Manifest
34 +++ b/app-i18n/mozc/Manifest
35 @@ -1,10 +1,13 @@
36 DIST fcitx-mozc-2.16.2037.102.2.patch 140421 SHA256 ff175f3e0301c33f750780765ea264887827d00bc7a59fc8b55ae514ba449a1e SHA512 22b885859588bb8e0efd354d153da461a654203729c723156a419bf33fae473e3f7165964aa3cb3b5c969f97c2727f9d87b0d587330e4eeab67f07d4458542a3 WHIRLPOOL cd9534c8904a7c9f866a8ddd41ab4c57b3ad8b5650fda4cf9ccc1e544c8e0da25c749870606687ee66e4252f224babdbe10415e035038ced654812bad8d299dc
37 +DIST fcitx-mozc-2.18.2612.102.1.patch 140722 SHA256 0ec5dc2e9798ce7a6dbcbe847cf016b0b49be1851008143d167c13333a15ed27 SHA512 725c464727f230707b90975705ef1565f1178f9144e66c5a688696a4ef520a6fec1d11f7aa68ee05f82aa9417060b1cccf49a155e30734871a525eaa4c76addb WHIRLPOOL 25d0efd313175f6648504b989302c73ab6d82a0cf4eecf332b68347331e1feff2df6251edd49c3d4e9251a2c7e01df56eb8de54ebbbc31582f7c2b89d1da53c1
38 DIST gmock-1.6.0.zip 2053682 SHA256 341ad07c31c619ba32c88c2265bc23693da1df062f47f146a7ed340f646d82b7 SHA512 7adff00bb6ff81a6ffb704be71d0747636d69e24b4a8b709e1fb8c177a9a47f6dea8d14fde73034ebfb1529c291c7212a944ad92a34f88abdfe23c2d0b11b6f7 WHIRLPOOL 1a03ff8f2d96287f5deb24f970688f20f3480e77a4a71089ef1399a87f28f616bf0feaedc217e7ac1ca8ca1246e53f5d882f350704be111ae547961949939530
39 DIST gtest-1.6.0.zip 1121697 SHA256 5ec97df8e75b4ee796604e74716d1b50582beba22c5502edd055a7e67a3965d8 SHA512 f4718dfbfa3339bb9449c3f14e5b44ae405ea7df64c10a0957a6300985b71c4642981d069a1382e27ae041a4e2873527a9e442aff978447e795a190f99fac115 WHIRLPOOL 745a49020d4353ed2fa38adfc80bbd777358c831719bbe3b7c90d243f84256615222ba5f04d48d98b9e1a803bb40766799b3aedd575024c19d853d9239a12f8a
40 DIST gyp-20140602.tar.bz2 432422 SHA256 f67be748f4dc36aa1619f43d4624c746728cf268af7f4ebf78dab3fa6d43d973 SHA512 e3a59daac57ddafc5804384c01cf51d4b90cd119d263afd83ec6eef9239c38bc7715736f70e20e44fae04fd8be1b86aa5323908a92d574372aa298f3355ce15f WHIRLPOOL 17e4630dcd7592e8ee197b4130d6147d9fd63404938f62e08ad10a204bd4bddcfc7d394abf3572a337e3dea46d4a7361dbc0cccc02e07ab99ed8f90e80830451
41 DIST japanese-usage-dictionary-10.tar.bz2 56142 SHA256 8c22284c97fdfad854790517f9200c439453c033db8f6a9d25aa5d95266b2384 SHA512 f299cf9183b9ec219d80c1fa745f351765d246d601f3c4091d1705e3c8b5ef66a32288d4c162e7bbc456b6d49ee90f1e5bf33721e1229165f3ee069daddd3198 WHIRLPOOL d2f690335cf271b0780c969f56616ece9d28f3dbe990548053a252c855db18a4a31d21e6bd8c34160c0893c21fab4543e5ff3cecb48c7f6ecfd5c84465d314a6
42 +DIST japanese-usage-dictionary-20120416091336.tar.gz 71051 SHA256 0b6efee0eebac2c1a8eeea333278aa40fcef7846bba9a379962c6e567e7e3dc1 SHA512 b7e997a979b6d50e49b9af5dc830ea4df0532f6ab1321b9ef14983f65bb54f1b2967375c82e07957ae7693ebbf43c9b56ecea6bfea8dd1fdaee444bd549d83a7 WHIRLPOOL 1c4324a6408cfc0b2e1df33a32583384ccf10374bc1a8f49f574e681a72174f7bee7e8500c93d714ee6459c087f7cd408e57cb52b8506ec50292249e50045cd2
43 DIST jsoncpp-src-0.6.0-rc2.tar.gz 117661 SHA256 d4d193d163f520b08b9155cba978615892ca1359d77e3fb261fce2f86d09b283 SHA512 5d44e766aa2d7657bc68cf16173130febaa6744d5fca0c6df5465617a3f306023a17cbeb07a62ad1a34c2d183d916401b4be48f37c2416c895db4ad5d9481b3d WHIRLPOOL bfa7e70e14f3ed0911c5127da0d2099ca8b9159a900a5bc5147d1e50b5a9f9d5be69a8d46a761d277ca1edabaab8d0d3b9f81417572e4664ed8239fd83c953e6
44 DIST mozc-1.10.1390.102.tar.bz2 57879881 SHA256 72a8ed6657daa1c03b1efe50c262a69be2ab66d45747a47df6e54996b6d5ee39 SHA512 4482e822f8a14bffd02cb1eaa5d14ba0a213266b2f0dd6402c42b9b357bf0d8c4dd572cef79f1d400bd68b7bd6cb4367933574f8f5967f68738249a300e3cfb9 WHIRLPOOL 90518e621ef784b438fcf677e211fdb6753719f3d78d14ce866ccea22d6d87f8d64e334bc568eebe93cb2850d3d545eb0b73d6f6de820eaf1d43f16bfdef4100
45 DIST mozc-1.13.1651.102.tar.bz2 31635636 SHA256 a275accc726d55d696adf235fa40822ae099f0a02d3dc9f8d0257ba191a1bc49 SHA512 caa75e60704e904a72fd06e315a219ff304a54adaeee70a8ab75d413f7801960add103b9aae1c19ee92f6d10c4c408fd840cf78c5dde0cc21c605feac59deaf4 WHIRLPOOL 72a870cc1bc5bc63227bba61c73183f69160aa5c58c9b89e75fa65bf16bbdc2c2b873b7407d0543b3847bc046866392d9bbe6d771d7b4b7eb3f6be759f1a63b4
46 DIST mozc-2.16.2037.102.tar.bz2 41172838 SHA256 4b78769b36366f056282267935a859e587f77e9aaf17132687d0e4d0c4da5cd0 SHA512 ff114a93054b43109407c44bc7c75de79fa2b028f9dba5c2ecc1776c5cbb032f184a91155b6b31bc17f0183dd70b0150ce13e80f59e26810daf4b65ba7e52be1 WHIRLPOOL 625c5a28da164ee96cdf523af32a7101357254cea1d57cd7f272bdf86ba8344d3e39bf2b2bfb0a79640d7961fd46c183eabc4002c8d86215ecffe183e4e0d193
47 +DIST mozc-2.20.2673.102.tar.gz 48623065 SHA256 794ec312e9a5567d2097059beb25718ddb1636cd8dd99b880ec97e26824276ea SHA512 409d406fdb21d55c93a4287cd3757a164c65c1c309918b4e905aec422d9c86bc6e51ae67c23ad0db2c87ab968443bd62f5a58684a0bf5d52751988a5ec5b0bd5 WHIRLPOOL 022029c7828502907f3c3e6fd39cfa059a947f75538b6958ec81528caec0a1be0cce48a3e94ff67303021f2003fcd1a966cdf3a4bbbf113968e454ba3e84295c
48 DIST protobuf-2.5.0.tar.bz2 1866763 SHA256 13bfc5ae543cf3aa180ac2485c0bc89495e3ae711fc6fab4f8ffe90dfb4bb677 SHA512 5994b3669808b82fef5c860ecad36358c0767f84acac877e7bfcf722e59d972835a955714149bdd4158fbd1328a51d01397a563991d26475351ee72be48142ee WHIRLPOOL 7e6786e1f20bf253d0e386a95c2bbfe1b443f484d492f97552cadcea62c24461436aa88130e3ff20b4dc9f352c101458cb8c03686f1cc4e6e2133b6e78f5b70d
49
50 diff --git a/app-i18n/mozc/files/mozc-2.20.2673.102-system_libraries.patch b/app-i18n/mozc/files/mozc-2.20.2673.102-system_libraries.patch
51 new file mode 100644
52 index 00000000000..dd6e57717d1
53 --- /dev/null
54 +++ b/app-i18n/mozc/files/mozc-2.20.2673.102-system_libraries.patch
55 @@ -0,0 +1,133 @@
56 +--- /src/net/jsoncpp.gyp
57 ++++ /src/net/jsoncpp.gyp
58 +@@ -31,31 +31,25 @@
59 + 'targets': [
60 + {
61 + 'target_name': 'jsoncpp',
62 +- 'type': 'static_library',
63 ++ 'type': 'none',
64 + 'variables': {
65 +- 'jsoncpp_root': '<(third_party_dir)/jsoncpp',
66 +- 'jsoncpp_srcs': [
67 +- '<(jsoncpp_root)/src/lib_json/json_reader.cpp',
68 +- '<(jsoncpp_root)/src/lib_json/json_value.cpp',
69 +- '<(jsoncpp_root)/src/lib_json/json_writer.cpp',
70 +- ],
71 +- 'jsoncpp_include_dirs': ['<(jsoncpp_root)/include'],
72 + 'jsoncpp_additional_macros': ['JSON_USE_EXCEPTION=0'],
73 + },
74 +- 'defines': [
75 +- '<@(jsoncpp_additional_macros)',
76 +- ],
77 +- 'sources': [
78 +- '<@(jsoncpp_srcs)',
79 +- 'jsoncpp.h',
80 +- ],
81 +- 'include_dirs': [
82 +- '<@(jsoncpp_include_dirs)',
83 +- ],
84 + 'all_dependent_settings': {
85 + 'defines': [
86 + '<@(jsoncpp_additional_macros)',
87 + ],
88 ++ 'cflags': [
89 ++ '<!@(pkg-config --cflags jsoncpp)',
90 ++ ],
91 ++ 'link_settings': {
92 ++ 'libraries': [
93 ++ '<!@(pkg-config --libs-only-l jsoncpp)',
94 ++ ],
95 ++ 'ldflags': [
96 ++ '<!@(pkg-config --libs-only-L jsoncpp)',
97 ++ ],
98 ++ }
99 + },
100 + },
101 + ],
102 +--- /src/net/jsoncpp.h
103 ++++ /src/net/jsoncpp.h
104 +@@ -35,7 +35,7 @@
105 + // Mozc basically disables C++ exception.
106 + #define JSON_USE_EXCEPTION 0
107 + #endif // !JSON_USE_EXCEPTION
108 +-#include "third_party/jsoncpp/include/json/json.h"
109 ++#include <json/json.h>
110 + #define MOZC_JSONCPP_JSON_H_INCLUDED
111 + #endif // !MOZC_JSONCPP_JSON_H_INCLUDED
112 +
113 +--- /src/testing/testing.gyp
114 ++++ /src/testing/testing.gyp
115 +@@ -53,14 +53,12 @@
116 + 'targets': [
117 + {
118 + 'target_name': 'testing',
119 +- 'type': 'static_library',
120 ++ 'type': 'none',
121 + 'variables': {
122 + 'gtest_defines': [
123 + 'GTEST_LANG_CXX11=1',
124 + 'GTEST_HAS_TR1_TUPLE=0', # disable tr1 tuple in favor of C++11 tuple.
125 + ],
126 +- 'gtest_dir': '<(third_party_dir)/gtest/googletest',
127 +- 'gmock_dir': '<(third_party_dir)/gtest/googlemock',
128 + 'conditions': [
129 + ['_toolset=="target" and target_platform=="Android"', {
130 + 'gtest_defines': [
131 +@@ -75,53 +73,15 @@
132 + }],
133 + ],
134 + },
135 +- 'sources': [
136 +- '<(gmock_dir)/src/gmock-cardinalities.cc',
137 +- '<(gmock_dir)/src/gmock-internal-utils.cc',
138 +- '<(gmock_dir)/src/gmock-matchers.cc',
139 +- '<(gmock_dir)/src/gmock-spec-builders.cc',
140 +- '<(gmock_dir)/src/gmock.cc',
141 +- '<(gtest_dir)/src/gtest-death-test.cc',
142 +- '<(gtest_dir)/src/gtest-filepath.cc',
143 +- '<(gtest_dir)/src/gtest-port.cc',
144 +- '<(gtest_dir)/src/gtest-printers.cc',
145 +- '<(gtest_dir)/src/gtest-test-part.cc',
146 +- '<(gtest_dir)/src/gtest-typed-test.cc',
147 +- '<(gtest_dir)/src/gtest.cc',
148 +- ],
149 +- 'include_dirs': [
150 +- '<(gmock_dir)',
151 +- '<(gmock_dir)/include',
152 +- '<(gtest_dir)',
153 +- '<(gtest_dir)/include',
154 +- ],
155 +- 'defines': [
156 +- '<@(gtest_defines)',
157 +- ],
158 + 'all_dependent_settings': {
159 + 'defines': [
160 + '<@(gtest_defines)',
161 + ],
162 +- 'include_dirs': [
163 +- '<(gmock_dir)/include',
164 +- '<(gtest_dir)/include',
165 +- ],
166 +- },
167 +- 'conditions': [
168 +- ['(_toolset=="target" and compiler_target=="clang") or '
169 +- '(_toolset=="host" and compiler_host=="clang")', {
170 +- 'cflags': [
171 +- '-Wno-missing-field-initializers',
172 +- '-Wno-unused-private-field',
173 ++ 'link_settings': {
174 ++ 'libraries': [
175 ++ '-lgmock -lgtest',
176 + ],
177 +- }],
178 +- ],
179 +- 'xcode_settings': {
180 +- # Remove the force included file. This is not necessary for third
181 +- # party libraries, and it causes a build error.
182 +- 'OTHER_CFLAGS!' : [
183 +- '-include base/namespace.h',
184 +- ],
185 ++ },
186 + },
187 + },
188 + {
189
190 diff --git a/app-i18n/mozc/files/mozc-2.20.2673.102-tests_build.patch b/app-i18n/mozc/files/mozc-2.20.2673.102-tests_build.patch
191 new file mode 100644
192 index 00000000000..b8b4477437f
193 --- /dev/null
194 +++ b/app-i18n/mozc/files/mozc-2.20.2673.102-tests_build.patch
195 @@ -0,0 +1,27 @@
196 +--- /src/net/json_util_test.cc
197 ++++ /src/net/json_util_test.cc
198 +@@ -784,13 +784,13 @@
199 + for (size_t i = 0; i < arraysize(kNumS32ValueKeys); ++i) {
200 + {
201 + Json::Value json_value;
202 +- json_value[kNumS32ValueKeys[i]] = -2147483649ll;
203 ++ json_value[kNumS32ValueKeys[i]] = static_cast<Json::Value::Int64>(-2147483649ll);
204 + TestMsg msg;
205 + EXPECT_FALSE(JsonUtil::JsonValueToProtobufMessage(json_value, &msg));
206 + }
207 + {
208 + Json::Value json_value;
209 +- json_value[kNumS32ValueKeys[i]] = 2147483648ull;
210 ++ json_value[kNumS32ValueKeys[i]] = static_cast<Json::Value::UInt64>(2147483648ull);
211 + TestMsg msg;
212 + EXPECT_FALSE(JsonUtil::JsonValueToProtobufMessage(json_value, &msg));
213 + }
214 +@@ -805,7 +805,7 @@
215 + }
216 + {
217 + Json::Value json_value;
218 +- json_value[kNumU32ValueKeys[i]] = 4294967296ull;
219 ++ json_value[kNumU32ValueKeys[i]] = static_cast<Json::Value::UInt64>(4294967296ull);
220 + TestMsg msg;
221 + EXPECT_FALSE(JsonUtil::JsonValueToProtobufMessage(json_value, &msg));
222 + }
223
224 diff --git a/app-i18n/mozc/files/mozc-2.20.2673.102-tests_skipping.patch b/app-i18n/mozc/files/mozc-2.20.2673.102-tests_skipping.patch
225 new file mode 100644
226 index 00000000000..28c5486de50
227 --- /dev/null
228 +++ b/app-i18n/mozc/files/mozc-2.20.2673.102-tests_skipping.patch
229 @@ -0,0 +1,70 @@
230 +Disable test leaving mozc_server orphan process.
231 +
232 +--- /src/unix/ibus/mozc_engine_test.cc
233 ++++ /src/unix/ibus/mozc_engine_test.cc
234 +@@ -41,65 +41,5 @@
235 + namespace mozc {
236 + namespace ibus {
237 +
238 +-class LaunchToolTest : public testing::Test {
239 +- public:
240 +- LaunchToolTest() {
241 +- g_type_init();
242 +- }
243 +-
244 +- protected:
245 +- virtual void SetUp() {
246 +- mozc_engine_.reset(new MozcEngine());
247 +-
248 +- mock_ = new client::ClientMock();
249 +- mock_->ClearFunctionCounter();
250 +- mozc_engine_->client_.reset(mock_);
251 +- }
252 +-
253 +- virtual void TearDown() {
254 +- mozc_engine_.reset();
255 +- }
256 +-
257 +- client::ClientMock* mock_;
258 +- unique_ptr<MozcEngine> mozc_engine_;
259 +-
260 +- private:
261 +- DISALLOW_COPY_AND_ASSIGN(LaunchToolTest);
262 +-};
263 +-
264 +-TEST_F(LaunchToolTest, LaunchToolTest) {
265 +- commands::Output output;
266 +-
267 +- // Launch config dialog
268 +- mock_->ClearFunctionCounter();
269 +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", true);
270 +- output.set_launch_tool_mode(commands::Output::CONFIG_DIALOG);
271 +- EXPECT_TRUE(mozc_engine_->LaunchTool(output));
272 +-
273 +- // Launch dictionary tool
274 +- mock_->ClearFunctionCounter();
275 +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", true);
276 +- output.set_launch_tool_mode(commands::Output::DICTIONARY_TOOL);
277 +- EXPECT_TRUE(mozc_engine_->LaunchTool(output));
278 +-
279 +- // Launch word register dialog
280 +- mock_->ClearFunctionCounter();
281 +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", true);
282 +- output.set_launch_tool_mode(commands::Output::WORD_REGISTER_DIALOG);
283 +- EXPECT_TRUE(mozc_engine_->LaunchTool(output));
284 +-
285 +- // Launch no tool(means do nothing)
286 +- mock_->ClearFunctionCounter();
287 +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", false);
288 +- output.set_launch_tool_mode(commands::Output::NO_TOOL);
289 +- EXPECT_FALSE(mozc_engine_->LaunchTool(output));
290 +-
291 +- // Something occurring in client::Client::LaunchTool
292 +- mock_->ClearFunctionCounter();
293 +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", false);
294 +- output.set_launch_tool_mode(commands::Output::CONFIG_DIALOG);
295 +- EXPECT_FALSE(mozc_engine_->LaunchTool(output));
296 +-}
297 +-
298 + } // namespace ibus
299 + } // namespace mozc
300
301 diff --git a/app-i18n/mozc/metadata.xml b/app-i18n/mozc/metadata.xml
302 index 932a35bc627..f5031cbbd25 100644
303 --- a/app-i18n/mozc/metadata.xml
304 +++ b/app-i18n/mozc/metadata.xml
305 @@ -14,8 +14,12 @@ Mozc is a Japanese Input Method Editor (IME) designed for multi-platform such as
306 </longdescription>
307 <use>
308 <flag name="fcitx">Enable support for <pkg>app-i18n/fcitx</pkg></flag>
309 + <flag name="fcitx4">Enable support for <pkg>app-i18n/fcitx</pkg> 4</flag>
310 + <flag name="gui">Install graphical user interface tool (mozc_tool)</flag>
311 + <flag name="handwriting-tegaki">Use handwriting recognition model from <pkg>app-i18n/tegaki-zinnia-japanese</pkg></flag>
312 + <flag name="handwriting-tomoe">Use handwriting recognition model from <pkg>app-i18n/zinnia-tomoe</pkg></flag>
313 <flag name="ibus">Enable support for <pkg>app-i18n/ibus</pkg></flag>
314 - <flag name="renderer">Enable native candidate window.</flag>
315 + <flag name="renderer">Enable native candidate window</flag>
316 </use>
317 <upstream>
318 <remote-id type="sourceforge">jsoncpp</remote-id>
319
320 diff --git a/app-i18n/mozc/mozc-2.20.2673.102.ebuild b/app-i18n/mozc/mozc-2.20.2673.102.ebuild
321 new file mode 100644
322 index 00000000000..a5b640dac27
323 --- /dev/null
324 +++ b/app-i18n/mozc/mozc-2.20.2673.102.ebuild
325 @@ -0,0 +1,309 @@
326 +# Copyright 1999-2017 Gentoo Foundation
327 +# Distributed under the terms of the GNU General Public License v2
328 +
329 +EAPI="6"
330 +PYTHON_COMPAT=(python2_7)
331 +
332 +inherit elisp-common multiprocessing python-any-r1 toolchain-funcs
333 +
334 +if [[ "${PV}" == "9999" ]]; then
335 + inherit git-r3
336 +
337 + EGIT_REPO_URI="https://github.com/google/mozc"
338 + EGIT_SUBMODULES=(src/third_party/japanese_usage_dictionary)
339 +else
340 + MOZC_GIT_REVISION="280e38fe3d9db4df52f0713acf2ca65898cd697a"
341 + JAPANESE_USAGE_DICTIONARY_GIT_REVISION="e5b3425575734c323e1d947009dd74709437b684"
342 + JAPANESE_USAGE_DICTIONARY_DATE="20120416091336"
343 +fi
344 +
345 +FCITX_PATCH_VERSION="2.18.2612.102.1"
346 +
347 +DESCRIPTION="Mozc - Japanese input method editor"
348 +HOMEPAGE="https://github.com/google/mozc"
349 +if [[ "${PV}" == "9999" ]]; then
350 + SRC_URI=""
351 +else
352 + SRC_URI="https://github.com/google/${PN}/archive/${MOZC_GIT_REVISION}.tar.gz -> ${P}.tar.gz
353 + https://github.com/hiroyuki-komatsu/japanese-usage-dictionary/archive/${JAPANESE_USAGE_DICTIONARY_GIT_REVISION}.tar.gz -> japanese-usage-dictionary-${JAPANESE_USAGE_DICTIONARY_DATE}.tar.gz"
354 +fi
355 +SRC_URI+=" fcitx4? ( https://download.fcitx-im.org/fcitx-mozc/fcitx-mozc-${FCITX_PATCH_VERSION}.patch )"
356 +
357 +# Mozc: BSD
358 +# src/data/dictionary_oss: ipadic, public-domain
359 +# src/data/unicode: unicode
360 +# japanese-usage-dictionary: BSD-2
361 +LICENSE="BSD BSD-2 ipadic public-domain unicode"
362 +SLOT="0"
363 +KEYWORDS="~amd64 ~x86"
364 +IUSE="debug emacs fcitx4 +gui +handwriting-tegaki handwriting-tomoe ibus renderer test"
365 +REQUIRED_USE="|| ( emacs fcitx4 ibus ) gui? ( ^^ ( handwriting-tegaki handwriting-tomoe ) ) !gui? ( !handwriting-tegaki !handwriting-tomoe )"
366 +
367 +RDEPEND="dev-libs/protobuf:=
368 + emacs? ( virtual/emacs )
369 + fcitx4? ( app-i18n/fcitx:4 )
370 + gui? (
371 + app-i18n/zinnia
372 + dev-qt/qtcore:5
373 + dev-qt/qtgui:5
374 + dev-qt/qtwidgets:5
375 + handwriting-tegaki? ( app-i18n/tegaki-zinnia-japanese )
376 + handwriting-tomoe? ( app-i18n/zinnia-tomoe )
377 + )
378 + ibus? (
379 + >=app-i18n/ibus-1.4.1
380 + dev-libs/glib:2
381 + x11-libs/libxcb
382 + )
383 + renderer? (
384 + dev-libs/glib:2
385 + x11-libs/cairo
386 + x11-libs/gtk+:2
387 + x11-libs/pango
388 + )"
389 +DEPEND="${RDEPEND}
390 + ${PYTHON_DEPS}
391 + dev-util/gyp
392 + dev-util/ninja
393 + virtual/pkgconfig
394 + test? (
395 + >=dev-cpp/gtest-1.8.0
396 + dev-libs/jsoncpp
397 + )"
398 +
399 +S="${WORKDIR}/${P}/src"
400 +
401 +SITEFILE="50${PN}-gentoo.el"
402 +
403 +execute() {
404 + einfo "$@"
405 + "$@"
406 +}
407 +
408 +src_unpack() {
409 + if [[ "${PV}" == "9999" ]]; then
410 + git-r3_src_unpack
411 + else
412 + unpack ${P}.tar.gz
413 + mv mozc-${MOZC_GIT_REVISION} ${P} || die
414 +
415 + unpack japanese-usage-dictionary-${JAPANESE_USAGE_DICTIONARY_DATE}.tar.gz
416 + cp -p japanese-usage-dictionary-${JAPANESE_USAGE_DICTIONARY_GIT_REVISION}/usage_dict.txt ${P}/src/third_party/japanese_usage_dictionary || die
417 + fi
418 +}
419 +
420 +src_prepare() {
421 + eapply -p2 "${FILESDIR}/${PN}-2.20.2673.102-system_libraries.patch"
422 + eapply -p2 "${FILESDIR}/${PN}-2.20.2673.102-tests_build.patch"
423 + eapply -p2 "${FILESDIR}/${PN}-2.20.2673.102-tests_skipping.patch"
424 +
425 + if use fcitx4; then
426 + eapply -p2 "${DISTDIR}/fcitx-mozc-${FCITX_PATCH_VERSION}.patch"
427 + fi
428 +
429 + eapply_user
430 +
431 + sed \
432 + -e "s/def GypMain(options, unused_args):/def GypMain(options, gyp_args):/" \
433 + -e "s/RunOrDie(gyp_command + gyp_options)/RunOrDie(gyp_command + gyp_options + gyp_args)/" \
434 + -e "s/RunOrDie(\[ninja/&, '-j$(makeopts_jobs)', '-l$(makeopts_loadavg "${MAKEOPTS}" 0)', '-v'/" \
435 + -i build_mozc.py || die
436 +
437 + sed \
438 + -e "s/'release_extra_cflags%': \['-O2'\]/'release_extra_cflags%': []/" \
439 + -e "s/'debug_extra_cflags%': \['-O0', '-g'\]/'debug_extra_cflags%': []/" \
440 + -i gyp/common.gypi || die
441 +
442 + local ar=($(tc-getAR))
443 + local cc=($(tc-getCC))
444 + local cxx=($(tc-getCXX))
445 + local ld=($(tc-getLD))
446 + local nm=($(tc-getNM))
447 + local readelf=($(tc-getPROG READELF readelf))
448 +
449 + # Use absolute paths. Non-absolute paths are mishandled by GYP.
450 + ar[0]=$(type -P ${ar[0]})
451 + cc[0]=$(type -P ${cc[0]})
452 + cxx[0]=$(type -P ${cxx[0]})
453 + ld[0]=$(type -P ${ld[0]})
454 + nm[0]=$(type -P ${nm[0]})
455 + readelf[0]=$(type -P ${readelf[0]})
456 +
457 + sed \
458 + -e "s:<!(which ar):${ar[@]}:" \
459 + -e "s:<!(which clang):${cc[@]}:" \
460 + -e "s:<!(which clang++):${cxx[@]}:" \
461 + -e "s:<!(which ld):${ld[@]}:" \
462 + -e "s:<!(which nm):${nm[@]}:" \
463 + -e "s:<!(which readelf):${readelf[@]}:" \
464 + -i gyp/common.gypi || die
465 +}
466 +
467 +src_configure() {
468 + if use debug; then
469 + BUILD_TYPE="Debug"
470 + else
471 + BUILD_TYPE="Release"
472 + fi
473 +
474 + local gyp_arguments=()
475 +
476 + if tc-is-gcc; then
477 + gyp_arguments+=(-D compiler_host=gcc -D compiler_target=gcc)
478 + elif tc-is-clang; then
479 + gyp_arguments+=(-D compiler_host=clang -D compiler_target=clang)
480 + else
481 + gyp_arguments+=(-D compiler_host=unknown -D compiler_target=unknown)
482 + fi
483 +
484 + gyp_arguments+=(-D use_libibus=$(usex ibus 1 0))
485 + gyp_arguments+=(-D use_libprotobuf=1)
486 + gyp_arguments+=(-D use_libzinnia=1)
487 + gyp_arguments+=(-D enable_gtk_renderer=$(usex renderer 1 0))
488 +
489 + gyp_arguments+=(-D server_dir="${EPREFIX}/usr/libexec/mozc")
490 + gyp_arguments+=(-D document_dir="${EPREFIX}/usr/libexec/mozc/documents")
491 +
492 + if use handwriting-tegaki; then
493 + gyp_arguments+=(-D zinnia_model_file="${EPREFIX}/usr/share/tegaki/models/zinnia/handwriting-ja.model")
494 + elif use handwriting-tomoe; then
495 + gyp_arguments+=(-D zinnia_model_file="${EPREFIX}/usr/$(get_libdir)/zinnia/model/tomoe/handwriting-ja.model")
496 + fi
497 +
498 + if use ibus; then
499 + gyp_arguments+=(-D ibus_mozc_path="${EPREFIX}/usr/libexec/ibus-engine-mozc")
500 + gyp_arguments+=(-D ibus_mozc_icon_path="${EPREFIX}/usr/share/ibus-mozc/product_icon.png")
501 + fi
502 +
503 + unset AR CC CXX LD NM READELF
504 +
505 + execute "${PYTHON}" build_mozc.py gyp \
506 + --gypdir="${EPREFIX}/usr/bin" \
507 + --server_dir="${EPREFIX}/usr/libexec/mozc" \
508 + --verbose \
509 + $(usex gui "" --noqt) \
510 + -- "${gyp_arguments[@]}" || die "Configuration failed"
511 +}
512 +
513 +src_compile() {
514 + local targets=(server/server.gyp:mozc_server)
515 + if use emacs; then
516 + targets+=(unix/emacs/emacs.gyp:mozc_emacs_helper)
517 + fi
518 + if use fcitx4; then
519 + targets+=(unix/fcitx/fcitx.gyp:fcitx-mozc)
520 + fi
521 + if use gui; then
522 + targets+=(gui/gui.gyp:mozc_tool)
523 + fi
524 + if use ibus; then
525 + targets+=(unix/ibus/ibus.gyp:ibus_mozc)
526 + fi
527 + if use renderer; then
528 + targets+=(renderer/renderer.gyp:mozc_renderer)
529 + fi
530 + if use test; then
531 + targets+=(gyp/tests.gyp:unittests)
532 + fi
533 +
534 + execute "${PYTHON}" build_mozc.py build -c ${BUILD_TYPE} -v "${targets[@]}" || die "Building failed"
535 +
536 + if use emacs; then
537 + elisp-compile unix/emacs/*.el
538 + fi
539 +}
540 +
541 +src_test() {
542 + execute "${PYTHON}" build_mozc.py runtests -c ${BUILD_TYPE} --test_jobs 1 || die "Testing failed"
543 +}
544 +
545 +src_install() {
546 + exeinto /usr/libexec/mozc
547 + doexe out_linux/${BUILD_TYPE}/mozc_server
548 +
549 + if use gui; then
550 + doexe out_linux/${BUILD_TYPE}/mozc_tool
551 + fi
552 +
553 + if use renderer; then
554 + doexe out_linux/${BUILD_TYPE}/mozc_renderer
555 + fi
556 +
557 + insinto /usr/libexec/mozc/documents
558 + doins data/installer/credits_en.html
559 +
560 + if use emacs; then
561 + dobin out_linux/${BUILD_TYPE}/mozc_emacs_helper
562 + elisp-install ${PN} unix/emacs/*.{el,elc}
563 + elisp-site-file-install "${FILESDIR}/${SITEFILE}" ${PN}
564 + fi
565 +
566 + if use fcitx4; then
567 + exeinto /usr/$(get_libdir)/fcitx
568 + doexe out_linux/${BUILD_TYPE}/fcitx-mozc.so
569 +
570 + insinto /usr/share/fcitx/addon
571 + doins unix/fcitx/fcitx-mozc.conf
572 +
573 + insinto /usr/share/fcitx/inputmethod
574 + doins unix/fcitx/mozc.conf
575 +
576 + insinto /usr/share/fcitx/mozc/icon
577 + newins data/images/product_icon_32bpp-128.png mozc.png
578 + local image
579 + for image in data/images/unix/ui-*.png; do
580 + newins "${image}" "mozc-${image#data/images/unix/ui-}"
581 + done
582 +
583 + local locale mo_file
584 + for mo_file in out_linux/${BUILD_TYPE}/gen/unix/fcitx/po/*.mo; do
585 + locale="${mo_file##*/}"
586 + locale="${locale%.mo}"
587 + insinto /usr/share/locale/${locale}/LC_MESSAGES
588 + newins "${mo_file}" fcitx-mozc.mo
589 + done
590 + fi
591 +
592 + if use ibus; then
593 + exeinto /usr/libexec
594 + newexe out_linux/${BUILD_TYPE}/ibus_mozc ibus-engine-mozc
595 +
596 + insinto /usr/share/ibus/component
597 + doins out_linux/${BUILD_TYPE}/gen/unix/ibus/mozc.xml
598 +
599 + insinto /usr/share/ibus-mozc
600 + newins data/images/unix/ime_product_icon_opensource-32.png product_icon.png
601 + local image
602 + for image in data/images/unix/ui-*.png; do
603 + newins "${image}" "${image#data/images/unix/ui-}"
604 + done
605 + fi
606 +}
607 +
608 +pkg_postinst() {
609 + if use emacs; then
610 + elisp-site-regen
611 +
612 + elog "USAGE IN EMACS"
613 + elog
614 + elog "mozc-mode is minor mode to input Japanese text using Mozc server."
615 + elog "mozc-mode can be used via LEIM (Library of Emacs Input Method)."
616 + elog
617 + elog "In order to use mozc-mode by default, the following settings should be added to"
618 + elog "Emacs init file (~/.emacs.d/init.el or ~/.emacs):"
619 + elog
620 + elog " (require 'mozc)"
621 + elog " (set-language-environment \"Japanese\")"
622 + elog " (setq default-input-method \"japanese-mozc\")"
623 + elog
624 + elog "With the above settings, typing C-\\ (which is bound to \"toggle-input-method\""
625 + elog "by default) will enable mozc-mode."
626 + elog
627 + elog "Alternatively, at run time, after loading mozc.el, mozc-mode can be activated by"
628 + elog "calling \"set-input-method\" and entering \"japanese-mozc\"."
629 + fi
630 +}
631 +
632 +pkg_postrm() {
633 + use emacs && elisp-site-regen
634 +}