mozc: Update to 2.26.4282.100

* Use internal protobuf to fix build (more works required).

Changelog:
Not available.
This commit is contained in:
ryoon 2021-02-15 14:50:22 +00:00
parent 724299cada
commit 7f637623dc
49 changed files with 448 additions and 1629 deletions

View file

@ -1,7 +1,6 @@
# $NetBSD: Makefile,v 1.63 2020/11/05 09:08:31 ryoon Exp $
# $NetBSD: Makefile,v 1.64 2021/02/15 14:50:22 ryoon Exp $
PKGNAME= ibus-${DISTNAME}
PKGREVISION= 27
INSTALLATION_DIRS+= libexec share/ibus share/ibus/component \
share/ibus-mozc

View file

@ -1,7 +1,6 @@
# $NetBSD: Makefile,v 1.52 2020/11/05 09:08:31 ryoon Exp $
# $NetBSD: Makefile,v 1.53 2021/02/15 14:50:23 ryoon Exp $
PKGNAME= ${EMACS_PKGNAME_PREFIX}${DISTNAME:S/mozc-/mozc-elisp-/}
PKGREVISION= 26
CATEGORIES= inputmethod editors
EMACS_MODULES= base leim

View file

@ -1,7 +1,6 @@
# $NetBSD: Makefile,v 1.44 2020/11/05 09:08:31 ryoon Exp $
# $NetBSD: Makefile,v 1.45 2021/02/15 14:50:23 ryoon Exp $
PKGNAME= ${DISTNAME:S/mozc-/mozc-renderer-/}
PKGREVISION= 27
CONFLICTS+= ibus-mozc<=1.13.1651.102

View file

@ -1,7 +1,6 @@
# $NetBSD: Makefile,v 1.61 2020/11/05 09:08:31 ryoon Exp $
# $NetBSD: Makefile,v 1.62 2021/02/15 14:50:23 ryoon Exp $
PKGNAME= ${DISTNAME:S/mozc-/mozc-server-/}
PKGREVISION= 27
INSTALLATION_DIRS+= libexec

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile.common,v 1.28 2020/05/25 05:30:31 rillig Exp $
# $NetBSD: Makefile.common,v 1.29 2021/02/15 14:50:23 ryoon Exp $
# used by inputmethod/ibus-mozc/Makefile
# used by inputmethod/mozc-elisp/Makefile
# used by inputmethod/mozc-server/Makefile
@ -7,7 +7,7 @@
# used by inputmethod/uim-mozc/Makefile
#
DISTNAME= mozc-2.20.2673.102
DISTNAME= mozc-2.26.4282.100
CATEGORIES= inputmethod
MASTER_SITES= ${MASTER_SITE_LOCAL}
EXTRACT_SUFX= .tar.xz
@ -28,9 +28,8 @@ WRKSRC= ${WRKDIR}/${DISTNAME}/src
DISTINFO_FILE= ${.CURDIR}/../../inputmethod/mozc-server/distinfo
PATCHDIR= ${.CURDIR}/../../inputmethod/mozc-server/patches
PYTHON_VERSIONS_ACCEPTED= 27 # gyp
BUILD_DEPENDS+= ${PYPKGPREFIX}-gyp-[0-9]*:../../devel/gyp
BUILD_DEPENDS+= ${PYPKGPREFIX}-six-[0-9]*:../../lang/py-six
BUILD_DEPENDS+= ninja-build-[0-9]*:../../devel/ninja-build
USE_LANGUAGES= c c++
@ -46,9 +45,9 @@ OPENSSL_LIBS= -lssl -lcrypto
SUBST_CLASSES+= gyp
SUBST_STAGE.gyp= pre-configure
SUBST_MESSAGE.gyp= Fix gyp defaults
SUBST_FILES.gyp+= config.bzl
SUBST_FILES.gyp+= base/process.cc
SUBST_FILES.gyp+= gyp/directories.gypi
SUBST_FILES.gyp+= handwriting/zinnia_handwriting.cc
SUBST_FILES.gyp+= unix/ibus/ibus.gyp
SUBST_FILES.gyp+= unix/ibus/path_util.cc
SUBST_VARS.gyp+= OPENSSL_CFLAGS OPENSSL_INC OPENSSL_LDFLAGS OPENSSL_LIBS
@ -64,6 +63,7 @@ OSDEST.Linux= linux
OSDEST.NetBSD= bsd
MOZC_BUILD_MODE= Release # or Debug
MOZC_BUILD_MODE= Debug
# In file included from src/dictionary/system/system_dictionary.h:43:0,
# from ../../dictionary/system/system_dictionary.cc:47:
@ -75,13 +75,12 @@ BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts
do-configure:
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
GYP_DEFINES="use_libprotobuf=1" \
${PYTHONBIN} build_mozc.py \
gyp \
--gypdir=${LOCALBASE}/bin
.include "../../devel/glib2/buildlink3.mk"
.include "../../devel/protobuf/buildlink3.mk"
#.include "../../devel/protobuf/buildlink3.mk"
# gmock is not used yet...
#.include "../../devel/gmock/buildlink3.mk"
.include "../../inputmethod/zinnia/buildlink3.mk"

View file

@ -1,60 +1,48 @@
$NetBSD: distinfo,v 1.22 2020/06/19 05:45:30 taca Exp $
$NetBSD: distinfo,v 1.23 2021/02/15 14:50:23 ryoon Exp $
SHA1 (mozc-2.20.2673.102.tar.xz) = 9cedf4d392593e04755fa44afd79cd40bb80b9d1
RMD160 (mozc-2.20.2673.102.tar.xz) = 723fef550d88c5a4dc33f2ec9c8d7ee694e60d64
SHA512 (mozc-2.20.2673.102.tar.xz) = 06ce43b0fa6d5a696cddafc97cd84bfa4482204ffb3793a6d3811dd50c4ed859289394ee471987b20fd637768bdfcc2f0289993b88e24c141c93514229dfc402
Size (mozc-2.20.2673.102.tar.xz) = 44187096 bytes
SHA1 (mozc-2.26.4282.100.tar.xz) = aacec607aec52145ba66c993f9c02ae2d1a5948c
RMD160 (mozc-2.26.4282.100.tar.xz) = b2f9f6fc129811b25640d4ae5582ab324b6bf2a4
SHA512 (mozc-2.26.4282.100.tar.xz) = 236ec8ece076aea04480cb9aee30076699a30db88356c8bd9eb0694d86716a89748a6d33d66f5ba831e95bd0d16260e3111a9c75fded9e34df35e1785980cf12
Size (mozc-2.26.4282.100.tar.xz) = 38346468 bytes
SHA1 (uim-mozc-321.3ea28b1.tar.xz) = 22b7c2a5b0a7fef778ee72ebe5873a75e879d26b
RMD160 (uim-mozc-321.3ea28b1.tar.xz) = 30d160d02a39065e4bc34968fbe6232018b0b202
SHA512 (uim-mozc-321.3ea28b1.tar.xz) = b28f4d207a52c208694371dbc550ac5022a29c5870b8d856bca8052106d8be88ab8d066bdc6d895ac6fa9f350ce6be16d638603e46058f9528691f97cb86d054
Size (uim-mozc-321.3ea28b1.tar.xz) = 24400 bytes
SHA1 (patch-base_base.gyp) = d8d9abc0da196f0573ad645937812710c7c67746
SHA1 (patch-base_clock.cc) = 0fa3f4b3bcd34283870a317032172745dcf90eaa
SHA1 (patch-base_cpu__stats.cc) = c55ee389eced767e875553937a80c8ba6c6abd2d
SHA1 (patch-base_logging.cc) = 5dddcbbf4445e91e6f8ab41999c938e0491c05c4
SHA1 (patch-base_mutex.cc) = 9563ff1563eef8dc73417454b2ba06322a2cd76d
SHA1 (patch-base_mutex.h) = cf12a1574d28dd612820578560a76b3b8ab6e27d
SHA1 (patch-base_password__manager.cc) = 8216bc58d398fae4935e99fe5d11febbee380644
SHA1 (patch-base_port.h) = 775b8a5afe2336218fc936d009bae9f6b13a4379
SHA1 (patch-base_process.cc) = 1cba930ffdf14694fa55e473c2e94ee2cf523de4
SHA1 (patch-base_run__level.cc) = 849a6a6727463305c2fdca4eed0fb4a4cac10567
SHA1 (patch-base_system__util.cc) = c4d81bb3d4633a11d969520af610c3e10417ab4e
SHA1 (patch-base_thread.cc) = 2cc63c1d369f842a29e07311364c2a3537f3b428
SHA1 (patch-build__mozc.py) = 5fd1e328c9a35cc01a507566afeda1179657e685
SHA1 (patch-build__tools_mozc__version.py) = 7130eac051d0d4f78da887aedd669fc4713dbd62
SHA1 (patch-base_clock.cc) = bac420650fed0450cf82b5071703a1c60e974a93
SHA1 (patch-base_cpu__stats.cc) = 9c18fb2543f352951969822e0095f01f0e8d3bcd
SHA1 (patch-base_logging.cc) = 65938bf4f4d414a0c3bcaffe9615d976dcab2254
SHA1 (patch-base_mutex.cc) = c52761be5ef60af35685a4de18ef18a083b1d0b9
SHA1 (patch-base_password__manager.cc) = 6b669b7c2cf15b1a85e648265dfca0f34e86d00d
SHA1 (patch-base_port.h) = 73b76a61759e32dcb7edcbb70b5cff6ad091a15c
SHA1 (patch-base_process.cc) = 9b838e6178d7dd64012c94b9c55a201d096e4680
SHA1 (patch-base_run__level.cc) = b26b0c8a457b9feb9a4de0abd7d5aae5bcd9e491
SHA1 (patch-base_system__util.cc) = bdd468c5a22fe8ecc3de57168162944afd0bb20d
SHA1 (patch-base_thread.cc) = 5e62c41beedc57dec004d100753bae4c77289762
SHA1 (patch-build__mozc.py) = c0ef43010c0f048550ed4a5e9bb7b29c8a24ac77
SHA1 (patch-build__tools_mozc__version.py) = 133f6b17d9dc811284901513e4e4ae3711710082
SHA1 (patch-build__tools_util.py) = 5ca614adf2453fcc33c18cda74c0d9b2e4f6bc21
SHA1 (patch-client_client.cc) = f1eb1860c41a97c82a338f74acdcf0ed3477b6da
SHA1 (patch-config_stats__config__util__test.cc) = 3514f04a921908795c03d0e8685135297dc9e2af
SHA1 (patch-dictionary_user__dictionary.cc) = 34147edfd4d0c09637ab285584b4fad4e7ee95ff
SHA1 (patch-dictionary_user__dictionary__session.cc) = 13270d72fcdd11a3d7fd6992613a8b562f7e51d0
SHA1 (patch-dictionary_user__dictionary__session__test.cc) = 2c3fb20f3bd8c4f7e870e978f51a6e707d4a366d
SHA1 (patch-dictionary_user__dictionary__storage.cc) = d2ac32d6606b835d93422e925bb1b82e62b46ab8
SHA1 (patch-dictionary_user__dictionary__storage.h) = df3da7bf5a31f030d0202051befb70cf7afac519
SHA1 (patch-dictionary_user__dictionary__storage__test.cc) = 1f11ecc89326af675f252ead82bcd4afb65cec2e
SHA1 (patch-dictionary_user__dictionary__test.cc) = 5ca305cae59163f1e1779e77e608f3087aae0190
SHA1 (patch-gui_config__dialog_config__dialog.cc) = de2750a6bf99c4e38983cf5322adae8c46ca45d6
SHA1 (patch-gui_config__dialog_keybinding__editor.cc) = 529e902c146907d3a91181bad3822bbbec69b6b7
SHA1 (patch-client_client.cc) = c11341d48ce55af0aea440800da4a53a62a436c1
SHA1 (patch-config.bzl) = 5f959d46741f2f3fbf0fbbe38aa8fa1baafadb27
SHA1 (patch-config_stats__config__util__test.cc) = f1af7403f8e06faadc5c46267d2d8b26a60c8f8d
SHA1 (patch-gui_config__dialog_config__dialog.cc) = f3349d6ed2bee63f7bb92bc71f9d8a8ab1316b74
SHA1 (patch-gui_config__dialog_keybinding__editor.cc) = 09c03f57031306b5cca8f1e546719db936159e2d
SHA1 (patch-gui_dictionary__tool_dictionary__tool.cc) = cae617cc8e324b0f93adc1e76632a018530cd2c7
SHA1 (patch-gui_qt__libraries.gypi) = ceb8d5b15d4cd5b2d907406f02413290bd4ab652
SHA1 (patch-gui_qt__moc.gypi) = e3d42e61b35012cda10da13aa03cee67786e171c
SHA1 (patch-gui_qt__rcc.gypi) = d38a849fe8e81672eb441a41936f454d8e45ff5c
SHA1 (patch-gui_qt__uic.gypi) = 7dd69ee109e81f0e70f2866b77555412518b4844
SHA1 (patch-gui_word__register__dialog_word__register__dialog.cc) = 213b087d4cd5f22ee2b202963a7b7b3325baafb0
SHA1 (patch-gyp_common.gypi) = 13cd5010a6f3ed314a94248144657955f8bbbe72
SHA1 (patch-gyp_directories.gypi) = 6504d8b43f83be3908b39a5e51598c2aba0dffd9
SHA1 (patch-handwriting_zinnia.gyp) = b59e546cb9b8b91dcd627885e1853e8ba8dead46
SHA1 (patch-handwriting_zinnia__handwriting.cc) = dd87817aabcd290c9fb25f3ebe4f36ce670ae44b
SHA1 (patch-ipc_ipc__path__manager.cc) = 533d37b3802385873450ebeef561425aef7d9c63
SHA1 (patch-gui_word__register__dialog_word__register__dialog.cc) = 218e3706b819855814ba8871504fc7ccb4e40b23
SHA1 (patch-gyp_common.gypi) = 18e03490d6758ce49f4b79eb1259409cd440faba
SHA1 (patch-gyp_directories.gypi) = eea985113aac5b99bf3c12267ad754817eef5dcc
SHA1 (patch-ipc_ipc__path__manager.cc) = cd1352bd5333f1ed755dcf6221f931fcd0a936d3
SHA1 (patch-ipc_ipc__path__manager__test.cc) = 1b83b513383f184f5ab5a56cce734b7934998533
SHA1 (patch-ipc_named__event.cc) = 92283261e7580569587e43156f13567b593c9a32
SHA1 (patch-ipc_unix__ipc.cc) = 25107c2e84844ecaa3445efb48cc3f2795579dec
SHA1 (patch-net_net.gyp) = 61353724533f9239f4c58fa37f0a8fb2eb5552c3
SHA1 (patch-prediction_user__history__predictor.cc) = 66cf79206663d35f64a0cbee63be04c8faa99903
SHA1 (patch-prediction_user__history__predictor.h) = 50ee05871b01864b71e4682f712c3eb662b0be94
SHA1 (patch-prediction_user__history__predictor__test.cc) = 7fbcbfcb6bcaa236bc94fd8a9c1cd97051ffa222
SHA1 (patch-rewriter_usage__rewriter__test.cc) = 0ceba47a833574d4eeac3e38ed2fca5ba5ba0c0c
SHA1 (patch-session_session.cc) = 773017ac54e79239f6734a124f457b0b81bb1ced
SHA1 (patch-session_session__test.cc) = 99165b29555844a40d30cf5554cc5c66773b70ed
SHA1 (patch-ipc_named__event.cc) = 8be0b1e5c4675e5b238e07b63e395dbed3c2d125
SHA1 (patch-ipc_unix__ipc.cc) = d5d86910ca610015103a309bba8d6392d96f6ce6
SHA1 (patch-renderer_renderer.gyp) = 83493259d6b8cd9ab6871512bebc9616d72132d1
SHA1 (patch-session_session.cc) = 3ae2c8dd056aae4c92d9dbfdac53d9c45261aad2
SHA1 (patch-session_session__test.cc) = 7396e2f4931257d8a33087b1bed5418a038fefa1
SHA1 (patch-third__party_abseil-cpp_absl_base_config.h) = e996fad886e0763c7be7b79735819e668159fd82
SHA1 (patch-third__party_protobuf_post__process__dist.sh) = 8adc79d5d7eed3cbf406ebcfbd5832b7a050ced6
SHA1 (patch-unix_ibus_ibus.gyp) = aa2077cf3c379bf9ce33e97abe478540346782ad
SHA1 (patch-unix_ibus_path__util.cc) = a6aa368d9ce8926e200602fdc370c13e35d5a8cf

View file

@ -1,24 +1,24 @@
$NetBSD: patch-base_clock.cc,v 1.2 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-base_clock.cc,v 1.3 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- base/clock.cc.orig 2016-05-15 08:11:10.000000000 +0000
--- base/clock.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ base/clock.cc
@@ -124,7 +124,7 @@ class ClockImpl : public ClockInterface
@@ -116,7 +116,7 @@ class ClockImpl : public ClockInterface
mach_timebase_info(&timebase_info);
return static_cast<uint64>(
1.0e9 * timebase_info.denom / timebase_info.numer);
-#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
return static_cast<uint64>(1.0e9 * timebase_info.denom /
timebase_info.numer);
-#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM)
+#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM) || defined(OS_NETBSD)
return 1000000uLL;
#else // platforms (OS_WIN, OS_MACOSX, OS_LINUX, ...)
#else // platforms (OS_WIN, __APPLE__, OS_LINUX, ...)
#error "Not supported platform"
@@ -141,7 +141,7 @@ class ClockImpl : public ClockInterface
@@ -133,7 +133,7 @@ class ClockImpl : public ClockInterface
return static_cast<uint64>(timestamp.QuadPart);
#elif defined(OS_MACOSX)
#elif defined(__APPLE__)
return static_cast<uint64>(mach_absolute_time());
-#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
-#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM)
+#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM) || defined(OS_NETBSD)
uint64 sec;
uint32 usec;
GetTimeOfDay(&sec, &usec);

View file

@ -1,48 +1,48 @@
$NetBSD: patch-base_cpu__stats.cc,v 1.3 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-base_cpu__stats.cc,v 1.4 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- base/cpu_stats.cc.orig 2016-05-15 08:11:10.000000000 +0000
--- base/cpu_stats.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ base/cpu_stats.cc
@@ -123,13 +123,13 @@ float CPUStats::GetSystemCPULoad() {
@@ -122,13 +122,13 @@ float CPUStats::GetSystemCPULoad() {
#endif // OS_MACOSX
#endif // __APPLE__
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM) || defined(OS_NETBSD)
// NOT IMPLEMENTED
// TODO(taku): implement Linux version
// can take the info from /proc/stats
const uint64 total_times = 0;
const uint64 cpu_times = 0;
-#endif // OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#endif // OS_LINUX || OS_ANDROID || OS_WASM
+#endif // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
return UpdateCPULoad(total_times,
cpu_times,
@@ -178,11 +178,11 @@ float CPUStats::GetCurrentProcessCPULoad
TimeValueTToInt64(task_times_info.system_time);
#endif // OS_MACOSX
return UpdateCPULoad(total_times, cpu_times, &prev_system_total_times_,
&prev_system_cpu_times_);
@@ -175,11 +175,11 @@ float CPUStats::GetCurrentProcessCPULoad
TimeValueTToInt64(task_times_info.system_time);
#endif // __APPLE__
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM) || defined(OS_NETBSD)
// not implemented
const uint64 total_times = 0;
const uint64 cpu_times = 0;
-#endif // OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#endif // OS_LINUX || OS_ANDROID || OS_WASM
+#endif // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
return UpdateCPULoad(total_times,
cpu_times,
@@ -210,9 +210,9 @@ size_t CPUStats::GetNumberOfProcessors()
return UpdateCPULoad(total_times, cpu_times,
&prev_current_process_total_times_,
@@ -206,9 +206,9 @@ size_t CPUStats::GetNumberOfProcessors()
return static_cast<size_t>(basic_info.avail_cpus);
#endif // OS_MACOSX
#endif // __APPLE__
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM) || defined(OS_NETBSD)
// Not implemented
return 1;
-#endif // OS_LINUX
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
+#endif // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
}
} // namespace mozc

View file

@ -1,36 +1,27 @@
$NetBSD: patch-base_logging.cc,v 1.5 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-base_logging.cc,v 1.6 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- base/logging.cc.orig 2016-05-15 08:11:10.000000000 +0000
--- base/logging.cc.orig 2021-02-15 05:04:33.000000000 +0000
+++ base/logging.cc
@@ -61,6 +61,10 @@
#include "base/mutex.h"
#include "base/singleton.h"
@@ -62,6 +62,10 @@
#include "absl/flags/flag.h"
#include "absl/strings/str_cat.h"
+#if defined(OS_NETBSD)
+#include <lwp.h>
+#endif
+
DEFINE_bool(colored_log, true, "Enables colored log messages on tty devices");
DEFINE_bool(logtostderr,
false,
@@ -102,7 +106,7 @@ string Logging::GetLogMessageHeader() {
"%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d %u "
#if defined(OS_NACL)
"%p",
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_NETBSD)
"%lu",
#elif defined(OS_MACOSX) && defined(__LP64__)
"%llu",
@@ -129,6 +133,9 @@ string Logging::GetLogMessageHeader() {
::getpid(),
// pthread_self() returns __nc_basic_thread_data*.
static_cast<void*>(pthread_self())
+#elif defined(OS_NETBSD)
+ ::getpid(),
+ (unsigned long)_lwp_self()
#else // = OS_LINUX
::getpid(),
// It returns unsigned long.
ABSL_FLAG(bool, colored_log, true,
"Enables colored log messages on tty devices");
ABSL_FLAG(bool, logtostderr, false,
@@ -112,6 +116,9 @@ string Logging::GetLogMessageHeader() {
return absl::StrCat(timestamp, ::getpid(), " ",
// It returns unsigned long.
pthread_self());
+# elif defined(OS_NETBSD)
+ return absl::StrCat(timestamp, ::getpid(), " ",
+ (unsigned long)_lwp_self());
# elif defined(__APPLE__)
# ifdef __LP64__
return absl::StrCat(timestamp, ::getpid(), " ",

View file

@ -1,42 +1,15 @@
$NetBSD: patch-base_mutex.cc,v 1.5 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-base_mutex.cc,v 1.6 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- base/mutex.cc.orig 2017-11-02 13:32:45.000000000 +0000
--- base/mutex.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ base/mutex.cc
@@ -53,7 +53,7 @@ namespace mozc {
// Wrapper for Windows InterlockedCompareExchange
namespace {
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
// Linux doesn't provide InterlockedCompareExchange-like function.
inline int InterlockedCompareExchange(volatile int *target,
int new_value,
@@ -72,7 +72,7 @@ inline int InterlockedCompareExchange(vo
pthread_mutex_unlock(&lock);
return result;
}
-#endif // OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
// Use OSAtomicCompareAndSwapInt on Mac OSX
// https://developer.apple.com/library/prerelease/mac/documentation/Darwin/Reference/ManPages/man3/OSAtomicCompareAndSwapInt.3.html
@@ -84,7 +84,7 @@ inline int InterlockedCompareExchange(vo
return OSAtomicCompareAndSwapInt(old_value, new_value, target)
? old_value : *target;
}
-#endif // OX_MACOSX
+#endif // OS_MACOSX
} // namespace
@@ -182,7 +182,7 @@ Mutex::Mutex() {
@@ -148,7 +148,7 @@ Mutex::Mutex() {
// PTHREAD_MUTEX_RECURSIVE_NP but Mac OS X 10.5 does not
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_NETBSD)
-#if defined(__APPLE__) || defined(OS_WASM)
+#if defined(__APPLE__) || defined(OS_WASM) || defined(OS_NETBSD)
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
#elif defined(OS_LINUX) || defined(OS_ANDROID)
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);

View file

@ -1,18 +0,0 @@
$NetBSD: patch-base_mutex.h,v 1.2 2016/05/16 11:51:49 ryoon Exp $
* First chunk, NetBSD ILP32 ports seem to require larger mutex array size.
* I am not sure.
--- base/mutex.h.orig 2016-05-15 08:11:10.000000000 +0000
+++ base/mutex.h
@@ -50,8 +50,8 @@ namespace mozc {
// To remove dependencies against plafrom specific headers such as
// <Windows.h> or <pthread.h>, we use an array of pointers as an opaque buffer
// where platform specific mutex structure will be placed.
-#if defined(OS_MACOSX)
-// Mac requires relatively large buffer for pthread mutex object.
+#if defined(OS_MACOSX) || defined(OS_NETBSD)
+// Mac and NetBSD requires relatively large buffer for pthread mutex object.
#define MOZC_MUTEX_PTR_ARRAYSIZE 11
#define MOZC_RW_MUTEX_PTR_ARRAYSIZE 32
#else

View file

@ -1,18 +1,15 @@
$NetBSD: patch-base_password__manager.cc,v 1.4 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-base_password__manager.cc,v 1.5 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- base/password_manager.cc.orig 2016-05-15 08:11:10.000000000 +0000
--- base/password_manager.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ base/password_manager.cc
@@ -264,9 +264,9 @@ bool WinMacPasswordManager::RemovePasswo
@@ -264,7 +264,7 @@ bool WinMacPasswordManager::RemovePasswo
// We use plain text file for password storage on Linux. If you port this module
// to other Linux distro, you might want to implement a new password manager
// which adopts some secure mechanism such like gnome-keyring.
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM) || defined(OS_NETBSD)
typedef PlainPasswordManager DefaultPasswordManager;
-#endif // OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
#endif // OS_LINUX || OS_ANDROID || OS_WASM
// Windows or Mac
#if (defined(OS_WIN) || defined(OS_MACOSX))

View file

@ -1,27 +1,15 @@
$NetBSD: patch-base_port.h,v 1.4 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-base_port.h,v 1.5 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
* kludge to build with gcc45
--- base/port.h.orig 2017-11-02 13:32:45.000000000 +0000
--- base/port.h.orig 2021-02-15 05:04:33.000000000 +0000
+++ base/port.h
@@ -56,6 +56,9 @@
#endif // !OS_ANDROID && !OS_NACL
#endif // OS_LINUX
@@ -69,6 +69,10 @@ using std::string;
#define MOZC_OS_DEFINED
#endif // OS_WASM
+#ifdef OS_NETBSD
+#define MOZC_OS_DEFINED
+#endif // OS_NETBSD
+
#ifndef MOZC_OS_DEFINED
#error "OS_XXX (e.g., OS_WIN) must be defined."
@@ -154,4 +157,9 @@ static const int64 kint64max = (( int6
#define AS_STRING(x) AS_STRING_INTERNAL(x)
#define AS_STRING_INTERNAL(x) #x
+// gcc>=46 has nullptr, otherwise use __null instead.
+#if __cplusplus < 201103L && !defined(__clang__) && defined(__GNUC__) && __GNUC__ * 1000 + __GNUC__MINOR__ < 4006
+#define nullptr __null
+#endif
+
#endif // MOZC_BASE_PORT_H_
#endif // !MOZC_OS_DEFINED

View file

@ -1,73 +1,73 @@
$NetBSD: patch-base_process.cc,v 1.5 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-base_process.cc,v 1.6 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- base/process.cc.orig 2017-11-02 13:32:45.000000000 +0000
--- base/process.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ base/process.cc
@@ -44,12 +44,12 @@
@@ -46,12 +46,12 @@
#include "base/mac_process.h"
#endif // OS_MACOSX
#endif // __APPLE__
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
-#if defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NETBSD)
#include <fcntl.h>
#include <signal.h>
#include <spawn.h> // for posix_spawn().
#include <sys/types.h>
-#endif // OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#endif // OS_LINUX || OS_ANDROID
+#endif // OS_LINUX || OS_ANDROID || OS_NETBSD
#include <cstdlib>
#include <memory>
@@ -96,12 +96,12 @@ bool Process::OpenBrowser(const string &
@@ -98,12 +98,12 @@ bool Process::OpenBrowser(const std::str
return WinUtil::ShellExecuteInSystemDir(L"open", wurl.c_str(), nullptr);
#endif
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
-#if defined(OS_LINUX) || defined(OS_ANDROID)
- static const char kBrowserCommand[] = "/usr/bin/xdg-open";
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NETBSD)
+ static const char kBrowserCommand[] = "@PREFIX@/bin/xdg-open";
// xdg-open which uses kfmclient or gnome-open internally works both on KDE
// and GNOME environments.
return SpawnProcess(kBrowserCommand, url);
-#endif // OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#endif // OS_LINUX || OS_ANDROID
+#endif // OS_LINUX || OS_ANDROID || OS_NETBSD
#ifdef OS_MACOSX
#ifdef __APPLE__
return MacProcess::OpenBrowserForMac(url);
@@ -180,7 +180,7 @@ bool Process::SpawnProcess(const string
@@ -185,7 +185,7 @@ bool Process::SpawnProcess(const std::st
}
#endif
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
-#if defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NETBSD)
// Do not call posix_spawn() for obviously bad path.
if (!S_ISREG(statbuf.st_mode)) {
LOG(ERROR) << "Not a regular file: " << path;
@@ -203,7 +203,7 @@ bool Process::SpawnProcess(const string
@@ -208,7 +208,7 @@ bool Process::SpawnProcess(const std::st
// (www.gnu.org/software/libc/manual/html_node/Heap-Consistency-Checking.html)
const int kOverwrite = 0; // Do not overwrite.
::setenv("MALLOC_CHECK_", "2", kOverwrite);
-#endif // OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#endif // OS_LINUX || OS_ANDROID
+#endif // OS_LINUX || OS_ANDROID || OS_NETBSD
pid_t tmp_pid = 0;
// Spawn new process.
@@ -374,7 +374,7 @@ bool Process::LaunchErrorMessageDialog(c
@@ -383,7 +383,7 @@ bool Process::LaunchErrorMessageDialog(c
}
#endif // OS_WIN
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
-#if defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NETBSD)
const char kMozcTool[] = "mozc_tool";
const string arg = "--mode=error_message_dialog --error_type=" + error_type;
size_t pid = 0;
@@ -382,7 +382,7 @@ bool Process::LaunchErrorMessageDialog(c
const std::string arg =
"--mode=error_message_dialog --error_type=" + error_type;
@@ -392,7 +392,7 @@ bool Process::LaunchErrorMessageDialog(c
LOG(ERROR) << "cannot launch " << kMozcTool;
return false;
}
-#endif // OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#endif // OS_LINUX || OS_ANDROID
+#endif // OS_LINUX || OS_ANDROID || OS_NETBSD
return true;
}

View file

@ -1,19 +1,19 @@
$NetBSD: patch-base_run__level.cc,v 1.5 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-base_run__level.cc,v 1.6 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- base/run_level.cc.orig 2016-05-15 08:11:10.000000000 +0000
--- base/run_level.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ base/run_level.cc
@@ -38,10 +38,10 @@
#include <unistd.h>
#endif // OS_MACOSX
#endif // __APPLE__
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
#include <unistd.h>
-#if defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NETBSD)
#include <sys/types.h>
-#endif // OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
#include <unistd.h>
-#endif // OS_LINUX || OS_ANDROID
+#endif // OS_LINUX || OS_ANDROID || OS_NETBSD
#include "base/const.h"
#include "base/logging.h"

View file

@ -1,61 +1,87 @@
$NetBSD: patch-base_system__util.cc,v 1.5 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-base_system__util.cc,v 1.6 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- base/system_util.cc.orig 2017-11-02 13:32:45.000000000 +0000
--- base/system_util.cc.orig 2021-02-15 05:04:33.000000000 +0000
+++ base/system_util.cc
@@ -372,7 +372,7 @@ string SystemUtil::GetServerDirectory()
#elif defined(OS_MACOSX)
@@ -275,7 +275,7 @@ std::string UserProfileDirectoryImpl::Ge
# endif // GOOGLE_JAPANESE_INPUT_BUILD
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_NETBSD)
// 1. If "$HOME/.mozc" already exists,
// use "$HOME/.mozc" for backward compatibility.
// 2. If $XDG_CONFIG_HOME is defined
@@ -422,7 +422,7 @@ std::string SystemUtil::GetServerDirecto
return MacUtil::GetServerDirectory();
#endif // __APPLE__
-#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
#if defined(MOZC_SERVER_DIRECTORY)
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM) || defined(OS_NETBSD)
# if defined(MOZC_SERVER_DIRECTORY)
return MOZC_SERVER_DIRECTORY;
#else
@@ -450,7 +450,7 @@ string SystemUtil::GetUserNameAsString()
# else
@@ -499,12 +499,12 @@ std::string SystemUtil::GetUserNameAsStr
return ppw->pw_name;
#endif // OS_ANDROID
#else // OS_ANDROID
- // OS_MACOSX, OS_LINUX or OS_NACL
+ // OS_MACOSX, OS_LINUX, OS_NACL or OS_NETBSD
-#if defined(__APPLE__) || defined(OS_LINUX) || defined(OS_WASM)
+#if defined(__APPLE__) || defined(OS_LINUX) || defined(OS_WASM) || defined(OS_NETBSD)
struct passwd pw, *ppw;
char buf[1024];
CHECK_EQ(0, getpwuid_r(geteuid(), &pw, buf, sizeof(buf), &ppw));
@@ -610,7 +610,7 @@ string GetSessionIdString() {
return pw.pw_name;
-#endif // __APPLE__ || OS_LINUX || OS_WASM
+#endif // __APPLE__ || OS_LINUX || OS_WASM || OS_NETBSD
// If none of the above platforms is specified, the compiler raises an error
// because of no return value.
@@ -662,13 +662,13 @@ string GetSessionIdString() {
#endif // OS_WIN
string SystemUtil::GetDesktopNameAsString() {
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
const char *display = getenv("DISPLAY");
if (display == NULL) {
std::string SystemUtil::GetDesktopNameAsString() {
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM) || defined(OS_NETBSD)
const char *display = Environ::GetEnv("DISPLAY");
if (display == nullptr) {
return "";
@@ -812,6 +812,9 @@ string SystemUtil::GetOSVersionString()
#elif defined(OS_LINUX) || defined(OS_NACL)
const string ret = "Linux";
}
return display;
-#endif // OS_LINUX || OS_ANDROID || OS_WASM
+#endif // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
#if defined(__APPLE__)
return "";
@@ -862,10 +862,13 @@ std::string SystemUtil::GetOSVersionStri
#elif defined(OS_LINUX)
const std::string ret = "Linux";
return ret;
-#else // !OS_WIN && !__APPLE__ && !OS_LINUX
+#elif defined(OS_NETBSD)
+ const string ret = "NetBSD";
+ const std::string ret = "NetBSD";
+ return ret;
#else // !OS_WIN && !OS_MACOSX && !OS_LINUX
+#else // !OS_WIN && !__APPLE__ && !OS_LINUX && !OS_NETBSD
const string ret = "Unknown";
return ret;
@@ -847,7 +850,7 @@ uint64 SystemUtil::GetTotalPhysicalMemor
return 0;
}
return total_memory;
-#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
#if defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES)
const long page_size = sysconf(_SC_PAGESIZE);
const long number_of_phyisical_pages = sysconf(_SC_PHYS_PAGES);
@@ -862,7 +865,7 @@ uint64 SystemUtil::GetTotalPhysicalMemor
#endif // defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES)
#else // !(defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX))
#error "unknown platform"
-#endif // OS_WIN, OS_MACOSX, OS_LINUX
+#endif // OS_WIN, OS_MACOSX, OS_LINUX, OS_NETBSD
-#endif // OS_WIN, __APPLE__, OS_LINUX
+#endif // OS_WIN, __APPLE__, OS_LINUX, OS_NETBSD
}
} // namespace mozc
void SystemUtil::DisableIME() {
@@ -901,7 +904,7 @@ uint64 SystemUtil::GetTotalPhysicalMemor
return total_memory;
#endif // __APPLE__
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM) || defined(OS_NETBSD)
# if defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES)
const int32 page_size = sysconf(_SC_PAGESIZE);
const int32 number_of_phyisical_pages = sysconf(_SC_PHYS_PAGES);
@@ -914,7 +917,7 @@ uint64 SystemUtil::GetTotalPhysicalMemor
# else // defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES)
return 0;
# endif // defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES)
-#endif // OS_LINUX || OS_ANDROID || OS_WASM
+#endif // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
// If none of the above platforms is specified, the compiler raises an error
// because of no return value.

View file

@ -1,20 +1,20 @@
$NetBSD: patch-base_thread.cc,v 1.1 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-base_thread.cc,v 1.2 2021/02/15 14:50:23 ryoon Exp $
* tweak for NetBSD pthread_setname_np(3)
--- base/thread.cc.orig 2017-11-02 13:32:45.000000000 +0000
--- base/thread.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ base/thread.cc
@@ -145,9 +145,11 @@ void Thread::Start(const string &thread_
// NaCl doesn't support setname.
#elif defined(OS_MACOSX)
@@ -145,9 +145,11 @@ void Thread::Start(const std::string &th
// WASM doesn't support setname?
#elif defined(__APPLE__) // !OS_WASM
pthread_setname_np(thread_name.c_str());
-#else // !(OS_NACL | OS_MACOSX)
-#else // !(OS_WASM | __APPLE__)
+#elif defined(OS_NETBSD)
+ pthread_setname_np(*state_->handle_, "%s", (void *)thread_name.c_str());
+#else // !(OS_NACL | OS_MACOSX | OS_NETBSD)
pthread_setname_np(*state_->handle_, thread_name.c_str());
-#endif // !(OS_NACL | OS_MACOSX)
+#endif // !(OS_NACL | OS_MACOSX | OS_NETBSD)
+ pthread_setname_np(*state_->handle, "%s", (void *)thread_name.c_str());
+#else // !(OS_WASM | __APPLE__ | OS_NETBSD)
pthread_setname_np(*state_->handle, thread_name.c_str());
-#endif // !(OS_WASM | __APPLE__)
+#endif // !(OS_WASM | __APPLE__ | OS_NETBSD)
}
}

View file

@ -1,40 +1,36 @@
$NetBSD: patch-build__mozc.py,v 1.9 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-build__mozc.py,v 1.10 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- build_mozc.py.orig 2017-11-02 13:32:45.000000000 +0000
--- build_mozc.py.orig 2021-02-15 03:48:53.000000000 +0000
+++ build_mozc.py
@@ -58,6 +58,7 @@ from build_tools.util import GetNumberOf
from build_tools.util import GetRelPath
@@ -55,6 +55,7 @@ from build_tools.util import CopyFile
from build_tools.util import GetNumberOfProcessors
from build_tools.util import IsLinux
from build_tools.util import IsMac
+from build_tools.util import IsNetBSD
from build_tools.util import IsWindows
from build_tools.util import PrintErrorAndExit
from build_tools.util import RemoveDirectoryRecursively
@@ -102,6 +103,7 @@ def GetBuildShortBaseName(target_platfor
@@ -96,6 +97,7 @@ def GetBuildShortBaseName(target_platfor
'Windows': 'out_win',
'Mac': 'out_mac',
'Linux': 'out_linux',
+ 'NetBSD': 'out_bsd',
'Android': 'out_android',
'NaCl': 'out_nacl'
'iOS': 'out_ios',
}
@@ -179,6 +181,12 @@ def GetGypFileNames(options):
elif options.target_platform == 'Android':
# Add Android Mozc gyp scripts.
gyp_file_names.extend(glob.glob('%s/android/*/*.gyp' % SRC_DIR))
+ elif options.target_platform == 'NetBSD':
+ gyp_file_names.extend(glob.glob('%s/unix/*/*.gyp' % SRC_DIR))
+ # Add ibus.gyp if ibus version is >=1.4.1.
+ if not PkgExists('ibus-1.0 >= 1.4.1'):
+ logging.info('removing ibus.gyp.')
+ gyp_file_names.remove('%s/unix/ibus/ibus.gyp' % SRC_DIR)
gyp_file_names.sort()
return gyp_file_names
@@ -243,6 +251,8 @@ def AddTargetPlatformOption(parser):
# If you want Android build, specify "Android".
@@ -155,7 +157,7 @@ def GetGypFileNames(options):
# Include subdirectory of win32 and breakpad for Windows
if options.target_platform == 'Windows':
gyp_file_names.extend(glob.glob('%s/win32/*/*.gyp' % SRC_DIR))
- elif options.target_platform == 'Linux':
+ elif options.target_platform == 'Linux' or options.target_platform == 'NetBSD':
gyp_file_names.extend(glob.glob('%s/unix/*/*.gyp' % SRC_DIR))
# Add ibus.gyp if ibus version is >=1.4.1.
if not PkgExists('ibus-1.0 >= 1.4.1'):
@@ -182,6 +184,8 @@ def ParseVerbose(unused_option, unused_o
def AddTargetPlatformOption(parser):
if IsLinux():
default_target = 'Linux'
+ if IsNetBSD():
@ -42,7 +38,7 @@ $NetBSD: patch-build__mozc.py,v 1.9 2017/12/17 14:15:43 tsutsui Exp $
elif IsWindows():
default_target = 'Windows'
elif IsMac():
@@ -410,6 +420,12 @@ def ExpandMetaTarget(options, meta_targe
@@ -269,6 +273,12 @@ def ExpandMetaTarget(options, meta_targe
SRC_DIR + '/gui/gui.gyp:mozc_tool']
if PkgExists('ibus-1.0 >= 1.4.1'):
targets.append(SRC_DIR + '/unix/ibus/ibus.gyp:ibus_mozc')
@ -53,10 +49,10 @@ $NetBSD: patch-build__mozc.py,v 1.9 2017/12/17 14:15:43 tsutsui Exp $
+ if PkgExists('ibus-1.0 >= 1.4.1'):
+ targets.append(SRC_DIR + '/unix/ibus/ibus.gyp:ibus_mozc')
elif target_platform == 'Mac':
targets = [SRC_DIR + '/mac/mac.gyp:DiskImage']
targets = [SRC_DIR + '/mac/mac.gyp:codesign_DiskImage']
elif target_platform == 'Windows':
@@ -585,7 +601,8 @@ def GypMain(options, unused_args):
if options.noqt or target_platform in ['Android', 'NaCl']:
@@ -441,7 +451,8 @@ def GypMain(options, unused_args):
if options.noqt:
gyp_options.extend(['-D', 'use_qt=NO'])
gyp_options.extend(['-D', 'qt_dir='])
- elif target_platform == 'Linux':
@ -65,54 +61,9 @@ $NetBSD: patch-build__mozc.py,v 1.9 2017/12/17 14:15:43 tsutsui Exp $
gyp_options.extend(['-D', 'use_qt=YES'])
gyp_options.extend(['-D', 'qt_dir='])
@@ -607,7 +624,8 @@ def GypMain(options, unused_args):
else:
gyp_options.extend(['-D', 'use_wix=NO'])
- if target_platform == 'Linux':
+ if (target_platform == 'Linux' or
+ target_platform == 'NetBSD'):
gyp_options.extend(['-D', 'enable_gtk_renderer=1'])
# Android
@@ -653,7 +671,8 @@ def GypMain(options, unused_args):
gyp_options.extend(['-D', 'channel_dev=1'])
def SetCommandLineForFeature(option_name, windows=False, mac=False,
- linux=False, android=False, nacl=False):
+ linux=False, android=False, nacl=False,
+ netbsd=False):
"""Updates an option like '--enable_foober' and add a -D argument for gyp.
This function ensures an option like '--enable_foober' exists and it has a
@@ -675,6 +694,8 @@ def GypMain(options, unused_args):
option on Android platform.
nacl: A boolean which replesents the default value of the target
option on NaCl.
+ netbsd: A boolean which replesents the default value of the target option
+ on NetBSD platform.
Raises:
ValueError: An error occurred when 'option_name' is empty.
@@ -685,6 +706,7 @@ def GypMain(options, unused_args):
default_enabled = {'Windows': windows,
'Mac': mac,
'Linux': linux,
+ 'NetBSD': netbsd,
'Android': android,
'NaCl': nacl}.get(target_platform, False)
enable_option_name = 'enable_%s' % option_name
@@ -697,6 +719,7 @@ def GypMain(options, unused_args):
SetCommandLineForFeature(option_name='cloud_handwriting',
linux=is_official_dev,
+ netbsd=is_official_dev,
windows=is_official_dev,
mac=is_official_dev)
@@ -706,7 +729,8 @@ def GypMain(options, unused_args):
@@ -482,7 +493,8 @@ def GypMain(options, unused_args):
if IsWindows():
gyp_options.extend(['-G', 'msvs_version=2015'])
gyp_options.extend(['-G', 'msvs_version=2017'])
- if (target_platform == 'Linux' and
+ if ((target_platform == 'Linux' or
@ -120,12 +71,3 @@ $NetBSD: patch-build__mozc.py,v 1.9 2017/12/17 14:15:43 tsutsui Exp $
'%s/unix/ibus/ibus.gyp' % SRC_DIR in gyp_file_names):
gyp_options.extend(['-D', 'use_libibus=1'])
@@ -1163,7 +1187,7 @@ def CleanMain(options, unused_args):
if build_base:
directory_names.append(build_base)
- if IsLinux():
+ if IsLinux() or IsNetBSD():
# Remove auto-generated files.
file_names.append(os.path.join(SRC_DIR, 'android', 'AndroidManifest.xml'))
file_names.append(os.path.join(

View file

@ -1,14 +1,14 @@
$NetBSD: patch-build__tools_mozc__version.py,v 1.3 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-build__tools_mozc__version.py,v 1.4 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- build_tools/mozc_version.py.orig 2014-01-06 07:10:26.000000000 +0000
--- build_tools/mozc_version.py.orig 2021-02-15 03:48:53.000000000 +0000
+++ build_tools/mozc_version.py
@@ -64,6 +64,7 @@ TARGET_PLATFORM_TO_DIGIT = {
'Linux': '2',
'Android': '3',
'NaCl': '4',
+ 'NetBSD': '5',
}
@@ -69,6 +69,7 @@ TARGET_PLATFORM_TO_DIGIT = {
'iOS': '6',
'iOS_sim': '6',
'Wasm': '7',
+ 'NetBSD': '8',
}
VERSION_PROPERTIES = [

View file

@ -1,24 +1,24 @@
$NetBSD: patch-client_client.cc,v 1.3 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-client_client.cc,v 1.4 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- client/client.cc.orig 2016-05-15 08:11:10.000000000 +0000
--- client/client.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ client/client.cc
@@ -891,7 +891,7 @@ bool Client::LaunchTool(const string &mo
@@ -867,7 +867,7 @@ bool Client::LaunchTool(const std::strin
return false;
}
#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)\
- || defined(OS_NACL)
+ || defined(OS_NACL) || defined(OS_NETBSD)
string arg = "--mode=" + mode;
-#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NETBSD)
std::string arg = "--mode=" + mode;
if (!extra_arg.empty()) {
arg += " ";
@@ -901,7 +901,7 @@ bool Client::LaunchTool(const string &mo
@@ -877,7 +877,7 @@ bool Client::LaunchTool(const std::strin
LOG(ERROR) << "Cannot execute: " << kMozcTool << " " << arg;
return false;
}
-#endif // OS_WIN || OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_WIN || OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#endif // OS_WIN || OS_LINUX || OS_ANDROID
+#endif // OS_WIN || OS_LINUX || OS_ANDROID || OS_NETBSD
// TODO(taku): move MacProcess inside SpawnMozcProcess.
// TODO(taku): support extra_arg.

View file

@ -0,0 +1,19 @@
$NetBSD: patch-config.bzl,v 1.1 2021/02/15 14:50:23 ryoon Exp $
* For pkgsrc layout.
--- config.bzl.orig 2021-02-15 05:04:34.000000000 +0000
+++ config.bzl
@@ -30,9 +30,9 @@
BRANDING = "Mozc"
-LINUX_MOZC_SERVER_DIRECTORY = "/usr/lib/mozc"
-IBUS_MOZC_ICON_PATH = "/usr/share/ibus-mozc/product_icon.png"
-IBUS_MOZC_PATH = "/usr/lib/ibus-mozc/ibus-engine-mozc"
+LINUX_MOZC_SERVER_DIRECTORY = "@PREFIX@/libexec"
+IBUS_MOZC_ICON_PATH = "@PREFIX@/share/ibus-mozc/product_icon.png"
+IBUS_MOZC_PATH = "@PREFIX@/libexec/ibus-engine-mozc"
MACOS_BUNDLE_ID_PREFIX = "org.mozc.inputmethod.Japanese"
MACOS_MIN_OS_VER = "10.12"

View file

@ -1,20 +1,20 @@
$NetBSD: patch-config_stats__config__util__test.cc,v 1.3 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-config_stats__config__util__test.cc,v 1.4 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- config/stats_config_util_test.cc.orig 2016-05-15 08:11:10.000000000 +0000
--- config/stats_config_util_test.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ config/stats_config_util_test.cc
@@ -696,11 +696,11 @@ TEST(StatsConfigUtilTestAndroid, Default
@@ -685,11 +685,11 @@ TEST(StatsConfigUtilTestAndroid, Default
}
#endif // OS_ANDROID
-#if defined(OS_LINUX) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_NACL) || defined(OS_NETBSD)
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_NETBSD)
TEST(StatsConfigUtilTestLinux, DefaultValueTest) {
EXPECT_FALSE(StatsConfigUtil::IsEnabled());
}
-#endif // OS_LINUX || OS_NACL
+#endif // OS_LINUX || OS_NACL || OS_NETBSD
-#endif // OS_LINUX
+#endif // OS_LINUX || OS_NETBSD
#else // !GOOGLE_JAPANESE_INPUT_BUILD
TEST(StatsConfigUtilTestNonOfficialBuild, DefaultValueTest) {

View file

@ -1,15 +0,0 @@
$NetBSD: patch-dictionary_user__dictionary.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
Fix from https://github.com/google/mozc/issues/460
--- dictionary/user_dictionary.cc.orig 2017-11-02 13:32:47.000000000 +0000
+++ dictionary/user_dictionary.cc
@@ -289,7 +289,7 @@ class UserDictionary::UserDictionaryRelo
}
auto_register_mode_ = false;
- dic_->Load(*(storage.get()));
+ dic_->Load(storage.get()->user_dictionary_storage_base);
}
private:

View file

@ -1,204 +0,0 @@
$NetBSD: patch-dictionary_user__dictionary__session.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
Fix from https://github.com/google/mozc/issues/460
--- dictionary/user_dictionary_session.cc.orig 2017-11-02 13:32:47.000000000 +0000
+++ dictionary/user_dictionary_session.cc
@@ -69,11 +69,11 @@ class UndoCreateDictionaryCommand : publ
}
virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
- if (storage->dictionaries_size() == 0) {
+ if (storage->user_dictionary_storage_base.dictionaries_size() == 0) {
return false;
}
- storage->mutable_dictionaries()->RemoveLast();
+ storage->user_dictionary_storage_base.mutable_dictionaries()->RemoveLast();
return true;
}
@@ -94,7 +94,7 @@ class UndoDeleteDictionaryCommand : publ
}
RepeatedPtrField<UserDictionary> *dictionaries =
- storage->mutable_dictionaries();
+ storage->user_dictionary_storage_base.mutable_dictionaries();
dictionaries->AddAllocated(dictionary_.release());
// Adjust the position of the reverted dictionary.
@@ -120,10 +120,10 @@ class UndoDeleteDictionaryWithEnsuringNo
}
virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
- if (storage->dictionaries_size() != 1) {
+ if (storage->user_dictionary_storage_base.dictionaries_size() != 1) {
return false;
}
- dictionary_->Swap(storage->mutable_dictionaries(0));
+ dictionary_->Swap(storage->user_dictionary_storage_base.mutable_dictionaries(0));
return true;
}
@@ -144,7 +144,7 @@ class UndoRenameDictionaryCommand : publ
virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage, dictionary_id_);
+ &storage->user_dictionary_storage_base, dictionary_id_);
if (dictionary == NULL) {
return false;
}
@@ -169,7 +169,7 @@ class UndoAddEntryCommand : public UserD
virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage, dictionary_id_);
+ &storage->user_dictionary_storage_base, dictionary_id_);
if (dictionary == NULL || dictionary->entries_size() == 0) {
return false;
}
@@ -195,7 +195,7 @@ class UndoEditEntryCommand : public User
virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage, dictionary_id_);
+ &storage->user_dictionary_storage_base, dictionary_id_);
if (dictionary == NULL ||
index_ < 0 || dictionary->entries_size() <= index_) {
return false;
@@ -240,7 +240,7 @@ class UndoDeleteEntryCommand : public Us
virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage, dictionary_id_);
+ &storage->user_dictionary_storage_base, dictionary_id_);
if (dictionary == NULL) {
return false;
}
@@ -306,7 +306,7 @@ class UndoImportFromStringCommand : publ
virtual bool RunUndo(mozc::UserDictionaryStorage *storage) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage, dictionary_id_);
+ &storage->user_dictionary_storage_base, dictionary_id_);
if (dictionary == NULL) {
return false;
}
@@ -345,7 +345,7 @@ UserDictionarySession::~UserDictionarySe
// TODO(hidehiko) move this to header.
const UserDictionaryStorage &UserDictionarySession::storage() const {
- return *storage_;
+ return storage_->user_dictionary_storage_base;
}
mozc::UserDictionaryStorage *UserDictionarySession::mutable_storage() {
return storage_.get();
@@ -464,7 +464,7 @@ UserDictionaryCommandStatus::Status User
const string &dictionary_name, uint64 *new_dictionary_id) {
UserDictionaryCommandStatus::Status status =
UserDictionaryUtil::CreateDictionary(
- storage_.get(), dictionary_name, new_dictionary_id);
+ &storage_->user_dictionary_storage_base, dictionary_name, new_dictionary_id);
if (status == UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS) {
AddUndoCommand(new UndoCreateDictionaryCommand);
}
@@ -488,7 +488,7 @@ UserDictionarySession::DeleteDictionaryI
int original_index;
UserDictionary *deleted_dictionary;
if (!UserDictionaryUtil::DeleteDictionary(
- storage_.get(), dictionary_id,
+ &storage_->user_dictionary_storage_base, dictionary_id,
&original_index, &deleted_dictionary)) {
// Failed to delete the dictionary.
return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
@@ -510,7 +510,7 @@ UserDictionaryCommandStatus::Status User
uint64 dictionary_id, const string &dictionary_name) {
string original_name;
const UserDictionary *dictionary =
- UserDictionaryUtil::GetUserDictionaryById(*storage_, dictionary_id);
+ UserDictionaryUtil::GetUserDictionaryById(storage_->user_dictionary_storage_base, 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 User
uint64 dictionary_id, const UserDictionary::Entry &entry) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage_.get(), dictionary_id);
+ &storage_->user_dictionary_storage_base, dictionary_id);
if (dictionary == NULL) {
return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
}
@@ -575,7 +575,7 @@ UserDictionaryCommandStatus::Status User
uint64 dictionary_id, int index, const UserDictionary::Entry &entry) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage_.get(), dictionary_id);
+ &storage_->user_dictionary_storage_base, dictionary_id);
if (dictionary == NULL) {
return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
}
@@ -604,7 +604,7 @@ UserDictionaryCommandStatus::Status User
uint64 dictionary_id, const std::vector<int> &index_list) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage_.get(), dictionary_id);
+ &storage_->user_dictionary_storage_base, dictionary_id);
if (dictionary == NULL) {
return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
}
@@ -644,7 +644,7 @@ UserDictionaryCommandStatus::Status User
uint64 dictionary_id, const string &data) {
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage_.get(), dictionary_id);
+ &storage_->user_dictionary_storage_base, dictionary_id);
if (dictionary == NULL) {
return UserDictionaryCommandStatus::UNKNOWN_DICTIONARY_ID;
}
@@ -699,7 +699,7 @@ UserDictionarySession::ImportToNewDictio
uint64 *new_dictionary_id) {
UserDictionaryCommandStatus::Status status =
UserDictionaryUtil::CreateDictionary(
- storage_.get(), dictionary_name, new_dictionary_id);
+ &storage_->user_dictionary_storage_base, dictionary_name, new_dictionary_id);
if (status != UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS) {
return status;
}
@@ -709,7 +709,7 @@ UserDictionarySession::ImportToNewDictio
UserDictionary *dictionary =
UserDictionaryUtil::GetMutableUserDictionaryById(
- storage_.get(), *new_dictionary_id);
+ &storage_->user_dictionary_storage_base, *new_dictionary_id);
if (dictionary == NULL) {
// The dictionary should be always found.
return UserDictionaryCommandStatus::UNKNOWN_ERROR;
@@ -719,7 +719,7 @@ UserDictionarySession::ImportToNewDictio
}
bool UserDictionarySession::EnsureNonEmptyStorage() {
- if (storage_->dictionaries_size() > 0) {
+ if (storage_->user_dictionary_storage_base.dictionaries_size() > 0) {
// The storage already has at least one dictionary. Do nothing.
return false;
}
@@ -728,7 +728,7 @@ bool UserDictionarySession::EnsureNonEmp
uint64 new_dictionary_id;
UserDictionaryCommandStatus::Status status =
UserDictionaryUtil::CreateDictionary(
- storage_.get(), default_dictionary_name_, &new_dictionary_id);
+ &storage_->user_dictionary_storage_base, default_dictionary_name_, &new_dictionary_id);
CHECK_EQ(
status, UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS);
return true;
@@ -755,7 +755,7 @@ void UserDictionarySession::AddUndoComma
void UserDictionarySession::ClearDictionariesAndUndoHistory() {
ScopedUserDictionaryLocker l(storage_.get());
- storage_->clear_dictionaries();
+ storage_->user_dictionary_storage_base.clear_dictionaries();
ClearUndoHistory();
}

View file

@ -1,66 +0,0 @@
$NetBSD: patch-dictionary_user__dictionary__session__test.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
Fix from https://github.com/google/mozc/issues/460
--- dictionary/user_dictionary_session_test.cc.orig 2017-11-02 13:32:47.000000000 +0000
+++ dictionary/user_dictionary_session_test.cc
@@ -105,12 +105,12 @@ TEST_F(UserDictionarySessionTest, SaveAn
ASSERT_EQ(UserDictionaryCommandStatus::FILE_NOT_FOUND, session.Load());
- session.mutable_storage()->set_version(10);
+ session.mutable_storage()->user_dictionary_storage_base.set_version(10);
ASSERT_EQ(UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS,
session.Save());
// Clear once, in order to make sure that Load is actually working.
- session.mutable_storage()->Clear();
+ session.mutable_storage()->user_dictionary_storage_base.Clear();
ASSERT_EQ(UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS,
session.Load());
@@ -140,7 +140,7 @@ TEST_F(UserDictionarySessionTest, DISABL
// Create huge dummy data.
{
- UserDictionaryStorage *storage = session.mutable_storage();
+ UserDictionaryStorage *storage = &session.mutable_storage()->user_dictionary_storage_base;
for (int i = 0; i < 100; ++i) {
UserDictionary *dictionary = storage->add_dictionaries();
for (int j = 0; j < 1000; ++j) {
@@ -157,7 +157,7 @@ TEST_F(UserDictionarySessionTest, DISABL
ASSERT_EQ(UserDictionaryCommandStatus::FILE_SIZE_LIMIT_EXCEEDED,
session.Save());
- session.mutable_storage()->Clear();
+ session.mutable_storage()->user_dictionary_storage_base.Clear();
ASSERT_EQ(UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS,
session.Load());
@@ -201,7 +201,7 @@ TEST_F(UserDictionarySessionTest, Create
while (session.storage().dictionaries_size() <
::mozc::UserDictionaryStorage::max_dictionary_size()) {
- session.mutable_storage()->add_dictionaries();
+ session.mutable_storage()->user_dictionary_storage_base.add_dictionaries();
}
EXPECT_EQ(UserDictionaryCommandStatus::DICTIONARY_SIZE_LIMIT_EXCEEDED,
session.CreateDictionary("dictionary 2", &dummy_dictionary_id));
@@ -214,7 +214,7 @@ TEST_F(UserDictionarySessionTest, Delete
const uint64 kDummyId = 10;
{
UserDictionary *user_dictionary =
- session.mutable_storage()->add_dictionaries();
+ session.mutable_storage()->user_dictionary_storage_base.add_dictionaries();
user_dictionary->set_id(kDummyId);
}
@@ -239,7 +239,7 @@ TEST_F(UserDictionarySessionTest,
const uint64 kDummyId = 10;
{
UserDictionary *user_dictionary =
- session.mutable_storage()->add_dictionaries();
+ session.mutable_storage()->user_dictionary_storage_base.add_dictionaries();
user_dictionary->set_id(kDummyId);
}

View file

@ -1,197 +0,0 @@
$NetBSD: patch-dictionary_user__dictionary__storage.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
Fix from https://github.com/google/mozc/issues/460
--- dictionary/user_dictionary_storage.cc.orig 2017-11-02 13:32:47.000000000 +0000
+++ dictionary/user_dictionary_storage.cc
@@ -114,7 +114,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 (!user_dictionary_storage_base.ParseFromCodedStream(&decoder)) {
LOG(ERROR) << "Failed to parse";
if (!decoder.ConsumedEntireMessage() || !ifs.eof()) {
LOG(ERROR) << "ParseFromStream failed: file seems broken";
@@ -142,11 +142,11 @@ bool UserDictionaryStorage::Load() {
}
// Check dictionary id here. if id is 0, assign random ID.
- for (int i = 0; i < dictionaries_size(); ++i) {
- const UserDictionary &dict = dictionaries(i);
+ for (int i = 0; i < user_dictionary_storage_base.dictionaries_size(); ++i) {
+ const UserDictionary &dict = user_dictionary_storage_base.dictionaries(i);
if (dict.id() == 0) {
- mutable_dictionaries(i)->set_id(
- UserDictionaryUtil::CreateNewDictionaryId(*this));
+ user_dictionary_storage_base.mutable_dictionaries(i)->set_id(
+ UserDictionaryUtil::CreateNewDictionaryId(this->user_dictionary_storage_base));
}
}
@@ -176,7 +176,7 @@ bool UserDictionaryStorage::Save() {
return false;
}
- if (!SerializeToOstream(&ofs)) {
+ if (!user_dictionary_storage_base.SerializeToOstream(&ofs)) {
LOG(ERROR) << "SerializeToString failed";
last_error_type_ = SYNC_FAILURE;
return false;
@@ -232,7 +232,7 @@ bool UserDictionaryStorage::ExportDictio
return false;
}
- const UserDictionary &dic = dictionaries(index);
+ const UserDictionary &dic = user_dictionary_storage_base.dictionaries(index);
for (size_t i = 0; i < dic.entries_size(); ++i) {
const UserDictionaryEntry &entry = dic.entries(i);
ofs << entry.key() << "\t" << entry.value() << "\t"
@@ -246,7 +246,7 @@ bool UserDictionaryStorage::ExportDictio
bool UserDictionaryStorage::CreateDictionary(
const string &dic_name, uint64 *new_dic_id) {
UserDictionaryCommandStatus::Status status =
- UserDictionaryUtil::CreateDictionary(this, dic_name, new_dic_id);
+ UserDictionaryUtil::CreateDictionary(&this->user_dictionary_storage_base, dic_name, new_dic_id);
// Update last_error_type_
switch (status) {
case UserDictionaryCommandStatus::DICTIONARY_NAME_EMPTY:
@@ -278,7 +278,7 @@ bool UserDictionaryStorage::CreateDictio
}
bool UserDictionaryStorage::DeleteDictionary(uint64 dic_id) {
- if (!UserDictionaryUtil::DeleteDictionary(this, dic_id, NULL, NULL)) {
+ if (!UserDictionaryUtil::DeleteDictionary(&this->user_dictionary_storage_base, dic_id, NULL, NULL)) {
// Failed to delete dictionary.
last_error_type_ = INVALID_DICTIONARY_ID;
return false;
@@ -309,8 +309,8 @@ bool UserDictionaryStorage::RenameDictio
return true;
}
- for (int i = 0; i < dictionaries_size(); ++i) {
- if (dic_name == dictionaries(i).name()) {
+ for (int i = 0; i < user_dictionary_storage_base.dictionaries_size(); ++i) {
+ if (dic_name == user_dictionary_storage_base.dictionaries(i).name()) {
last_error_type_ = DUPLICATED_DICTIONARY_NAME;
LOG(ERROR) << "duplicated dictionary name";
return false;
@@ -323,14 +323,14 @@ bool UserDictionaryStorage::RenameDictio
}
int UserDictionaryStorage::GetUserDictionaryIndex(uint64 dic_id) const {
- return UserDictionaryUtil::GetUserDictionaryIndexById(*this, dic_id);
+ return UserDictionaryUtil::GetUserDictionaryIndexById(this->user_dictionary_storage_base, dic_id);
}
bool UserDictionaryStorage::GetUserDictionaryId(const string &dic_name,
uint64 *dic_id) {
- for (size_t i = 0; i < dictionaries_size(); ++i) {
- if (dic_name == dictionaries(i).name()) {
- *dic_id = dictionaries(i).id();
+ for (size_t i = 0; i < user_dictionary_storage_base.dictionaries_size(); ++i) {
+ if (dic_name == user_dictionary_storage_base.dictionaries(i).name()) {
+ *dic_id = user_dictionary_storage_base.dictionaries(i).id();
return true;
}
}
@@ -340,7 +340,7 @@ bool UserDictionaryStorage::GetUserDicti
user_dictionary::UserDictionary *UserDictionaryStorage::GetUserDictionary(
uint64 dic_id) {
- return UserDictionaryUtil::GetMutableUserDictionaryById(this, dic_id);
+ return UserDictionaryUtil::GetMutableUserDictionaryById(&this->user_dictionary_storage_base, dic_id);
}
UserDictionaryStorage::UserDictionaryStorageErrorType
@@ -357,8 +357,8 @@ bool UserDictionaryStorage::AddToAutoReg
}
int auto_index = -1;
- for (int i = 0; i < dictionaries_size(); ++i) {
- if (dictionaries(i).name() == kAutoRegisteredDictionaryName) {
+ for (int i = 0; i < user_dictionary_storage_base.dictionaries_size(); ++i) {
+ if (user_dictionary_storage_base.dictionaries(i).name() == kAutoRegisteredDictionaryName) {
auto_index = i;
break;
}
@@ -366,17 +366,17 @@ bool UserDictionaryStorage::AddToAutoReg
UserDictionary *dic = NULL;
if (auto_index == -1) {
- if (UserDictionaryUtil::IsStorageFull(*this)) {
+ if (UserDictionaryUtil::IsStorageFull(this->user_dictionary_storage_base)) {
last_error_type_ = TOO_MANY_DICTIONARIES;
LOG(ERROR) << "too many dictionaries";
UnLock();
return false;
}
- dic = add_dictionaries();
- dic->set_id(UserDictionaryUtil::CreateNewDictionaryId(*this));
+ dic = user_dictionary_storage_base.add_dictionaries();
+ dic->set_id(UserDictionaryUtil::CreateNewDictionaryId(this->user_dictionary_storage_base));
dic->set_name(kAutoRegisteredDictionaryName);
} else {
- dic = mutable_dictionaries(auto_index);
+ dic = user_dictionary_storage_base.mutable_dictionaries(auto_index);
}
if (dic == NULL) {
@@ -415,13 +415,13 @@ bool UserDictionaryStorage::AddToAutoReg
}
bool UserDictionaryStorage::ConvertSyncDictionariesToNormalDictionaries() {
- if (CountSyncableDictionaries(*this) == 0) {
+ if (CountSyncableDictionaries(this->user_dictionary_storage_base) == 0) {
return false;
}
- for (int dictionary_index = dictionaries_size() - 1;
+ for (int dictionary_index = user_dictionary_storage_base.dictionaries_size() - 1;
dictionary_index >= 0; --dictionary_index) {
- UserDictionary *dic = mutable_dictionaries(dictionary_index);
+ UserDictionary *dic = user_dictionary_storage_base.mutable_dictionaries(dictionary_index);
if (!dic->syncable()) {
continue;
}
@@ -438,10 +438,10 @@ bool UserDictionaryStorage::ConvertSyncD
// Delete removed or unused sync dictionaries.
if (dic->removed() || dic->entries_size() == 0) {
- for (int i = dictionary_index + 1; i < dictionaries_size(); ++i) {
- mutable_dictionaries()->SwapElements(i - 1, i);
+ for (int i = dictionary_index + 1; i < user_dictionary_storage_base.dictionaries_size(); ++i) {
+ user_dictionary_storage_base.mutable_dictionaries()->SwapElements(i - 1, i);
}
- mutable_dictionaries()->RemoveLast();
+ user_dictionary_storage_base.mutable_dictionaries()->RemoveLast();
continue;
}
@@ -450,7 +450,7 @@ bool UserDictionaryStorage::ConvertSyncD
kDictionaryNameConvertedFromSyncableDictionary;
int index = 0;
while (UserDictionaryUtil::ValidateDictionaryName(
- *this, new_dictionary_name)
+ this->user_dictionary_storage_base, new_dictionary_name)
!= UserDictionaryCommandStatus::USER_DICTIONARY_COMMAND_SUCCESS) {
++index;
new_dictionary_name = Util::StringPrintf(
@@ -461,7 +461,7 @@ bool UserDictionaryStorage::ConvertSyncD
dic->set_syncable(false);
}
- DCHECK_EQ(0, CountSyncableDictionaries(*this));
+ DCHECK_EQ(0, CountSyncableDictionaries(this->user_dictionary_storage_base));
return true;
}
@@ -492,7 +492,7 @@ size_t UserDictionaryStorage::max_dictio
bool UserDictionaryStorage::IsValidDictionaryName(const string &name) {
UserDictionaryCommandStatus::Status status =
UserDictionaryUtil::ValidateDictionaryName(
- UserDictionaryStorage::default_instance(), name);
+ user_dictionary::UserDictionaryStorage::default_instance(), name);
// Update last_error_type_.
switch (status) {

View file

@ -1,25 +0,0 @@
$NetBSD: patch-dictionary_user__dictionary__storage.h,v 1.1 2020/06/19 05:45:30 taca Exp $
Fix from https://github.com/google/mozc/issues/460
--- dictionary/user_dictionary_storage.h.orig 2017-11-02 13:32:47.000000000 +0000
+++ dictionary/user_dictionary_storage.h
@@ -72,13 +72,15 @@ namespace mozc {
class Mutex;
class ProcessMutex;
-// Inherit from ProtocolBuffer
-// TODO(hidehiko): Get rid of this implementation.
-class UserDictionaryStorage : public user_dictionary::UserDictionaryStorage {
+class UserDictionaryStorage {
public:
typedef user_dictionary::UserDictionary UserDictionary;
typedef user_dictionary::UserDictionary::Entry UserDictionaryEntry;
+ // Instance of base class generated by Protocol Buffers compiler.
+ // Regular inheritance strongly discouraged.
+ user_dictionary::UserDictionaryStorage user_dictionary_storage_base;
+
enum UserDictionaryStorageErrorType {
USER_DICTIONARY_STORAGE_NO_ERROR = 0, // default
FILE_NOT_EXISTS,

View file

@ -1,176 +0,0 @@
$NetBSD: patch-dictionary_user__dictionary__storage__test.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
Fix from https://github.com/google/mozc/issues/460
--- dictionary/user_dictionary_storage_test.cc.orig 2017-11-02 13:32:47.000000000 +0000
+++ dictionary/user_dictionary_storage_test.cc
@@ -135,7 +135,7 @@ TEST_F(UserDictionaryStorageTest, BasicO
}
for (size_t i = 0; i < kDictionariesSize; ++i) {
- EXPECT_EQ(storage.mutable_dictionaries(i + dict_size),
+ EXPECT_EQ(storage.user_dictionary_storage_base.mutable_dictionaries(i + dict_size),
storage.GetUserDictionary(id[i]));
EXPECT_EQ(NULL, storage.GetUserDictionary(id[i] + 1));
}
@@ -167,7 +167,7 @@ TEST_F(UserDictionaryStorageTest, BasicO
EXPECT_FALSE(storage.DeleteDictionary(0));
EXPECT_TRUE(storage.DeleteDictionary(id[1]));
- EXPECT_EQ(kDictionariesSize + dict_size - 1, storage.dictionaries_size());
+ EXPECT_EQ(kDictionariesSize + dict_size - 1, storage.user_dictionary_storage_base.dictionaries_size());
}
TEST_F(UserDictionaryStorageTest, DeleteTest) {
@@ -176,7 +176,7 @@ TEST_F(UserDictionaryStorageTest, Delete
// repeat 10 times
for (int i = 0; i < 10; ++i) {
- storage.Clear();
+ storage.user_dictionary_storage_base.Clear();
std::vector<uint64> ids(100);
for (size_t i = 0; i < ids.size(); ++i) {
EXPECT_TRUE(storage.CreateDictionary(
@@ -193,10 +193,10 @@ TEST_F(UserDictionaryStorageTest, Delete
alive.push_back(ids[i]);
}
- EXPECT_EQ(alive.size(), storage.dictionaries_size());
+ EXPECT_EQ(alive.size(), storage.user_dictionary_storage_base.dictionaries_size());
for (size_t i = 0; i < alive.size(); ++i) {
- EXPECT_EQ(alive[i], storage.dictionaries(i).id());
+ EXPECT_EQ(alive[i], storage.user_dictionary_storage_base.dictionaries(i).id());
}
}
}
@@ -270,7 +270,7 @@ TEST_F(UserDictionaryStorageTest, Serial
const size_t entry_size = Util::Random(100) + 1;
for (size_t j = 0; j < entry_size; ++j) {
UserDictionaryStorage::UserDictionary *dic =
- storage1.mutable_dictionaries(i);
+ storage1.user_dictionary_storage_base.mutable_dictionaries(i);
UserDictionaryStorage::UserDictionaryEntry *entry =
dic->add_entries();
entry->set_key(GenRandomString(10));
@@ -290,7 +290,7 @@ TEST_F(UserDictionaryStorageTest, Serial
EXPECT_TRUE(storage2.Load());
}
- EXPECT_EQ(storage1.DebugString(), storage2.DebugString());
+ EXPECT_EQ(storage1.user_dictionary_storage_base.DebugString(), storage2.user_dictionary_storage_base.DebugString());
}
}
@@ -354,7 +354,7 @@ TEST_F(UserDictionaryStorageTest, Conver
uint64 dict_id = 0;
ASSERT_TRUE(storage.CreateDictionary(data.dictionary_name, &dict_id));
UserDictionaryStorage::UserDictionary *dict =
- storage.mutable_dictionaries(storage.GetUserDictionaryIndex(dict_id));
+ storage.user_dictionary_storage_base.mutable_dictionaries(storage.GetUserDictionaryIndex(dict_id));
dict->set_syncable(data.is_sync_dictionary);
dict->set_removed(data.is_removed_dictionary);
if (data.has_normal_entry) {
@@ -371,7 +371,7 @@ TEST_F(UserDictionaryStorageTest, Conver
entry->set_removed(true);
}
}
- EXPECT_EQ(9, UserDictionaryStorage::CountSyncableDictionaries(storage));
+ EXPECT_EQ(9, UserDictionaryStorage::CountSyncableDictionaries(storage.user_dictionary_storage_base));
ASSERT_TRUE(storage.ConvertSyncDictionariesToNormalDictionaries());
@@ -389,12 +389,12 @@ TEST_F(UserDictionaryStorageTest, Conver
{ true, kDictionaryNameConvertedFromSyncableDictionary },
};
- EXPECT_EQ(0, UserDictionaryStorage::CountSyncableDictionaries(storage));
- ASSERT_EQ(arraysize(expected_data), storage.dictionaries_size());
+ EXPECT_EQ(0, UserDictionaryStorage::CountSyncableDictionaries(storage.user_dictionary_storage_base));
+ ASSERT_EQ(arraysize(expected_data), storage.user_dictionary_storage_base.dictionaries_size());
for (size_t i = 0; i < arraysize(expected_data); ++i) {
SCOPED_TRACE(Util::StringPrintf("verify %d", static_cast<int>(i)));
const ExpectedData &expected = expected_data[i];
- const UserDictionaryStorage::UserDictionary &dict = storage.dictionaries(i);
+ const UserDictionaryStorage::UserDictionary &dict = storage.user_dictionary_storage_base.dictionaries(i);
EXPECT_EQ(expected.dictionary_name, dict.name());
EXPECT_FALSE(dict.syncable());
@@ -408,42 +408,42 @@ TEST_F(UserDictionaryStorageTest, Conver
}
// Test duplicated dictionary name.
- storage.Clear();
+ storage.user_dictionary_storage_base.Clear();
{
uint64 dict_id = 0;
storage.CreateDictionary(
UserDictionaryStorage::default_sync_dictionary_name(), &dict_id);
storage.CreateDictionary(
kDictionaryNameConvertedFromSyncableDictionary, &dict_id);
- ASSERT_EQ(2, storage.dictionaries_size());
+ ASSERT_EQ(2, storage.user_dictionary_storage_base.dictionaries_size());
UserDictionaryStorage::UserDictionary *dict;
- dict = storage.mutable_dictionaries(0);
+ dict = storage.user_dictionary_storage_base.mutable_dictionaries(0);
dict->set_syncable(true);
dict->add_entries()->set_key("0");
- dict = storage.mutable_dictionaries(1);
+ dict = storage.user_dictionary_storage_base.mutable_dictionaries(1);
dict->set_syncable(false);
dict->add_entries()->set_key("1");
}
ASSERT_TRUE(storage.ConvertSyncDictionariesToNormalDictionaries());
- EXPECT_EQ(0, UserDictionaryStorage::CountSyncableDictionaries(storage));
- EXPECT_EQ(2, storage.dictionaries_size());
+ EXPECT_EQ(0, UserDictionaryStorage::CountSyncableDictionaries(storage.user_dictionary_storage_base));
+ EXPECT_EQ(2, storage.user_dictionary_storage_base.dictionaries_size());
EXPECT_EQ(Util::StringPrintf("%s_1",
kDictionaryNameConvertedFromSyncableDictionary),
- storage.dictionaries(0).name());
+ storage.user_dictionary_storage_base.dictionaries(0).name());
EXPECT_EQ(kDictionaryNameConvertedFromSyncableDictionary,
- storage.dictionaries(1).name());
+ storage.user_dictionary_storage_base.dictionaries(1).name());
}
TEST_F(UserDictionaryStorageTest, AddToAutoRegisteredDictionary) {
{
UserDictionaryStorage storage(GetUserDictionaryFile());
- EXPECT_EQ(0, storage.dictionaries_size());
+ EXPECT_EQ(0, storage.user_dictionary_storage_base.dictionaries_size());
EXPECT_TRUE(storage.AddToAutoRegisteredDictionary(
"key1", "value1", UserDictionary::NOUN));
- EXPECT_EQ(1, storage.dictionaries_size());
- EXPECT_EQ(1, storage.dictionaries(0).entries_size());
+ EXPECT_EQ(1, storage.user_dictionary_storage_base.dictionaries_size());
+ EXPECT_EQ(1, storage.user_dictionary_storage_base.dictionaries(0).entries_size());
const UserDictionaryStorage::UserDictionaryEntry &entry1 =
- storage.dictionaries(0).entries(0);
+ storage.user_dictionary_storage_base.dictionaries(0).entries(0);
EXPECT_EQ("key1", entry1.key());
EXPECT_EQ("value1", entry1.value());
EXPECT_EQ(UserDictionary::NOUN, entry1.pos());
@@ -451,10 +451,10 @@ TEST_F(UserDictionaryStorageTest, AddToA
EXPECT_TRUE(storage.AddToAutoRegisteredDictionary(
"key2", "value2", UserDictionary::NOUN));
- EXPECT_EQ(1, storage.dictionaries_size());
- EXPECT_EQ(2, storage.dictionaries(0).entries_size());
+ EXPECT_EQ(1, storage.user_dictionary_storage_base.dictionaries_size());
+ EXPECT_EQ(2, storage.user_dictionary_storage_base.dictionaries(0).entries_size());
const UserDictionaryStorage::UserDictionaryEntry &entry2 =
- storage.dictionaries(0).entries(1);
+ storage.user_dictionary_storage_base.dictionaries(0).entries(1);
EXPECT_EQ("key2", entry2.key());
EXPECT_EQ("value2", entry2.value());
EXPECT_EQ(UserDictionary::NOUN, entry2.pos());
@@ -478,7 +478,7 @@ TEST_F(UserDictionaryStorageTest, Export
{
UserDictionaryStorage storage(GetUserDictionaryFile());
{
- UserDictionary *dictionary = storage.add_dictionaries();
+ UserDictionary *dictionary = storage.user_dictionary_storage_base.add_dictionaries();
dictionary->set_id(kDummyDictionaryId);
UserDictionary::Entry *entry = dictionary->add_entries();
entry->set_key("key");

View file

@ -1,212 +0,0 @@
$NetBSD: patch-dictionary_user__dictionary__test.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
Fix from https://github.com/google/mozc/issues/460
--- dictionary/user_dictionary_test.cc.orig 2017-11-02 13:32:47.000000000 +0000
+++ dictionary/user_dictionary_test.cc
@@ -336,9 +336,9 @@ class UserDictionaryTest : public ::test
std::istringstream is(contents);
CHECK(is.good());
- storage->Clear();
+ storage->user_dictionary_storage_base.Clear();
UserDictionaryStorage::UserDictionary *dic
- = storage->add_dictionaries();
+ = storage->user_dictionary_storage_base.add_dictionaries();
CHECK(dic);
string line;
@@ -391,7 +391,7 @@ TEST_F(UserDictionaryTest, TestLookupPre
{
UserDictionaryStorage storage("");
UserDictionaryTest::LoadFromString(kUserDictionary0, &storage);
- dic->Load(storage);
+ dic->Load(storage.user_dictionary_storage_base);
}
// A normal lookup operation.
@@ -429,7 +429,7 @@ TEST_F(UserDictionaryTest, TestLookupPre
{
UserDictionaryStorage storage("");
LoadFromString(kUserDictionary1, &storage);
- dic->Load(storage);
+ dic->Load(storage.user_dictionary_storage_base);
}
// A normal lookup again.
@@ -454,7 +454,7 @@ TEST_F(UserDictionaryTest, TestLookupPre
{
UserDictionaryStorage storage("");
LoadFromString(kUserDictionary0, &storage);
- dic->Load(storage);
+ dic->Load(storage.user_dictionary_storage_base);
}
// A normal lookup operation.
@@ -486,7 +486,7 @@ TEST_F(UserDictionaryTest, TestLookupPre
{
UserDictionaryStorage storage("");
LoadFromString(kUserDictionary1, &storage);
- dic->Load(storage);
+ dic->Load(storage.user_dictionary_storage_base);
}
// A normal lookup.
@@ -510,7 +510,7 @@ TEST_F(UserDictionaryTest, TestLookupExa
{
UserDictionaryStorage storage("");
LoadFromString(kUserDictionary0, &storage);
- dic->Load(storage);
+ dic->Load(storage.user_dictionary_storage_base);
}
// A normal lookup operation.
@@ -547,7 +547,7 @@ TEST_F(UserDictionaryTest, TestLookupExa
uint64 id = 0;
EXPECT_TRUE(storage.CreateDictionary("test", &id));
UserDictionaryStorage::UserDictionary *dic =
- storage.mutable_dictionaries(0);
+ storage.user_dictionary_storage_base.mutable_dictionaries(0);
// "名詞"
UserDictionaryStorage::UserDictionaryEntry *entry =
@@ -562,7 +562,7 @@ TEST_F(UserDictionaryTest, TestLookupExa
entry->set_value("suggest_only");
entry->set_pos(user_dictionary::UserDictionary::SUGGESTION_ONLY);
- user_dic->Load(storage);
+ user_dic->Load(storage.user_dictionary_storage_base);
}
// "suggestion_only" should not be looked up.
@@ -584,7 +584,7 @@ TEST_F(UserDictionaryTest, IncognitoMode
{
UserDictionaryStorage storage("");
UserDictionaryTest::LoadFromString(kUserDictionary0, &storage);
- dic->Load(storage);
+ dic->Load(storage.user_dictionary_storage_base);
}
TestLookupPrefixHelper(NULL, 0, "start", 4, *dic);
@@ -619,7 +619,7 @@ TEST_F(UserDictionaryTest, AsyncLoadTest
uint64 id = 0;
EXPECT_TRUE(storage.CreateDictionary("test", &id));
UserDictionaryStorage::UserDictionary *dic =
- storage.mutable_dictionaries(0);
+ storage.user_dictionary_storage_base.mutable_dictionaries(0);
for (size_t j = 0; j < 10000; ++j) {
UserDictionaryStorage::UserDictionaryEntry *entry =
dic->add_entries();
@@ -727,12 +727,12 @@ TEST_F(UserDictionaryTest, AddToAutoRegi
{
UserDictionaryStorage storage(filename);
EXPECT_TRUE(storage.Load());
- EXPECT_EQ(1, storage.dictionaries_size());
- EXPECT_EQ(1, storage.dictionaries(0).entries_size());
- EXPECT_EQ("key", storage.dictionaries(0).entries(0).key());
- EXPECT_EQ("value", storage.dictionaries(0).entries(0).value());
+ EXPECT_EQ(1, storage.user_dictionary_storage_base.dictionaries_size());
+ EXPECT_EQ(1, storage.user_dictionary_storage_base.dictionaries(0).entries_size());
+ EXPECT_EQ("key", storage.user_dictionary_storage_base.dictionaries(0).entries(0).key());
+ EXPECT_EQ("value", storage.user_dictionary_storage_base.dictionaries(0).entries(0).value());
EXPECT_EQ(user_dictionary::UserDictionary::NOUN,
- storage.dictionaries(0).entries(0).pos());
+ storage.user_dictionary_storage_base.dictionaries(0).entries(0).pos());
}
}
@@ -751,7 +751,7 @@ TEST_F(UserDictionaryTest, TestSuppressi
uint64 id = 0;
EXPECT_TRUE(storage.CreateDictionary("test", &id));
UserDictionaryStorage::UserDictionary *dic =
- storage.mutable_dictionaries(0);
+ storage.user_dictionary_storage_base.mutable_dictionaries(0);
for (size_t j = 0; j < 10000; ++j) {
UserDictionaryStorage::UserDictionaryEntry *entry =
dic->add_entries();
@@ -775,7 +775,7 @@ TEST_F(UserDictionaryTest, TestSuppressi
suppression_dictionary_->Lock();
EXPECT_TRUE(suppression_dictionary_->IsLocked());
- user_dic->Load(storage);
+ user_dic->Load(storage.user_dictionary_storage_base);
EXPECT_FALSE(suppression_dictionary_->IsLocked());
for (size_t j = 0; j < 10; ++j) {
@@ -787,11 +787,11 @@ TEST_F(UserDictionaryTest, TestSuppressi
// Remove suppression entry
{
- storage.Clear();
+ storage.user_dictionary_storage_base.Clear();
uint64 id = 0;
EXPECT_TRUE(storage.CreateDictionary("test", &id));
UserDictionaryStorage::UserDictionary *dic =
- storage.mutable_dictionaries(0);
+ storage.user_dictionary_storage_base.mutable_dictionaries(0);
for (size_t j = 0; j < 10000; ++j) {
UserDictionaryStorage::UserDictionaryEntry *entry =
dic->add_entries();
@@ -803,7 +803,7 @@ TEST_F(UserDictionaryTest, TestSuppressi
}
suppression_dictionary_->Lock();
- user_dic->Load(storage);
+ user_dic->Load(storage.user_dictionary_storage_base);
EXPECT_FALSE(suppression_dictionary_->IsLocked());
for (size_t j = 0; j < 10; ++j) {
@@ -830,7 +830,7 @@ TEST_F(UserDictionaryTest, TestSuggestio
uint64 id = 0;
EXPECT_TRUE(storage.CreateDictionary("test", &id));
UserDictionaryStorage::UserDictionary *dic =
- storage.mutable_dictionaries(0);
+ storage.user_dictionary_storage_base.mutable_dictionaries(0);
for (size_t j = 0; j < 10; ++j) {
UserDictionaryStorage::UserDictionaryEntry *entry =
@@ -850,7 +850,7 @@ TEST_F(UserDictionaryTest, TestSuggestio
entry->set_pos(user_dictionary::UserDictionary::SUGGESTION_ONLY);
}
- user_dic->Load(storage);
+ user_dic->Load(storage.user_dictionary_storage_base);
}
{
@@ -883,7 +883,7 @@ TEST_F(UserDictionaryTest, TestUsageStat
UserDictionaryStorage storage("");
{
- UserDictionaryStorage::UserDictionary *dic1 = storage.add_dictionaries();
+ UserDictionaryStorage::UserDictionary *dic1 = storage.user_dictionary_storage_base.add_dictionaries();
CHECK(dic1);
UserDictionaryStorage::UserDictionaryEntry *entry;
entry = dic1->add_entries();
@@ -898,7 +898,7 @@ TEST_F(UserDictionaryTest, TestUsageStat
entry->set_pos(user_dictionary::UserDictionary::NOUN);
}
{
- UserDictionaryStorage::UserDictionary *dic2 = storage.add_dictionaries();
+ UserDictionaryStorage::UserDictionary *dic2 = storage.user_dictionary_storage_base.add_dictionaries();
CHECK(dic2);
UserDictionaryStorage::UserDictionaryEntry *entry;
entry = dic2->add_entries();
@@ -917,7 +917,7 @@ TEST_F(UserDictionaryTest, TestUsageStat
entry->set_value("value5");
entry->set_pos(user_dictionary::UserDictionary::NOUN);
}
- dic->Load(storage);
+ dic->Load(storage.user_dictionary_storage_base);
EXPECT_INTEGER_STATS("UserRegisteredWord", 5);
}
@@ -930,7 +930,7 @@ TEST_F(UserDictionaryTest, LookupComment
{
UserDictionaryStorage storage("");
UserDictionaryTest::LoadFromString(kUserDictionary0, &storage);
- dic->Load(storage);
+ dic->Load(storage.user_dictionary_storage_base);
}
// Entry is in user dictionary but has no comment.

View file

@ -1,12 +1,12 @@
$NetBSD: patch-gui_config__dialog_config__dialog.cc,v 1.6 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-gui_config__dialog_config__dialog.cc,v 1.7 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- gui/config_dialog/config_dialog.cc.orig 2016-05-15 08:11:11.000000000 +0000
--- gui/config_dialog/config_dialog.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ gui/config_dialog/config_dialog.cc
@@ -100,21 +100,21 @@ ConfigDialog::ConfigDialog()
setWindowTitle(tr("Mozc Preferences"));
#endif // OS_MACOSX
@@ -104,21 +104,21 @@ ConfigDialog::ConfigDialog()
setWindowTitle(tr("%1 Preferences").arg(GuiUtil::ProductName()));
#endif // __APPLE__
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_NETBSD)
@ -16,7 +16,7 @@ $NetBSD: patch-gui_config__dialog_config__dialog.cc,v 1.6 2017/12/17 14:15:43 ts
-#endif // OS_LINUX
+#endif // OS_LINUX || OS_NETBSD
#ifdef NO_LOGGING
#ifdef MOZC_NO_LOGGING
// disable logging options
miscLoggingWidget->setVisible(false);
@ -27,10 +27,10 @@ $NetBSD: patch-gui_config__dialog_config__dialog.cc,v 1.6 2017/12/17 14:15:43 ts
configDialogTabWidget->removeTab(kMiscTabIndex);
-#endif // OS_LINUX
+#endif // OS_LINUX || OS_NETBSD
#endif // NO_LOGGING
#endif // MOZC_NO_LOGGING
#ifndef ENABLE_CLOUD_HANDWRITING
@@ -324,7 +324,7 @@ ConfigDialog::ConfigDialog()
suggestionsSizeSpinBox->setRange(1, 9);
@@ -280,7 +280,7 @@ ConfigDialog::ConfigDialog()
dictionaryPreloadingAndUACLabel->setVisible(false);
#endif // OS_WIN
@ -39,12 +39,12 @@ $NetBSD: patch-gui_config__dialog_config__dialog.cc,v 1.6 2017/12/17 14:15:43 ts
// On Linux, disable all fields for UsageStats
usageStatsLabel->setEnabled(false);
usageStatsLabel->setVisible(false);
@@ -334,7 +334,7 @@ ConfigDialog::ConfigDialog()
@@ -290,7 +290,7 @@ ConfigDialog::ConfigDialog()
usageStatsMessage->setVisible(false);
usageStatsCheckBox->setEnabled(false);
usageStatsCheckBox->setVisible(false);
-#endif // OS_LINUX
+#endif // OS_LINUX || OS_NETBSD
Reload();
GuiUtil::ReplaceWidgetLabels(this);

View file

@ -1,37 +1,19 @@
$NetBSD: patch-gui_config__dialog_keybinding__editor.cc,v 1.3 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-gui_config__dialog_keybinding__editor.cc,v 1.4 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- gui/config_dialog/keybinding_editor.cc.orig 2017-11-02 13:32:47.000000000 +0000
--- gui/config_dialog/keybinding_editor.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ gui/config_dialog/keybinding_editor.cc
@@ -37,7 +37,7 @@
#include <windows.h>
#include <imm.h>
#include <ime.h>
-#elif OS_LINUX
+#elif defined(OS_LINUX) || defined(OS_NETBSD)
#define XK_MISCELLANY
#include <X11/keysymdef.h>
#endif
@@ -128,7 +128,7 @@ const WinVirtualKeyEntry kWinVirtualKeyM
{ VK_DBE_DBCSCHAR, "Hankaku/Zenkaku" }, // Zenkaku/hankaku
// { VK_KANJI, "Kanji" }, // Do not support Kanji
};
-#elif OS_LINUX
+#elif defined(OS_LINUX) || defined(OS_NETBSD)
struct LinuxVirtualKeyEntry {
uint16 virtual_key;
const char *mozc_key_name;
@@ -397,7 +397,7 @@ KeyBindingFilter::KeyState KeyBindingFil
@@ -381,7 +381,7 @@ KeyBindingFilter::KeyState KeyBindingFil
return Encode(result);
}
}
-#elif OS_LINUX
+#elif defined(OS_LINUX) || defined(OS_NETBSD)
const uint16 virtual_key = key_event.nativeVirtualKey();
// The XKB defines three types of logical key code: "xkb::Hiragana",
@@ -507,7 +507,7 @@ bool KeyBindingFilter::eventFilter(QObje
// "xkb::Katakana" and "xkb::Hiragana_Katakana".
// On most of Linux distributions, any key event against physical
@@ -478,7 +478,7 @@ bool KeyBindingFilter::eventFilter(QObje
KeyBindingEditor::KeyBindingEditor(QWidget *parent, QWidget *trigger_parent)
: QDialog(parent), trigger_parent_(trigger_parent) {
setupUi(this);

View file

@ -1,28 +1,19 @@
$NetBSD: patch-gui_word__register__dialog_word__register__dialog.cc,v 1.5 2020/06/19 05:45:30 taca Exp $
$NetBSD: patch-gui_word__register__dialog_word__register__dialog.cc,v 1.6 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
* Fix from https://github.com/google/mozc/issues/460
--- gui/word_register_dialog/word_register_dialog.cc.orig 2017-11-02 13:32:47.000000000 +0000
--- gui/word_register_dialog/word_register_dialog.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ gui/word_register_dialog/word_register_dialog.cc
@@ -90,9 +90,9 @@ QString GetEnv(const char *envname) {
@@ -97,9 +97,9 @@ QString GetEnv(const char *envname) {
}
return "";
return QLatin1String("");
#endif // OS_WIN
-#if defined(OS_MACOSX) || defined(OS_LINUX)
+#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_NETBSD)
return ::getenv(envname);
-#endif // OS_MACOSX or OS_LINUX
+#endif // OS_MACOSX, OS_LINUX or OS_NETBSD
-#if defined(__APPLE__) || defined(OS_LINUX)
+#if defined(__APPLE__) || defined(OS_LINUX) || defined(OS_NETBSD)
return QString::fromUtf8(::getenv(envname));
-#endif // __APPLE__ or OS_LINUX
+#endif // __APPLE__ or OS_LINUX or OS_NETBSD
// TODO(team): Support other platforms.
return "";
return QLatin1String("");
}
@@ -301,7 +301,7 @@ WordRegisterDialog::ErrorCode WordRegist
}
UserDictionary *dic =
- session_->mutable_storage()->mutable_dictionaries(index);
+ session_->mutable_storage()->user_dictionary_storage_base.mutable_dictionaries(index);
CHECK(dic);
if (dic->name() != DictionarycomboBox->currentText().toStdString()) {

View file

@ -1,10 +1,10 @@
$NetBSD: patch-gyp_common.gypi,v 1.9 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-gyp_common.gypi,v 1.10 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- gyp/common.gypi.orig 2017-11-02 13:32:47.000000000 +0000
--- gyp/common.gypi.orig 2021-02-15 05:04:33.000000000 +0000
+++ gyp/common.gypi
@@ -88,6 +88,12 @@
@@ -93,6 +93,13 @@
'-fstack-protector',
'--param=ssp-buffer-size=4',
],
@ -12,25 +12,26 @@ $NetBSD: patch-gyp_common.gypi,v 1.9 2017/12/17 14:15:43 tsutsui Exp $
+ 'netbsd_cflags': [
+ '<@(gcc_cflags)',
+ '-fPIC',
+ '-D_NETBSD_SOURCE',
+ '-fno-exceptions',
+ ],
# nacl_cflags will be used for NaCl.
# -fno-omit-frame-pointer flag does not work correctly.
# http://code.google.com/p/chromium/issues/detail?id=122623
@@ -133,6 +139,12 @@
# mac_cflags will be used in Mac.
# Xcode 4.5 which we are currently using does not support ssp-buffer-size.
# TODO(horo): When we can use Xcode 4.6 which supports ssp-buffer-size,
@@ -128,6 +135,12 @@
'compiler_host': 'clang',
'compiler_host_version_int': 304, # Clang 3.4 or higher
}],
+ ['target_platform=="NetBSD"', {
+ 'compiler_target': 'gcc',
+ 'compiler_target_version_int': 409, # GCC 4.9 or higher
+ 'compiler_host': 'clang',
+ 'compiler_host_version_int': 304, # Clang 3.4 or higher
+ 'compiler_host': 'gcc',
+ 'compiler_host_version_int': 409, # GCC 4.9 or higher
+ }],
],
},
'target_defaults': {
@@ -371,6 +383,24 @@
@@ -318,6 +331,24 @@
}],
],
}],
@ -54,11 +55,11 @@ $NetBSD: patch-gyp_common.gypi,v 1.9 2017/12/17 14:15:43 tsutsui Exp $
+ }],
['OS=="mac"', {
'defines': [
'OS_MACOSX',
@@ -442,7 +472,7 @@
['READELF.host', '<!(which readelf)'],
],
}],
'__APPLE__',
@@ -410,7 +441,7 @@
],
},
'conditions': [
- ['target_platform=="Linux"', {
+ ['target_platform=="Linux" or target_platform=="NetBSD"', {
'make_global_settings': [

View file

@ -1,10 +1,8 @@
$NetBSD: patch-gyp_directories.gypi,v 1.1 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-gyp_directories.gypi,v 1.2 2021/02/15 14:50:23 ryoon Exp $
* use ${PREFIX} paths
--- gyp/directories.gypi.orig 2017-11-02 13:32:47.000000000 +0000
--- gyp/directories.gypi.orig 2021-02-15 05:04:33.000000000 +0000
+++ gyp/directories.gypi
@@ -42,7 +42,7 @@
@@ -43,7 +43,7 @@
# server_dir represents the directory where mozc_server is
# installed. This option is only for Linux.
@ -13,12 +11,3 @@ $NetBSD: patch-gyp_directories.gypi,v 1.1 2017/12/17 14:15:43 tsutsui Exp $
# Represents the directory where the source code of protobuf is
# extracted. This value is ignored when 'use_libprotobuf' is 1.
@@ -85,7 +85,7 @@
# Win / Mac / Linux:
# this file path is directory used by binaries without copying.
'zinnia_model_file%':
- '/usr/share/tegaki/models/zinnia/handwriting-ja.model',
+ '@PREFIX@/share/tegaki/models/zinnia/handwriting-ja.model',
}],
],
},

View file

@ -1,15 +0,0 @@
$NetBSD: patch-handwriting_zinnia.gyp,v 1.3 2017/12/17 14:15:43 tsutsui Exp $
* NetBSD support
--- handwriting/zinnia.gyp.orig 2017-11-02 13:32:47.000000000 +0000
+++ handwriting/zinnia.gyp
@@ -88,7 +88,7 @@
'ZINNIA_STATIC_LIBRARY',
],
}],
- ['target_platform=="Linux" or target_platform=="Mac"', {
+ ['target_platform=="Linux" or target_platform=="Mac" or target_platform=="NetBSD"', {
'defines': [
'HAVE_CONFIG_H=1'
],

View file

@ -1,15 +0,0 @@
$NetBSD: patch-handwriting_zinnia__handwriting.cc,v 1.4 2017/12/17 14:15:43 tsutsui Exp $
* Not confirmed yet.
--- handwriting/zinnia_handwriting.cc.orig 2017-11-02 13:32:47.000000000 +0000
+++ handwriting/zinnia_handwriting.cc
@@ -59,7 +59,7 @@ string ZinniaHandwriting::GetModelFileNa
const char kModelFile[] = "handwriting-ja.model";
return FileUtil::JoinPath(MacUtil::GetResourcesDirectory(), kModelFile);
#else // OS_LINUX
- return "/usr/share/tegaki/models/zinnia/handwriting-ja.model";
+ return "@PREFIX@/tegaki/models/zinnia/handwriting-ja.model";
#endif
#endif // else defined(MOZC_BUILD)
}

View file

@ -1,11 +1,11 @@
$NetBSD: patch-ipc_ipc__path__manager.cc,v 1.5 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-ipc_ipc__path__manager.cc,v 1.6 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- ipc/ipc_path_manager.cc.orig 2014-01-06 07:10:26.000000000 +0000
--- ipc/ipc_path_manager.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ ipc/ipc_path_manager.cc
@@ -44,6 +44,11 @@
#endif // OS_MACOSX
@@ -53,6 +53,11 @@
#endif // __APPLE__
#endif // OS_WIN
+#if defined(OS_NETBSD)
@ -16,7 +16,7 @@ $NetBSD: patch-ipc_ipc__path__manager.cc,v 1.5 2017/12/17 14:15:43 tsutsui Exp $
#include <cstdlib>
#include <map>
#ifdef OS_WIN
@@ -407,6 +412,23 @@ bool IPCPathManager::IsValidServer(uint3
@@ -425,6 +430,23 @@ bool IPCPathManager::IsValidServer(uint3
return true;
}

View file

@ -1,13 +1,13 @@
$NetBSD: patch-ipc_named__event.cc,v 1.1 2013/04/29 09:52:17 ryoon Exp $
$NetBSD: patch-ipc_named__event.cc,v 1.2 2021/02/15 14:50:23 ryoon Exp $
* sem_open(..., 0) is not supported for NetBSD at least.
--- ipc/named_event.cc.orig 2012-08-31 05:37:07.000000000 +0000
--- ipc/named_event.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ ipc/named_event.cc
@@ -337,7 +337,7 @@ int NamedEventListener::WaitEventOrProce
NamedEventNotifier::NamedEventNotifier(const char *name)
: sem_(SEM_FAILED) {
const string key_filename = NamedEventUtil::GetEventPath(name);
@@ -325,7 +325,7 @@ int NamedEventListener::WaitEventOrProce
NamedEventNotifier::NamedEventNotifier(const char *name) : sem_(SEM_FAILED) {
const std::string key_filename = NamedEventUtil::GetEventPath(name);
- sem_ = ::sem_open(key_filename.c_str(), 0);
+ sem_ = ::sem_open(key_filename.c_str(), O_CREAT);
if (sem_ == SEM_FAILED) {

View file

@ -1,19 +1,19 @@
$NetBSD: patch-ipc_unix__ipc.cc,v 1.5 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-ipc_unix__ipc.cc,v 1.6 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- ipc/unix_ipc.cc.orig 2016-05-15 08:11:11.000000000 +0000
--- ipc/unix_ipc.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ ipc/unix_ipc.cc
@@ -28,7 +28,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OS_LINUX only. Note that OS_ANDROID/OS_NACL don't reach here.
// OS_LINUX only. Note that OS_ANDROID/OS_WASM don't reach here.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_NETBSD)
#include "ipc/ipc.h"
@@ -127,7 +127,7 @@ bool IsPeerValid(int socket, pid_t *pid)
#include <arpa/inet.h>
#include <fcntl.h>
@@ -125,7 +125,7 @@ bool IsPeerValid(int socket, pid_t *pid)
// sometimes doesn't support the getsockopt(sock, SOL_SOCKET, SO_PEERCRED)
// system call.
// TODO(yusukes): Add implementation for ARM Linux.
@ -22,7 +22,7 @@ $NetBSD: patch-ipc_unix__ipc.cc,v 1.5 2017/12/17 14:15:43 tsutsui Exp $
struct ucred peer_cred;
int peer_cred_len = sizeof(peer_cred);
if (getsockopt(socket, SOL_SOCKET, SO_PEERCRED,
@@ -143,7 +143,23 @@ bool IsPeerValid(int socket, pid_t *pid)
@@ -141,7 +141,23 @@ bool IsPeerValid(int socket, pid_t *pid)
}
*pid = peer_cred.pid;
@ -47,3 +47,9 @@ $NetBSD: patch-ipc_unix__ipc.cc,v 1.5 2017/12/17 14:15:43 tsutsui Exp $
return true;
}
@@ -468,4 +484,4 @@ void IPCServer::Terminate() { server_thr
} // namespace mozc
-#endif // OS_LINUX
+#endif // OS_LINUX || OS_NETBSD

View file

@ -1,15 +0,0 @@
$NetBSD: patch-net_net.gyp,v 1.2 2017/12/17 14:15:43 tsutsui Exp $
* NetBSD support
--- net/net.gyp.orig 2017-11-02 13:32:47.000000000 +0000
+++ net/net.gyp
@@ -64,7 +64,7 @@
},
},
}],
- ['target_platform=="Linux"', {
+ ['target_platform=="Linux" or target_platform=="NetBSD"', {
# Enable libcurl
'cflags': [
'<!@(pkg-config --cflags libcurl)',

View file

@ -1,78 +0,0 @@
$NetBSD: patch-prediction_user__history__predictor.cc,v 1.2 2020/06/19 05:45:30 taca Exp $
- Apply a patch from the upstream pull request #424:
https://github.com/google/mozc/pull/424/files
- Fix from https://github.com/google/mozc/issues/460
--- prediction/user_history_predictor.cc.orig 2017-11-02 13:32:47.000000000 +0000
+++ prediction/user_history_predictor.cc
@@ -298,23 +298,23 @@ bool UserHistoryStorage::Load() {
return false;
}
- if (!ParseFromString(input)) {
+ if (!user_history_base.ParseFromString(input)) {
LOG(ERROR) << "ParseFromString failed. message looks broken";
return false;
}
- VLOG(1) << "Loaded user histroy, size=" << entries_size();
+ VLOG(1) << "Loaded user histroy, size=" << user_history_base.entries_size();
return true;
}
bool UserHistoryStorage::Save() const {
- if (entries_size() == 0) {
+ if (user_history_base.entries_size() == 0) {
LOG(WARNING) << "etries size is 0. Not saved";
return false;
}
string output;
- if (!AppendToString(&output)) {
+ if (!user_history_base.AppendToString(&output)) {
LOG(ERROR) << "AppendToString failed";
return false;
}
@@ -501,12 +501,12 @@ bool UserHistoryPredictor::Load() {
return false;
}
- for (size_t i = 0; i < history.entries_size(); ++i) {
- dic_->Insert(EntryFingerprint(history.entries(i)),
- history.entries(i));
+ for (size_t i = 0; i < history.user_history_base.entries_size(); ++i) {
+ dic_->Insert(EntryFingerprint(history.user_history_base.entries(i)),
+ history.user_history_base.entries(i));
}
- VLOG(1) << "Loaded user histroy, size=" << history.entries_size();
+ VLOG(1) << "Loaded user histroy, size=" << history.user_history_base.entries_size();
return true;
}
@@ -528,13 +528,13 @@ bool UserHistoryPredictor::Save() {
UserHistoryStorage history(filename);
for (const DicElement *elm = tail; elm != nullptr; elm = elm->prev) {
- history.add_entries()->CopyFrom(elm->value);
+ history.user_history_base.add_entries()->CopyFrom(elm->value);
}
// Updates usage stats here.
UsageStats::SetInteger(
"UserHistoryPredictorEntrySize",
- static_cast<int>(history.entries_size()));
+ static_cast<int>(history.user_history_base.entries_size()));
if (!history.Save()) {
LOG(ERROR) << "UserHistoryStorage::Save() failed";
@@ -841,7 +841,7 @@ bool UserHistoryPredictor::RomanFuzzyPre
// swap.
if (i + 1 < prefix.size()) {
string swapped_prefix = prefix;
- swap(swapped_prefix[i], swapped_prefix[i + 1]);
+ std::swap(swapped_prefix[i], swapped_prefix[i + 1]);
if (Util::StartsWith(str, swapped_prefix)) {
return true;
}

View file

@ -1,23 +0,0 @@
$NetBSD: patch-prediction_user__history__predictor.h,v 1.1 2020/06/19 05:45:30 taca Exp $
Fix from https://github.com/google/mozc/issues/460
--- prediction/user_history_predictor.h.orig 2017-11-02 13:32:47.000000000 +0000
+++ prediction/user_history_predictor.h
@@ -61,11 +61,15 @@ class Segments;
class UserHistoryPredictorSyncer;
// Added serialization method for UserHistory.
-class UserHistoryStorage : public mozc::user_history_predictor::UserHistory {
+class UserHistoryStorage {
public:
explicit UserHistoryStorage(const string &filename);
~UserHistoryStorage();
+ // Instance of base class generated by Protocol Buffers compiler.
+ // Regular inheritance strongly discouraged.
+ mozc::user_history_predictor::UserHistory user_history_base;
+
// Loads from encrypted file.
bool Load();

View file

@ -1,24 +0,0 @@
$NetBSD: patch-prediction_user__history__predictor__test.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
Fix from https://github.com/google/mozc/issues/460
--- prediction/user_history_predictor_test.cc.orig 2017-11-02 13:32:47.000000000 +0000
+++ prediction/user_history_predictor_test.cc
@@ -2715,7 +2715,7 @@ TEST_F(UserHistoryPredictorTest, UserHis
UserHistoryStorage storage1(filename);
- UserHistoryPredictor::Entry *entry = storage1.add_entries();
+ UserHistoryPredictor::Entry *entry = storage1.user_history_base.add_entries();
CHECK(entry);
entry->set_key("key");
entry->set_key("value");
@@ -2723,7 +2723,7 @@ TEST_F(UserHistoryPredictorTest, UserHis
UserHistoryStorage storage2(filename);
storage2.Load();
- EXPECT_EQ(storage1.DebugString(), storage2.DebugString());
+ EXPECT_EQ(storage1.user_history_base.DebugString(), storage2.user_history_base.DebugString());
FileUtil::Unlink(filename);
}

View file

@ -0,0 +1,24 @@
$NetBSD: patch-renderer_renderer.gyp,v 1.1 2021/02/15 14:50:23 ryoon Exp $
* Support NetBSD.
--- renderer/renderer.gyp.orig 2021-02-15 05:04:33.000000000 +0000
+++ renderer/renderer.gyp
@@ -193,7 +193,7 @@
'win32_renderer_core_test',
],
}],
- ['target_platform=="Linux" and enable_gtk_renderer==1', {
+ ['(target_platform=="Linux" or target_platform=="NetBSD") and enable_gtk_renderer==1', {
'dependencies': [
'gtk_renderer_test',
],
@@ -518,7 +518,7 @@
},
],
}],
- ['target_platform=="Linux" and enable_gtk_renderer==1', {
+ ['(target_platform=="Linux" or target_platform=="NetBSD") and enable_gtk_renderer==1', {
'targets': [
{
# Meta target to set up build environment for gtk+-2.0.

View file

@ -1,24 +0,0 @@
$NetBSD: patch-rewriter_usage__rewriter__test.cc,v 1.1 2020/06/19 05:45:30 taca Exp $
Fix from https://github.com/google/mozc/issues/460
--- rewriter/usage_rewriter_test.cc.orig 2017-11-02 13:32:47.000000000 +0000
+++ rewriter/usage_rewriter_test.cc
@@ -478,7 +478,7 @@ TEST_F(UsageRewriterTest, CommentFromUse
// Load mock data
{
UserDictionaryStorage storage("");
- UserDictionaryStorage::UserDictionary *dic = storage.add_dictionaries();
+ UserDictionaryStorage::UserDictionary *dic = storage.user_dictionary_storage_base.add_dictionaries();
UserDictionaryStorage::UserDictionaryEntry *entry = dic->add_entries();
// key="うま", value="アルパカ", comment="アルパカコメント"
@@ -488,7 +488,7 @@ TEST_F(UsageRewriterTest, CommentFromUse
entry->set_comment("\xE3\x82\xA2\xE3\x83\xAB\xE3\x83\x91\xE3\x82\xAB\xE3"
"\x82\xB3\xE3\x83\xA1\xE3\x83\xB3\xE3\x83\x88");
- user_dictionary_->Load(storage);
+ user_dictionary_->Load(storage.user_dictionary_storage_base);
}
// Emulates the conversion of key="うま".

View file

@ -1,36 +1,36 @@
$NetBSD: patch-session_session.cc,v 1.5 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-session_session.cc,v 1.6 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- session/session.cc.orig 2016-05-15 08:11:12.000000000 +0000
--- session/session.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ session/session.cc
@@ -232,9 +232,9 @@ void Session::InitContext(ImeContext *co
@@ -230,9 +230,9 @@ void Session::InitContext(ImeContext *co
context->SetConfig(&context->GetConfig());
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
#if defined(OS_ANDROID) || defined(OS_IOS) || defined(OS_LINUX) || \
- defined(OS_WASM)
+ defined(OS_WASM) || defined(OS_NETBSD)
context->mutable_converter()->set_use_cascading_window(false);
-#endif // OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#endif // OS_ANDROID || OS_IOS || OS_LINUX || OS_WASM
+#endif // OS_ANDROID || OS_IOS || OS_LINUX || OS_WASM || OS_NETBSD
}
@@ -961,14 +961,14 @@ void Session::UpdatePreferences(commands
config.selection_shortcut());
void Session::PushUndoContext() {
@@ -964,14 +964,14 @@ void Session::UpdatePreferences(commands
}
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
#if defined(OS_ANDROID) || defined(OS_IOS) || defined(OS_LINUX) || \
- defined(OS_WASM)
+ defined(OS_WASM) || defined(OS_NETBSD)
context_->mutable_converter()->set_use_cascading_window(false);
-#else // OS_LINUX || OS_ANDROID || OS_NACL
+#else // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#else // OS_LINUX || OS_ANDROID || OS_WASM
+#else // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
if (config.has_use_cascading_window()) {
context_->mutable_converter()->set_use_cascading_window(
config.use_cascading_window());
}
-#endif // OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#endif // OS_ANDROID || OS_IOS || OS_LINUX || OS_WASM
+#endif // OS_ANDROID || OS_IOS || OS_LINUX || OS_WASM || OS_NETBSD
}
bool Session::IMEOn(commands::Command *command) {

View file

@ -1,71 +1,71 @@
$NetBSD: patch-session_session__test.cc,v 1.3 2017/12/17 14:15:43 tsutsui Exp $
$NetBSD: patch-session_session__test.cc,v 1.4 2021/02/15 14:50:23 ryoon Exp $
* NetBSD support
--- session/session_test.cc.orig 2016-05-15 08:11:12.000000000 +0000
--- session/session_test.cc.orig 2021-02-15 03:48:53.000000000 +0000
+++ session/session_test.cc
@@ -2136,11 +2136,11 @@ TEST_F(SessionTest, UpdatePreferences) {
@@ -1974,11 +1974,11 @@ TEST_F(SessionTest, UpdatePreferences) {
const size_t cascading_cand_size =
command.output().candidates().candidate_size();
-#if defined(OS_LINUX) || defined(OS_ANDROID) || OS_NACL
+#if defined(OS_LINUX) || defined(OS_ANDROID) || OS_NACL || defined(OS_NETBSD)
-#if defined(OS_LINUX) || defined(OS_ANDROID) || OS_WASM
+#if defined(OS_LINUX) || defined(OS_ANDROID) || OS_WASM || defined(OS_NETBSD)
EXPECT_EQ(no_cascading_cand_size, cascading_cand_size);
-#else // defined(OS_LINUX) || defined(OS_ANDROID) || OS_NACL
+#else // defined(OS_LINUX) || defined(OS_ANDROID) || OS_NACL || defined(OS_NETBSD)
-#else // defined(OS_LINUX) || defined(OS_ANDROID) || OS_WASM
+#else // defined(OS_LINUX) || defined(OS_ANDROID) || OS_WASM || defined(OS_NETBSD)
EXPECT_GT(no_cascading_cand_size, cascading_cand_size);
-#endif // defined(OS_LINUX) || defined(OS_ANDROID) || OS_NACL
+#endif // defined(OS_LINUX) || defined(OS_ANDROID) || OS_NACL || defined(OS_NETBSD)
-#endif // defined(OS_LINUX) || defined(OS_ANDROID) || OS_WASM
+#endif // defined(OS_LINUX) || defined(OS_ANDROID) || OS_WASM || defined(OS_NETBSD)
command.Clear();
session->ConvertCancel(&command);
@@ -2330,7 +2330,7 @@ TEST_F(SessionTest, OutputAllCandidateWo
@@ -2149,7 +2149,7 @@ TEST_F(SessionTest, OutputAllCandidateWo
EXPECT_EQ(0, output.all_candidate_words().focused_index());
EXPECT_EQ(commands::CONVERSION, output.all_candidate_words().category());
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM) || defined(OS_NETBSD)
// Cascading window is not supported on Linux, so the size of
// candidate words is different from other platform.
// TODO(komatsu): Modify the client for Linux to explicitly change
@@ -2340,13 +2340,13 @@ TEST_F(SessionTest, OutputAllCandidateWo
@@ -2159,13 +2159,13 @@ TEST_F(SessionTest, OutputAllCandidateWo
// "" (t13n), "" (t13n), "" (t13n),
// "アイウエオ" (t13n) ]
EXPECT_EQ(9, output.all_candidate_words().candidates_size());
-#else // OS_LINUX || OS_ANDROID || OS_NACL
+#else // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#else // OS_LINUX || OS_ANDROID || OS_WASM
+#else // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
// [ "あいうえお", "アイウエオ", "アイウエオ" (t13n), "あいうえお" (t13n),
// "aiueo" (t13n), "AIUEO" (t13n), "Aieuo" (t13n),
// "" (t13n), "" (t13n), "" (t13n),
// "アイウエオ" (t13n) ]
EXPECT_EQ(11, output.all_candidate_words().candidates_size());
-#endif // OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#endif // OS_LINUX || OS_ANDROID || OS_WASM
+#endif // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
}
command.Clear();
@@ -2358,7 +2358,7 @@ TEST_F(SessionTest, OutputAllCandidateWo
@@ -2177,7 +2177,7 @@ TEST_F(SessionTest, OutputAllCandidateWo
EXPECT_EQ(1, output.all_candidate_words().focused_index());
EXPECT_EQ(commands::CONVERSION, output.all_candidate_words().category());
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || defined(OS_NETBSD)
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM)
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM) || defined(OS_NETBSD)
// Cascading window is not supported on Linux, so the size of
// candidate words is different from other platform.
// TODO(komatsu): Modify the client for Linux to explicitly change
@@ -2368,13 +2368,13 @@ TEST_F(SessionTest, OutputAllCandidateWo
@@ -2187,13 +2187,13 @@ TEST_F(SessionTest, OutputAllCandidateWo
// "" (t13n), "" (t13n), "" (t13n),
// "アイウエオ" (t13n) ]
EXPECT_EQ(9, output.all_candidate_words().candidates_size());
-#else // OS_LINUX || OS_ANDROID || OS_NACL
+#else // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#else // OS_LINUX || OS_ANDROID || OS_WASM
+#else // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
// [ "あいうえお", "アイウエオ",
// "aiueo" (t13n), "AIUEO" (t13n), "Aieuo" (t13n),
// "" (t13n), "" (t13n), "" (t13n),
// "アイウエオ" (t13n) ]
EXPECT_EQ(11, output.all_candidate_words().candidates_size());
-#endif // OS_LINUX || OS_ANDROID || OS_NACL
+#endif // OS_LINUX || OS_ANDROID || OS_NACL || OS_NETBSD
-#endif // OS_LINUX || OS_ANDROID || OS_WASM
+#endif // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
}
}

View file

@ -0,0 +1,15 @@
$NetBSD: patch-third__party_abseil-cpp_absl_base_config.h,v 1.1 2021/02/15 14:50:23 ryoon Exp $
* Support NetBSD.
--- third_party/abseil-cpp/absl/base/config.h.orig 2021-02-15 05:04:34.000000000 +0000
+++ third_party/abseil-cpp/absl/base/config.h
@@ -364,7 +364,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMES
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__ros__) || defined(__native_client__) || defined(__asmjs__) || \
defined(__wasm__) || defined(__Fuchsia__) || defined(__sun) || \
- defined(__ASYLO__)
+ defined(__ASYLO__) || defined(__NetBSD__)
#define ABSL_HAVE_MMAP 1
#endif

View file

@ -1,7 +1,6 @@
# $NetBSD: Makefile,v 1.58 2020/11/05 09:08:31 ryoon Exp $
# $NetBSD: Makefile,v 1.59 2021/02/15 14:50:23 ryoon Exp $
PKGNAME= ${DISTNAME:S/mozc-/mozc-tool-/}
PKGREVISION= 27
INSTALLATION_DIRS+= libexec