From c90670d8b94f18b16d004fd3aacf2fa5f49104c7 Mon Sep 17 00:00:00 2001 From: Matthias von Faber Date: Sat, 9 Mar 2019 14:53:27 +0100 Subject: [PATCH] New package: mozc-2.23.2815.102 Co-authored-by: maxice8 --- srcpkgs/mozc/INSTALL.msg | 1 - srcpkgs/mozc/emacs-mozc.INSTALL.msg | 7 + srcpkgs/mozc/ibus-mozc.INSTALL.msg | 7 + srcpkgs/mozc/patches/cross.patch | 40 +++ .../default_hiragana_from_environment.patch | 20 ++ srcpkgs/mozc/patches/no-parallel.patch | 10 + srcpkgs/mozc/patches/protobuf-370.patch | 327 ++++++++++++++++++ srcpkgs/mozc/template | 121 ++++++- 8 files changed, 519 insertions(+), 14 deletions(-) delete mode 100644 srcpkgs/mozc/INSTALL.msg create mode 100644 srcpkgs/mozc/emacs-mozc.INSTALL.msg create mode 100644 srcpkgs/mozc/ibus-mozc.INSTALL.msg create mode 100644 srcpkgs/mozc/patches/cross.patch create mode 100644 srcpkgs/mozc/patches/default_hiragana_from_environment.patch create mode 100644 srcpkgs/mozc/patches/no-parallel.patch create mode 100644 srcpkgs/mozc/patches/protobuf-370.patch diff --git a/srcpkgs/mozc/INSTALL.msg b/srcpkgs/mozc/INSTALL.msg deleted file mode 100644 index 78e218473c..0000000000 --- a/srcpkgs/mozc/INSTALL.msg +++ /dev/null @@ -1 +0,0 @@ -mozc is no longer provided by Void Linux, and will be fully removed from the repos on 2019/06/08 diff --git a/srcpkgs/mozc/emacs-mozc.INSTALL.msg b/srcpkgs/mozc/emacs-mozc.INSTALL.msg new file mode 100644 index 0000000000..08e953d39d --- /dev/null +++ b/srcpkgs/mozc/emacs-mozc.INSTALL.msg @@ -0,0 +1,7 @@ +To enable Mozc mode, add this to your ~/.emacs.d/init.el file: + +(set-language-environment "Japanese") +(require 'mozc) ; or (load-file "/path/to/mozc.el") +(setq default-input-method "japanese-mozc") + +C-\ is bound to `toggle-input-method' by default. diff --git a/srcpkgs/mozc/ibus-mozc.INSTALL.msg b/srcpkgs/mozc/ibus-mozc.INSTALL.msg new file mode 100644 index 0000000000..527683859b --- /dev/null +++ b/srcpkgs/mozc/ibus-mozc.INSTALL.msg @@ -0,0 +1,7 @@ +ibus-mozc always starts up in Direct Input mode. If you prefer Hiragana +mode by default, set the IBUS_MOZC_DEFAULT_HIRAGANA environment variable +for ibus-daemon, e.g.: + +IBUS_MOZC_DEFAULT_HIRAGANA= ibus-daemon --xim -d + +This is a Void Linux extension. diff --git a/srcpkgs/mozc/patches/cross.patch b/srcpkgs/mozc/patches/cross.patch new file mode 100644 index 0000000000..17d47a900e --- /dev/null +++ b/srcpkgs/mozc/patches/cross.patch @@ -0,0 +1,40 @@ +--- mozc/src/gyp/common.gypi ++++ mozc/src/gyp/common.gypi +@@ -444,12 +444,12 @@ + }], + ['target_platform=="Linux"', { + 'make_global_settings': [ +- ['AR', ' ++ + // 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 diff --git a/srcpkgs/mozc/patches/no-parallel.patch b/srcpkgs/mozc/patches/no-parallel.patch new file mode 100644 index 0000000000..14b23367f0 --- /dev/null +++ b/srcpkgs/mozc/patches/no-parallel.patch @@ -0,0 +1,10 @@ +--- mozc/src/build_mozc.py ++++ mozc/src/build_mozc.py +@@ -728,6 +728,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]) ++ gyp_options.extend(['--no-parallel']) # Parallel generation requires writable /dev/shm + + # Enable cross-compile + # TODO(yukawa): Enable GYP_CROSSCOMPILE for Windows. diff --git a/srcpkgs/mozc/patches/protobuf-370.patch b/srcpkgs/mozc/patches/protobuf-370.patch new file mode 100644 index 0000000000..59d4e0bb99 --- /dev/null +++ b/srcpkgs/mozc/patches/protobuf-370.patch @@ -0,0 +1,327 @@ +--- 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 &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* mutable_dictionaries() { return storage_.mutable_dictionaries(); } ++ const ::google::protobuf::RepeatedPtrField& 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(); + diff --git a/srcpkgs/mozc/template b/srcpkgs/mozc/template index 1fa9c871b4..b8dd904f32 100644 --- a/srcpkgs/mozc/template +++ b/srcpkgs/mozc/template @@ -1,24 +1,119 @@ # Template file for 'mozc' pkgname=mozc version=2.23.2815.102 -revision=3 -archs=noarch -build_style=meta -short_desc="Japanese IME (Open Source version of Google Japanese Input) (removed package)" -license="metapackage" +revision=4 +create_wrksrc=yes +build_wrksrc=mozc/src +hostmakedepends="ninja pkg-config protobuf protobuf-devel python" +makedepends="gtk+-devel ibus-devel libzinnia-devel protobuf-devel qt5-devel + fcitx-devel" +depends="tegaki-zinnia-japanese>=0.3" +short_desc="Japanese IME (Open Source version of Google Japanese Input)" +maintainer="Matthias von Faber " +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/hiroyuki-komatsu/japanese-usage-dictionary/archive/e5b3425575734c323e1d947009dd74709437b684.tar.gz +" +checksum=" + e38457e63a7fa8d62d87b4f8b3e89fe5f6939d92e3c4fd287a93358375693892 + 882f074cbb3a4f2bba550fb615e63949c0fbf39eeb1718a0330b4a545ab97616 + 0b6efee0eebac2c1a8eeea333278aa40fcef7846bba9a379962c6e567e7e3dc1 +" -emacs-mozc_package() { - build_style=meta - archs=noarch +CXXFLAGS="-D_GNU_SOURCE" + +if [ "$CROSS_BUILD" ]; then + hostmakedepends+=" qt5-devel" +fi + +post_extract() { + ln -s mozc-* mozc + rm -rf mozc/src/unix/fcitx5 + + # symlink "submodules" into place + for _src_dest in gyp 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 + fi } -fcitx-mozc_package() { - build_style=meta - archs=noarch +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 +} + +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 + + sed -i 's|/usr/libexec/|/usr/lib/ibus-mozc/|g' out_linux/Release/gen/unix/ibus/mozc.xml +} + +do_install() { + vinstall out_linux/Release/mozc_server 755 usr/lib/mozc/mozc_server + vinstall out_linux/Release/mozc_tool 755 usr/lib/mozc_tool + + head -n 29 server/mozc_server.cc > LICENSE + for i in LICENSE data/installer/*.html; do + vlicense "$i" + done } ibus-mozc_package() { - build_style=meta - archs=noarch + short_desc="Mozc engine for IBus - Client of the Mozc input method" + depends="${sourcepkg}-${version}_${revision} ibus>=1.5.14" + pkg_install() { + vinstall out_linux/Release/ibus_mozc 755 usr/lib/ivus/mozc/ibus-engine-mozc + vinstall out_linux/Release/gen/unix/ibus/mozc.xml 644 usr/share/ibus/component/mozc.xml + vinstall data/images/unix/ime_product_icon_opensource-32.png 644 usr/share/ibus-mozc/product_icon.png + for i in data/images/unix/ui-*.png; do + vinstall "${i}" 644 usr/share/ibus/mozc/"${i##/ui-}" + done + vinstall out_linux/Release/mozc_renderer 755 usr/lib/mozc/mozc_renderer + } +} + +emacs-mozc_package() { + pkgdesc="Mozc for Emacs" + depends="${sourcepkg}-${version}_${revision} emacs" + pkg_install() { + vbin out_linux/Release/mozc_emacs_helper + vinstall unix/emacs/mozc.el 644 usr/share/emacs/site-list/emacs-mozc/mozc.el + } +} + +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" + pkg_install() { + vinstall out_linux/Release/fcitx-mozc.so 644 usr/lib/fcitx/fcitx-mozc.so + vinstall unix/fcitx/fcitx-mozc.conf 644 usr/share/fcitx/addon/fcitx-mozc.conf + vinstall unix/fcitx/mozc.conf 644 usr/share/fcitx/inputmethod/mozc.conf + } }