app-i18n/mozc: treeclean

Signed-off-by: Yongxiang Liang <tanekliang@gmail.com>
This commit is contained in:
Yongxiang Liang 2024-12-17 21:21:09 +08:00 committed by 梁永祥
parent bcb82b0724
commit 16d20bc036
17 changed files with 0 additions and 2103 deletions

View File

@ -1,6 +0,0 @@
DIST fcitx-mozc-2.26.4632-20220214004422.tar.gz 37072137 BLAKE2B 4177ca93bd0a369db1b7bc5b2bae73968c7d648bd8614c6154c63a3556a54d7f6adf9cbf8b8706eedfba223611fc0efda099bdbd558e5253e56766ca72c68140 SHA512 dd6a9ea9485b302ebecbaf2beb33e45a2cd2d708461c3f94ba5eb440aa2e040f2e416b42ca0b0729d8649b32a87823cc1d03e339f90167913e9eea13cbe373b3
DIST fcitx-mozc-2.28.5029.102-2.28.5029.102.tar.gz 37246575 BLAKE2B 54381968e33870f2d9f769184cf49428548d04de66e767140c8f053fad7873f1b2e3b02be81ce54e51b824d2c9cd971da37bff8b60efe60c9e2c748ff298afbd SHA512 4962e9505b79d4680a260c257719ba2486a6fe127018298758728faa9535504bc2dd6b1bfb430ac2982cb377cda52c145430531afd0968f49f91d366fdd43d92
DIST japanese-usage-dictionary-20180701040110.tar.gz 71285 BLAKE2B dfad056a1d5061b6764f583da15b9ad60a3c4421cee0430c4665d1c2779a64f9b31473c1746a3e2b9bda5167349432e51dcf7d4d48f75fde9543e9c16ff74c0d SHA512 68b4d3f52dd6cd4f00a8012a870b4f5929519cd69815b1729f3881d1f964802308f4aa101e236824b4c0f832183a9e8097437ed620403f2a652f126e7cdc1eb3
DIST mozc-2.26.4632-20220213064411.tar.gz 37001875 BLAKE2B 08ce19bd102c7ad01d364987a0329855093e53fc805568ae9310995a412c26a20b33b46a55dcace294ac0874b400a5539c8a75d407eab45520f6e75ce4b9a22f SHA512 dbd63c1916b95e9b7be260061048b9ef340d2c616e9022c791ee70da34c0457aa7456277d15e3f15ff082830291c1bcedc0b2b190bb515abfca2641107010001
DIST mozc-2.28.5029.102-2.28.5029.102.tar.gz 37247099 BLAKE2B 4bb528991102d34a26321e6fa00a73cc83cb103e0b765f1ebb837dd6894387288b13ed75cc255003d07d6f0c4a82f963684fa4f2bd9b5043cfaddb57a5f5cef0 SHA512 b20aa45757db92f66d1c135eacf907b4cec937226a8d09e5f9f6768ae22a6b8464e3b75276773ce55413f2002ffcc3d8cae136e7fd3acfc0733e48bccf848d5b
DIST mozc-2.28.5029.102-patches.tar.xz 224380 BLAKE2B 377d2cac6ec8a9c90661f10c0b105d8347ca8080ec43cee3dfd4660feadfe2d9b204d6e4b9e22bd11a5fdbbf26e7f6f298b703b88fb1621ea1847741408c1953 SHA512 5836a19ea68de271475b3ca1efce928b0ad012c96ff7ecdc4474b05daf8b8df022203eb46ec839b76e7d50be7a75b8f278d534d762fac0e612a8f09ae13c7c16

View File

@ -1,4 +0,0 @@
;;; app-i18n/ibus-mozc site-lisp configuration
(add-to-list 'load-path "@SITELISP@")
(autoload 'mozc-mode "mozc" nil t)

View File

@ -1,89 +0,0 @@
https://github.com/google/mozc/issues/470
--- a/src/base/system_util.cc
+++ b/src/base/system_util.cc
@@ -226,6 +226,11 @@
std::string UserProfileDirectoryImpl::GetUserProfileDirectory() const {
#if defined(OS_CHROMEOS)
+ const char *configuration_directory_env = Environ::GetEnv("MOZC_CONFIGURATION_DIRECTORY");
+ if (configuration_directory_env) {
+ return configuration_directory_env;
+ }
+
// TODO(toka): Must use passed in user profile dir which passed in. If mojo
// platform the user profile is determined on runtime.
// It's hack, the user profile dir should be passed in. Although the value in
@@ -245,13 +250,23 @@
#elif defined(OS_IOS)
// OS_IOS block must be placed before __APPLE__ because both macros are
// currently defined on iOS.
- //
+
+ const char *configuration_directory_env = Environ::GetEnv("MOZC_CONFIGURATION_DIRECTORY");
+ if (configuration_directory_env) {
+ return configuration_directory_env;
+ }
+
// On iOS, use Caches directory instead of Application Spport directory
// because the support directory doesn't exist by default. Also, it is backed
// up by iTunes and iCloud.
return FileUtil::JoinPath({MacUtil::GetCachesDirectory(), kProductPrefix});
#elif defined(OS_WIN)
+ const char *configuration_directory_env = Environ::GetEnv("MOZC_CONFIGURATION_DIRECTORY");
+ if (configuration_directory_env) {
+ return configuration_directory_env;
+ }
+
DCHECK(SUCCEEDED(Singleton<LocalAppDataDirectoryCache>::get()->result()));
std::string dir = Singleton<LocalAppDataDirectoryCache>::get()->path();
@@ -263,6 +278,11 @@
#elif defined(__APPLE__)
+ const char *configuration_directory_env = Environ::GetEnv("MOZC_CONFIGURATION_DIRECTORY");
+ if (configuration_directory_env) {
+ return configuration_directory_env;
+ }
+
std::string dir = MacUtil::GetApplicationSupportDirectory();
# ifdef GOOGLE_JAPANESE_INPUT_BUILD
dir = FileUtil::JoinPath(dir, "Google");
@@ -276,6 +296,11 @@
#elif defined(OS_LINUX)
+ const char *configuration_directory_env = Environ::GetEnv("MOZC_CONFIGURATION_DIRECTORY");
+ if (configuration_directory_env) {
+ return configuration_directory_env;
+ }
+
// 1. If "$HOME/.mozc" already exists,
// use "$HOME/.mozc" for backward compatibility.
// 2. If $XDG_CONFIG_HOME is defined
@@ -395,6 +420,11 @@
#endif // OS_WIN
std::string SystemUtil::GetServerDirectory() {
+ const char *server_directory_env = Environ::GetEnv("MOZC_SERVER_DIRECTORY");
+ if (server_directory_env) {
+ return server_directory_env;
+ }
+
#ifdef OS_WIN
DCHECK(SUCCEEDED(Singleton<ProgramFilesX86Cache>::get()->result()));
# if defined(GOOGLE_JAPANESE_INPUT_BUILD)
@@ -453,6 +483,11 @@
}
std::string SystemUtil::GetDocumentDirectory() {
+ const char *documents_directory_env = Environ::GetEnv("MOZC_DOCUMENTS_DIRECTORY");
+ if (documents_directory_env) {
+ return documents_directory_env;
+ }
+
#if defined(__APPLE__)
return GetServerDirectory();
#elif defined(MOZC_DOCUMENT_DIRECTORY)

View File

@ -1,95 +0,0 @@
https://github.com/google/mozc/issues/471
--- a/src/ipc/ipc_path_manager.cc
+++ b/src/ipc/ipc_path_manager.cc
@@ -340,9 +340,21 @@
return false;
}
+ // Expand symbolic links in the expected server path to avoid false negatives
+ // during comparisons of the expected server path and the actual server path.
+ string real_server_path = server_path;
+#ifndef OS_WIN
+ char real_server_path_[PATH_MAX];
+ if (realpath(server_path.c_str(), real_server_path_) == NULL) {
+ LOG(ERROR) << "realpath failed: " << strerror(errno);
+ return false;
+ }
+ real_server_path = real_server_path_;
+#endif
+
// compare path name
if (pid == server_pid_) {
- return (server_path == server_path_);
+ return (real_server_path == server_path_);
}
server_pid_ = 0;
@@ -352,17 +364,17 @@
{
std::wstring expected_server_ntpath;
const std::map<string, std::wstring>::const_iterator it =
- expected_server_ntpath_cache_.find(server_path);
+ expected_server_ntpath_cache_.find(real_server_path);
if (it != expected_server_ntpath_cache_.end()) {
expected_server_ntpath = it->second;
} else {
std::wstring wide_server_path;
- Util::UTF8ToWide(server_path, &wide_server_path);
+ Util::UTF8ToWide(real_server_path, &wide_server_path);
if (WinUtil::GetNtPath(wide_server_path, &expected_server_ntpath)) {
- // Caches the relationship from |server_path| to
- // |expected_server_ntpath| in case |server_path| is renamed later.
+ // Caches the relationship from |real_server_path| to
+ // |expected_server_ntpath| in case |real_server_path| is renamed later.
// (This can happen during the updating).
- expected_server_ntpath_cache_[server_path] = expected_server_ntpath;
+ expected_server_ntpath_cache_[real_server_path] = expected_server_ntpath;
}
}
@@ -379,9 +391,9 @@
return false;
}
- // Here we can safely assume that |server_path| (expected one) should be
+ // Here we can safely assume that |real_server_path| (expected one) should be
// the same to |server_path_| (actual one).
- server_path_ = server_path;
+ server_path_ = real_server_path;
server_pid_ = pid;
}
#endif // OS_WIN
@@ -406,7 +418,7 @@
#ifdef OS_LINUX
// load from /proc/<pid>/exe
char proc[128];
- char filename[512];
+ char filename[PATH_MAX];
absl::SNPrintF(proc, sizeof(proc) - 1, "/proc/%u/exe", pid);
const ssize_t size = readlink(proc, filename, sizeof(filename) - 1);
if (size == -1) {
@@ -419,18 +431,18 @@
server_pid_ = pid;
#endif // OS_LINUX
- VLOG(1) << "server path: " << server_path << " " << server_path_;
- if (server_path == server_path_) {
+ VLOG(1) << "server path: " << real_server_path << " " << server_path_;
+ if (real_server_path == server_path_) {
return true;
}
#ifdef OS_LINUX
- if ((server_path + " (deleted)") == server_path_) {
- LOG(WARNING) << server_path << " on disk is modified";
+ if ((real_server_path + " (deleted)") == server_path_) {
+ LOG(WARNING) << real_server_path << " on disk is modified";
// If a user updates the server binary on disk during the server is running,
// "readlink /proc/<pid>/exe" returns a path with the " (deleted)" suffix.
// We allow the special case.
- server_path_ = server_path;
+ server_path_ = real_server_path;
return true;
}
#endif // OS_LINUX

View File

@ -1,141 +0,0 @@
https://github.com/google/mozc/issues/490
--- a/src/gyp/defines.gypi
+++ b/src/gyp/defines.gypi
@@ -67,6 +67,10 @@
# use_system_abseil_cpp represents if system version or bundled version
# of abseil-cpp library is used.
'use_system_abseil_cpp%': '0',
+
+ # use_system_gtest represents if system version or bundled version
+ # of gtest library is used.
+ 'use_system_gtest%': '0',
},
'target_defaults': {
'defines': [
--- a/src/testing/testing.gyp
+++ b/src/testing/testing.gyp
@@ -59,54 +59,76 @@
'targets': [
{
'target_name': 'testing',
- 'type': 'static_library',
- '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',
- },
- '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-matchers.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',
+ ['use_system_gtest==1', {
+ 'type': 'none',
+ 'variables': {
+ 'gtest_defines': [
+ 'GTEST_LANG_CXX11=1',
+ 'GTEST_HAS_TR1_TUPLE=0', # disable tr1 tuple in favor of C++11 tuple.
+ ],
+ },
+ 'all_dependent_settings': {
+ 'defines': [
+ '<@(gtest_defines)',
+ ],
+ 'link_settings': {
+ 'libraries': [
+ '-lgmock -lgtest',
+ ],
+ },
+ },
+ }, {
+ 'type': 'static_library',
+ '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',
+ },
+ '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-matchers.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',
+ ],
+ }],
],
}],
],

View File

@ -1,117 +0,0 @@
https://github.com/google/mozc/issues/490
--- a/src/gyp/defines.gypi
+++ b/src/gyp/defines.gypi
@@ -71,6 +71,10 @@
# use_system_gtest represents if system version or bundled version
# of gtest library is used.
'use_system_gtest%': '0',
+
+ # use_system_jsoncpp represents if system version or bundled version
+ # of jsoncpp library is used.
+ 'use_system_jsoncpp%': '0',
},
'target_defaults': {
'defines': [
--- a/src/net/jsoncpp.gyp
+++ b/src/net/jsoncpp.gyp
@@ -31,32 +31,60 @@
'targets': [
{
'target_name': 'jsoncpp',
- 'type': 'static_library',
- '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)',
+ 'conditions': [
+ ['use_system_jsoncpp==1', {
+ 'type': 'none',
+ 'variables': {
+ 'jsoncpp_additional_macros': [
+ 'JSON_USE_EXCEPTION=0',
+ 'MOZC_USE_SYSTEM_JSONCPP',
+ ],
+ },
+ '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)',
+ ],
+ }
+ },
+ }, {
+ 'type': 'static_library',
+ '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)',
+ ],
+ },
+ }],
],
- 'sources': [
- '<@(jsoncpp_srcs)',
- 'jsoncpp.h',
- ],
- 'include_dirs': [
- '<@(jsoncpp_include_dirs)',
- ],
- 'all_dependent_settings': {
- 'defines': [
- '<@(jsoncpp_additional_macros)',
- ],
- },
},
],
}
--- a/src/net/jsoncpp.h
+++ b/src/net/jsoncpp.h
@@ -35,7 +35,11 @@
// Mozc basically disables C++ exception.
#define JSON_USE_EXCEPTION 0
#endif // !JSON_USE_EXCEPTION
+#ifdef MOZC_USE_SYSTEM_JSONCPP
+#include <json/json.h>
+#else
#include "third_party/jsoncpp/include/json/json.h"
+#endif
#define MOZC_JSONCPP_JSON_H_INCLUDED
#endif // !MOZC_JSONCPP_JSON_H_INCLUDED

View File

@ -1,89 +0,0 @@
https://github.com/google/mozc/issues/470
--- a/src/base/system_util.cc 2022-06-27 02:02:49.363848587 +0800
+++ b/src/base/system_util.cc 2022-06-27 02:25:41.701524057 +0800
@@ -239,6 +239,11 @@
std::string UserProfileDirectoryImpl::GetUserProfileDirectory() const {
#if defined(OS_CHROMEOS)
+ const char *configuration_dir_env = Environ::GetEnv("MOZC_CONFIGURATION_DIR");
+ if (configuration_dir_env) {
+ return configuration_dir_env;
+ }
+
// TODO(toka): Must use passed in user profile dir which passed in. If mojo
// platform the user profile is determined on runtime.
// It's hack, the user profile dir should be passed in. Although the value in
@@ -258,13 +263,23 @@
#elif defined(OS_IOS)
// OS_IOS block must be placed before __APPLE__ because both macros are
// currently defined on iOS.
- //
+
+ const char *configuration_dir_env = Environ::GetEnv("MOZC_CONFIGURATION_DIR");
+ if (configuration_dir_env) {
+ return configuration_dir_env;
+ }
+
// On iOS, use Caches directory instead of Application Spport directory
// because the support directory doesn't exist by default. Also, it is backed
// up by iTunes and iCloud.
return FileUtil::JoinPath({MacUtil::GetCachesDirectory(), kProductPrefix});
#elif defined(OS_WIN)
+ const char *configuration_dir_env = Environ::GetEnv("MOZC_CONFIGURATION_DIR");
+ if (configuration_dir_env) {
+ return configuration_dir_env;
+ }
+
DCHECK(SUCCEEDED(Singleton<LocalAppDataDirectoryCache>::get()->result()));
std::string dir = Singleton<LocalAppDataDirectoryCache>::get()->path();
@@ -277,6 +292,11 @@
return FileUtil::JoinPath(dir, kProductNameInEnglish);
#elif defined(__APPLE__)
+ const char *configuration_dir_env = Environ::GetEnv("MOZC_CONFIGURATION_DIR");
+ if (configuration_dir_env) {
+ return configuration_dir_env;
+ }
+
std::string dir = MacUtil::GetApplicationSupportDirectory();
#ifdef GOOGLE_JAPANESE_INPUT_BUILD
dir = FileUtil::JoinPath(dir, "Google");
@@ -289,6 +309,11 @@
#endif // GOOGLE_JAPANESE_INPUT_BUILD
#elif defined(OS_LINUX)
+ const char *configuration_dir_env = Environ::GetEnv("MOZC_CONFIGURATION_DIR");
+ if (configuration_dir_env) {
+ return configuration_dir_env;
+ }
+
// 1. If "$HOME/.mozc" already exists,
// use "$HOME/.mozc" for backward compatibility.
// 2. If $XDG_CONFIG_HOME is defined
@@ -421,6 +446,11 @@
#endif // OS_WIN
std::string SystemUtil::GetServerDirectory() {
+ const char *server_dir_env = Environ::GetEnv("MOZC_SERVER_DIR");
+ if (server_dir_env) {
+ return server_dir_env;
+ }
+
#ifdef OS_WIN
DCHECK(SUCCEEDED(Singleton<ProgramFilesX86Cache>::get()->result()));
#if defined(GOOGLE_JAPANESE_INPUT_BUILD)
@@ -477,6 +507,11 @@
}
std::string SystemUtil::GetDocumentDirectory() {
+ const char *documents_dir_env = Environ::GetEnv("MOZC_DOCUMENTS_DIR");
+ if (documents_dir_env) {
+ return documents_dir_env;
+ }
+
#if defined(OS_LINUX)
#ifndef MOZC_DOCUMENT_DIR

View File

@ -1,95 +0,0 @@
https://github.com/google/mozc/issues/471
--- a/src/ipc/ipc_path_manager.cc 2021-12-03 23:31:50.000000000 +0800
+++ b/src/ipc/ipc_path_manager.cc 2022-06-19 21:15:01.871580323 +0800
@@ -345,9 +345,21 @@
return false;
}
+ // Expand symbolic links in the expected server path to avoid false negatives
+ // during comparisons of the expected server path and the actual server path.
+ string real_server_path = server_path;
+#ifndef OS_WIN
+ char real_server_path_[PATH_MAX];
+ if (realpath(server_path.c_str(), real_server_path_) == NULL) {
+ LOG(ERROR) << "realpath failed: " << strerror(errno);
+ return false;
+ }
+ real_server_path = real_server_path_;
+#endif
+
// compare path name
if (pid == server_pid_) {
- return (server_path == server_path_);
+ return (real_server_path == server_path_);
}
server_pid_ = 0;
@@ -357,17 +369,17 @@
{
std::wstring expected_server_ntpath;
const std::map<std::string, std::wstring>::const_iterator it =
- expected_server_ntpath_cache_.find(server_path);
+ expected_server_ntpath_cache_.find(real_server_path);
if (it != expected_server_ntpath_cache_.end()) {
expected_server_ntpath = it->second;
} else {
std::wstring wide_server_path;
- Util::Utf8ToWide(server_path, &wide_server_path);
+ Util::UTF8ToWide(real_server_path, &wide_server_path);
if (WinUtil::GetNtPath(wide_server_path, &expected_server_ntpath)) {
- // Caches the relationship from |server_path| to
- // |expected_server_ntpath| in case |server_path| is renamed later.
+ // Caches the relationship from |real_server_path| to
+ // |expected_server_ntpath| in case |real_server_path| is renamed later.
// (This can happen during the updating).
- expected_server_ntpath_cache_[server_path] = expected_server_ntpath;
+ expected_server_ntpath_cache_[real_server_path] = expected_server_ntpath;
}
}
@@ -384,9 +396,9 @@
return false;
}
- // Here we can safely assume that |server_path| (expected one) should be
+ // Here we can safely assume that |real_server_path| (expected one) should be
// the same to |server_path_| (actual one).
- server_path_ = server_path;
+ server_path_ = real_server_path;
server_pid_ = pid;
}
#endif // OS_WIN
@@ -411,7 +423,7 @@
#ifdef OS_LINUX
// load from /proc/<pid>/exe
char proc[128];
- char filename[512];
+ char filename[PATH_MAX];
absl::SNPrintF(proc, sizeof(proc) - 1, "/proc/%u/exe", pid);
const ssize_t size = readlink(proc, filename, sizeof(filename) - 1);
if (size == -1) {
@@ -424,18 +436,18 @@
server_pid_ = pid;
#endif // OS_LINUX
- VLOG(1) << "server path: " << server_path << " " << server_path_;
- if (server_path == server_path_) {
+ VLOG(1) << "server path: " << real_server_path << " " << server_path_;
+ if (real_server_path == server_path_) {
return true;
}
#ifdef OS_LINUX
- if ((server_path + " (deleted)") == server_path_) {
- LOG(WARNING) << server_path << " on disk is modified";
+ if ((real_server_path + " (deleted)") == server_path_) {
+ LOG(WARNING) << real_server_path << " on disk is modified";
// If a user updates the server binary on disk during the server is running,
// "readlink /proc/<pid>/exe" returns a path with the " (deleted)" suffix.
// We allow the special case.
- server_path_ = server_path;
+ server_path_ = real_server_path;
return true;
}
#endif // OS_LINUX

View File

@ -1,29 +0,0 @@
diff --git a/src/unix/fcitx/surrounding_text_util.cc b/src/unix/fcitx/surrounding_text_util.cc
index b2d533c..76357cd 100644
--- a/src/unix/fcitx/surrounding_text_util.cc
+++ b/src/unix/fcitx/surrounding_text_util.cc
@@ -233,9 +233,9 @@ bool GetSurroundingText(FcitxInstance* instance,
const size_t selection_start = std::min(cursor_pos, anchor_pos);
const size_t selection_length = std::abs(info->relative_selected_length);
- info->preceding_text = Util::Utf8SubString(surrounding_text, 0, selection_start);
- info->selection_text = Util::Utf8SubString(surrounding_text, selection_start, selection_length);
- info->following_text = Util::Utf8SubString(surrounding_text, selection_start + selection_length);
+ info->preceding_text = std::string(Util::Utf8SubString(surrounding_text, 0, selection_start));
+ info->selection_text = std::string(Util::Utf8SubString(surrounding_text, selection_start, selection_length));
+ info->following_text = std::string(Util::Utf8SubString(surrounding_text, selection_start + selection_length));
return true;
}
diff --git a/src/unix/fcitx/eim.cc b/src/unix/fcitx/eim.cc
index 4da2e80..fc7a9ff 100644
--- a/src/unix/fcitx/eim.cc
+++ b/src/unix/fcitx/eim.cc
@@ -33,6 +33,7 @@
#include <fcitx/module.h>
#include <fcitx/keys.h>
#include <fcitx-config/xdg.h>
+#undef InvokeFunction
#include "fcitx_mozc.h"
#include "mozc_connection.h"
#include "mozc_response_parser.h

View File

@ -1,18 +0,0 @@
diff -ura a/src/unix/fcitx5/surrounding_text_util.cc b/src/unix/fcitx5/surrounding_text_util.cc
--- a/src/unix/fcitx5/surrounding_text_util.cc 2023-03-17 01:39:27.000000000 +0800
+++ b/src/unix/fcitx5/surrounding_text_util.cc 2023-09-26 10:30:36.424641839 +0800
@@ -211,11 +211,11 @@
const size_t selection_start = std::min(cursor_pos, anchor_pos);
const size_t selection_length = std::abs(info->relative_selected_length);
info->preceding_text =
- Util::Utf8SubString(surrounding_text, 0, selection_start);
+ std::string(Util::Utf8SubString(surrounding_text, 0, selection_start));
info->selection_text =
- Util::Utf8SubString(surrounding_text, selection_start, selection_length);
+ std::string(Util::Utf8SubString(surrounding_text, selection_start, selection_length));
info->following_text =
- Util::Utf8SubString(surrounding_text, selection_start + selection_length);
+ std::string(Util::Utf8SubString(surrounding_text, selection_start + selection_length));
return true;
}

View File

@ -1,13 +0,0 @@
diff --git a/src/base/absl.gyp b/src/base/absl.gyp
index 932f6ac..35e5a22 100644
--- a/src/base/absl.gyp
+++ b/src/base/absl.gyp
@@ -398,7 +398,7 @@
'all_dependent_settings': {
'link_settings': {
'libraries': [
- '-labsl_synchronization -labsl_flags -labsl_graphcycles_internal',
+ '-labsl_synchronization -labsl_flags -labsl_graphcycles_internal -labsl_string_view',
],
},
},

View File

@ -1,15 +0,0 @@
https://bugs.gentoo.org/912776
Adapted from https://src.fedoraproject.org/rpms/mozc/raw/aa3cba136c9a28e176d246f450465d3a8a4e8533/f/mozc-build-new-abseil.patch
--- a/src/base/init_mozc.cc
+++ b/src/base/init_mozc.cc
@@ -87,7 +87,10 @@ std::string GetLogFilePathFromProgramName(const std::string &program_name) {
void ParseCommandLineFlags(int argc, char **argv) {
absl::flags_internal::ParseCommandLineImpl(
argc, argv,
+ #if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20230802
+ // Abseil 20230802.0 does not use ArgvListAction
absl::flags_internal::ArgvListAction::kRemoveParsedArgs,
+ #endif
// Suppress help messages invoked by --help and others.
// Use UsageFlagsAction::kHandleUsage to enable it.
absl::flags_internal::UsageFlagsAction::kIgnoreUsage,

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person" proxied="yes">
<email>arfrever.fta@gmail.com</email>
<name>Arfrever Frehtes Taifersar Arahesis</name>
</maintainer>
<maintainer type="project">
<email>cjk@gentoo.org</email>
<name>Cjk</name>
</maintainer>
<use>
<flag name="fcitx4">Enable support for <pkg>app-i18n/fcitx</pkg> 4</flag>
<flag name="fcitx5">Enable support for <pkg>app-i18n/fcitx</pkg> 5</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> by default</flag>
<flag name="handwriting-tomoe">Use handwriting recognition model from <pkg>app-i18n/zinnia-tomoe</pkg> by default</flag>-->
<flag name="ibus">Enable support for <pkg>app-i18n/ibus</pkg></flag>
<flag name="renderer">Enable native candidate window</flag>
</use>
<upstream>
<remote-id type="github">google/mozc</remote-id>
</upstream>
</pkgmetadata>

View File

@ -1,445 +0,0 @@
# Copyright 2010-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="8"
PYTHON_COMPAT=( python3_{9..11} )
inherit elisp-common multiprocessing python-any-r1 toolchain-funcs desktop xdg
DESCRIPTION="Mozc - Japanese input method editor"
HOMEPAGE="https://github.com/google/mozc"
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="7f02ce1923516502854aa48a95e2c1e84a3e5a9f"
MOZC_DATE="${PV#*_p}"
MOZC_DATE="${MOZC_DATE%%_p*}"
FCITX_MOZC_GIT_REVISION="36fb17175ceb2ade323ad729e0d7cfb06f98e675"
FCITX_MOZC_DATE="${PV#*_p}"
FCITX_MOZC_DATE="${FCITX_MOZC_DATE#*_p}"
FCITX_MOZC_DATE="${FCITX_MOZC_DATE%%_p*}"
JAPANESE_USAGE_DICTIONARY_GIT_REVISION="a4a66772e33746b91e99caceecced9a28507e925"
JAPANESE_USAGE_DICTIONARY_DATE="20180701040110"
SRC_URI="https://github.com/google/${PN}/archive/${MOZC_GIT_REVISION}.tar.gz -> ${PN}-${PV%%_p*}-${MOZC_DATE}.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
https://github.com/fcitx/${PN}/archive/${FCITX_MOZC_GIT_REVISION}.tar.gz -> fcitx-${PN}-${PV%%_p*}-${FCITX_MOZC_DATE}.tar.gz"
fi
# 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 ~arm64 ~ppc64 x86"
KEYWORDS="~amd64 ~x86"
IUSE="debug emacs fcitx4 fcitx5 +gui ibus renderer test"
REQUIRED_USE="|| ( emacs fcitx4 fcitx5 ibus )"
RESTRICT="!test? ( test )"
BDEPEND="$(python_gen_any_dep 'dev-python/six[${PYTHON_USEDEP}]')
>=dev-libs/protobuf-3.0.0
dev-build/gyp
app-alternatives/ninja
virtual/pkgconfig
emacs? ( app-editors/emacs:* )
fcitx4? ( sys-devel/gettext )
fcitx5? ( sys-devel/gettext )"
DEPEND=">=dev-cpp/abseil-cpp-20211102[cxx17(+)]
>=dev-libs/protobuf-3.0.0:=
fcitx4? (
app-i18n/fcitx:4
virtual/libintl
)
fcitx5? (
app-i18n/fcitx:5
app-i18n/libime
sys-devel/gettext
virtual/libintl
)
gui? (
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtwidgets:5
)
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
)
test? (
>=dev-cpp/gtest-1.8.0
dev-libs/jsoncpp
)"
RDEPEND=">=dev-cpp/abseil-cpp-20211102[cxx17(+)]
>=dev-libs/protobuf-3.0.0:=
emacs? ( app-editors/emacs:* )
fcitx4? (
app-i18n/fcitx:4
virtual/libintl
)
fcitx5? (
app-i18n/fcitx:5
app-i18n/libime
sys-devel/gettext
virtual/libintl
)
gui? (
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtwidgets:5
)
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
)"
S="${WORKDIR}/${P}/src"
SITEFILE="50${PN}-gentoo.el"
execute() {
einfo "$@"
"$@"
}
python_check_deps() {
has_version -b "dev-python/six[${PYTHON_USEDEP}]"
}
src_unpack() {
if [[ "${PV}" == "9999" ]]; then
git-r3_src_unpack
if use fcitx4 || use fcitx5; then
local EGIT_SUBMODULES=()
git-r3_fetch https://github.com/fcitx/mozc refs/heads/fcitx
git-r3_checkout https://github.com/fcitx/mozc "${WORKDIR}/fcitx-mozc"
fi
if use fcitx5; then
cp -pr "${WORKDIR}"/fcitx{,5}-mozc || die
fi
else
unpack ${PN}-${PV%%_p*}-${MOZC_DATE}.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
if use fcitx4 || use fcitx5; then
unpack fcitx-${PN}-${PV%%_p*}-${FCITX_MOZC_DATE}.tar.gz
if use fcitx4; then
cp -pr mozc-${FCITX_MOZC_GIT_REVISION} fcitx-${PN} || die
fi
if use fcitx5; then
cp -pr mozc-${FCITX_MOZC_GIT_REVISION} fcitx5-${PN} || die
fi
rm -r mozc-${FCITX_MOZC_GIT_REVISION} || die
fi
fi
xz -cd "${FILESDIR}"/${PN}-2.26.4632-system_abseil-cpp.patch.xz > \
"${S}"/${PN}-2.26.4632-system_abseil-cpp.patch || die
}
src_prepare() {
if use fcitx4; then
cp -pr "${WORKDIR}/fcitx-mozc/src/unix/fcitx" unix || die
fi
if use fcitx5; then
cp -pr "${WORKDIR}/fcitx5-mozc/src/unix/fcitx5" unix || die
fi
pushd "${WORKDIR}/${P}" > /dev/null || die
eapply "${S}/${PN}-2.26.4632-system_abseil-cpp.patch"
eapply "${FILESDIR}/${PN}-2.26.4220-system_gtest.patch"
eapply "${FILESDIR}/${PN}-2.26.4220-system_jsoncpp.patch"
eapply "${FILESDIR}/${PN}-2.26.4632-environmental_variables.patch"
# eapply "${FILESDIR}/${PN}-2.26.4632-server_path_check.patch"
eapply_user
popd > /dev/null || die
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 "${MAKEOPTS}" 999)', '-l$(makeopts_loadavg "${MAKEOPTS}" 0)', '-v'/" \
-i build_mozc.py || die
local ar=($(tc-getAR))
local cc=($(tc-getCC))
local cxx=($(tc-getCXX))
local ld=($(tc-getLD))
local nm=($(tc-getNM))
local readelf=($(tc-getREADELF))
# 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
# https://github.com/google/mozc/issues/489
sed \
-e "/'-lc++'/s/-lc++/-Wl,--copy-dt-needed-entries/" \
-e "/'-stdlib=libc++'/d" \
-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 debug_extra_cflags=)
gyp_arguments+=(-D release_extra_cflags=)
gyp_arguments+=(-D use_fcitx=$(usex fcitx4 YES NO))
gyp_arguments+=(-D use_fcitx5=$(usex fcitx5 YES NO))
gyp_arguments+=(-D use_libibus=$(usex ibus 1 0))
gyp_arguments+=(-D use_libprotobuf=1)
gyp_arguments+=(-D use_system_abseil_cpp=1)
gyp_arguments+=(-D use_system_gtest=$(usex test 1 0))
gyp_arguments+=(-D use_system_jsoncpp=$(usex test 1 0))
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 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 fcitx5; then
targets+=(unix/fcitx5/fcitx5.gyp:fcitx5-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 ../../fcitx-${PN}/src/data/images/unix/ui-*.png; do
newins "${image}" "mozc-${image#../../fcitx-${PN}/src/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 fcitx5; then
exeinto /usr/$(get_libdir)/fcitx5
doexe out_linux/${BUILD_TYPE}/fcitx5-mozc.so
insinto /usr/share/fcitx5/addon
newins unix/fcitx5/mozc-addon.conf mozc.conf
insinto /usr/share/fcitx5/inputmethod
doins unix/fcitx5/mozc.conf
local orgfcitx5="org.fcitx.Fcitx5.fcitx-mozc"
newicon -s 128 data/images/product_icon_32bpp-128.png ${orgfcitx5}.png
newicon -s 128 data/images/product_icon_32bpp-128.png fcitx-mozc.png
newicon -s 32 data/images/unix/ime_product_icon_opensource-32.png ${orgfcitx5}.png
newicon -s 32 data/images/unix/ime_product_icon_opensource-32.png fcitx-mozc.png
for uiimg in ../../fcitx5-mozc/scripts/icons/ui-*.png; do
dimg=${uiimg#*ui-}
newicon -s 48 ${uiimg} ${orgfcitx5}-${dimg/_/-}
newicon -s 48 ${uiimg} fcitx-mozc-${dimg/_/-}
done
local locale mo_file
for mo_file in unix/fcitx5/po/*.po; do
locale="${mo_file##*/}"
locale="${locale%.po}"
msgfmt ${mo_file} -o ${mo_file/.po/.mo} || die
insinto /usr/share/locale/${locale}/LC_MESSAGES
newins "${mo_file/.po/.mo}" fcitx5-mozc.mo
done
msgfmt --xml -d unix/fcitx5/po/ --template unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml.in -o \
unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml || die
insinto /usr/share/metainfo
doins unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml
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() {
elog
elog "ENVIRONMENTAL VARIABLES"
elog
elog "MOZC_SERVER_DIR"
elog " Mozc server directory"
elog " Value used by default: \"${EPREFIX}/usr/libexec/mozc\""
elog "MOZC_DOCUMENTS_DIR"
elog " Mozc documents directory"
elog " Value used by default: \"${EPREFIX}/usr/libexec/mozc/documents\""
elog "MOZC_CONFIGURATION_DIR"
elog " Mozc configuration directory"
elog " Value used by default: \"~/.mozc\""
elog
if use emacs; then
elog
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\"."
elog
elisp-site-regen
fi
xdg_pkg_postinst
}
pkg_postrm() {
if use emacs; then
elisp-site-regen
fi
xdg_pkg_postrm
}

View File

@ -1,463 +0,0 @@
# Copyright 2010-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="8"
PYTHON_COMPAT=( python3_{10..12} )
inherit desktop edo elisp-common multiprocessing python-any-r1 savedconfig toolchain-funcs xdg
DESCRIPTION="Mozc - Japanese input method editor"
HOMEPAGE="https://github.com/google/mozc"
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="305e9a7374254148474d067c46d55a4ee6081837"
MOZC_DATE="${PV#*_p}"
MOZC_DATE="${MOZC_DATE%%_p*}"
FCITX_MOZC_GIT_REVISION="242b4f703cba27d4ff4dc123c713a478f964e001"
FCITX_MOZC_DATE="${PV#*_p}"
FCITX_MOZC_DATE="${FCITX_MOZC_DATE#*_p}"
FCITX_MOZC_DATE="${FCITX_MOZC_DATE%%_p*}"
JAPANESE_USAGE_DICTIONARY_GIT_REVISION="a4a66772e33746b91e99caceecced9a28507e925"
JAPANESE_USAGE_DICTIONARY_DATE="20180701040110"
SRC_URI="
https://github.com/google/${PN}/archive/${MOZC_GIT_REVISION}.tar.gz -> ${PN}-${PV%%_p*}-${MOZC_DATE}.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
https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${PN}-2.28.5029.102-patches.tar.xz
fcitx4? ( https://github.com/fcitx/${PN}/archive/${FCITX_MOZC_GIT_REVISION}.tar.gz -> fcitx-${PN}-${PV%%_p*}-${FCITX_MOZC_DATE}.tar.gz )
fcitx5? ( https://github.com/fcitx/${PN}/archive/${FCITX_MOZC_GIT_REVISION}.tar.gz -> fcitx-${PN}-${PV%%_p*}-${FCITX_MOZC_DATE}.tar.gz )
"
fi
# 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 fcitx5 +gui ibus renderer test"
REQUIRED_USE="|| ( emacs fcitx4 fcitx5 ibus )"
RESTRICT="!test? ( test )"
BDEPEND="
$(python_gen_any_dep 'dev-python/six[${PYTHON_USEDEP}]')
>=dev-libs/protobuf-3.0.0
dev-build/gyp
app-alternatives/ninja
virtual/pkgconfig
emacs? ( app-editors/emacs:* )
fcitx4? ( sys-devel/gettext )
fcitx5? ( sys-devel/gettext )
"
DEPEND="
>=dev-cpp/abseil-cpp-20230802.0:=[cxx17(+)]
>=dev-libs/protobuf-3.0.0:=
fcitx4? (
app-i18n/fcitx:4
virtual/libintl
)
fcitx5? (
app-i18n/fcitx:5
app-i18n/libime
sys-devel/gettext
virtual/libintl
)
gui? (
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtwidgets:5
)
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
)
test? (
>=dev-cpp/gtest-1.8.0
dev-libs/jsoncpp
)"
RDEPEND="
>=dev-cpp/abseil-cpp-20230802.0:=[cxx17(+)]
>=dev-libs/protobuf-3.0.0:=
emacs? ( app-editors/emacs:* )
fcitx4? (
app-i18n/fcitx:4
virtual/libintl
)
fcitx5? (
app-i18n/fcitx:5
app-i18n/libime
sys-devel/gettext
virtual/libintl
)
gui? (
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtwidgets:5
)
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
)
"
S="${WORKDIR}/${P}/src"
SITEFILE="50${PN}-gentoo.el"
PATCHES=(
"${WORKDIR}"/mozc-2.28.5029.102-patches
"${FILESDIR}"/mozc-2.28.5029.102-abseil.patch
"${FILESDIR}"/mozc-2.28.5029.102-abseil-20230802.0.patch
)
python_check_deps() {
python_has_version "dev-python/six[${PYTHON_USEDEP}]"
}
src_unpack() {
if [[ "${PV}" == "9999" ]]; then
git-r3_src_unpack
if use fcitx4 || use fcitx5; then
local EGIT_SUBMODULES=()
git-r3_fetch https://github.com/fcitx/mozc refs/heads/fcitx
git-r3_checkout https://github.com/fcitx/mozc "${WORKDIR}/fcitx-mozc"
fi
if use fcitx5; then
cp -pr "${WORKDIR}"/fcitx{,5}-mozc || die
fi
else
unpack ${PN}-${PV%%_p*}-${MOZC_DATE}.tar.gz
mv mozc-${MOZC_GIT_REVISION} ${P} || die
unpack ${PN}-2.28.5029.102-patches.tar.xz
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
if use fcitx4 || use fcitx5; then
unpack fcitx-${PN}-${PV%%_p*}-${FCITX_MOZC_DATE}.tar.gz
if use fcitx4; then
cp -pr mozc-${FCITX_MOZC_GIT_REVISION} fcitx-${PN} || die
fi
if use fcitx5; then
cp -pr mozc-${FCITX_MOZC_GIT_REVISION} fcitx5-${PN} || die
fi
rm -r mozc-${FCITX_MOZC_GIT_REVISION} || die
fi
fi
}
src_prepare() {
if use fcitx4; then
cp -pr "${WORKDIR}/fcitx-mozc/src/unix/fcitx" unix || die
PATCHES+=( "${FILESDIR}"/mozc-2.28.5029.102-abseil-20230802.0-fcitx4.patch )
fi
if use fcitx5; then
cp -pr "${WORKDIR}/fcitx5-mozc/src/unix/fcitx5" unix || die
PATCHES+=( "${FILESDIR}"/mozc-2.28.5029.102-abseil-20230802.0-fcitx5.patch )
fi
pushd "${WORKDIR}/${P}" > /dev/null || die
default
popd > /dev/null || die
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 "${MAKEOPTS}" 999)', '-l$(makeopts_loadavg "${MAKEOPTS}" 0)', '-v'/" \
-i build_mozc.py || die
local ar=($(tc-getAR))
local cc=($(tc-getCC))
local cxx=($(tc-getCXX))
local ld=($(tc-getLD))
local nm=($(tc-getNM))
local readelf=($(tc-getREADELF))
# 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
# https://github.com/google/mozc/issues/489
sed \
-e "/'-lc++'/d" \
-e "/'-stdlib=libc++'/d" \
-i gyp/common.gypi || die
# bug #877765
restore_config mozcdic-ut.txt
if [[ -f /mozcdic-ut.txt && -s mozcdic-ut.txt ]]; then
einfo "mozcdic-ut.txt found. Adding to mozc dictionary..."
cat mozcdic-ut.txt >> "${WORKDIR}/${P}/src/data/dictionary_oss/dictionary00.txt" || die
fi
}
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 debug_extra_cflags=)
gyp_arguments+=(-D release_extra_cflags=)
gyp_arguments+=(-D use_fcitx=$(usex fcitx4 YES NO))
gyp_arguments+=(-D use_fcitx5=$(usex fcitx5 YES NO))
gyp_arguments+=(-D use_libibus=$(usex ibus 1 0))
gyp_arguments+=(-D use_libprotobuf=1)
gyp_arguments+=(-D use_system_abseil_cpp=1)
gyp_arguments+=(-D use_system_gtest=$(usex test 1 0))
gyp_arguments+=(-D use_system_jsoncpp=$(usex test 1 0))
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 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
edo "${PYTHON}" build_mozc.py gyp \
--gypdir="${EPREFIX}/usr/bin" \
--server_dir="${EPREFIX}/usr/libexec/mozc" \
--verbose \
$(usex gui "" --noqt) \
-- "${gyp_arguments[@]}"
}
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 fcitx5; then
targets+=(unix/fcitx5/fcitx5.gyp:fcitx5-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
if use ibus; then
GYP_IBUS_FLAG="--use_gyp_for_ibus_build"
fi
edo "${PYTHON}" build_mozc.py build -c ${BUILD_TYPE} ${GYP_IBUS_FLAG} -v "${targets[@]}"
if use emacs; then
elisp-compile unix/emacs/*.el
fi
}
src_test() {
edo "${PYTHON}" build_mozc.py runtests -c ${BUILD_TYPE} --test_jobs 1
}
src_install() {
exeinto /usr/libexec/mozc
doexe out_linux/${BUILD_TYPE}/mozc_server
[[ -s mozcdic-ut.txt ]] && save_config mozcdic-ut.txt
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 ../../fcitx-${PN}/src/data/images/unix/ui-*.png; do
newins "${image}" "mozc-${image#../../fcitx-${PN}/src/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 fcitx5; then
exeinto /usr/$(get_libdir)/fcitx5
doexe out_linux/${BUILD_TYPE}/fcitx5-mozc.so
insinto /usr/share/fcitx5/addon
newins unix/fcitx5/mozc-addon.conf mozc.conf
insinto /usr/share/fcitx5/inputmethod
doins unix/fcitx5/mozc.conf
local orgfcitx5="org.fcitx.Fcitx5.fcitx-mozc"
newicon -s 128 data/images/product_icon_32bpp-128.png ${orgfcitx5}.png
newicon -s 128 data/images/product_icon_32bpp-128.png fcitx-mozc.png
newicon -s 32 data/images/unix/ime_product_icon_opensource-32.png ${orgfcitx5}.png
newicon -s 32 data/images/unix/ime_product_icon_opensource-32.png fcitx-mozc.png
for uiimg in ../../fcitx5-mozc/scripts/icons/ui-*.png; do
dimg=${uiimg#*ui-}
newicon -s 48 ${uiimg} ${orgfcitx5}-${dimg/_/-}
newicon -s 48 ${uiimg} fcitx-mozc-${dimg/_/-}
done
local locale mo_file
for mo_file in unix/fcitx5/po/*.po; do
locale="${mo_file##*/}"
locale="${locale%.po}"
msgfmt ${mo_file} -o ${mo_file/.po/.mo} || die
insinto /usr/share/locale/${locale}/LC_MESSAGES
newins "${mo_file/.po/.mo}" fcitx5-mozc.mo
done
msgfmt --xml -d unix/fcitx5/po/ --template unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml.in -o \
unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml || die
insinto /usr/share/metainfo
doins unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml
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() {
elog
elog "ENVIRONMENTAL VARIABLES"
elog
elog "MOZC_SERVER_DIRECTORY"
elog " Mozc server directory"
elog " Value used by default: \"${EPREFIX}/usr/libexec/mozc\""
elog "MOZC_DOCUMENTS_DIRECTORY"
elog " Mozc documents directory"
elog " Value used by default: \"${EPREFIX}/usr/libexec/mozc/documents\""
elog "MOZC_CONFIGURATION_DIRECTORY"
elog " Mozc configuration directory"
elog " Value used by default: \"~/.mozc\""
elog
if use emacs; then
elog
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\"."
elog
elisp-site-regen
fi
xdg_pkg_postinst
}
pkg_postrm() {
if use emacs; then
elisp-site-regen
fi
xdg_pkg_postrm
}

View File

@ -1,460 +0,0 @@
# Copyright 2010-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="8"
PYTHON_COMPAT=( python3_{10..12} )
inherit desktop edo elisp-common multiprocessing python-any-r1 savedconfig toolchain-funcs xdg
DESCRIPTION="Mozc - Japanese input method editor"
HOMEPAGE="https://github.com/google/mozc"
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="305e9a7374254148474d067c46d55a4ee6081837"
MOZC_DATE="${PV#*_p}"
MOZC_DATE="${MOZC_DATE%%_p*}"
FCITX_MOZC_GIT_REVISION="242b4f703cba27d4ff4dc123c713a478f964e001"
FCITX_MOZC_DATE="${PV#*_p}"
FCITX_MOZC_DATE="${FCITX_MOZC_DATE#*_p}"
FCITX_MOZC_DATE="${FCITX_MOZC_DATE%%_p*}"
JAPANESE_USAGE_DICTIONARY_GIT_REVISION="a4a66772e33746b91e99caceecced9a28507e925"
JAPANESE_USAGE_DICTIONARY_DATE="20180701040110"
SRC_URI="
https://github.com/google/${PN}/archive/${MOZC_GIT_REVISION}.tar.gz -> ${PN}-${PV%%_p*}-${MOZC_DATE}.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
https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${PN}-2.28.5029.102-patches.tar.xz
fcitx4? ( https://github.com/fcitx/${PN}/archive/${FCITX_MOZC_GIT_REVISION}.tar.gz -> fcitx-${PN}-${PV%%_p*}-${FCITX_MOZC_DATE}.tar.gz )
fcitx5? ( https://github.com/fcitx/${PN}/archive/${FCITX_MOZC_GIT_REVISION}.tar.gz -> fcitx-${PN}-${PV%%_p*}-${FCITX_MOZC_DATE}.tar.gz )
"
fi
# 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 fcitx5 +gui ibus renderer test"
REQUIRED_USE="|| ( emacs fcitx4 fcitx5 ibus )"
RESTRICT="!test? ( test )"
BDEPEND="
$(python_gen_any_dep 'dev-python/six[${PYTHON_USEDEP}]')
>=dev-libs/protobuf-3.0.0
dev-build/gyp
app-alternatives/ninja
virtual/pkgconfig
emacs? ( app-editors/emacs:* )
fcitx4? ( sys-devel/gettext )
fcitx5? ( sys-devel/gettext )
"
DEPEND="
>=dev-cpp/abseil-cpp-20211102.0-r2:=[cxx17(+)]
>=dev-libs/protobuf-3.0.0:=
fcitx4? (
app-i18n/fcitx:4
virtual/libintl
)
fcitx5? (
app-i18n/fcitx:5
app-i18n/libime
sys-devel/gettext
virtual/libintl
)
gui? (
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtwidgets:5
)
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
)
test? (
>=dev-cpp/gtest-1.8.0
dev-libs/jsoncpp
)"
RDEPEND="
>=dev-cpp/abseil-cpp-20211102.0-r2:=[cxx17(+)]
>=dev-libs/protobuf-3.0.0:=
emacs? ( app-editors/emacs:* )
fcitx4? (
app-i18n/fcitx:4
virtual/libintl
)
fcitx5? (
app-i18n/fcitx:5
app-i18n/libime
sys-devel/gettext
virtual/libintl
)
gui? (
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtwidgets:5
)
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
)
"
S="${WORKDIR}/${P}/src"
SITEFILE="50${PN}-gentoo.el"
PATCHES=(
"${WORKDIR}"/mozc-2.28.5029.102-patches
"${FILESDIR}"/mozc-2.28.5029.102-abseil.patch
)
python_check_deps() {
python_has_version "dev-python/six[${PYTHON_USEDEP}]"
}
src_unpack() {
if [[ "${PV}" == "9999" ]]; then
git-r3_src_unpack
if use fcitx4 || use fcitx5; then
local EGIT_SUBMODULES=()
git-r3_fetch https://github.com/fcitx/mozc refs/heads/fcitx
git-r3_checkout https://github.com/fcitx/mozc "${WORKDIR}/fcitx-mozc"
fi
if use fcitx5; then
cp -pr "${WORKDIR}"/fcitx{,5}-mozc || die
fi
else
unpack ${PN}-${PV%%_p*}-${MOZC_DATE}.tar.gz
mv mozc-${MOZC_GIT_REVISION} ${P} || die
unpack ${PN}-2.28.5029.102-patches.tar.xz
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
if use fcitx4 || use fcitx5; then
unpack fcitx-${PN}-${PV%%_p*}-${FCITX_MOZC_DATE}.tar.gz
if use fcitx4; then
cp -pr mozc-${FCITX_MOZC_GIT_REVISION} fcitx-${PN} || die
fi
if use fcitx5; then
cp -pr mozc-${FCITX_MOZC_GIT_REVISION} fcitx5-${PN} || die
fi
rm -r mozc-${FCITX_MOZC_GIT_REVISION} || die
fi
fi
}
src_prepare() {
if use fcitx4; then
cp -pr "${WORKDIR}/fcitx-mozc/src/unix/fcitx" unix || die
fi
if use fcitx5; then
cp -pr "${WORKDIR}/fcitx5-mozc/src/unix/fcitx5" unix || die
fi
pushd "${WORKDIR}/${P}" > /dev/null || die
default
popd > /dev/null || die
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 "${MAKEOPTS}" 999)', '-l$(makeopts_loadavg "${MAKEOPTS}" 0)', '-v'/" \
-i build_mozc.py || die
local ar=($(tc-getAR))
local cc=($(tc-getCC))
local cxx=($(tc-getCXX))
local ld=($(tc-getLD))
local nm=($(tc-getNM))
local readelf=($(tc-getREADELF))
# 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
# https://github.com/google/mozc/issues/489
sed \
-e "/'-lc++'/d" \
-e "/'-stdlib=libc++'/d" \
-i gyp/common.gypi || die
# bug #877765
restore_config mozcdic-ut.txt
if [[ -f /mozcdic-ut.txt && -s mozcdic-ut.txt ]]; then
einfo "mozcdic-ut.txt found. Adding to mozc dictionary..."
cat mozcdic-ut.txt >> "${WORKDIR}/${P}/src/data/dictionary_oss/dictionary00.txt" || die
fi
}
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 debug_extra_cflags=)
gyp_arguments+=(-D release_extra_cflags=)
gyp_arguments+=(-D use_fcitx=$(usex fcitx4 YES NO))
gyp_arguments+=(-D use_fcitx5=$(usex fcitx5 YES NO))
gyp_arguments+=(-D use_libibus=$(usex ibus 1 0))
gyp_arguments+=(-D use_libprotobuf=1)
gyp_arguments+=(-D use_system_abseil_cpp=1)
gyp_arguments+=(-D use_system_gtest=$(usex test 1 0))
gyp_arguments+=(-D use_system_jsoncpp=$(usex test 1 0))
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 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
edo "${PYTHON}" build_mozc.py gyp \
--gypdir="${EPREFIX}/usr/bin" \
--server_dir="${EPREFIX}/usr/libexec/mozc" \
--verbose \
$(usex gui "" --noqt) \
-- "${gyp_arguments[@]}"
}
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 fcitx5; then
targets+=(unix/fcitx5/fcitx5.gyp:fcitx5-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
if use ibus; then
GYP_IBUS_FLAG="--use_gyp_for_ibus_build"
fi
edo "${PYTHON}" build_mozc.py build -c ${BUILD_TYPE} ${GYP_IBUS_FLAG} -v "${targets[@]}"
if use emacs; then
elisp-compile unix/emacs/*.el
fi
}
src_test() {
edo "${PYTHON}" build_mozc.py runtests -c ${BUILD_TYPE} --test_jobs 1
}
src_install() {
exeinto /usr/libexec/mozc
doexe out_linux/${BUILD_TYPE}/mozc_server
[[ -s mozcdic-ut.txt ]] && save_config mozcdic-ut.txt
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 ../../fcitx-${PN}/src/data/images/unix/ui-*.png; do
newins "${image}" "mozc-${image#../../fcitx-${PN}/src/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 fcitx5; then
exeinto /usr/$(get_libdir)/fcitx5
doexe out_linux/${BUILD_TYPE}/fcitx5-mozc.so
insinto /usr/share/fcitx5/addon
newins unix/fcitx5/mozc-addon.conf mozc.conf
insinto /usr/share/fcitx5/inputmethod
doins unix/fcitx5/mozc.conf
local orgfcitx5="org.fcitx.Fcitx5.fcitx-mozc"
newicon -s 128 data/images/product_icon_32bpp-128.png ${orgfcitx5}.png
newicon -s 128 data/images/product_icon_32bpp-128.png fcitx-mozc.png
newicon -s 32 data/images/unix/ime_product_icon_opensource-32.png ${orgfcitx5}.png
newicon -s 32 data/images/unix/ime_product_icon_opensource-32.png fcitx-mozc.png
for uiimg in ../../fcitx5-mozc/scripts/icons/ui-*.png; do
dimg=${uiimg#*ui-}
newicon -s 48 ${uiimg} ${orgfcitx5}-${dimg/_/-}
newicon -s 48 ${uiimg} fcitx-mozc-${dimg/_/-}
done
local locale mo_file
for mo_file in unix/fcitx5/po/*.po; do
locale="${mo_file##*/}"
locale="${locale%.po}"
msgfmt ${mo_file} -o ${mo_file/.po/.mo} || die
insinto /usr/share/locale/${locale}/LC_MESSAGES
newins "${mo_file/.po/.mo}" fcitx5-mozc.mo
done
msgfmt --xml -d unix/fcitx5/po/ --template unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml.in -o \
unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml || die
insinto /usr/share/metainfo
doins unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml
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() {
elog
elog "ENVIRONMENTAL VARIABLES"
elog
elog "MOZC_SERVER_DIRECTORY"
elog " Mozc server directory"
elog " Value used by default: \"${EPREFIX}/usr/libexec/mozc\""
elog "MOZC_DOCUMENTS_DIRECTORY"
elog " Mozc documents directory"
elog " Value used by default: \"${EPREFIX}/usr/libexec/mozc/documents\""
elog "MOZC_CONFIGURATION_DIRECTORY"
elog " Mozc configuration directory"
elog " Value used by default: \"~/.mozc\""
elog
if use emacs; then
elog
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\"."
elog
elisp-site-regen
fi
xdg_pkg_postinst
}
pkg_postrm() {
if use emacs; then
elisp-site-regen
fi
xdg_pkg_postrm
}