diff options
author | Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> | 2017-09-28 17:52:59 +0200 |
---|---|---|
committer | Mike Gilbert <floppym@gentoo.org> | 2017-09-28 13:11:00 -0400 |
commit | ab7a7c7c7ca7b03d914d8106a5462f726e8d0a0b (patch) | |
tree | 2de09bb249d911404994b55ac8ccb08ee58dd9da /app-i18n/mozc | |
parent | dev-util/gyp: Initial addition. (diff) | |
download | gentoo-ab7a7c7c7ca7b03d914d8106a5462f726e8d0a0b.tar.gz gentoo-ab7a7c7c7ca7b03d914d8106a5462f726e8d0a0b.tar.bz2 gentoo-ab7a7c7c7ca7b03d914d8106a5462f726e8d0a0b.zip |
app-i18n/mozc: Version bump (2.20.2673.102).
Upstream migrated from Qt 4 to Qt 5.
"qt4" / "qt5" USE flag renamed to "gui".
"fcitx" USE flag renamed to "fcitx4".
("fcitx5" USE flag will be used to control support for Fcitx 5.)
"handwriting-tegaki" and "handwriting-tomoe" USE flags introduced to select usage
of handwriting recognition model from app-i18n/tegaki-zinnia-japanese or
app-i18n/zinnia-tomoe. "handwriting-tegaki" is enabled by default in accordance
with upstream default for Mozc.
Test suite unrestricted and fixed to build.
Diffstat (limited to 'app-i18n/mozc')
-rw-r--r-- | app-i18n/mozc/Manifest | 3 | ||||
-rw-r--r-- | app-i18n/mozc/files/mozc-2.20.2673.102-system_libraries.patch | 133 | ||||
-rw-r--r-- | app-i18n/mozc/files/mozc-2.20.2673.102-tests_build.patch | 27 | ||||
-rw-r--r-- | app-i18n/mozc/files/mozc-2.20.2673.102-tests_skipping.patch | 70 | ||||
-rw-r--r-- | app-i18n/mozc/metadata.xml | 6 | ||||
-rw-r--r-- | app-i18n/mozc/mozc-2.20.2673.102.ebuild | 309 |
6 files changed, 547 insertions, 1 deletions
diff --git a/app-i18n/mozc/Manifest b/app-i18n/mozc/Manifest index c88789227fd9..ee7002187dcc 100644 --- a/app-i18n/mozc/Manifest +++ b/app-i18n/mozc/Manifest @@ -1,10 +1,13 @@ DIST fcitx-mozc-2.16.2037.102.2.patch 140421 SHA256 ff175f3e0301c33f750780765ea264887827d00bc7a59fc8b55ae514ba449a1e SHA512 22b885859588bb8e0efd354d153da461a654203729c723156a419bf33fae473e3f7165964aa3cb3b5c969f97c2727f9d87b0d587330e4eeab67f07d4458542a3 WHIRLPOOL cd9534c8904a7c9f866a8ddd41ab4c57b3ad8b5650fda4cf9ccc1e544c8e0da25c749870606687ee66e4252f224babdbe10415e035038ced654812bad8d299dc +DIST fcitx-mozc-2.18.2612.102.1.patch 140722 SHA256 0ec5dc2e9798ce7a6dbcbe847cf016b0b49be1851008143d167c13333a15ed27 SHA512 725c464727f230707b90975705ef1565f1178f9144e66c5a688696a4ef520a6fec1d11f7aa68ee05f82aa9417060b1cccf49a155e30734871a525eaa4c76addb WHIRLPOOL 25d0efd313175f6648504b989302c73ab6d82a0cf4eecf332b68347331e1feff2df6251edd49c3d4e9251a2c7e01df56eb8de54ebbbc31582f7c2b89d1da53c1 DIST gmock-1.6.0.zip 2053682 SHA256 341ad07c31c619ba32c88c2265bc23693da1df062f47f146a7ed340f646d82b7 SHA512 7adff00bb6ff81a6ffb704be71d0747636d69e24b4a8b709e1fb8c177a9a47f6dea8d14fde73034ebfb1529c291c7212a944ad92a34f88abdfe23c2d0b11b6f7 WHIRLPOOL 1a03ff8f2d96287f5deb24f970688f20f3480e77a4a71089ef1399a87f28f616bf0feaedc217e7ac1ca8ca1246e53f5d882f350704be111ae547961949939530 DIST gtest-1.6.0.zip 1121697 SHA256 5ec97df8e75b4ee796604e74716d1b50582beba22c5502edd055a7e67a3965d8 SHA512 f4718dfbfa3339bb9449c3f14e5b44ae405ea7df64c10a0957a6300985b71c4642981d069a1382e27ae041a4e2873527a9e442aff978447e795a190f99fac115 WHIRLPOOL 745a49020d4353ed2fa38adfc80bbd777358c831719bbe3b7c90d243f84256615222ba5f04d48d98b9e1a803bb40766799b3aedd575024c19d853d9239a12f8a DIST gyp-20140602.tar.bz2 432422 SHA256 f67be748f4dc36aa1619f43d4624c746728cf268af7f4ebf78dab3fa6d43d973 SHA512 e3a59daac57ddafc5804384c01cf51d4b90cd119d263afd83ec6eef9239c38bc7715736f70e20e44fae04fd8be1b86aa5323908a92d574372aa298f3355ce15f WHIRLPOOL 17e4630dcd7592e8ee197b4130d6147d9fd63404938f62e08ad10a204bd4bddcfc7d394abf3572a337e3dea46d4a7361dbc0cccc02e07ab99ed8f90e80830451 DIST japanese-usage-dictionary-10.tar.bz2 56142 SHA256 8c22284c97fdfad854790517f9200c439453c033db8f6a9d25aa5d95266b2384 SHA512 f299cf9183b9ec219d80c1fa745f351765d246d601f3c4091d1705e3c8b5ef66a32288d4c162e7bbc456b6d49ee90f1e5bf33721e1229165f3ee069daddd3198 WHIRLPOOL d2f690335cf271b0780c969f56616ece9d28f3dbe990548053a252c855db18a4a31d21e6bd8c34160c0893c21fab4543e5ff3cecb48c7f6ecfd5c84465d314a6 +DIST japanese-usage-dictionary-20120416091336.tar.gz 71051 SHA256 0b6efee0eebac2c1a8eeea333278aa40fcef7846bba9a379962c6e567e7e3dc1 SHA512 b7e997a979b6d50e49b9af5dc830ea4df0532f6ab1321b9ef14983f65bb54f1b2967375c82e07957ae7693ebbf43c9b56ecea6bfea8dd1fdaee444bd549d83a7 WHIRLPOOL 1c4324a6408cfc0b2e1df33a32583384ccf10374bc1a8f49f574e681a72174f7bee7e8500c93d714ee6459c087f7cd408e57cb52b8506ec50292249e50045cd2 DIST jsoncpp-src-0.6.0-rc2.tar.gz 117661 SHA256 d4d193d163f520b08b9155cba978615892ca1359d77e3fb261fce2f86d09b283 SHA512 5d44e766aa2d7657bc68cf16173130febaa6744d5fca0c6df5465617a3f306023a17cbeb07a62ad1a34c2d183d916401b4be48f37c2416c895db4ad5d9481b3d WHIRLPOOL bfa7e70e14f3ed0911c5127da0d2099ca8b9159a900a5bc5147d1e50b5a9f9d5be69a8d46a761d277ca1edabaab8d0d3b9f81417572e4664ed8239fd83c953e6 DIST mozc-1.10.1390.102.tar.bz2 57879881 SHA256 72a8ed6657daa1c03b1efe50c262a69be2ab66d45747a47df6e54996b6d5ee39 SHA512 4482e822f8a14bffd02cb1eaa5d14ba0a213266b2f0dd6402c42b9b357bf0d8c4dd572cef79f1d400bd68b7bd6cb4367933574f8f5967f68738249a300e3cfb9 WHIRLPOOL 90518e621ef784b438fcf677e211fdb6753719f3d78d14ce866ccea22d6d87f8d64e334bc568eebe93cb2850d3d545eb0b73d6f6de820eaf1d43f16bfdef4100 DIST mozc-1.13.1651.102.tar.bz2 31635636 SHA256 a275accc726d55d696adf235fa40822ae099f0a02d3dc9f8d0257ba191a1bc49 SHA512 caa75e60704e904a72fd06e315a219ff304a54adaeee70a8ab75d413f7801960add103b9aae1c19ee92f6d10c4c408fd840cf78c5dde0cc21c605feac59deaf4 WHIRLPOOL 72a870cc1bc5bc63227bba61c73183f69160aa5c58c9b89e75fa65bf16bbdc2c2b873b7407d0543b3847bc046866392d9bbe6d771d7b4b7eb3f6be759f1a63b4 DIST mozc-2.16.2037.102.tar.bz2 41172838 SHA256 4b78769b36366f056282267935a859e587f77e9aaf17132687d0e4d0c4da5cd0 SHA512 ff114a93054b43109407c44bc7c75de79fa2b028f9dba5c2ecc1776c5cbb032f184a91155b6b31bc17f0183dd70b0150ce13e80f59e26810daf4b65ba7e52be1 WHIRLPOOL 625c5a28da164ee96cdf523af32a7101357254cea1d57cd7f272bdf86ba8344d3e39bf2b2bfb0a79640d7961fd46c183eabc4002c8d86215ecffe183e4e0d193 +DIST mozc-2.20.2673.102.tar.gz 48623065 SHA256 794ec312e9a5567d2097059beb25718ddb1636cd8dd99b880ec97e26824276ea SHA512 409d406fdb21d55c93a4287cd3757a164c65c1c309918b4e905aec422d9c86bc6e51ae67c23ad0db2c87ab968443bd62f5a58684a0bf5d52751988a5ec5b0bd5 WHIRLPOOL 022029c7828502907f3c3e6fd39cfa059a947f75538b6958ec81528caec0a1be0cce48a3e94ff67303021f2003fcd1a966cdf3a4bbbf113968e454ba3e84295c DIST protobuf-2.5.0.tar.bz2 1866763 SHA256 13bfc5ae543cf3aa180ac2485c0bc89495e3ae711fc6fab4f8ffe90dfb4bb677 SHA512 5994b3669808b82fef5c860ecad36358c0767f84acac877e7bfcf722e59d972835a955714149bdd4158fbd1328a51d01397a563991d26475351ee72be48142ee WHIRLPOOL 7e6786e1f20bf253d0e386a95c2bbfe1b443f484d492f97552cadcea62c24461436aa88130e3ff20b4dc9f352c101458cb8c03686f1cc4e6e2133b6e78f5b70d 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 new file mode 100644 index 000000000000..dd6e57717d15 --- /dev/null +++ b/app-i18n/mozc/files/mozc-2.20.2673.102-system_libraries.patch @@ -0,0 +1,133 @@ +--- /src/net/jsoncpp.gyp ++++ /src/net/jsoncpp.gyp +@@ -31,31 +31,25 @@ + 'targets': [ + { + 'target_name': 'jsoncpp', +- 'type': 'static_library', ++ 'type': 'none', + 'variables': { +- 'jsoncpp_root': '<(third_party_dir)/jsoncpp', +- 'jsoncpp_srcs': [ +- '<(jsoncpp_root)/src/lib_json/json_reader.cpp', +- '<(jsoncpp_root)/src/lib_json/json_value.cpp', +- '<(jsoncpp_root)/src/lib_json/json_writer.cpp', +- ], +- 'jsoncpp_include_dirs': ['<(jsoncpp_root)/include'], + 'jsoncpp_additional_macros': ['JSON_USE_EXCEPTION=0'], + }, +- 'defines': [ +- '<@(jsoncpp_additional_macros)', +- ], +- 'sources': [ +- '<@(jsoncpp_srcs)', +- 'jsoncpp.h', +- ], +- 'include_dirs': [ +- '<@(jsoncpp_include_dirs)', +- ], + 'all_dependent_settings': { + 'defines': [ + '<@(jsoncpp_additional_macros)', + ], ++ 'cflags': [ ++ '<!@(pkg-config --cflags jsoncpp)', ++ ], ++ 'link_settings': { ++ 'libraries': [ ++ '<!@(pkg-config --libs-only-l jsoncpp)', ++ ], ++ 'ldflags': [ ++ '<!@(pkg-config --libs-only-L jsoncpp)', ++ ], ++ } + }, + }, + ], +--- /src/net/jsoncpp.h ++++ /src/net/jsoncpp.h +@@ -35,7 +35,7 @@ + // Mozc basically disables C++ exception. + #define JSON_USE_EXCEPTION 0 + #endif // !JSON_USE_EXCEPTION +-#include "third_party/jsoncpp/include/json/json.h" ++#include <json/json.h> + #define MOZC_JSONCPP_JSON_H_INCLUDED + #endif // !MOZC_JSONCPP_JSON_H_INCLUDED + +--- /src/testing/testing.gyp ++++ /src/testing/testing.gyp +@@ -53,14 +53,12 @@ + 'targets': [ + { + 'target_name': 'testing', +- 'type': 'static_library', ++ 'type': 'none', + 'variables': { + 'gtest_defines': [ + 'GTEST_LANG_CXX11=1', + 'GTEST_HAS_TR1_TUPLE=0', # disable tr1 tuple in favor of C++11 tuple. + ], +- 'gtest_dir': '<(third_party_dir)/gtest/googletest', +- 'gmock_dir': '<(third_party_dir)/gtest/googlemock', + 'conditions': [ + ['_toolset=="target" and target_platform=="Android"', { + 'gtest_defines': [ +@@ -75,53 +73,15 @@ + }], + ], + }, +- 'sources': [ +- '<(gmock_dir)/src/gmock-cardinalities.cc', +- '<(gmock_dir)/src/gmock-internal-utils.cc', +- '<(gmock_dir)/src/gmock-matchers.cc', +- '<(gmock_dir)/src/gmock-spec-builders.cc', +- '<(gmock_dir)/src/gmock.cc', +- '<(gtest_dir)/src/gtest-death-test.cc', +- '<(gtest_dir)/src/gtest-filepath.cc', +- '<(gtest_dir)/src/gtest-port.cc', +- '<(gtest_dir)/src/gtest-printers.cc', +- '<(gtest_dir)/src/gtest-test-part.cc', +- '<(gtest_dir)/src/gtest-typed-test.cc', +- '<(gtest_dir)/src/gtest.cc', +- ], +- 'include_dirs': [ +- '<(gmock_dir)', +- '<(gmock_dir)/include', +- '<(gtest_dir)', +- '<(gtest_dir)/include', +- ], +- 'defines': [ +- '<@(gtest_defines)', +- ], + 'all_dependent_settings': { + 'defines': [ + '<@(gtest_defines)', + ], +- 'include_dirs': [ +- '<(gmock_dir)/include', +- '<(gtest_dir)/include', +- ], +- }, +- 'conditions': [ +- ['(_toolset=="target" and compiler_target=="clang") or ' +- '(_toolset=="host" and compiler_host=="clang")', { +- 'cflags': [ +- '-Wno-missing-field-initializers', +- '-Wno-unused-private-field', ++ 'link_settings': { ++ 'libraries': [ ++ '-lgmock -lgtest', + ], +- }], +- ], +- 'xcode_settings': { +- # Remove the force included file. This is not necessary for third +- # party libraries, and it causes a build error. +- 'OTHER_CFLAGS!' : [ +- '-include base/namespace.h', +- ], ++ }, + }, + }, + { 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 new file mode 100644 index 000000000000..b8b4477437f8 --- /dev/null +++ b/app-i18n/mozc/files/mozc-2.20.2673.102-tests_build.patch @@ -0,0 +1,27 @@ +--- /src/net/json_util_test.cc ++++ /src/net/json_util_test.cc +@@ -784,13 +784,13 @@ + for (size_t i = 0; i < arraysize(kNumS32ValueKeys); ++i) { + { + Json::Value json_value; +- json_value[kNumS32ValueKeys[i]] = -2147483649ll; ++ json_value[kNumS32ValueKeys[i]] = static_cast<Json::Value::Int64>(-2147483649ll); + TestMsg msg; + EXPECT_FALSE(JsonUtil::JsonValueToProtobufMessage(json_value, &msg)); + } + { + Json::Value json_value; +- json_value[kNumS32ValueKeys[i]] = 2147483648ull; ++ json_value[kNumS32ValueKeys[i]] = static_cast<Json::Value::UInt64>(2147483648ull); + TestMsg msg; + EXPECT_FALSE(JsonUtil::JsonValueToProtobufMessage(json_value, &msg)); + } +@@ -805,7 +805,7 @@ + } + { + Json::Value json_value; +- json_value[kNumU32ValueKeys[i]] = 4294967296ull; ++ json_value[kNumU32ValueKeys[i]] = static_cast<Json::Value::UInt64>(4294967296ull); + TestMsg msg; + EXPECT_FALSE(JsonUtil::JsonValueToProtobufMessage(json_value, &msg)); + } 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 new file mode 100644 index 000000000000..28c5486de50d --- /dev/null +++ b/app-i18n/mozc/files/mozc-2.20.2673.102-tests_skipping.patch @@ -0,0 +1,70 @@ +Disable test leaving mozc_server orphan process. + +--- /src/unix/ibus/mozc_engine_test.cc ++++ /src/unix/ibus/mozc_engine_test.cc +@@ -41,65 +41,5 @@ + namespace mozc { + namespace ibus { + +-class LaunchToolTest : public testing::Test { +- public: +- LaunchToolTest() { +- g_type_init(); +- } +- +- protected: +- virtual void SetUp() { +- mozc_engine_.reset(new MozcEngine()); +- +- mock_ = new client::ClientMock(); +- mock_->ClearFunctionCounter(); +- mozc_engine_->client_.reset(mock_); +- } +- +- virtual void TearDown() { +- mozc_engine_.reset(); +- } +- +- client::ClientMock* mock_; +- unique_ptr<MozcEngine> mozc_engine_; +- +- private: +- DISALLOW_COPY_AND_ASSIGN(LaunchToolTest); +-}; +- +-TEST_F(LaunchToolTest, LaunchToolTest) { +- commands::Output output; +- +- // Launch config dialog +- mock_->ClearFunctionCounter(); +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", true); +- output.set_launch_tool_mode(commands::Output::CONFIG_DIALOG); +- EXPECT_TRUE(mozc_engine_->LaunchTool(output)); +- +- // Launch dictionary tool +- mock_->ClearFunctionCounter(); +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", true); +- output.set_launch_tool_mode(commands::Output::DICTIONARY_TOOL); +- EXPECT_TRUE(mozc_engine_->LaunchTool(output)); +- +- // Launch word register dialog +- mock_->ClearFunctionCounter(); +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", true); +- output.set_launch_tool_mode(commands::Output::WORD_REGISTER_DIALOG); +- EXPECT_TRUE(mozc_engine_->LaunchTool(output)); +- +- // Launch no tool(means do nothing) +- mock_->ClearFunctionCounter(); +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", false); +- output.set_launch_tool_mode(commands::Output::NO_TOOL); +- EXPECT_FALSE(mozc_engine_->LaunchTool(output)); +- +- // Something occurring in client::Client::LaunchTool +- mock_->ClearFunctionCounter(); +- mock_->SetBoolFunctionReturn("LaunchToolWithProtoBuf", false); +- output.set_launch_tool_mode(commands::Output::CONFIG_DIALOG); +- EXPECT_FALSE(mozc_engine_->LaunchTool(output)); +-} +- + } // namespace ibus + } // namespace mozc diff --git a/app-i18n/mozc/metadata.xml b/app-i18n/mozc/metadata.xml index 932a35bc627e..f5031cbbd25c 100644 --- a/app-i18n/mozc/metadata.xml +++ b/app-i18n/mozc/metadata.xml @@ -14,8 +14,12 @@ Mozc is a Japanese Input Method Editor (IME) designed for multi-platform such as </longdescription> <use> <flag name="fcitx">Enable support for <pkg>app-i18n/fcitx</pkg></flag> + <flag name="fcitx4">Enable support for <pkg>app-i18n/fcitx</pkg> 4</flag> + <flag name="gui">Install graphical user interface tool (mozc_tool)</flag> + <flag name="handwriting-tegaki">Use handwriting recognition model from <pkg>app-i18n/tegaki-zinnia-japanese</pkg></flag> + <flag name="handwriting-tomoe">Use handwriting recognition model from <pkg>app-i18n/zinnia-tomoe</pkg></flag> <flag name="ibus">Enable support for <pkg>app-i18n/ibus</pkg></flag> - <flag name="renderer">Enable native candidate window.</flag> + <flag name="renderer">Enable native candidate window</flag> </use> <upstream> <remote-id type="sourceforge">jsoncpp</remote-id> diff --git a/app-i18n/mozc/mozc-2.20.2673.102.ebuild b/app-i18n/mozc/mozc-2.20.2673.102.ebuild new file mode 100644 index 000000000000..a5b640dac271 --- /dev/null +++ b/app-i18n/mozc/mozc-2.20.2673.102.ebuild @@ -0,0 +1,309 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" +PYTHON_COMPAT=(python2_7) + +inherit elisp-common multiprocessing python-any-r1 toolchain-funcs + +if [[ "${PV}" == "9999" ]]; then + inherit git-r3 + + EGIT_REPO_URI="https://github.com/google/mozc" + EGIT_SUBMODULES=(src/third_party/japanese_usage_dictionary) +else + MOZC_GIT_REVISION="280e38fe3d9db4df52f0713acf2ca65898cd697a" + JAPANESE_USAGE_DICTIONARY_GIT_REVISION="e5b3425575734c323e1d947009dd74709437b684" + JAPANESE_USAGE_DICTIONARY_DATE="20120416091336" +fi + +FCITX_PATCH_VERSION="2.18.2612.102.1" + +DESCRIPTION="Mozc - Japanese input method editor" +HOMEPAGE="https://github.com/google/mozc" +if [[ "${PV}" == "9999" ]]; then + SRC_URI="" +else + SRC_URI="https://github.com/google/${PN}/archive/${MOZC_GIT_REVISION}.tar.gz -> ${P}.tar.gz + 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" +fi +SRC_URI+=" fcitx4? ( https://download.fcitx-im.org/fcitx-mozc/fcitx-mozc-${FCITX_PATCH_VERSION}.patch )" + +# Mozc: BSD +# src/data/dictionary_oss: ipadic, public-domain +# src/data/unicode: unicode +# japanese-usage-dictionary: BSD-2 +LICENSE="BSD BSD-2 ipadic public-domain unicode" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="debug emacs fcitx4 +gui +handwriting-tegaki handwriting-tomoe ibus renderer test" +REQUIRED_USE="|| ( emacs fcitx4 ibus ) gui? ( ^^ ( handwriting-tegaki handwriting-tomoe ) ) !gui? ( !handwriting-tegaki !handwriting-tomoe )" + +RDEPEND="dev-libs/protobuf:= + emacs? ( virtual/emacs ) + fcitx4? ( app-i18n/fcitx:4 ) + gui? ( + app-i18n/zinnia + dev-qt/qtcore:5 + dev-qt/qtgui:5 + dev-qt/qtwidgets:5 + handwriting-tegaki? ( app-i18n/tegaki-zinnia-japanese ) + handwriting-tomoe? ( app-i18n/zinnia-tomoe ) + ) + ibus? ( + >=app-i18n/ibus-1.4.1 + dev-libs/glib:2 + x11-libs/libxcb + ) + renderer? ( + dev-libs/glib:2 + x11-libs/cairo + x11-libs/gtk+:2 + x11-libs/pango + )" +DEPEND="${RDEPEND} + ${PYTHON_DEPS} + dev-util/gyp + dev-util/ninja + virtual/pkgconfig + test? ( + >=dev-cpp/gtest-1.8.0 + dev-libs/jsoncpp + )" + +S="${WORKDIR}/${P}/src" + +SITEFILE="50${PN}-gentoo.el" + +execute() { + einfo "$@" + "$@" +} + +src_unpack() { + if [[ "${PV}" == "9999" ]]; then + git-r3_src_unpack + else + unpack ${P}.tar.gz + mv mozc-${MOZC_GIT_REVISION} ${P} || die + + unpack japanese-usage-dictionary-${JAPANESE_USAGE_DICTIONARY_DATE}.tar.gz + cp -p japanese-usage-dictionary-${JAPANESE_USAGE_DICTIONARY_GIT_REVISION}/usage_dict.txt ${P}/src/third_party/japanese_usage_dictionary || die + fi +} + +src_prepare() { + eapply -p2 "${FILESDIR}/${PN}-2.20.2673.102-system_libraries.patch" + eapply -p2 "${FILESDIR}/${PN}-2.20.2673.102-tests_build.patch" + eapply -p2 "${FILESDIR}/${PN}-2.20.2673.102-tests_skipping.patch" + + if use fcitx4; then + eapply -p2 "${DISTDIR}/fcitx-mozc-${FCITX_PATCH_VERSION}.patch" + fi + + eapply_user + + sed \ + -e "s/def GypMain(options, unused_args):/def GypMain(options, gyp_args):/" \ + -e "s/RunOrDie(gyp_command + gyp_options)/RunOrDie(gyp_command + gyp_options + gyp_args)/" \ + -e "s/RunOrDie(\[ninja/&, '-j$(makeopts_jobs)', '-l$(makeopts_loadavg "${MAKEOPTS}" 0)', '-v'/" \ + -i build_mozc.py || die + + sed \ + -e "s/'release_extra_cflags%': \['-O2'\]/'release_extra_cflags%': []/" \ + -e "s/'debug_extra_cflags%': \['-O0', '-g'\]/'debug_extra_cflags%': []/" \ + -i gyp/common.gypi || die + + local ar=($(tc-getAR)) + local cc=($(tc-getCC)) + local cxx=($(tc-getCXX)) + local ld=($(tc-getLD)) + local nm=($(tc-getNM)) + local readelf=($(tc-getPROG READELF readelf)) + + # Use absolute paths. Non-absolute paths are mishandled by GYP. + ar[0]=$(type -P ${ar[0]}) + cc[0]=$(type -P ${cc[0]}) + cxx[0]=$(type -P ${cxx[0]}) + ld[0]=$(type -P ${ld[0]}) + nm[0]=$(type -P ${nm[0]}) + readelf[0]=$(type -P ${readelf[0]}) + + sed \ + -e "s:<!(which ar):${ar[@]}:" \ + -e "s:<!(which clang):${cc[@]}:" \ + -e "s:<!(which clang++):${cxx[@]}:" \ + -e "s:<!(which ld):${ld[@]}:" \ + -e "s:<!(which nm):${nm[@]}:" \ + -e "s:<!(which readelf):${readelf[@]}:" \ + -i gyp/common.gypi || die +} + +src_configure() { + if use debug; then + BUILD_TYPE="Debug" + else + BUILD_TYPE="Release" + fi + + local gyp_arguments=() + + if tc-is-gcc; then + gyp_arguments+=(-D compiler_host=gcc -D compiler_target=gcc) + elif tc-is-clang; then + gyp_arguments+=(-D compiler_host=clang -D compiler_target=clang) + else + gyp_arguments+=(-D compiler_host=unknown -D compiler_target=unknown) + fi + + gyp_arguments+=(-D use_libibus=$(usex ibus 1 0)) + gyp_arguments+=(-D use_libprotobuf=1) + gyp_arguments+=(-D use_libzinnia=1) + gyp_arguments+=(-D enable_gtk_renderer=$(usex renderer 1 0)) + + gyp_arguments+=(-D server_dir="${EPREFIX}/usr/libexec/mozc") + gyp_arguments+=(-D document_dir="${EPREFIX}/usr/libexec/mozc/documents") + + if use handwriting-tegaki; then + gyp_arguments+=(-D zinnia_model_file="${EPREFIX}/usr/share/tegaki/models/zinnia/handwriting-ja.model") + elif use handwriting-tomoe; then + gyp_arguments+=(-D zinnia_model_file="${EPREFIX}/usr/$(get_libdir)/zinnia/model/tomoe/handwriting-ja.model") + fi + + if use ibus; then + gyp_arguments+=(-D ibus_mozc_path="${EPREFIX}/usr/libexec/ibus-engine-mozc") + gyp_arguments+=(-D ibus_mozc_icon_path="${EPREFIX}/usr/share/ibus-mozc/product_icon.png") + fi + + unset AR CC CXX LD NM READELF + + execute "${PYTHON}" build_mozc.py gyp \ + --gypdir="${EPREFIX}/usr/bin" \ + --server_dir="${EPREFIX}/usr/libexec/mozc" \ + --verbose \ + $(usex gui "" --noqt) \ + -- "${gyp_arguments[@]}" || die "Configuration failed" +} + +src_compile() { + local targets=(server/server.gyp:mozc_server) + if use emacs; then + targets+=(unix/emacs/emacs.gyp:mozc_emacs_helper) + fi + if use fcitx4; then + targets+=(unix/fcitx/fcitx.gyp:fcitx-mozc) + fi + if use gui; then + targets+=(gui/gui.gyp:mozc_tool) + fi + if use ibus; then + targets+=(unix/ibus/ibus.gyp:ibus_mozc) + fi + if use renderer; then + targets+=(renderer/renderer.gyp:mozc_renderer) + fi + if use test; then + targets+=(gyp/tests.gyp:unittests) + fi + + execute "${PYTHON}" build_mozc.py build -c ${BUILD_TYPE} -v "${targets[@]}" || die "Building failed" + + if use emacs; then + elisp-compile unix/emacs/*.el + fi +} + +src_test() { + execute "${PYTHON}" build_mozc.py runtests -c ${BUILD_TYPE} --test_jobs 1 || die "Testing failed" +} + +src_install() { + exeinto /usr/libexec/mozc + doexe out_linux/${BUILD_TYPE}/mozc_server + + if use gui; then + doexe out_linux/${BUILD_TYPE}/mozc_tool + fi + + if use renderer; then + doexe out_linux/${BUILD_TYPE}/mozc_renderer + fi + + insinto /usr/libexec/mozc/documents + doins data/installer/credits_en.html + + if use emacs; then + dobin out_linux/${BUILD_TYPE}/mozc_emacs_helper + elisp-install ${PN} unix/emacs/*.{el,elc} + elisp-site-file-install "${FILESDIR}/${SITEFILE}" ${PN} + fi + + if use fcitx4; then + exeinto /usr/$(get_libdir)/fcitx + doexe out_linux/${BUILD_TYPE}/fcitx-mozc.so + + insinto /usr/share/fcitx/addon + doins unix/fcitx/fcitx-mozc.conf + + insinto /usr/share/fcitx/inputmethod + doins unix/fcitx/mozc.conf + + insinto /usr/share/fcitx/mozc/icon + newins data/images/product_icon_32bpp-128.png mozc.png + local image + for image in data/images/unix/ui-*.png; do + newins "${image}" "mozc-${image#data/images/unix/ui-}" + done + + local locale mo_file + for mo_file in out_linux/${BUILD_TYPE}/gen/unix/fcitx/po/*.mo; do + locale="${mo_file##*/}" + locale="${locale%.mo}" + insinto /usr/share/locale/${locale}/LC_MESSAGES + newins "${mo_file}" fcitx-mozc.mo + done + fi + + if use ibus; then + exeinto /usr/libexec + newexe out_linux/${BUILD_TYPE}/ibus_mozc ibus-engine-mozc + + insinto /usr/share/ibus/component + doins out_linux/${BUILD_TYPE}/gen/unix/ibus/mozc.xml + + insinto /usr/share/ibus-mozc + newins data/images/unix/ime_product_icon_opensource-32.png product_icon.png + local image + for image in data/images/unix/ui-*.png; do + newins "${image}" "${image#data/images/unix/ui-}" + done + fi +} + +pkg_postinst() { + if use emacs; then + elisp-site-regen + + elog "USAGE IN EMACS" + elog + elog "mozc-mode is minor mode to input Japanese text using Mozc server." + elog "mozc-mode can be used via LEIM (Library of Emacs Input Method)." + elog + elog "In order to use mozc-mode by default, the following settings should be added to" + elog "Emacs init file (~/.emacs.d/init.el or ~/.emacs):" + elog + elog " (require 'mozc)" + elog " (set-language-environment \"Japanese\")" + elog " (setq default-input-method \"japanese-mozc\")" + elog + elog "With the above settings, typing C-\\ (which is bound to \"toggle-input-method\"" + elog "by default) will enable mozc-mode." + elog + elog "Alternatively, at run time, after loading mozc.el, mozc-mode can be activated by" + elog "calling \"set-input-method\" and entering \"japanese-mozc\"." + fi +} + +pkg_postrm() { + use emacs && elisp-site-regen +} |