diff --git a/app-i18n/mozc/mozc-2.20.2677.102.recipe b/app-i18n/mozc/mozc-2.20.2677.102.recipe new file mode 100644 index 000000000..5ecf6c235 --- /dev/null +++ b/app-i18n/mozc/mozc-2.20.2677.102.recipe @@ -0,0 +1,94 @@ +SUMMARY="Japanese input method editor" +DESCRIPTION="A Japanese Input Method Editor (IME) designed for multi-platform. \ +This is open source version." +HOMEPAGE="https://github.com/google/mozc/" +COPYRIGHT="2010-2016, Google Inc." +LICENSE="BSD (3-clause)" +REVISION="1" +fileVersion="v2.20.2677.102.3" +SOURCE_URI="https://github.com/hanya/mozc/releases/download/$fileVersion/mozc-$fileVersion.tar.bz2" +CHECKSUM_SHA256="5b7c8c1e114b99221a2d9cf650fadd1cad9137986c94762f490a62af1048a8b1" +SOURCE_DIR="mozc" +if [ $effectiveTargetArchitecture == "x86" ]; then + PATCHES="mozc-$portVersion-x86.patch" +fi +SOURCE_URI_2="https://jaist.dl.sourceforge.net/project/zinnia/zinnia-tomoe/0.6.0-20080911/zinnia-tomoe-0.6.0-20080911.tar.bz2" +CHECKSUM_SHA256_2="fd1a264b8aeea0ebec59e8c8765864a9543a75fb2dba349745bb3a3587790927" + +ARCHITECTURES="!x86_gcc2 x86 x86_64" + +PROVIDES=" + mozc + addon:mozc + " +REQUIRES=" + haiku + lib:libQt5Core + lib:libQt5Gui + lib:libQt5Widgets + " +BUILD_REQUIRES=" + haiku_devel + devel:libprotobuf + devel:libQt5Core + devel:libQt5Gui + devel:libQt5Widgets + devel:libGL + " +BUILD_PREREQUIRES=" + cmd:python2 + cmd:g++ + cmd:gcc + cmd:gyp + cmd:pkg_config + cmd:which + cmd:xres + cmd:protoc + cmd:ninja + " + +USER_SETTINGS_FILES=" + settings/mozc directory + " + +BUILD() +{ + cd src + + GYP_DEFINES="document_dir=$dataDir/mozc \ + zinnia_model_file=$dataDir/mozc/zinnia/handwriting-ja.model \ + zinnia_tomoe_dir=../../../../../sources-2/zinnia-tomoe-0.6.0-20080911" \ + $portPackageLinksDir/cmd~python2/bin/python2 build_mozc.py gyp \ + --target_platform=Linux --variant=Haiku \ + --server_dir=$dataDir/mozc + + $portPackageLinksDir/cmd~python2/bin/python2 build_mozc.py build \ + -c Release \ + server/server.gyp:mozc_server \ + emacs/emacs.gyp:mozc_emacs_helper \ + input_method/input_method.gyp:mozc \ + gui/gui.gyp:mozc_tool \ + zinnia_model/zinnia_model.gyp:zinnia_model +} + +INSTALL() +{ + MozcOutDir=src/out_linux/Release + MozcDataDir=$dataDir/mozc + mkdir -p $MozcDataDir + mkdir -p $MozcDataDir/zinnia + mkdir -p $dataDir/locale/catalogs/x-vnd.Mozc-InputMethod + mkdir -p $addOnsDir/input_server/methods + + cp $MozcOutDir/mozc $addOnsDir/input_server/methods/mozc + + cp $MozcOutDir/mozc_server $MozcDataDir/mozc_server + cp $MozcOutDir/mozc_tool $MozcDataDir/mozc_tool + cp $MozcOutDir/handwriting-ja.model \ + $MozcDataDir/zinnia/handwriting-ja.model + cp $MozcOutDir/mozc_emacs_helper $MozcDataDir/mozc_emacs_helper + cp src/data/installer/credits_en.html $MozcDataDir/credits_en.html + + cp $MozcOutDir/x-vnd.Mozc-InputMethod/* \ + $dataDir/locale/catalogs/x-vnd.Mozc-InputMethod +} diff --git a/app-i18n/mozc/patches/mozc-2.20.2677.102-x86.patch b/app-i18n/mozc/patches/mozc-2.20.2677.102-x86.patch new file mode 100644 index 000000000..ed1f2d510 --- /dev/null +++ b/app-i18n/mozc/patches/mozc-2.20.2677.102-x86.patch @@ -0,0 +1,233 @@ +diff --git a/src/base/port.h b/src/base/port.h +index 4e70bf2..072affb 100644 +--- a/src/base/port.h ++++ b/src/base/port.h +@@ -67,7 +67,7 @@ + + #include + #include +- ++#ifndef OS_HAIKU + // basic macros + typedef signed char int8; + typedef short int16; +@@ -75,6 +75,9 @@ typedef int int32; + typedef unsigned char uint8; + typedef unsigned short uint16; + typedef unsigned int uint32; ++#else ++#include ++#endif // OS_HAIKU + typedef unsigned int char32; + #ifdef OS_WIN + typedef unsigned __int64 uint64; +diff --git a/src/base/logging.cc b/src/base/logging.cc +index 41ff086..f38d6f3 100644 +--- a/src/base/logging.cc ++++ b/src/base/logging.cc +@@ -205,7 +205,7 @@ class LogStreamImpl { + void Reset(); + + int verbose_level() const { +- return max(FLAGS_v, config_verbose_level_); ++ return max(FLAGS_v, (int32)config_verbose_level_); + } + + void set_verbose_level(int level) { +diff --git a/src/config/config_handler.cc b/src/config/config_handler.cc +index 0b02a95..a5fd6bc 100644 +--- a/src/config/config_handler.cc ++++ b/src/config/config_handler.cc +@@ -80,7 +80,7 @@ class ConfigHandlerImpl { + ConfigHandlerImpl() { + // /config1.db + filename_ = kFileNamePrefix; +- filename_ += NumberUtil::SimpleItoa(CONFIG_VERSION); ++ filename_ += NumberUtil::SimpleItoa((int32)CONFIG_VERSION); + filename_ += ".db"; + Reload(); + ConfigHandler::GetDefaultConfig(&default_config_); +diff --git a/src/converter/candidate_filter.cc b/src/converter/candidate_filter.cc +index 282162b..e093d70 100644 +--- a/src/converter/candidate_filter.cc ++++ b/src/converter/candidate_filter.cc +@@ -418,8 +418,8 @@ CandidateFilter::ResultType CandidateFilter::FilterCandidateInternal( + } + } + +- const int top_cost = max(kMinCost, top_candidate_->cost); +- const int top_structure_cost = max(kMinCost, top_candidate_->structure_cost); ++ const int top_cost = max(kMinCost, (int)top_candidate_->cost); ++ const int top_structure_cost = max(kMinCost, (int)top_candidate_->structure_cost); + + // If candidate size < 3, don't filter candidate aggressively + // TOOD(taku): This is a tentative workaround for the case where +diff --git a/src/converter/immutable_converter.cc b/src/converter/immutable_converter.cc +index a6ad5d4..42993d6 100644 +--- a/src/converter/immutable_converter.cc ++++ b/src/converter/immutable_converter.cc +@@ -480,7 +480,7 @@ bool ImmutableConverterImpl::ResegmentArabicNumberAndSuffix( + + // do -1 so that resegmented nodes are boosted + // over compound node. +- const int32 wcost = max(compound_node->wcost / 2 - 1, 0); ++ const int32 wcost = max(compound_node->wcost / 2 - 1, (long int)0); + + Node *number_node = lattice->NewNode(); + CHECK(number_node); +@@ -557,7 +557,7 @@ bool ImmutableConverterImpl::ResegmentPrefixAndArabicNumber( + + // do -1 so that resegmented nodes are boosted + // over compound node. +- const int32 wcost = max(compound_node->wcost / 2 - 1, 0); ++ const int32 wcost = max(compound_node->wcost / 2 - 1, (long int)0); + + Node *prefix_node = lattice->NewNode(); + CHECK(prefix_node); +@@ -1690,11 +1690,11 @@ void ImmutableConverterImpl::InsertFirstSegmentToCandidates( + // cost penalty based on the cost diff. + const Segment &first_segment = segments->conversion_segment(0); + const int base_cost_diff = +- max(0, ++ max((long int)0, + (first_segment.candidate(0).cost - + first_segment.candidate(only_first_segment_candidate_pos).cost)); + const int base_wcost_diff = +- max(0, ++ max((long int)0, + (first_segment.candidate(0).wcost - + first_segment.candidate(only_first_segment_candidate_pos).wcost)); + for (size_t i = only_first_segment_candidate_pos; +diff --git a/src/rewriter/date_rewriter.cc b/src/rewriter/date_rewriter.cc +index 2bbea10..9aa088e 100644 +--- a/src/rewriter/date_rewriter.cc ++++ b/src/rewriter/date_rewriter.cc +@@ -1634,9 +1634,9 @@ bool ExpandYear(const string &prefix, int year, std::vector *result) { + return true; + } + +- result->push_back(prefix + NumberUtil::SimpleItoa(year)); ++ result->push_back(prefix + NumberUtil::SimpleItoa((int32)year)); + +- string arabic = NumberUtil::SimpleItoa(year); ++ string arabic = NumberUtil::SimpleItoa((int32)year); + + std::vector output; + +@@ -1778,7 +1778,7 @@ bool EraToAdForCourt(const YearData *data, size_t size, const string &key, + // Get wide arabic numbers + // e.g.) 1989 -> "1989", "一九八九" + std::vector output; +- const string ad_year_str(NumberUtil::SimpleItoa(ad_year)); ++ const string ad_year_str(NumberUtil::SimpleItoa((int32)ad_year)); + NumberUtil::ArabicToWideArabic(ad_year_str, &output); + // add half-width arabic number to `output` (e.g. "1989") + output.push_back(NumberUtil::NumberString( +diff --git a/src/rewriter/user_segment_history_rewriter.cc b/src/rewriter/user_segment_history_rewriter.cc +index 4c5afe8..8fcf6e7 100644 +--- a/src/rewriter/user_segment_history_rewriter.cc ++++ b/src/rewriter/user_segment_history_rewriter.cc +@@ -333,7 +333,7 @@ inline bool GetFeatureS(const Segments &segments, size_t i, + // used for number rewrite + inline bool GetFeatureN(uint16 type, string *value) { + DCHECK(value); +- JoinStringsWithTab2(StringPiece("N", 1), NumberUtil::SimpleItoa(type), value); ++ JoinStringsWithTab2(StringPiece("N", 1), NumberUtil::SimpleItoa((uint32)type), value); + return true; + } + +diff --git a/src/session/session_handler.cc b/src/session/session_handler.cc +index 765f5ae..51eafa1 100644 +--- a/src/session/session_handler.cc ++++ b/src/session/session_handler.cc +@@ -196,7 +196,7 @@ void SessionHandler::Init( + config::ConfigHandler::GetConfig(config_.get()); + + // allow [2..128] sessions +- max_session_size_ = max(2, min(FLAGS_max_session_size, 128)); ++ max_session_size_ = max((int32)2, min(FLAGS_max_session_size, (int32)128)); + session_map_.reset(new SessionMap(max_session_size_)); + + if (!engine_) { +@@ -626,7 +626,7 @@ bool SessionHandler::CreateSession(commands::Command *command) { + // prevent DOS attack + // don't allow CreateSession in very short period. + const int create_session_minimum_interval = +- max(0, min(FLAGS_create_session_min_interval, 10)); ++ max((int32)0, min(FLAGS_create_session_min_interval, (int32)10)); + + uint64 current_time = Clock::GetTime(); + if (last_create_session_time_ != 0 && +@@ -754,12 +754,12 @@ bool SessionHandler::Cleanup(commands::Command *command) { + // allow [1..600] sec. default: 300 + const uint64 create_session_timeout = + suspend_time + +- max(1, min(FLAGS_last_create_session_timeout, 600)); ++ max((int32)1, min(FLAGS_last_create_session_timeout, (int32)600)); + + // allow [10..7200] sec. default 3600 + const uint64 last_command_timeout = + suspend_time + +- max(10, min(FLAGS_last_command_timeout, 7200)); ++ max((int32)10, min(FLAGS_last_command_timeout, (long int)7200)); + + std::vector remove_ids; + for (SessionElement *element = +diff --git a/src/session/session_watch_dog.cc b/src/session/session_watch_dog.cc +index 4454e62..4f1611b 100644 +--- a/src/session/session_watch_dog.cc ++++ b/src/session/session_watch_dog.cc +@@ -67,7 +67,7 @@ SessionWatchDog::SessionWatchDog(int32 interval_sec) + : interval_sec_(interval_sec), + client_(NULL), cpu_stats_(NULL), event_(new UnnamedEvent) { + // allow [1..600]. +- interval_sec_ = max(1, min(interval_sec_, 600)); ++ interval_sec_ = max((int32)1, min(interval_sec_, (int32)600)); + DCHECK(event_->IsAvailable()) + << "Unnamed event is not available"; + } +@@ -128,13 +128,13 @@ void SessionWatchDog::Run() { + DCHECK_GE(number_of_processors, 1); + + // the first (interval_sec_ - 60) sec: -> Do nothing +- const int32 idle_interval_msec = max(0, (interval_sec_ - 60)) * 1000; ++ const int32 idle_interval_msec = max((int32)0, (interval_sec_ - (int32)60)) * 1000; + + // last 60 sec: -> check CPU usage +- const int32 cpu_check_interval_msec = min(60, interval_sec_) * 1000; ++ const int32 cpu_check_interval_msec = min((int32)60, interval_sec_) * 1000; + + // for every 5 second, get CPU load percentage +- const int32 cpu_check_duration_msec = min(5, interval_sec_) * 1000; ++ const int32 cpu_check_duration_msec = min((int32)5, interval_sec_) * 1000; + + std::fill(cpu_loads, cpu_loads + arraysize(cpu_loads), 0.0); + +diff --git a/src/usage_stats/upload_util.cc b/src/usage_stats/upload_util.cc +index 44d5728..aa4fb09 100644 +--- a/src/usage_stats/upload_util.cc ++++ b/src/usage_stats/upload_util.cc +@@ -102,7 +102,7 @@ void UploadUtil::AddIntegerValue(const string &name, int int_value) { + stat_values_.append("&"); + stat_values_.append(encoded_name); + stat_values_.append(":i="); +- stat_values_.append(NumberUtil::SimpleItoa(int_value)); ++ stat_values_.append(NumberUtil::SimpleItoa((int32)int_value)); + } + + void UploadUtil::AddBooleanValue(const string &name, bool boolean_value) { +diff --git a/src/usage_stats/usage_stats.cc b/src/usage_stats/usage_stats.cc +index 6c362f5..8fcc73a 100644 +--- a/src/usage_stats/usage_stats.cc ++++ b/src/usage_stats/usage_stats.cc +@@ -174,8 +174,8 @@ void UsageStats::UpdateTiming(const string &name, uint32 val) { + stats.set_num_timings(stats.num_timings() + 1); + stats.set_total_time(stats.total_time() + val); + stats.set_avg_time(stats.total_time() / stats.num_timings()); +- stats.set_min_time(min(stats.min_time(), val)); +- stats.set_max_time(max(stats.max_time(), val)); ++ stats.set_min_time(min(stats.min_time(), (google::protobuf::uint32)val)); ++ stats.set_max_time(max(stats.max_time(), (google::protobuf::uint32)val)); + } else { + stats.set_name(name); + stats.set_type(Stats::TIMING);  \ No newline at end of file