mozc: update to 2.26.4353.100.

This commit is contained in:
Đoàn Trần Công Danh 2021-04-25 22:53:14 +07:00 committed by Đoàn Trần Công Danh
parent 89423a636e
commit 568bc837cd
11 changed files with 409 additions and 391 deletions

1
srcpkgs/fcitx5-mozc Symbolic link
View file

@ -0,0 +1 @@
mozc

View file

@ -0,0 +1,73 @@
Ported from grpc's patches
An all-in-one patch that fixes several issues:
1) UnscaledCycleClock not fully implemented for ppc*-musl (disabled on musl)
2) powerpc stacktrace implementation only works on glibc (disabled on musl)
3) powerpc stacktrace implementation has ppc64 assumptions (fixed)
4) examine_stack.cpp makes glibc assumptions on powerpc (fixed)
--- mozc/src/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h
+++ mozc/src/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h
@@ -46,7 +46,7 @@
// The following platforms have an implementation of a hardware counter.
#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
- defined(__powerpc__) || defined(__ppc__) || \
+ ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__)) || \
defined(_M_IX86) || defined(_M_X64)
#define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1
#else
--- mozc/src/third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc
+++ mozc/src/third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc
@@ -27,6 +27,10 @@
#include <csignal>
#include <cstdio>
+#if defined(__powerpc__)
+#include <asm/ptrace.h>
+#endif
+
#include "absl/base/attributes.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
@@ -55,8 +59,10 @@
return reinterpret_cast<void*>(context->uc_mcontext.pc);
#elif defined(__powerpc64__)
return reinterpret_cast<void*>(context->uc_mcontext.gp_regs[32]);
-#elif defined(__powerpc__)
+#elif defined(__powerpc__) && defined(__GLIBC__)
return reinterpret_cast<void*>(context->uc_mcontext.regs->nip);
+#elif defined(__powerpc__)
+ return reinterpret_cast<void*>(((struct pt_regs *)context->uc_regs)->nip);
#elif defined(__riscv)
return reinterpret_cast<void*>(context->uc_mcontext.__gregs[REG_PC]);
#elif defined(__s390__) && !defined(__s390x__)
--- mozc/src/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
+++ mozc/src/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
@@ -64,7 +64,7 @@
#elif defined(__i386__) || defined(__x86_64__)
#define ABSL_STACKTRACE_INL_HEADER \
"absl/debugging/internal/stacktrace_x86-inl.inc"
-#elif defined(__ppc__) || defined(__PPC__)
+#elif (defined(__ppc__) || defined(__PPC__)) && defined(__GLIBC__)
#define ABSL_STACKTRACE_INL_HEADER \
"absl/debugging/internal/stacktrace_powerpc-inl.inc"
#elif defined(__aarch64__)
--- mozc/src/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc
+++ mozc/src/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc
@@ -130,8 +130,13 @@
StacktracePowerPCGetLR(new_sp) == kernel_sigtramp_rt64_address) {
const ucontext_t* signal_context =
reinterpret_cast<const ucontext_t*>(uc);
+#if defined(__powerpc64__)
void **const sp_before_signal =
reinterpret_cast<void**>(signal_context->uc_mcontext.gp_regs[PT_R1]);
+#else
+ void **const sp_before_signal =
+ reinterpret_cast<void**>(signal_context->uc_mcontext.uc_regs->gregs[PT_R1]);
+#endif
// Check that alleged sp before signal is nonnull and is reasonably
// aligned.
if (sp_before_signal != nullptr &&

View file

@ -1,7 +1,9 @@
--- mozc/src/gyp/common.gypi
Index: mozc/src/gyp/common.gypi
===================================================================
--- mozc/src/gyp/common.gypi.orig
+++ mozc/src/gyp/common.gypi
@@ -444,12 +444,12 @@
}],
@@ -409,12 +409,12 @@
'conditions': [
['target_platform=="Linux"', {
'make_global_settings': [
- ['AR', '<!(which ar)'],
@ -19,7 +21,7 @@
],
}],
['target_platform=="Android"', {
@@ -494,12 +494,12 @@
@@ -459,12 +459,12 @@
['LD', '<(ndk_bin_dir)/<(toolchain_prefix)-ld'],
['NM', '<(ndk_bin_dir)/<(toolchain_prefix)-nm'],
['READELF', '<(ndk_bin_dir)/<(toolchain_prefix)-readelf'],

View file

@ -0,0 +1,29 @@
Index: mozc/src/gyp/common.gypi
===================================================================
--- mozc/src/gyp/common.gypi
+++ mozc/src/gyp/common.gypi
@@ -105,7 +105,7 @@
],
# Libraries for GNU/Linux environment.
'linux_ldflags': [
- '-lc++',
+ '-lstdc++',
'-pthread',
],
@@ -205,7 +205,6 @@
'-Wtype-limits',
],
'cflags_cc': [
- '-stdlib=libc++',
'-Wno-covered-switch-default',
'-Wno-unnamed-type-template-args',
'-Wno-c++11-narrowing',
@@ -225,7 +224,6 @@
'-Wtype-limits',
],
'cflags_cc': [
- '-stdlib=libc++',
'-Wno-covered-switch-default',
'-Wno-unnamed-type-template-args',
'-Wno-c++11-narrowing',

View file

@ -1,20 +0,0 @@
--- mozc/src/unix/ibus/property_handler.cc
+++ mozc/src/unix/ibus/property_handler.cc
@@ -40,6 +40,8 @@
#include "unix/ibus/mozc_engine_property.h"
#include "unix/ibus/path_util.h"
+#include <cstdlib>
+
// On Gnome Shell with IBus 1.5, new property named "symbol" is used to
// represent the mode indicator on the system panel. Note that "symbol" does
// not exist in IBus 1.4.x.
@@ -80,7 +82,7 @@ bool GetDisabled(IBusEngine *engine) {
// On IBus 1.4.x, IBus expects that an IME should always be turned on and
// IME on/off keys are handled by IBus itself rather than each IME.
#if IBUS_CHECK_VERSION(1, 5, 0)
-const bool kActivatedOnLaunch = false;
+const bool kActivatedOnLaunch = !!::std::getenv("IBUS_MOZC_DEFAULT_HIRAGANA");
#else
const bool kActivatedOnLaunch = true;
#endif // IBus>=1.5.0

View file

@ -0,0 +1,13 @@
Index: mozc/src/unix/fcitx/fcitx.gyp
===================================================================
--- mozc/src/unix/fcitx/fcitx.gyp.orig
+++ mozc/src/unix/fcitx/fcitx.gyp
@@ -96,7 +96,7 @@
'<@(fcitx_dep_include_dirs)',
],
'defines': [
- 'LOCALEDIR="<!@(fcitx4-config --prefix)/share/locale/"',
+ 'LOCALEDIR="/usr/share/locale/"',
],
},
],

View file

@ -1,6 +1,8 @@
--- mozc/src/build_mozc.py
Index: mozc/src/build_mozc.py
===================================================================
--- mozc/src/build_mozc.py.orig
+++ mozc/src/build_mozc.py
@@ -728,6 +728,7 @@ def GypMain(options, unused_args):
@@ -496,6 +496,7 @@ def GypMain(options, unused_args):
gyp_options.extend(['--generator-output=.'])
short_basename = GetBuildShortBaseName(target_platform)
gyp_options.extend(['-G', 'output_dir=%s' % short_basename])

View file

@ -1,327 +0,0 @@
--- mozc/src/dictionary/user_dictionary.cc
+++ mozc/src/dictionary/user_dictionary.cc
@@ -289,7 +289,7 @@ class UserDictionary::UserDictionaryReloader : public Thread {
}
auto_register_mode_ = false;
- dic_->Load(*(storage.get()));
+ dic_->Load(*(storage->storage()));
}
private:
--- mozc/src/dictionary/user_dictionary_session.cc
+++ mozc/src/dictionary/user_dictionary_session.cc
@@ -144,7 +144,7 @@ class UndoRenameDictionaryCommand : public UserDictionarySession::UndoCommand {
virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage, dictionary_id_);
+ storage->storage(), dictionary_id_);
if (dictionary == NULL) {
return false;
}
@@ -169,7 +169,7 @@ class UndoAddEntryCommand : public UserDictionarySession::UndoCommand {
virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage, dictionary_id_);
+ storage->storage(), dictionary_id_);
if (dictionary == NULL || dictionary->entries_size() == 0) {
return false;
}
@@ -195,7 +195,7 @@ class UndoEditEntryCommand : public UserDictionarySession::UndoCommand {
virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage, dictionary_id_);
+ storage->storage(), dictionary_id_);
if (dictionary == NULL ||
index_ < 0 || dictionary->entries_size() <= index_) {
return false;
@@ -240,7 +240,7 @@ class UndoDeleteEntryCommand : public UserDictionarySession::UndoCommand {
virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage, dictionary_id_);
+ storage->storage(), dictionary_id_);
if (dictionary == NULL) {
return false;
}
@@ -306,7 +306,7 @@ class UndoImportFromStringCommand : public UserDictionarySession::UndoCommand {
virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage, dictionary_id_);
+ storage->storage(), dictionary_id_);
if (dictionary == NULL) {
return false;
}
@@ -345,7 +345,7 @@ UserDictionarySession::~UserDictionarySession() {
// TODO(hidehiko) move this to header.
const UserDictionaryStorage &UserDictionarySession::storage() const {
- return *storage_;
+ return *storage_->storage();
}
mozc::UserDictionaryStorage *UserDictionarySession::mutable_storage() {
return storage_.get();
@@ -464,7 +464,7 @@ UserDictionaryCommandStatus::Status UserDictionarySession::CreateDictionary(
const string &dictionary_name, uint64 *new_dictionary_id) {
UserDictionaryCommandStatus::Status status =
UserDictionaryUtil::CreateDictionary(
- storage_.get(), dictionary_name, new_dictionary_id);
+ storage_->storage(), dictionary_name, new_dictionary_id);
if (status == UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS) {
AddUndoCommand(new UndoCreateDictionaryCommand);
}
@@ -488,7 +488,7 @@ UserDictionarySession::DeleteDictionaryInternal(
int original_index;
UserDictionary *deleted_dictionary;
if (!UserDictionaryUtil::DeleteDictionary(
- storage_.get(), dictionary_id,
+ storage_->storage(), dictionary_id,
&original_index, &deleted_dictionary)) {
// Failed to delete the dictionary.
return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
@@ -510,7 +510,7 @@ UserDictionaryCommandStatus::Status UserDictionarySession::RenameDictionary(
uint64 dictionary_id, const string &dictionary_name) {
string original_name;
const UserDictionary *dictionary =
- UserDictionaryUtil::GetUserDictionaryById(*storage_, dictionary_id);
+ UserDictionaryUtil::GetUserDictionaryById(*storage_->storage(), dictionary_id);
if (dictionary != NULL) {
// Note that if dictionary is null, it means the dictionary_id is invalid
// so following RenameDictionary will fail, and error handling is done
@@ -547,7 +547,7 @@ UserDictionaryCommandStatus::Status UserDictionarySession::AddEntry(
uint64 dictionary_id, const UserDictionary::Entry &entry) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage_.get(), dictionary_id);
+ storage_->storage(), dictionary_id);
if (dictionary == NULL) {
return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
}
@@ -575,7 +575,7 @@ UserDictionaryCommandStatus::Status UserDictionarySession::EditEntry(
uint64 dictionary_id, int index, const UserDictionary::Entry &entry) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage_.get(), dictionary_id);
+ storage_->storage(), dictionary_id);
if (dictionary == NULL) {
return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
}
@@ -604,7 +604,7 @@ UserDictionaryCommandStatus::Status UserDictionarySession::DeleteEntry(
uint64 dictionary_id, const std::vector<int> &index_list) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage_.get(), dictionary_id);
+ storage_->storage(), dictionary_id);
if (dictionary == NULL) {
return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
}
@@ -644,7 +644,7 @@ UserDictionaryCommandStatus::Status UserDictionarySession::ImportFromString(
uint64 dictionary_id, const string &data) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage_.get(), dictionary_id);
+ storage_->storage(), dictionary_id);
if (dictionary == NULL) {
return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
}
@@ -699,7 +699,7 @@ UserDictionarySession::ImportToNewDictionaryFromString(
uint64 *new_dictionary_id) {
UserDictionaryCommandStatus::Status status =
UserDictionaryUtil::CreateDictionary(
- storage_.get(), dictionary_name, new_dictionary_id);
+ storage_->storage(), dictionary_name, new_dictionary_id);
if (status != UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS) {
return status;
}
@@ -709,7 +709,7 @@ UserDictionarySession::ImportToNewDictionaryFromString(
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage_.get(), *new_dictionary_id);
+ storage_->storage(), *new_dictionary_id);
if (dictionary == NULL) {
// The dictionary should be always found.
return UserDictionaryCommandStatus::UNKNOWN_ERROR;
@@ -728,7 +728,7 @@ bool UserDictionarySession::EnsureNonEmptyStorage() {
uint64 new_dictionary_id;
UserDictionaryCommandStatus::Status status =
UserDictionaryUtil::CreateDictionary(
- storage_.get(), default_dictionary_name_, &new_dictionary_id);
+ storage_->storage(), default_dictionary_name_, &new_dictionary_id);
CHECK_EQ(
status, UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS);
return true;
--- mozc/src/dictionary/user_dictionary_storage.cc
+++ mozc/src/dictionary/user_dictionary_storage.cc
@@ -109,7 +109,7 @@ bool UserDictionaryStorage::LoadInternal() {
mozc::protobuf::io::IstreamInputStream zero_copy_input(&ifs);
mozc::protobuf::io::CodedInputStream decoder(&zero_copy_input);
decoder.SetTotalBytesLimit(kDefaultTotalBytesLimit, -1);
- if (!ParseFromCodedStream(&decoder)) {
+ if (!storage_.ParseFromCodedStream(&decoder)) {
LOG(ERROR) << "Failed to parse";
if (!decoder.ConsumedEntireMessage() || !ifs.eof()) {
LOG(ERROR) << "ParseFromStream failed: file seems broken";
@@ -141,7 +141,7 @@ bool UserDictionaryStorage::Load() {
const UserDictionary &dict = dictionaries(i);
if (dict.id() == 0) {
mutable_dictionaries(i)->set_id(
- UserDictionaryUtil::CreateNewDictionaryId(*this));
+ UserDictionaryUtil::CreateNewDictionaryId(storage_));
}
}
@@ -171,7 +171,7 @@ bool UserDictionaryStorage::Save() {
return false;
}
- if (!SerializeToOstream(&ofs)) {
+ if (!storage_.SerializeToOstream(&ofs)) {
LOG(ERROR) << "SerializeToString failed";
last_error_type_ = SYNC_FAILURE;
return false;
@@ -241,7 +241,7 @@ bool UserDictionaryStorage::ExportDictionary(
bool UserDictionaryStorage::CreateDictionary(
const string &dic_name, uint64 *new_dic_id) {
UserDictionaryCommandStatus::Status status =
- UserDictionaryUtil::CreateDictionary(this, dic_name, new_dic_id);
+ UserDictionaryUtil::CreateDictionary(&storage_, dic_name, new_dic_id);
// Update last_error_type_
switch (status) {
case UserDictionaryCommandStatus::DICTIONARY_NAME_EMPTY:
@@ -273,7 +273,7 @@ bool UserDictionaryStorage::CreateDictionary(
}
bool UserDictionaryStorage::DeleteDictionary(uint64 dic_id) {
- if (!UserDictionaryUtil::DeleteDictionary(this, dic_id, NULL, NULL)) {
+ if (!UserDictionaryUtil::DeleteDictionary(&storage_, dic_id, NULL, NULL)) {
// Failed to delete dictionary.
last_error_type_ = INVALID_DICTIONARY_ID;
return false;
@@ -318,7 +318,7 @@ bool UserDictionaryStorage::RenameDictionary(uint64 dic_id,
}
int UserDictionaryStorage::GetUserDictionaryIndex(uint64 dic_id) const {
- return UserDictionaryUtil::GetUserDictionaryIndexById(*this, dic_id);
+ return UserDictionaryUtil::GetUserDictionaryIndexById(storage_, dic_id);
}
bool UserDictionaryStorage::GetUserDictionaryId(const string &dic_name,
@@ -335,7 +335,7 @@ bool UserDictionaryStorage::GetUserDictionaryId(const string &dic_name,
user_dictionary::UserDictionary *UserDictionaryStorage::GetUserDictionary(
uint64 dic_id) {
- return UserDictionaryUtil::GetMutableUserDictionaryById(this, dic_id);
+ return UserDictionaryUtil::GetMutableUserDictionaryById(&storage_, dic_id);
}
UserDictionaryStorage::UserDictionaryStorageErrorType
@@ -361,14 +361,14 @@ bool UserDictionaryStorage::AddToAutoRegisteredDictionary(
UserDictionary *dic = NULL;
if (auto_index == -1) {
- if (UserDictionaryUtil::IsStorageFull(*this)) {
+ if (UserDictionaryUtil::IsStorageFull(storage_)) {
last_error_type_ = TOO_MANY_DICTIONARIES;
LOG(ERROR) << "too many dictionaries";
UnLock();
return false;
}
dic = add_dictionaries();
- dic->set_id(UserDictionaryUtil::CreateNewDictionaryId(*this));
+ dic->set_id(UserDictionaryUtil::CreateNewDictionaryId(storage_));
dic->set_name(kAutoRegisteredDictionaryName);
} else {
dic = mutable_dictionaries(auto_index);
@@ -410,7 +410,7 @@ bool UserDictionaryStorage::AddToAutoRegisteredDictionary(
}
bool UserDictionaryStorage::ConvertSyncDictionariesToNormalDictionaries() {
- if (CountSyncableDictionaries(*this) == 0) {
+ if (CountSyncableDictionaries(storage_) == 0) {
return false;
}
@@ -445,7 +445,7 @@ bool UserDictionaryStorage::ConvertSyncDictionariesToNormalDictionaries() {
kDictionaryNameConvertedFromSyncableDictionary;
int index = 0;
while (UserDictionaryUtil::ValidateDictionaryName(
- *this, new_dictionary_name)
+ storage_, new_dictionary_name)
!= UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS) {
++index;
new_dictionary_name = Util::StringPrintf(
@@ -456,7 +456,7 @@ bool UserDictionaryStorage::ConvertSyncDictionariesToNormalDictionaries() {
dic->set_syncable(false);
}
- DCHECK_EQ(0, CountSyncableDictionaries(*this));
+ DCHECK_EQ(0, CountSyncableDictionaries(storage_));
return true;
}
--- mozc/src/dictionary/user_dictionary_storage.h
+++ mozc/src/dictionary/user_dictionary_storage.h
@@ -74,8 +74,20 @@ class ProcessMutex;
// Inherit from ProtocolBuffer
// TODO(hidehiko): Get rid of this implementation.
-class UserDictionaryStorage : public user_dictionary::UserDictionaryStorage {
+class UserDictionaryStorage {
+ private:
+ user_dictionary::UserDictionaryStorage storage_;
public:
+ static const user_dictionary::UserDictionaryStorage& default_instance() { return user_dictionary::UserDictionaryStorage::default_instance(); }
+ user_dictionary::UserDictionaryStorage *storage() { return &storage_; }
+ int dictionaries_size() const { return storage_.dictionaries_size(); }
+ void clear_dictionaries() { storage_.clear_dictionaries(); }
+ user_dictionary::UserDictionary* mutable_dictionaries(int index) { return storage_.mutable_dictionaries(index); }
+ ::google::protobuf::RepeatedPtrField<user_dictionary::UserDictionary >* mutable_dictionaries() { return storage_.mutable_dictionaries(); }
+ const ::google::protobuf::RepeatedPtrField<user_dictionary::UserDictionary >& dictionaries() const { return storage_.dictionaries(); }
+ const user_dictionary::UserDictionary& dictionaries(int index) const { return storage_.dictionaries(index); }
+ user_dictionary::UserDictionary* add_dictionaries() { return storage_.add_dictionaries(); }
+
typedef user_dictionary::UserDictionary UserDictionary;
typedef user_dictionary::UserDictionary::Entry UserDictionaryEntry;
--- mozc/src/prediction/user_history_predictor.cc
+++ mozc/src/prediction/user_history_predictor.cc
@@ -291,7 +291,7 @@ bool UserHistoryStorage::Load() {
return false;
}
- if (!ParseFromString(input)) {
+ if (!userHistory_.ParseFromString(input)) {
LOG(ERROR) << "ParseFromString failed. message looks broken";
return false;
}
@@ -307,7 +307,7 @@ bool UserHistoryStorage::Save() const {
}
string output;
- if (!AppendToString(&output)) {
+ if (!userHistory_.AppendToString(&output)) {
LOG(ERROR) << "AppendToString failed";
return false;
}
--- mozc/src/prediction/user_history_predictor.h
+++ mozc/src/prediction/user_history_predictor.h
@@ -61,8 +61,13 @@ class Segments;
class UserHistoryPredictorSyncer;
// Added serialization method for UserHistory.
-class UserHistoryStorage : public mozc::user_history_predictor::UserHistory {
+class UserHistoryStorage {
+ private:
+ user_history_predictor::UserHistory userHistory_;
public:
+ int entries_size() const { return userHistory_.entries_size(); }
+ const user_history_predictor::UserHistory_Entry& entries(int index) const { return userHistory_.entries(index); }
+ user_history_predictor::UserHistory_Entry* add_entries() { return userHistory_.add_entries(); }
explicit UserHistoryStorage(const string &filename);
~UserHistoryStorage();

View file

@ -0,0 +1,210 @@
Index: mozc/src/gui/word_register_dialog/word_register_dialog.cc
===================================================================
--- mozc/src/gui/word_register_dialog/word_register_dialog.cc
+++ mozc/src/gui/word_register_dialog/word_register_dialog.cc
@@ -94,7 +94,7 @@ QString GetEnv(const char *envname) {
return QString::fromUtf16(reinterpret_cast<const ushort *>(buffer.get()));
} else {
// This is a fallback just in case.
- return QString::fromUcs4(reinterpret_cast<const uint *>(buffer.get()));
+ return QString::fromUcs4(reinterpret_cast<const unsigned *>(buffer.get()));
}
}
return QLatin1String("");
Index: mozc/src/unix/fcitx/surrounding_text_util.cc
===================================================================
--- mozc/src/unix/fcitx/surrounding_text_util.cc
+++ mozc/src/unix/fcitx/surrounding_text_util.cc
@@ -41,10 +41,10 @@
namespace mozc {
namespace fcitx {
-bool SurroundingTextUtil::GetSafeDelta(uint from, uint to, int32 *delta) {
+bool SurroundingTextUtil::GetSafeDelta(unsigned from, unsigned to, int32 *delta) {
DCHECK(delta);
- static_assert(sizeof(int64) >= sizeof(uint),
+ static_assert(sizeof(int64) >= sizeof(unsigned),
"int64 must be sufficient to store a guint value.");
static_assert(sizeof(int64) == sizeof(llabs(0)),
"|llabs(0)| must returns a 64-bit integer.");
@@ -113,8 +113,8 @@ bool SearchAnchorPosForward(
const std::string &surrounding_text,
const std::string &selected_text,
size_t selected_chars_len,
- uint cursor_pos,
- uint *anchor_pos) {
+ unsigned cursor_pos,
+ unsigned *anchor_pos) {
ConstChar32Iterator iter(surrounding_text);
// Move |iter| to cursor pos.
@@ -137,15 +137,15 @@ bool SearchAnchorPosBackward(
const std::string &surrounding_text,
const std::string &selected_text,
size_t selected_chars_len,
- uint cursor_pos,
- uint *anchor_pos) {
+ unsigned cursor_pos,
+ unsigned *anchor_pos) {
if (cursor_pos < selected_chars_len) {
return false;
}
ConstChar32Iterator iter(surrounding_text);
// Skip |iter| to (potential) anchor pos.
- const uint skip_count = cursor_pos - selected_chars_len;
+ const unsigned skip_count = cursor_pos - selected_chars_len;
DCHECK_LE(skip_count, cursor_pos);
if (!Skip(&iter, skip_count)) {
return false;
@@ -164,8 +164,8 @@ bool SearchAnchorPosBackward(
bool SurroundingTextUtil::GetAnchorPosFromSelection(
const std::string &surrounding_text,
const std::string &selected_text,
- uint cursor_pos,
- uint *anchor_pos) {
+ unsigned cursor_pos,
+ unsigned *anchor_pos) {
DCHECK(anchor_pos);
if (surrounding_text.empty()) {
@@ -196,8 +196,8 @@ bool GetSurroundingText(FcitxInstance* i
return false;
}
- uint cursor_pos = 0;
- uint anchor_pos = 0;
+ unsigned cursor_pos = 0;
+ unsigned anchor_pos = 0;
char* str = NULL;
if (!FcitxInstanceGetSurroundingText(instance, ic, &str, &cursor_pos, &anchor_pos)) {
@@ -211,7 +211,7 @@ bool GetSurroundingText(FcitxInstance* i
const char* primary = NULL;
if ((primary = FcitxClipboardGetPrimarySelection(instance, NULL)) != NULL) {
- uint new_anchor_pos = 0;
+ unsigned new_anchor_pos = 0;
const std::string primary_text(primary);
if (SurroundingTextUtil::GetAnchorPosFromSelection(
surrounding_text, primary_text,
Index: mozc/src/unix/fcitx/surrounding_text_util.h
===================================================================
--- mozc/src/unix/fcitx/surrounding_text_util.h
+++ mozc/src/unix/fcitx/surrounding_text_util.h
@@ -55,7 +55,7 @@ class SurroundingTextUtil {
// Returns true when neither |abs(delta)| nor |-delta| does not cause
// integer overflow, that is, |delta| is in a safe range.
// Returns false otherwise.
- static bool GetSafeDelta(uint from, uint to, int32 *delta);
+ static bool GetSafeDelta(unsigned from, unsigned to, int32 *delta);
// Returns true if
// 1. |surrounding_text| contains |selected_text|
@@ -71,8 +71,8 @@ class SurroundingTextUtil {
static bool GetAnchorPosFromSelection(
const std::string &surrounding_text,
const std::string &selected_text,
- uint cursor_pos,
- uint *anchor_pos);
+ unsigned cursor_pos,
+ unsigned *anchor_pos);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(SurroundingTextUtil);
Index: mozc/src/unix/fcitx5/surrounding_text_util.cc
===================================================================
--- mozc/src/unix/fcitx5/surrounding_text_util.cc
+++ mozc/src/unix/fcitx5/surrounding_text_util.cc
@@ -43,10 +43,10 @@ namespace fcitx {
using namespace mozc;
-bool SurroundingTextUtil::GetSafeDelta(uint from, uint to, int32 *delta) {
+bool SurroundingTextUtil::GetSafeDelta(unsigned from, unsigned to, int32 *delta) {
DCHECK(delta);
- static_assert(sizeof(int64) >= sizeof(uint),
+ static_assert(sizeof(int64) >= sizeof(unsigned),
"int64 must be sufficient to store a guint value.");
static_assert(sizeof(int64) == sizeof(llabs(0)),
"|llabs(0)| must returns a 64-bit integer.");
@@ -110,8 +110,8 @@ bool StartsWith(ConstChar32Iterator *ite
// Otherwise returns false.
bool SearchAnchorPosForward(const std::string &surrounding_text,
const std::string &selected_text,
- size_t selected_chars_len, uint cursor_pos,
- uint *anchor_pos) {
+ size_t selected_chars_len, unsigned cursor_pos,
+ unsigned *anchor_pos) {
ConstChar32Iterator iter(surrounding_text);
// Move |iter| to cursor pos.
if (!Skip(&iter, cursor_pos)) {
@@ -131,15 +131,15 @@ bool SearchAnchorPosForward(const std::s
// Otherwise returns false.
bool SearchAnchorPosBackward(const std::string &surrounding_text,
const std::string &selected_text,
- size_t selected_chars_len, uint cursor_pos,
- uint *anchor_pos) {
+ size_t selected_chars_len, unsigned cursor_pos,
+ unsigned *anchor_pos) {
if (cursor_pos < selected_chars_len) {
return false;
}
ConstChar32Iterator iter(surrounding_text);
// Skip |iter| to (potential) anchor pos.
- const uint skip_count = cursor_pos - selected_chars_len;
+ const unsigned skip_count = cursor_pos - selected_chars_len;
DCHECK_LE(skip_count, cursor_pos);
if (!Skip(&iter, skip_count)) {
return false;
@@ -157,7 +157,7 @@ bool SearchAnchorPosBackward(const std::
bool SurroundingTextUtil::GetAnchorPosFromSelection(
const std::string &surrounding_text, const std::string &selected_text,
- uint cursor_pos, uint *anchor_pos) {
+ unsigned cursor_pos, unsigned *anchor_pos) {
DCHECK(anchor_pos);
if (surrounding_text.empty()) {
@@ -187,13 +187,13 @@ bool GetSurroundingText(InputContext *ic
}
const auto surrounding_text = ic->surroundingText().text();
- uint cursor_pos = ic->surroundingText().cursor();
- uint anchor_pos = ic->surroundingText().anchor();
+ unsigned cursor_pos = ic->surroundingText().cursor();
+ unsigned anchor_pos = ic->surroundingText().anchor();
if (cursor_pos == anchor_pos && clipboard) {
std::string primary = clipboard->call<IClipboard::primary>(ic);
if (!primary.empty()) {
- uint new_anchor_pos = 0;
+ unsigned new_anchor_pos = 0;
if (SurroundingTextUtil::GetAnchorPosFromSelection(
surrounding_text, primary, cursor_pos, &new_anchor_pos)) {
anchor_pos = new_anchor_pos;
Index: mozc/src/unix/fcitx5/surrounding_text_util.h
===================================================================
--- mozc/src/unix/fcitx5/surrounding_text_util.h
+++ mozc/src/unix/fcitx5/surrounding_text_util.h
@@ -56,7 +56,7 @@ class SurroundingTextUtil {
// Returns true when neither |abs(delta)| nor |-delta| does not cause
// integer overflow, that is, |delta| is in a safe range.
// Returns false otherwise.
- static bool GetSafeDelta(uint from, uint to, int32 *delta);
+ static bool GetSafeDelta(unsigned from, unsigned to, int32 *delta);
// Returns true if
// 1. |surrounding_text| contains |selected_text|
@@ -71,7 +71,7 @@ class SurroundingTextUtil {
// Otherwise returns false.
static bool GetAnchorPosFromSelection(const std::string &surrounding_text,
const std::string &selected_text,
- uint cursor_pos, uint *anchor_pos);
+ unsigned cursor_pos, unsigned *anchor_pos);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(SurroundingTextUtil);

View file

@ -1,33 +1,36 @@
# Template file for 'mozc'
pkgname=mozc
version=2.23.2815.102
revision=10
# src/data/version/mozc_version_template.bzl
version=2.26.4353.100
revision=1
create_wrksrc=yes
build_wrksrc=mozc/src
hostmakedepends="gettext ninja pkg-config protobuf protobuf-devel python which"
hostmakedepends="gettext ninja pkg-config protobuf protobuf-devel
python3-six which qt5-qmake qt5-host-tools"
makedepends="gtk+-devel ibus-devel libzinnia-devel protobuf-devel qt5-devel
fcitx-devel"
fcitx-devel libfcitx5-devel"
depends="tegaki-zinnia-japanese>=0.3"
short_desc="Japanese IME (Open Source version of Google Japanese Input)"
maintainer="Matthias von Faber <mvf@gmx.eu>"
license="BSD-3-Clause"
homepage="https://github.com/google/mozc"
distfiles="
https://gitlab.com/fcitx/mozc/repository/dad94584ea5012110ad1d204e433964243a1639d/archive.tar.bz2>${pkgname}-${version}.tar.bz2
https://github.com/bnoordhuis/gyp/archive/c6f471687407bf28ddfc63f1a8f47aeb7bf54edc.tar.gz
https://github.com/fcitx/mozc/archive/d384c3b3e7eed1aa54a6af3363781604fe538d65.tar.gz
https://github.com/abseil/abseil-cpp/archive/0f3bb466b868b523cf1dc9b2aaaed65c77b28862.tar.gz
${DEBIAN_SITE}/main/g/gyp/gyp_0.1+20200513gitcaa6002.orig.tar.gz
https://github.com/hiroyuki-komatsu/japanese-usage-dictionary/archive/e5b3425575734c323e1d947009dd74709437b684.tar.gz
"
checksum="
e38457e63a7fa8d62d87b4f8b3e89fe5f6939d92e3c4fd287a93358375693892
882f074cbb3a4f2bba550fb615e63949c0fbf39eeb1718a0330b4a545ab97616
0b6efee0eebac2c1a8eeea333278aa40fcef7846bba9a379962c6e567e7e3dc1
"
checksum="69cb26e1f9c03e20715356ef568b583f2baf996df5fd8536aca2ed8e7bd9444f
3d74cdc98b42fd4257d91f652575206de195e2c824fcd8d6e6d227f85cb143ef
8d531bc7d3302461d76a32367453cec60ed08b455f27a53d8f313d81761713a8
0b6efee0eebac2c1a8eeea333278aa40fcef7846bba9a379962c6e567e7e3dc1"
CXXFLAGS="-D_GNU_SOURCE"
patch_args=-Np0
lib32disabled=yes
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" qt5-devel"
subpackages="ibus-mozc fcitx-mozc"
subpackages="ibus-mozc fcitx-mozc fcitx5-mozc"
fi
if [ "$XBPS_TARGET_ENDIAN" = "be" ]; then
@ -35,45 +38,43 @@ if [ "$XBPS_TARGET_ENDIAN" = "be" ]; then
fi
post_extract() {
ln -s mozc-* mozc
rm -rf mozc/src/unix/fcitx5
mv mozc-* mozc
# symlink "submodules" into place
for _src_dest in gyp japanese-usage-dictionary:japanese_usage_dictionary; do
for _src_dest in gyp \
abseil-cpp \
japanese-usage-dictionary:japanese_usage_dictionary
do
_src=${_src_dest%:*}
_dst=mozc/src/third_party/${_src_dest#*:}
rmdir $_dst
ln -sr $_src-* $_dst
done
}
if [ "$CROSS_BUILD" ]; then
# find fcitx4-config
sed -i -e "s;fcitx4-config;${XBPS_CROSS_BASE}/usr/bin/fcitx4-config;" mozc/src/unix/fcitx/fcitx.gyp
post_patch() {
if [ "$XBPS_TARGET_LIBC" = musl ]; then
vsed -i -e 's|PTHREAD_MUTEX_RECURSIVE_NP|PTHREAD_MUTEX_RECURSIVE|g' base/mutex.cc
fi
}
do_configure() {
case "$XBPS_TARGET_MACHINE" in
*-musl) sed -i -e 's|PTHREAD_MUTEX_RECURSIVE_NP|PTHREAD_MUTEX_RECURSIVE|g' base/mutex.cc ;;
esac
GYP_DEFINES="
document_dir=/usr/share/licenses/${pkgname}
use_libprotobuf=1
use_libzinnia=1
" python2 build_mozc.py gyp --target_platform=Linux
" python3 build_mozc.py gyp --target_platform=Linux
}
do_build() {
local targets
targets="
server/server.gyp:mozc_server
gui/gui.gyp:mozc_tool
unix/emacs/emacs.gyp:mozc_emacs_helper
unix/ibus/ibus.gyp:ibus_mozc
renderer/renderer.gyp:mozc_renderer
unix/fcitx/fcitx.gyp:fcitx-mozc
"
python2 build_mozc.py build -c Release $targets
python3 build_mozc.py build -c Release \
server/server.gyp:mozc_server \
gui/gui.gyp:mozc_tool \
unix/emacs/emacs.gyp:mozc_emacs_helper \
unix/ibus/ibus.gyp:ibus_mozc \
renderer/renderer.gyp:mozc_renderer \
unix/fcitx/fcitx.gyp:fcitx-mozc \
unix/fcitx5/fcitx5.gyp:fcitx5-mozc
sed -i 's|/usr/libexec/|/usr/lib/ibus-mozc/|g' out_linux/Release/gen/unix/ibus/mozc.xml
}
@ -82,15 +83,16 @@ do_install() {
vinstall out_linux/Release/mozc_server 755 usr/lib/mozc
vinstall out_linux/Release/mozc_tool 755 usr/lib/mozc
head -n 29 server/mozc_server.cc > LICENSE
for i in LICENSE data/installer/*.html; do
vlicense "$i"
done
head -n 29 unix/fcitx5/fcitx_key_translator.cc >mozc.LICENSE
vlicense mozc.LICENSE
vlicense data/installer/credits_en.html
vlicense third_party/japanese_usage_dictionary/LICENSE dict.LICENSE
}
ibus-mozc_package() {
short_desc="Mozc engine for IBus - Client of the Mozc input method"
depends="${sourcepkg}-${version}_${revision} ibus>=1.5.14"
lib32disabled=yes
pkg_install() {
vinstall out_linux/Release/ibus_mozc 755 usr/lib/ibus-mozc ibus-engine-mozc
vinstall out_linux/Release/gen/unix/ibus/mozc.xml 644 usr/share/ibus/component
@ -105,6 +107,7 @@ ibus-mozc_package() {
emacs-mozc_package() {
pkgdesc="Mozc for Emacs"
depends="${sourcepkg}-${version}_${revision} emacs"
lib32disabled=yes
pkg_install() {
vbin out_linux/Release/mozc_emacs_helper
vinstall unix/emacs/mozc.el 644 usr/share/emacs/site-lisp/emacs-mozc
@ -115,10 +118,40 @@ fcitx-mozc_package() {
short_desc="Mozc engine for fcitx - Client of the Mozc input method"
depends="${sourcepkg}-${version}_${revision} fcitx>=4.2.9"
homepage="https://fcitx-im.org/"
license="GPL-2.0-or-later"
lib32disabled=yes
pkg_install() {
local _file _lang
vinstall out_linux/Release/fcitx-mozc.so 644 usr/lib/fcitx
vinstall unix/fcitx/fcitx-mozc.conf 644 usr/share/fcitx/addon
vinstall unix/fcitx/mozc.conf 644 usr/share/fcitx/inputmethod
vinstall data/images/unix/ime_product_icon_opensource-32.png \
644 usr/share/fcitx/icon mozc.png
for _file in out_linux/Release/gen/unix/fcitx/po/*.mo
do
_lang=${_file##*/}
_lang=${_lang%.mo}
vinstall "$_file" 644 usr/share/locale/$_lang fcitx-mozc.mo
done
}
}
fcitx5-mozc_package() {
short_desc="Mozc engine for fcitx v5"
depends="${sourcepkg}-${version}_${revision} fcitx5"
homepage="https://fcitx-im.org/"
lib32disabled=yes
pkg_install() {
local _file _lang
vinstall out_linux/Release/fcitx5-mozc.so 644 usr/lib/fcitx5
vinstall unix/fcitx5/mozc-addon.conf 644 \
usr/share/fcitx5/addon mozc.conf
vinstall unix/fcitx5/mozc.conf 644 usr/share/fcitx5/inputmethod
for _file in unix/fcitx5/po/*.po
do
_lang=${_file##*/}
_lang=${_lang%.po}
vmkdir usr/share/locale/$_lang
msgfmt "$_file" -o $PKGDESTDIR/usr/share/locale/$_lang/fcitx5-mozc.mo
done
}
}

2
srcpkgs/mozc/update Normal file
View file

@ -0,0 +1,2 @@
# Google never tags any releases.
ignore="*"