pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/inputmethod/fcitx5-mozc



Module Name:    pkgsrc
Committed By:   ryoon
Date:           Wed Feb 17 15:29:52 UTC 2021

Added Files:
        pkgsrc/inputmethod/fcitx5-mozc: DESCR Makefile Makefile.common PLIST
            distinfo
        pkgsrc/inputmethod/fcitx5-mozc/patches:
            patch-.._scripts_install__fcitx5
            patch-.._scripts_install__fcitx5__icons patch-2.26.4282.100
            patch-base_base.gyp patch-base_clock.cc patch-base_cpu__stats.cc
            patch-base_logging.cc patch-base_mutex.cc
            patch-base_password__manager.cc patch-base_port.h
            patch-base_process.cc patch-base_run__level.cc
            patch-base_system__util.cc patch-base_thread.cc
            patch-build__mozc.py patch-build__tools_mozc__version.py
            patch-build__tools_util.py patch-client_client.cc patch-config.bzl
            patch-config_stats__config__util__test.cc
            patch-gui_config__dialog_config__dialog.cc
            patch-gui_config__dialog_keybinding__editor.cc
            patch-gui_dictionary__tool_dictionary__tool.cc
            patch-gui_qt__libraries.gypi patch-gui_qt__moc.gypi
            patch-gui_qt__rcc.gypi patch-gui_qt__uic.gypi
            patch-gui_word__register__dialog_word__register__dialog.cc
            patch-gyp_common.gypi patch-gyp_directories.gypi
            patch-ipc_ipc__path__manager.cc
            patch-ipc_ipc__path__manager__test.cc patch-ipc_named__event.cc
            patch-ipc_unix__ipc.cc patch-renderer_renderer.gyp
            patch-session_session.cc patch-session_session__test.cc
            patch-third__party_abseil-cpp_absl_base_config.h
            patch-third__party_protobuf_post__process__dist.sh
            patch-unix_ibus_ibus.gyp patch-unix_ibus_path__util.cc

Log Message:
inputmethod/fcitx5-mozc: import fcitx5-mozc-2.26.4276.100

Mozc Japanese inputmethod for Fcitx5.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/inputmethod/fcitx5-mozc/DESCR \
    pkgsrc/inputmethod/fcitx5-mozc/Makefile \
    pkgsrc/inputmethod/fcitx5-mozc/Makefile.common \
    pkgsrc/inputmethod/fcitx5-mozc/PLIST \
    pkgsrc/inputmethod/fcitx5-mozc/distinfo
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-.._scripts_install__fcitx5 \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-.._scripts_install__fcitx5__icons \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-2.26.4282.100 \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_base.gyp \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_clock.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_cpu__stats.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_logging.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_mutex.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_password__manager.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_port.h \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_process.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_run__level.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_system__util.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_thread.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-build__mozc.py \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-build__tools_mozc__version.py \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-build__tools_util.py \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-client_client.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-config.bzl \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-config_stats__config__util__test.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_config__dialog_config__dialog.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_config__dialog_keybinding__editor.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_dictionary__tool_dictionary__tool.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__libraries.gypi \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__moc.gypi \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__rcc.gypi \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__uic.gypi \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_word__register__dialog_word__register__dialog.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gyp_common.gypi \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gyp_directories.gypi \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_ipc__path__manager.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_ipc__path__manager__test.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_named__event.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_unix__ipc.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-renderer_renderer.gyp \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-session_session.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-session_session__test.cc \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-third__party_abseil-cpp_absl_base_config.h \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-third__party_protobuf_post__process__dist.sh \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-unix_ibus_ibus.gyp \
    pkgsrc/inputmethod/fcitx5-mozc/patches/patch-unix_ibus_path__util.cc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/inputmethod/fcitx5-mozc/DESCR
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/DESCR:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/DESCR        Wed Feb 17 15:29:51 2021
@@ -0,0 +1 @@
+Mozc Japanese inputmethod for Fcitx5.
Index: pkgsrc/inputmethod/fcitx5-mozc/Makefile
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/Makefile:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/Makefile     Wed Feb 17 15:29:51 2021
@@ -0,0 +1,38 @@
+# $NetBSD: Makefile,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+PKGNAME=       ${DISTNAME:S/fcitx-/fcitx5-/}
+
+INSTALLATION_DIRS+=    lib/fcitx5
+INSTALLATION_DIRS+=    share/fcitx5/addon
+INSTALLATION_DIRS+=    share/fcitx5/inputmethod
+.for lang in ca da de he ja ko ru zh_CN zh_TW
+INSTALLATION_DIRS+=    share/locale/${lang}/LC_MESSAGES
+.endfor
+INSTALLATION_DIRS+=    share/metainfo
+.for size in 128x128 32x32 48x48
+INSTALLATION_DIRS+=    share/icons/hicolor/${size}/apps
+.endfor
+
+USE_TOOLS+=    bash
+
+DEPENDS+=      xdg-utils-[0-9]*:../../misc/xdg-utils
+DEPENDS+=      mozc-server-[0-9]*:../../inputmethod/mozc-server
+DEPENDS+=      mozc-tool-[0-9]*:../../inputmethod/mozc-tool
+
+pre-configure:
+       # Do not fail by fcitx4 is not found.
+       ${RM} ${WRKSRC}/unix/fcitx/fcitx.gyp
+
+do-build:
+       cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
+               ${PYTHONBIN} build_mozc.py build -c ${MOZC_BUILD_MODE} \
+                       unix/fcitx5/fcitx5.gyp:fcitx5-mozc
+
+do-install:
+       cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${INSTALL_ENV} \
+               OSDEST=${OSDEST} _bldtype=${MOZC_BUILD_MODE} \
+               ${BASH} ../scripts/install_fcitx5
+
+.include "../../inputmethod/fcitx5/buildlink3.mk"
+.include "../../inputmethod/fcitx5-mozc/Makefile.common"
+.include "../../graphics/hicolor-icon-theme/buildlink3.mk"
Index: pkgsrc/inputmethod/fcitx5-mozc/Makefile.common
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/Makefile.common:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/Makefile.common      Wed Feb 17 15:29:51 2021
@@ -0,0 +1,80 @@
+# $NetBSD: Makefile.common,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+# used by inputmethod/fcitx-mozc/Makefile
+#
+
+# Find version number in src/data/version/mozc_version_template.bzl
+DISTNAME=      fcitx-mozc-2.26.4276.100
+CATEGORIES=    inputmethod
+MASTER_SITES=  ${MASTER_SITE_LOCAL}
+EXTRACT_SUFX=  .tar.xz
+
+MAINTAINER=    ryoon%NetBSD.org@localhost
+HOMEPAGE=      https://github.com/fcitx/mozc/
+COMMENT=       Fcitx5 module for Japanese inputmethod Mozc engine
+LICENSE=       modified-bsd
+
+EXTRACT_USING= bsdtar
+WRKSRC=                ${WRKDIR}/${DISTNAME}/src
+
+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++
+
+USE_TOOLS+=    gmake pkg-config
+GCC_REQD+=     4.7     # for c++11
+
+OPENSSL_CFLAGS=                -I${BUILDLINK_PREFIX.openssl}/include
+OPENSSL_INC=           -I${BUILDLINK_PREFIX.openssl}/include
+OPENSSL_LDFLAGS=       -L${BUILDLINK_PREFIX.openssl}/lib -lssl -lcrypto
+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+=      unix/ibus/ibus.gyp
+SUBST_FILES.gyp+=      unix/ibus/path_util.cc
+SUBST_VARS.gyp+=       OPENSSL_CFLAGS OPENSSL_INC OPENSSL_LDFLAGS OPENSSL_LIBS
+SUBST_VARS.gyp+=       PREFIX
+
+# To disable flock(1) in link stage.
+ALL_ENV+=      LINK=${CXX}
+
+.include "../../mk/bsd.prefs.mk"
+
+OPSYSVARS+=    OSDEST
+OSDEST.Linux=  linux
+OSDEST.NetBSD= bsd
+
+MOZC_BUILD_MODE=       Release # or Debug
+
+# In file included from src/dictionary/system/system_dictionary.h:43:0,
+#                  from ../../dictionary/system/system_dictionary.cc:47:
+# src/dictionary/system/key_expansion_table.h: In member function 'const mozc::dictionary::ExpandedKey mozc::dictionary::KeyExpansionTable::ExpandKey(char) const':
+# src/dictionary/system/key_expansion_table.h:83:34: error: array subscript has type 'char' [-Werror=char-subscripts]
+#      return ExpandedKey(table_[key]);
+# Maybe fix this later.
+BUILDLINK_TRANSFORM+=  rm:-Werror=char-subscripts
+
+#              GYP_DEFINES="use_libprotobuf=1"
+do-configure:
+       cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
+               ${PYTHONBIN} build_mozc.py \
+               gyp \
+               --gypdir=${LOCALBASE}/bin
+
+.include "../../devel/glib2/buildlink3.mk"
+#.include "../../devel/protobuf/buildlink3.mk"
+# gmock is not used yet...
+#.include "../../devel/gmock/buildlink3.mk"
+.include "../../inputmethod/zinnia/buildlink3.mk"
+.include "../../www/curl/buildlink3.mk"
+.include "../../x11/gtk2/buildlink3.mk"
+.include "../../x11/qt5-qtbase/buildlink3.mk"
+
+.include "../../lang/python/tool.mk"
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/inputmethod/fcitx5-mozc/PLIST
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/PLIST:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/PLIST        Wed Feb 17 15:29:51 2021
@@ -0,0 +1,36 @@
+@comment $NetBSD: PLIST,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+lib/fcitx5/fcitx5-mozc.so
+share/fcitx5/addon/mozc.conf
+share/fcitx5/inputmethod/mozc.conf
+share/icons/hicolor/128x128/apps/fcitx-mozc.png
+share/icons/hicolor/128x128/apps/org.fcitx.Fcitx5.fcitx-mozc.png
+share/icons/hicolor/32x32/apps/fcitx-mozc.png
+share/icons/hicolor/32x32/apps/org.fcitx.Fcitx5.fcitx-mozc.png
+share/icons/hicolor/48x48/apps/fcitx-mozc-alpha-full.png
+share/icons/hicolor/48x48/apps/fcitx-mozc-alpha-half.png
+share/icons/hicolor/48x48/apps/fcitx-mozc-dictionary.png
+share/icons/hicolor/48x48/apps/fcitx-mozc-direct.png
+share/icons/hicolor/48x48/apps/fcitx-mozc-hiragana.png
+share/icons/hicolor/48x48/apps/fcitx-mozc-katakana-full.png
+share/icons/hicolor/48x48/apps/fcitx-mozc-katakana-half.png
+share/icons/hicolor/48x48/apps/fcitx-mozc-properties.png
+share/icons/hicolor/48x48/apps/fcitx-mozc-tool.png
+share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-alpha-full.png
+share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-alpha-half.png
+share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-dictionary.png
+share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-direct.png
+share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-hiragana.png
+share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-katakana-full.png
+share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-katakana-half.png
+share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-properties.png
+share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-tool.png
+share/locale/ca/LC_MESSAGES/fcitx5-mozc.mo
+share/locale/da/LC_MESSAGES/fcitx5-mozc.mo
+share/locale/de/LC_MESSAGES/fcitx5-mozc.mo
+share/locale/he/LC_MESSAGES/fcitx5-mozc.mo
+share/locale/ja/LC_MESSAGES/fcitx5-mozc.mo
+share/locale/ko/LC_MESSAGES/fcitx5-mozc.mo
+share/locale/ru/LC_MESSAGES/fcitx5-mozc.mo
+share/locale/zh_CN/LC_MESSAGES/fcitx5-mozc.mo
+share/locale/zh_TW/LC_MESSAGES/fcitx5-mozc.mo
+share/metainfo/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml
Index: pkgsrc/inputmethod/fcitx5-mozc/distinfo
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/distinfo:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/distinfo     Wed Feb 17 15:29:51 2021
@@ -0,0 +1,47 @@
+$NetBSD: distinfo,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+SHA1 (fcitx-mozc-2.26.4276.100.tar.xz) = d9b245a065a317b196816ff41cf52fc2fe3ff728
+RMD160 (fcitx-mozc-2.26.4276.100.tar.xz) = 1bd5ce4ec04d4be15840651cb570900b3dcb3e01
+SHA512 (fcitx-mozc-2.26.4276.100.tar.xz) = 18a67554a154580aa29b76eafc15456e7b3bbbde56a0d2e2efe9e83e203622108f73fd39704db324512cdf2cf56adedcf8570c1aab35d7379c408c8401c743b6
+Size (fcitx-mozc-2.26.4276.100.tar.xz) = 37170744 bytes
+SHA1 (patch-.._scripts_install__fcitx5) = 860da43f7c3ada65a473604259cf7e4d4a1d0b3e
+SHA1 (patch-.._scripts_install__fcitx5__icons) = 2ee7b5e36131be11192517c57119fe5c2b28d4c4
+SHA1 (patch-2.26.4282.100) = 9d9cd404657afc24f5e280c9db1835b2827182c7
+SHA1 (patch-base_base.gyp) = d8d9abc0da196f0573ad645937812710c7c67746
+SHA1 (patch-base_clock.cc) = bac420650fed0450cf82b5071703a1c60e974a93
+SHA1 (patch-base_cpu__stats.cc) = 9c18fb2543f352951969822e0095f01f0e8d3bcd
+SHA1 (patch-base_logging.cc) = 7ef5fc94744f37dc771684d2f1c218006118ec9e
+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) = 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) = 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) = 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

Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-.._scripts_install__fcitx5
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-.._scripts_install__fcitx5:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-.._scripts_install__fcitx5     Wed Feb 17 15:29:51 2021
@@ -0,0 +1,31 @@
+$NetBSD: patch-.._scripts_install__fcitx5,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+--- ../scripts/install_fcitx5.orig     2021-02-17 12:18:42.000000000 +0000
++++ ../scripts/install_fcitx5
+@@ -1,7 +1,7 @@
+ #!/bin/sh
+ 
+ _bldtype="${_bldtype:-Debug}"
+-PREFIX="${PREFIX:-/usr}"
++PREFIX="${DESTDIR}${PREFIX:-/usr}"
+ 
+ for pofile in unix/fcitx5/po/*.po
+ do
+@@ -9,13 +9,13 @@ do
+     lang=${filename/.po/}
+     mofile=${pofile/.po/.mo}
+     msgfmt $pofile -o $mofile
+-    install -D -m 644 "$mofile" "${PREFIX}/share/locale/$lang/LC_MESSAGES/fcitx5-mozc.mo"
++    install -m 644 "$mofile" "${PREFIX}/share/locale/$lang/LC_MESSAGES/fcitx5-mozc.mo"
+     rm -f $mofile
+ done
+ 
+-install -D -m 755 "out_linux/${_bldtype}/fcitx5-mozc.so" "${PREFIX}/lib/fcitx5/fcitx5-mozc.so"
+-install -D -m 644 unix/fcitx5/mozc-addon.conf "${PREFIX}/share/fcitx5/addon/mozc.conf"
+-install -D -m 644 unix/fcitx5/mozc.conf "${PREFIX}/share/fcitx5/inputmethod/mozc.conf"
++install -m 755 "out_${OSDEST}/${_bldtype}/fcitx5-mozc.so" "${PREFIX}/lib/fcitx5/fcitx5-mozc.so"
++install -m 644 unix/fcitx5/mozc-addon.conf "${PREFIX}/share/fcitx5/addon/mozc.conf"
++install -m 644 unix/fcitx5/mozc.conf "${PREFIX}/share/fcitx5/inputmethod/mozc.conf"
+ 
+ PREFIX="${PREFIX}" ../scripts/install_fcitx5_icons
+ 
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-.._scripts_install__fcitx5__icons
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-.._scripts_install__fcitx5__icons:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-.._scripts_install__fcitx5__icons      Wed Feb 17 15:29:51 2021
@@ -0,0 +1,33 @@
+$NetBSD: patch-.._scripts_install__fcitx5__icons,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+--- ../scripts/install_fcitx5_icons.orig       2021-02-17 12:18:42.000000000 +0000
++++ ../scripts/install_fcitx5_icons
+@@ -2,17 +2,17 @@
+ 
+ PREFIX="${PREFIX:-/usr}"
+ 
+-install -D -m 644 data/images/product_icon_32bpp-128.png "${PREFIX}/share/icons/hicolor/128x128/apps/org.fcitx.Fcitx5.fcitx-mozc.png"
+-install -D -m 644 data/images/unix/ime_product_icon_opensource-32.png "${PREFIX}/share/icons/hicolor/32x32/apps/org.fcitx.Fcitx5.fcitx-mozc.png"
+-install -D -m 644 ../scripts/icons/ui-alpha_full.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-alpha-full.png"
+-install -D -m 644 ../scripts/icons/ui-alpha_half.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-alpha-half.png"
+-install -D -m 644 ../scripts/icons/ui-direct.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-direct.png"
+-install -D -m 644 ../scripts/icons/ui-hiragana.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-hiragana.png"
+-install -D -m 644 ../scripts/icons/ui-katakana_full.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-katakana-full.png"
+-install -D -m 644 ../scripts/icons/ui-katakana_half.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-katakana-half.png"
+-install -D -m 644 ../scripts/icons/ui-dictionary.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-dictionary.png"
+-install -D -m 644 ../scripts/icons/ui-properties.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-properties.png"
+-install -D -m 644 ../scripts/icons/ui-tool.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-tool.png"
++install -m 644 data/images/product_icon_32bpp-128.png "${PREFIX}/share/icons/hicolor/128x128/apps/org.fcitx.Fcitx5.fcitx-mozc.png"
++install -m 644 data/images/unix/ime_product_icon_opensource-32.png "${PREFIX}/share/icons/hicolor/32x32/apps/org.fcitx.Fcitx5.fcitx-mozc.png"
++install -m 644 ../scripts/icons/ui-alpha_full.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-alpha-full.png"
++install -m 644 ../scripts/icons/ui-alpha_half.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-alpha-half.png"
++install -m 644 ../scripts/icons/ui-direct.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-direct.png"
++install -m 644 ../scripts/icons/ui-hiragana.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-hiragana.png"
++install -m 644 ../scripts/icons/ui-katakana_full.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-katakana-full.png"
++install -m 644 ../scripts/icons/ui-katakana_half.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-katakana-half.png"
++install -m 644 ../scripts/icons/ui-dictionary.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-dictionary.png"
++install -m 644 ../scripts/icons/ui-properties.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-properties.png"
++install -m 644 ../scripts/icons/ui-tool.png "${PREFIX}/share/icons/hicolor/48x48/apps/org.fcitx.Fcitx5.fcitx-mozc-tool.png"
+ 
+ ln -sf org.fcitx.Fcitx5.fcitx-mozc.png "${PREFIX}/share/icons/hicolor/128x128/apps/fcitx-mozc.png"
+ ln -sf org.fcitx.Fcitx5.fcitx-mozc.png "${PREFIX}/share/icons/hicolor/32x32/apps/fcitx-mozc.png"
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-2.26.4282.100
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-2.26.4282.100:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-2.26.4282.100  Wed Feb 17 15:29:51 2021
@@ -0,0 +1,12023 @@
+$NetBSD: patch-2.26.4282.100,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* Update to 2.26.4282.100
+
+diff --git android/gen_mozc_drawable.py android/gen_mozc_drawable.py
+index 92e58828a..3b8fc46c1 100644
+--- android/gen_mozc_drawable.py
++++ android/gen_mozc_drawable.py
+@@ -353,7 +353,7 @@ def _ParseStyle(self, node, has_shadow, shader_map):
+     stroke_map = {'style': 'stroke', 'shadow': has_shadow}
+ 
+     # Special warning for font-size.
+-    # Inkscape often unexpectedly converts from sytle to font-size attribute.
++    # Inkscape often unexpectedly converts from style to font-size attribute.
+     if node.get('font-size', ''):
+       logging.warning('font-size attribute is not supported.')
+ 
+diff --git android/gen_touch_event_stats.py android/gen_touch_event_stats.py
+index 2a28ba15d..f38f9b03a 100644
+--- android/gen_touch_event_stats.py
++++ android/gen_touch_event_stats.py
+@@ -112,7 +112,7 @@ def GetAverage(source_value, stats_type):
+       return 0
+     # Cumulative average values are multiplied by 10^7
+     # when usage stats are sent to the log server.
+-    # Here we get original value by dividing the avarage value.
++    # Here we get original value by dividing the average value.
+     return cumulative_average / 1e7 / count
+ 
+   # c.f. usage_stats/usage_stats_uploader.cc
+diff --git base/BUILD base/BUILD
+index 83f5740e4..6dca976f7 100644
+--- base/BUILD
++++ base/BUILD
+@@ -60,7 +60,6 @@ test_suite(
+         ":config_file_stream_test_android",
+         ":cpu_stats_test_android",
+         ":encryptor_test_android",
+-        ":flags_test_android",
+         ":hash_test_android",
+         ":iterator_adapter_test_android",
+         ":logging_test_android",
+@@ -101,7 +100,6 @@ cc_library_mozc(
+         ":const",
+         ":file_stream",
+         ":file_util",
+-        ":flags",
+         ":mmap",
+         ":mutex",
+         ":number_util",
+@@ -122,25 +120,10 @@ cc_library_mozc(
+ 
+ cc_library_mozc(
+     name = "flags",
+-    srcs = ["flags.cc"],
+     hdrs = ["flags.h"],
+     deps = [
+         ":port",
+         "@com_google_absl//absl/flags:flag",
+-    ] + select_mozc(
+-        client = [":singleton"],
+-        default = ["//base"],
+-    ),
+-)
+-
+-cc_test_mozc(
+-    name = "flags_test",
+-    size = "small",
+-    srcs = ["flags_test.cc"],
+-    requires_full_emulation = False,
+-    deps = [
+-        ":flags",
+-        "//testing:gunit_main",
+     ],
+ )
+ 
+@@ -150,16 +133,15 @@ cc_library_mozc(
+     hdrs = ["init_mozc.h"],
+     copts = ["-DMOZC_BUILDTOOL_BUILD"],
+     visibility = ["//:__subpackages__"],
+-    deps = select_mozc(
++    deps = [
++        "@com_google_absl//absl/flags:flag",
++    ] + select_mozc(
+         client = [
+             ":file_util",
+-            ":flags",
+             ":logging",
++            "@com_google_absl//absl/flags:parse",
+         ],
+-        default = [
+-            "//base",
+-            ":flags",
+-        ],
++        default = ["//base"],
+     ),
+ )
+ 
+@@ -168,17 +150,16 @@ cc_library_mozc(
+     srcs = ["init_mozc.cc"],
+     hdrs = ["init_mozc.h"],
+     visibility = ["//:__subpackages__"],
+-    deps = select_mozc(
++    deps = [
++        "@com_google_absl//absl/flags:flag",
++    ] + select_mozc(
+         client = [
+             ":file_util",
+-            ":flags",
+             ":logging",
+             ":system_util",
++            "@com_google_absl//absl/flags:parse",
+         ],
+-        default = [
+-            "//base",
+-            ":flags",
+-        ],
++        default = ["//base"],
+     ),
+ )
+ 
+@@ -227,7 +208,6 @@ cc_library_mozc(
+         client = [
+             ":clock",
+             ":const",
+-            ":flags",
+             ":mutex",
+             ":singleton",
+             "@com_google_absl//absl/strings",
+@@ -236,7 +216,10 @@ cc_library_mozc(
+             "//base",
+             "//base:logging_extensions",
+         ],
+-    ) + [":port"],
++    ) + [
++        ":port",
++        "@com_google_absl//absl/flags:flag",
++    ],
+ )
+ 
+ cc_test_mozc(
+@@ -576,10 +559,10 @@ cc_binary_mozc(
+     deps = [
+         ":double_array_def",
+         ":file_stream",
+-        ":flags",
+         ":init_mozc_buildtool",
+         ":logging",
+         ":util",
++        "@com_google_absl//absl/flags:flag",
+         "//third_party/darts/v0_32",
+     ],
+ )
+@@ -733,10 +716,10 @@ cc_test_mozc(
+     deps = [
+         ":file_stream",
+         ":file_util",
+-        ":flags",
+         ":mmap",
+         ":util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -800,11 +783,11 @@ cc_test_mozc(
+     deps = [
+         ":file_stream",
+         ":file_util",
+-        ":flags",
+         ":logging",
+         ":number_util",
+         ":util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -893,10 +876,10 @@ cc_binary_mozc(
+     name = "process_main",
+     srcs = ["process_main.cc"],
+     deps = [
+-        ":flags",
+         ":init_mozc",
+         ":logging",
+         ":process",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -925,11 +908,11 @@ cc_test_mozc(
+     deps = [
+         "logging",
+         ":file_util",
+-        ":flags",
+         ":process_mutex",
+         ":system_util",
+         ":util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -956,9 +939,9 @@ cc_binary_mozc(
+     name = "run_level_main",
+     srcs = ["run_level_main.cc"],
+     deps = [
+-        ":flags",
+         ":init_mozc",
+         ":run_level",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -1016,9 +999,9 @@ cc_test_mozc(
+     deps = [
+         ":config_file_stream",
+         ":file_util",
+-        ":flags",
+         ":system_util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -1169,10 +1152,10 @@ cc_test_mozc(
+     visibility = ["//visibility:private"],
+     deps = [
+         ":encryptor",
+-        ":flags",
+         ":system_util",
+         ":util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -1183,11 +1166,11 @@ cc_binary_mozc(
+     deps = [
+         ":encryptor",
+         ":file_stream",
+-        ":flags",
+         ":init_mozc",
+         ":logging",
+         ":mmap",
+         ":util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -1198,10 +1181,10 @@ cc_binary_mozc(
+     visibility = ["//visibility:private"],
+     deps = [
+         ":encryptor",
+-        ":flags",
+         ":init_mozc",
+         ":logging",
+         ":util",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -1288,11 +1271,11 @@ cc_binary_mozc(
+     srcs = ["cpu_stats_main.cc"],
+     deps = [
+         ":cpu_stats",
+-        ":flags",
+         ":init_mozc",
+         ":port",
+         ":thread",
+         ":util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -1326,10 +1309,10 @@ cc_binary_mozc(
+     name = "stopwatch_main",
+     srcs = ["stopwatch_main.cc"],
+     deps = [
+-        ":flags",
+         ":init_mozc",
+         ":stopwatch",
+         ":util",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -1381,10 +1364,10 @@ cc_test_mozc(
+     deps = [
+         ":file_stream",
+         ":file_util",
+-        ":flags",
+         ":multifile",
+         ":util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -1439,8 +1422,9 @@ cc_binary_mozc(
+     ],
+     deps = [
+         ":init_mozc",
+-        ":flags",
++        ":port",
+         ":util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ] + select_mozc(ios = [":mac_util"]),
+ )
+@@ -1545,7 +1529,6 @@ cc_library_mozc(
+         ],
+         oss = [
+             ":logging",
+-            ":flags",
+         ],
+     ),
+ )
+diff --git base/base.gyp base/base.gyp
+index 50446616f..0b87c4817 100644
+--- base/base.gyp
++++ base/base.gyp
+@@ -188,11 +188,8 @@
+       'target_name': 'flags',
+       'type': 'static_library',
+       'toolsets': ['host', 'target'],
+-      'sources': [
+-        'flags.cc',
+-      ],
+       'dependencies': [
+-        'singleton',
++        'absl.gyp:absl_flags',
+       ],
+     },
+     {
+diff --git base/base_test.gyp base/base_test.gyp
+index d252fe60a..09a4cb2fa 100644
+--- base/base_test.gyp
++++ base/base_test.gyp
+@@ -101,7 +101,6 @@
+       'type': 'executable',
+       'sources': [
+         'bitarray_test.cc',
+-        'flags_test.cc',
+         'iterator_adapter_test.cc',
+         'logging_test.cc',
+         'mmap_test.cc',
+diff --git base/config_file_stream.h base/config_file_stream.h
+index 17ddcf15d..7a09f850e 100644
+--- base/config_file_stream.h
++++ base/config_file_stream.h
+@@ -74,7 +74,7 @@ class ConfigFileStream {
+   //     return Open(filename, ios_base::in);
+   //   }
+   // As of Mozc 1.3, a number of files had had depended on this method.
+-  // However, we did not programatically replaced all of them with
++  // However, we did not programmatically replaced all of them with
+   // |OpenReadText| because these existing code do not have enough unit
+   // tests to check the treatment of line-end character, especially on Windows.
+   // Perhaps |OpenReadBinary| might be more appropriate in some cases.
+diff --git base/config_file_stream_test.cc base/config_file_stream_test.cc
+index 6040f604f..29875f055 100644
+--- base/config_file_stream_test.cc
++++ base/config_file_stream_test.cc
+@@ -35,10 +35,10 @@
+ #include <memory>
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ 
+@@ -61,7 +61,7 @@ std::string GetFileData(const std::string &filename) {
+ // |input_stream| as a side effect.
+ bool IsEof(std::istream *input_stream) {
+   return (input_stream->peek() == std::istream::traits_type::eof() &&
+-          // On some enviroment (e.g. Mac OS 10.8 w/ Xcode 4.5),
++          // On some environment (e.g. Mac OS 10.8 w/ Xcode 4.5),
+           // peek() does not flip eofbit.  So calling get() is also
+           // required.
+           input_stream->get() == std::istream::traits_type::eof() &&
+@@ -74,7 +74,7 @@ class ConfigFileStreamTest : public testing::Test {
+  protected:
+   void SetUp() override {
+     default_profile_directory_ = SystemUtil::GetUserProfileDirectory();
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ 
+   void TearDown() override {
+diff --git base/cpu_stats_main.cc base/cpu_stats_main.cc
+index d70e0f75c..b318d00d3 100644
+--- base/cpu_stats_main.cc
++++ base/cpu_stats_main.cc
+@@ -32,16 +32,16 @@
+ #include <string>
+ 
+ #include "base/cpu_stats.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/port.h"
+ #include "base/thread.h"
+ #include "base/util.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+-MOZC_FLAG(int32, iterations, 1000, "number of iterations");
+-MOZC_FLAG(int32, polling_duration, 1000, "duration period in msec");
+-MOZC_FLAG(int32, dummy_threads_size, 0, "number of dummy threads");
++ABSL_FLAG(int32, iterations, 1000, "number of iterations");
++ABSL_FLAG(int32, polling_duration, 1000, "duration period in msec");
++ABSL_FLAG(int32, dummy_threads_size, 0, "number of dummy threads");
+ 
+ namespace {
+ class DummyThread : public mozc::Thread {
+@@ -65,10 +65,10 @@ int main(int argc, char **argv) {
+ 
+   std::unique_ptr<DummyThread[]> threads;
+ 
+-  if (mozc::GetFlag(FLAGS_dummy_threads_size) > 0) {
++  if (absl::GetFlag(FLAGS_dummy_threads_size) > 0) {
+     threads = absl::make_unique<DummyThread[]>(
+-        mozc::GetFlag(FLAGS_dummy_threads_size));
+-    for (int i = 0; i < mozc::GetFlag(FLAGS_dummy_threads_size); ++i) {
++        absl::GetFlag(FLAGS_dummy_threads_size));
++    for (int i = 0; i < absl::GetFlag(FLAGS_dummy_threads_size); ++i) {
+       threads[i].Start("CpuStatsMain");
+     }
+   }
+@@ -76,10 +76,10 @@ int main(int argc, char **argv) {
+   mozc::CPUStats stats;
+   std::cout << "NumberOfProcessors: " << stats.GetNumberOfProcessors()
+             << std::endl;
+-  for (int i = 0; i < mozc::GetFlag(FLAGS_iterations); ++i) {
++  for (int i = 0; i < absl::GetFlag(FLAGS_iterations); ++i) {
+     std::cout << "CPUStats: " << stats.GetSystemCPULoad() << " "
+               << stats.GetCurrentProcessCPULoad() << std::endl;
+-    mozc::Util::Sleep(mozc::GetFlag(FLAGS_polling_duration));
++    mozc::Util::Sleep(absl::GetFlag(FLAGS_polling_duration));
+   }
+ 
+   return 0;
+diff --git base/encryptor_main.cc base/encryptor_main.cc
+index 04790502c..4714fcf30 100644
+--- base/encryptor_main.cc
++++ base/encryptor_main.cc
+@@ -32,26 +32,26 @@
+ 
+ #include "base/encryptor.h"
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/mmap.h"
+ #include "base/util.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, password, "", "password");
+-MOZC_FLAG(string, salt, "", "salt");
+-MOZC_FLAG(string, iv, "", "initialization vector");
++ABSL_FLAG(std::string, password, "", "password");
++ABSL_FLAG(std::string, salt, "", "salt");
++ABSL_FLAG(std::string, iv, "", "initialization vector");
+ 
+-MOZC_FLAG(bool, encrypt, false, "encrypt mode");
+-MOZC_FLAG(bool, decrypt, false, "decrypt mode");
++ABSL_FLAG(bool, encrypt, false, "encrypt mode");
++ABSL_FLAG(bool, decrypt, false, "decrypt mode");
+ 
+ // encrypt/decrypt files
+-MOZC_FLAG(string, input_file, "", "input file");
+-MOZC_FLAG(string, output_file, "", "input file");
++ABSL_FLAG(std::string, input_file, "", "input file");
++ABSL_FLAG(std::string, output_file, "", "input file");
+ 
+ // perform encryption/decryption with test_input.
+ // used for making a golden data for unittesting
+-MOZC_FLAG(string, test_input, "", "test input string");
++ABSL_FLAG(std::string, test_input, "", "test input string");
+ 
+ namespace {
+ std::string Escape(const std::string &buf) {
+@@ -64,48 +64,48 @@ std::string Escape(const std::string &buf) {
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  if (!mozc::GetFlag(FLAGS_iv).empty()) {
+-    CHECK_EQ(16, mozc::GetFlag(FLAGS_iv).size()) << "iv size must be 16 byte";
++  if (!absl::GetFlag(FLAGS_iv).empty()) {
++    CHECK_EQ(16, absl::GetFlag(FLAGS_iv).size()) << "iv size must be 16 byte";
+   }
+ 
+-  const std::string iv_str = mozc::GetFlag(FLAGS_iv);
++  const std::string iv_str = absl::GetFlag(FLAGS_iv);
+   const uint8 *iv =
+       iv_str.empty() ? nullptr : reinterpret_cast<const uint8 *>(iv_str.data());
+ 
+-  if (!mozc::GetFlag(FLAGS_input_file).empty() &&
+-      !mozc::GetFlag(FLAGS_output_file).empty()) {
++  if (!absl::GetFlag(FLAGS_input_file).empty() &&
++      !absl::GetFlag(FLAGS_output_file).empty()) {
+     mozc::Encryptor::Key key;
+-    CHECK(key.DeriveFromPassword(mozc::GetFlag(FLAGS_password),
+-                                 mozc::GetFlag(FLAGS_salt), iv));
++    CHECK(key.DeriveFromPassword(absl::GetFlag(FLAGS_password),
++                                 absl::GetFlag(FLAGS_salt), iv));
+ 
+     mozc::Mmap mmap;
+-    CHECK(mmap.Open(mozc::GetFlag(FLAGS_input_file).c_str(), "r"));
++    CHECK(mmap.Open(absl::GetFlag(FLAGS_input_file).c_str(), "r"));
+     std::string buf(mmap.begin(), mmap.size());
+-    if (mozc::GetFlag(FLAGS_encrypt)) {
++    if (absl::GetFlag(FLAGS_encrypt)) {
+       CHECK(mozc::Encryptor::EncryptString(key, &buf));
+-    } else if (mozc::GetFlag(FLAGS_decrypt)) {
++    } else if (absl::GetFlag(FLAGS_decrypt)) {
+       CHECK(mozc::Encryptor::DecryptString(key, &buf));
+     } else {
+       LOG(FATAL) << "unknown mode. set --encrypt or --decrypt";
+     }
+-    mozc::OutputFileStream ofs(mozc::GetFlag(FLAGS_output_file).c_str(),
++    mozc::OutputFileStream ofs(absl::GetFlag(FLAGS_output_file).c_str(),
+                                std::ios::binary);
+     CHECK(ofs);
+     ofs.write(buf.data(), buf.size());
+-  } else if (!mozc::GetFlag(FLAGS_test_input).empty()) {
++  } else if (!absl::GetFlag(FLAGS_test_input).empty()) {
+     mozc::Encryptor::Key key1, key2;
+-    CHECK(key1.DeriveFromPassword(mozc::GetFlag(FLAGS_password),
+-                                  mozc::GetFlag(FLAGS_salt), iv));
+-    CHECK(key2.DeriveFromPassword(mozc::GetFlag(FLAGS_password),
+-                                  mozc::GetFlag(FLAGS_salt), iv));
++    CHECK(key1.DeriveFromPassword(absl::GetFlag(FLAGS_password),
++                                  absl::GetFlag(FLAGS_salt), iv));
++    CHECK(key2.DeriveFromPassword(absl::GetFlag(FLAGS_password),
++                                  absl::GetFlag(FLAGS_salt), iv));
+ 
+-    std::string buf = mozc::GetFlag(FLAGS_test_input);
++    std::string buf = absl::GetFlag(FLAGS_test_input);
+     std::string iv_buf(reinterpret_cast<const char *>(key1.iv()),
+                        key1.iv_size());
+ 
+-    std::cout << "Password:  \"" << Escape(mozc::GetFlag(FLAGS_password))
++    std::cout << "Password:  \"" << Escape(absl::GetFlag(FLAGS_password))
+               << "\"" << std::endl;
+-    std::cout << "Salt:      \"" << Escape(mozc::GetFlag(FLAGS_salt)) << "\""
++    std::cout << "Salt:      \"" << Escape(absl::GetFlag(FLAGS_salt)) << "\""
+               << std::endl;
+     std::cout << "IV:        \"" << Escape(iv_buf) << "\"" << std::endl;
+     std::cout << "Input:     \"" << Escape(buf) << "\"" << std::endl;
+diff --git base/encryptor_test.cc base/encryptor_test.cc
+index d992ea901..9f9553a4e 100644
+--- base/encryptor_test.cc
++++ base/encryptor_test.cc
+@@ -31,12 +31,12 @@
+ 
+ #include <memory>
+ 
+-#include "base/flags.h"
+ #include "base/password_manager.h"
+ #include "base/system_util.h"
+ #include "base/util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ 
+@@ -226,7 +226,7 @@ TEST(EncryptorTest, EncryptBatch) {
+ }
+ 
+ TEST(EncryptorTest, ProtectData) {
+-  SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++  SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   const size_t kSizeTable[] = {1, 10, 100, 1000, 10000, 100000};
+ 
+   for (size_t i = 0; i < arraysize(kSizeTable); ++i) {
+diff --git base/file_util_test.cc base/file_util_test.cc
+index 1a11e2c5c..7251d2821 100644
+--- base/file_util_test.cc
++++ base/file_util_test.cc
+@@ -37,11 +37,11 @@
+ #include <string>
+ 
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ // Ad-hoc workadound against macro problem on Windows.
+ // On Windows, following macros, defined when you include <Windows.h>,
+@@ -71,10 +71,10 @@ void CreateTestFile(const std::string &filename, const std::string &data) {
+ }  // namespace
+ 
+ TEST_F(FileUtilTest, CreateDirectory) {
+-  EXPECT_TRUE(FileUtil::DirectoryExists(mozc::GetFlag(FLAGS_test_tmpdir)));
++  EXPECT_TRUE(FileUtil::DirectoryExists(absl::GetFlag(FLAGS_test_tmpdir)));
+   // dirpath = FLAGS_test_tmpdir/testdir
+   const std::string dirpath =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "testdir");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "testdir");
+ 
+   // Delete dirpath, if it exists.
+   if (FileUtil::FileExists(dirpath)) {
+@@ -92,9 +92,9 @@ TEST_F(FileUtilTest, CreateDirectory) {
+ }
+ 
+ TEST_F(FileUtilTest, DirectoryExists) {
+-  EXPECT_TRUE(FileUtil::DirectoryExists(mozc::GetFlag(FLAGS_test_tmpdir)));
++  EXPECT_TRUE(FileUtil::DirectoryExists(absl::GetFlag(FLAGS_test_tmpdir)));
+   const std::string filepath =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "testfile");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "testfile");
+ 
+   // Delete filepath, if it exists.
+   if (FileUtil::FileExists(filepath)) {
+@@ -114,7 +114,7 @@ TEST_F(FileUtilTest, DirectoryExists) {
+ 
+ TEST_F(FileUtilTest, Unlink) {
+   const std::string filepath =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "testfile");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "testfile");
+   FileUtil::Unlink(filepath);
+   EXPECT_FALSE(FileUtil::FileExists(filepath));
+ 
+@@ -150,7 +150,7 @@ TEST_F(FileUtilTest, Unlink) {
+ #ifdef OS_WIN
+ TEST_F(FileUtilTest, HideFile) {
+   const string filename =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "testfile");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "testfile");
+   FileUtil::Unlink(filename);
+ 
+   EXPECT_FALSE(FileUtil::HideFile(filename));
+@@ -198,9 +198,9 @@ TEST_F(FileUtilTest, HideFile) {
+ 
+ TEST_F(FileUtilTest, IsEqualFile) {
+   const std::string filename1 =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "test1");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "test1");
+   const std::string filename2 =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "test2");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "test2");
+   FileUtil::Unlink(filename1);
+   FileUtil::Unlink(filename2);
+   EXPECT_FALSE(FileUtil::IsEqualFile(filename1, filename2));
+@@ -224,9 +224,9 @@ TEST_F(FileUtilTest, IsEqualFile) {
+ TEST_F(FileUtilTest, CopyFile) {
+   // just test rename operation works as intended
+   const std::string from =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "copy_from");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "copy_from");
+   const std::string to =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "copy_to");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "copy_to");
+   FileUtil::Unlink(from);
+   FileUtil::Unlink(to);
+ 
+@@ -292,9 +292,9 @@ TEST_F(FileUtilTest, CopyFile) {
+ 
+ TEST_F(FileUtilTest, AtomicRename) {
+   // just test rename operation works as intended
+-  const std::string from = FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir),
++  const std::string from = FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir),
+                                               "atomic_rename_test_from");
+-  const std::string to = FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir),
++  const std::string to = FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir),
+                                             "atomic_rename_test_to");
+   FileUtil::Unlink(from);
+   FileUtil::Unlink(to);
+@@ -455,7 +455,7 @@ TEST_F(FileUtilTest, GetModificationTime) {
+   EXPECT_FALSE(FileUtil::GetModificationTime("not_existent_file", &time_stamp));
+ 
+   const std::string &path =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "testfile");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "testfile");
+   CreateTestFile(path, "content");
+   EXPECT_TRUE(FileUtil::GetModificationTime(path, &time_stamp));
+   EXPECT_NE(0, time_stamp);
+diff --git base/flags.cc base/flags.cc
+deleted file mode 100644
+index b01f56893..000000000
+--- base/flags.cc
++++ /dev/null
+@@ -1,320 +0,0 @@
+-// Copyright 2010-2021, Google Inc.
+-// All rights reserved.
+-//
+-// Redistribution and use in source and binary forms, with or without
+-// modification, are permitted provided that the following conditions are
+-// met:
+-//
+-//     * Redistributions of source code must retain the above copyright
+-// notice, this list of conditions and the following disclaimer.
+-//     * Redistributions in binary form must reproduce the above
+-// copyright notice, this list of conditions and the following disclaimer
+-// in the documentation and/or other materials provided with the
+-// distribution.
+-//     * Neither the name of Google Inc. nor the names of its
+-// contributors may be used to endorse or promote products derived from
+-// this software without specific prior written permission.
+-//
+-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+-#include "base/flags.h"
+-
+-#include <cstring>
+-#include <iostream>
+-#include <map>
+-#include <sstream>
+-#include <string>
+-#include <vector>
+-
+-#include "base/port.h"
+-#include "base/singleton.h"
+-
+-namespace mozc_flags {
+-
+-struct Flag {
+-  int type;
+-  void *storage;
+-  const void *default_storage;
+-  string help;
+-};
+-
+-namespace {
+-
+-typedef std::map<string, mozc_flags::Flag *> FlagMap;
+-
+-FlagMap *GetFlagMap() { return mozc::Singleton<FlagMap>::get(); }
+-
+-bool IsTrue(const char *value) {
+-  const char *kTrue[] = {"1", "t", "true", "y", "yes"};
+-  const char *kFalse[] = {"0", "f", "false", "n", "no"};
+-  for (size_t i = 0; i < arraysize(kTrue); ++i) {
+-    if (strcmp(value, kTrue[i]) == 0) {
+-      return true;
+-    } else if (strcmp(value, kFalse[i]) == 0) {
+-      return false;
+-    }
+-  }
+-  return false;
+-}
+-
+-// Wraps std::sto* functions by a template class so that appropriate functions
+-// are chosen for platform-dependent integral types by type deduction.  For
+-// example, if int64 is defined as long long, then StrToNumberImpl<int64>::Do()
+-// is mapped to StrToNumberImpl::Do<long long>().  Here, struct (class) is
+-// intentionally used instead of a template function because, if we use a
+-// function, compiler may warn of "unused function".
+-template <typename T>
+-struct StrToNumberImpl;
+-
+-template <>
+-struct StrToNumberImpl<int> {
+-  static int Do(const string &s) { return std::stoi(s); }
+-};
+-
+-template <>
+-struct StrToNumberImpl<long> {                              // NOLINT
+-  static long Do(const string &s) { return std::stol(s); }  // NOLINT
+-};
+-
+-template <>
+-struct StrToNumberImpl<long long> {                               // NOLINT
+-  static long long Do(const string &s) { return std::stoll(s); }  // NOLINT
+-};
+-
+-template <>
+-struct StrToNumberImpl<unsigned long> {                               // NOLINT
+-  static unsigned long Do(const string &s) { return std::stoul(s); }  // NOLINT
+-};
+-
+-template <>
+-struct StrToNumberImpl<unsigned long long> {       // NOLINT
+-  static unsigned long long Do(const string &s) {  // NOLINT
+-    return std::stoull(s);
+-  }
+-};
+-
+-template <typename T>
+-inline T StrToNumber(const string &s) {
+-  return StrToNumberImpl<T>::Do(s);
+-}
+-
+-#if defined(DEBUG) || defined(__APPLE__)
+-// Defines std::string version of absl::string_view::starts_with here to make
+-// flags module from independent of string_piece.cc because absl::string_view
+-// depends on logging.cc etc. and using it causes cyclic dependency.
+-inline bool StartsWith(const string &s, const string &prefix) {
+-  return s.size() >= prefix.size() &&
+-         memcmp(s.data(), prefix.data(), prefix.size()) == 0;
+-}
+-#endif  // defined(DEBUG) || defined(__APPLE__)
+-
+-}  // namespace
+-
+-FlagRegister::FlagRegister(const char *name, void *storage,
+-                           const void *default_storage, int shorttpe,
+-                           const char *help)
+-    : flag_(new Flag) {
+-  flag_->type = shorttpe;
+-  flag_->storage = storage;
+-  flag_->default_storage = default_storage;
+-  flag_->help = help;
+-  GetFlagMap()->insert(std::make_pair(string(name), flag_));
+-}
+-
+-FlagRegister::~FlagRegister() { delete flag_; }
+-
+-bool SetFlag(const string &name, const string &value) {
+-  std::map<string, Flag *>::iterator it = GetFlagMap()->find(name);
+-  if (it == GetFlagMap()->end()) return false;
+-  string v = value;
+-  Flag *flag = it->second;
+-
+-  // If empty value is set, we assume true or empty string is set
+-  // for boolean or string option. With other types, setting fails.
+-  if (value.empty()) {
+-    switch (flag->type) {
+-      case B:
+-        v = "true";
+-        break;
+-      case S:
+-        v = "";
+-        break;
+-      default:
+-        return false;
+-    }
+-  }
+-
+-  switch (flag->type) {
+-    case I:
+-      *reinterpret_cast<int32 *>(flag->storage) = StrToNumber<int32>(v);
+-      break;
+-    case B:
+-      *(reinterpret_cast<bool *>(flag->storage)) = IsTrue(v.c_str());
+-      break;
+-    case I64:
+-      *reinterpret_cast<int64 *>(flag->storage) = StrToNumber<int64>(v);
+-      break;
+-    case U64:
+-      *reinterpret_cast<uint64 *>(flag->storage) = StrToNumber<uint64>(v);
+-      break;
+-    case D:
+-      *reinterpret_cast<double *>(flag->storage) = strtod(v.c_str(), nullptr);
+-      break;
+-    case S:
+-      *reinterpret_cast<string *>(flag->storage) = v;
+-      break;
+-    default:
+-      break;
+-  }
+-  return true;
+-}
+-
+-namespace {
+-
+-#ifndef IGNORE_HELP_FLAG
+-
+-void PrintFlags(string *output) {
+-  std::ostringstream os;
+-  for (std::map<string, Flag *>::const_iterator it = GetFlagMap()->begin();
+-       it != GetFlagMap()->end(); ++it) {
+-    os << "   --" << it->first << " (" << it->second->help << ")";
+-    const Flag *flag = it->second;
+-    switch (flag->type) {
+-      case I:
+-        os << "  type: int32  default: "
+-           << *(reinterpret_cast<const int *>(flag->default_storage))
+-           << std::endl;
+-        break;
+-      case B:
+-        os << "  type: bool  default: "
+-           << (*(reinterpret_cast<const bool *>(flag->default_storage))
+-                   ? "true"
+-                   : "false")
+-           << std::endl;
+-        break;
+-      case I64:
+-        os << "  type: int64 default: "
+-           << *(reinterpret_cast<const int64 *>(flag->default_storage))
+-           << std::endl;
+-        break;
+-      case U64:
+-        os << "  type: uint64  default: "
+-           << *(reinterpret_cast<const uint64 *>(flag->default_storage))
+-           << std::endl;
+-        break;
+-      case D:
+-        os << "  type: double  default: "
+-           << *(reinterpret_cast<const double *>(flag->default_storage))
+-           << std::endl;
+-        break;
+-      case S:
+-        os << "  type: string  default: "
+-           << *(reinterpret_cast<const string *>(flag->default_storage))
+-           << std::endl;
+-        break;
+-      default:
+-        break;
+-    }
+-  }
+-  *output = os.str();
+-}
+-
+-#endif  // IGNORE_HELP_FLAG
+-
+-bool CommandLineGetFlag(int argc, char **argv, string *key, string *value,
+-                        int *used_args) {
+-  key->clear();
+-  value->clear();
+-  *used_args = 0;
+-  if (argc < 1) {
+-    return false;
+-  }
+-
+-  *used_args = 1;
+-  const char *start = argv[0];
+-  if (start[0] != '-') {
+-    return false;
+-  }
+-
+-  ++start;
+-  if (start[0] == '-') ++start;
+-  const string arg = start;
+-  const size_t n = arg.find("=");
+-  if (n != string::npos) {
+-    *key = arg.substr(0, n);
+-    *value = arg.substr(n + 1, arg.size() - n);
+-    return true;
+-  }
+-
+-  key->assign(arg);
+-  value->clear();
+-
+-  if (argc == 1) {
+-    return true;
+-  }
+-  start = argv[1];
+-  if (start[0] == '-') {
+-    return true;
+-  }
+-
+-  *used_args = 2;
+-  value->assign(start);
+-  return true;
+-}
+-
+-}  // namespace
+-
+-uint32 ParseCommandLineFlags(int *argc, char ***argv) {
+-  int used_argc = 0;
+-  string key, value;
+-  for (int i = 1; i < *argc; i += used_argc) {
+-    if (!CommandLineGetFlag(*argc - i, *argv + i, &key, &value, &used_argc)) {
+-      // TODO(komatsu): Do error handling
+-      continue;
+-    }
+-
+-    if (key == "help") {
+-#ifndef IGNORE_HELP_FLAG
+-      string help;
+-      PrintFlags(&help);
+-      std::cout << help;
+-      exit(0);
+-#endif
+-    }
+-#ifdef DEBUG
+-    // Ignores unittest specific commandline flags.
+-    // In the case of Release build, IGNORE_INVALID_FLAG macro is set, so that
+-    // following condition makes no sense.
+-    if (StartsWith(key, "gtest_") || StartsWith(key, "gunit_")) {
+-      continue;
+-    }
+-#endif  // DEBUG
+-#ifdef __APPLE__
+-    // Mac OSX specifies process serial number like -psn_0_217141.
+-    // Let's ignore it.
+-    if (StartsWith(key, "psn_")) {
+-      continue;
+-    }
+-#endif
+-    if (!SetFlag(key, value)) {
+-#ifndef IGNORE_INVALID_FLAG
+-      std::cerr << "Unknown/Invalid flag " << key << std::endl;
+-      exit(1);
+-#endif
+-    }
+-  }
+-  return *argc;
+-}
+-
+-}  // namespace mozc_flags
+-
+diff --git base/flags.h base/flags.h
+index 3bd878fa2..9e5ea80b9 100644
+--- base/flags.h
++++ base/flags.h
+@@ -33,94 +33,7 @@
+ #define MOZC_BASE_FLAGS_H_
+ 
+ #include "base/port.h"
+-
+-#include <string>
+-
+-namespace mozc_flags {
+-
+-enum { I, B, I64, U64, D, S };
+-
+-struct Flag;
+-
+-class FlagRegister {
+- public:
+-  FlagRegister(const char *name, void *storage, const void *default_storage,
+-               int shorttpe, const char *help);
+-  ~FlagRegister();
+-
+- private:
+-  Flag *flag_;
+-};
+-
+-uint32 ParseCommandLineFlags(int *argc, char ***argv);
+-bool SetFlag(const string &key, const string &value);
+-
+-}  // namespace mozc_flags
+-
+-#define DEFINE_VARIABLE(type, shorttype, name, value, help)               \
+-  namespace mozc_flags_fL##shorttype {                                    \
+-    using mozc_flags::shorttype;                                          \
+-    type FLAGS_##name = value;                                            \
+-    static const type FLAGS_DEFAULT_##name = value;                       \
+-    static const mozc_flags::FlagRegister fL##name(                       \
+-        #name, reinterpret_cast<void *>(&FLAGS_##name),                   \
+-        reinterpret_cast<const void *>(&FLAGS_DEFAULT_##name), shorttype, \
+-        help);                                                            \
+-  }                                                                       \
+-  using mozc_flags_fL##shorttype::FLAGS_##name
+-
+-#define DECLARE_VARIABLE(type, shorttype, name) \
+-  namespace mozc_flags_fL##shorttype {          \
+-    extern type FLAGS_##name;                   \
+-  }                                             \
+-  using mozc_flags_fL##shorttype::FLAGS_##name
+-
+-#define DEFINE_int32(name, value, help) \
+-  DEFINE_VARIABLE(int32, I, name, value, help)
+-#define DECLARE_int32(name) DECLARE_VARIABLE(int32, I, name)
+-
+-#define DEFINE_int64(name, value, help) \
+-  DEFINE_VARIABLE(int64, I64, name, value, help)
+-#define DECLARE_int64(name) DECLARE_VARIABLE(int64, I64, name)
+-
+-#define DEFINE_uint64(name, value, help) \
+-  DEFINE_VARIABLE(uint64, U64, name, value, help)
+-#define DECLARE_uint64(name) DECLARE_VARIABLE(uint64, U64, name)
+-
+-#define DEFINE_double(name, value, help) \
+-  DEFINE_VARIABLE(double, D, name, value, help)
+-#define DECLARE_double(name) DECLARE_VARIABLE(double, D, name)
+-
+-#define DEFINE_bool(name, value, help) \
+-  DEFINE_VARIABLE(bool, B, name, value, help)
+-#define DECLARE_bool(name) DECLARE_VARIABLE(bool, B, name)
+-
+-#define DEFINE_string(name, value, help) \
+-  DEFINE_VARIABLE(string, S, name, value, help)
+-#define DECLARE_string(name) DECLARE_VARIABLE(string, S, name)
+-
+-#define MOZC_FLAG(type, name, value, help) \
+-  DEFINE_##type(name, value, help)
+-
+-#define MOZC_DECLARE_FLAG(type, name) \
+-  DECLARE_##type(name)
+-
+-namespace mozc {
+-
+-inline bool GetFlag(bool flag) { return flag; }
+-inline int32 GetFlag(int32 flag) { return flag; }
+-inline int64 GetFlag(int64 flag) { return flag; }
+-inline uint64 GetFlag(uint64 flag) { return flag; }
+-inline double GetFlag(double flag) { return flag; }
+-inline string GetFlag(const string &flag) { return flag; }
+-
+-inline void SetFlag(bool *f, bool v) { *f = v; }
+-inline void SetFlag(int32 *f, int32 v) { *f = v; }
+-inline void SetFlag(int64 *f, int64 v) { *f = v; }
+-inline void SetFlag(uint64 *f, uint64 v) { *f = v; }
+-inline void SetFlag(double *f, double v) { *f = v; }
+-inline void SetFlag(string *f, const string &v) { *f = v; }
+-
+-}  // namespace mozc
++#include "absl/flags/declare.h"
++#include "absl/flags/flag.h"
+ 
+ #endif  // MOZC_BASE_FLAGS_H_
+diff --git base/flags_test.cc base/flags_test.cc
+deleted file mode 100644
+index 4453a8754..000000000
+--- base/flags_test.cc
++++ /dev/null
+@@ -1,157 +0,0 @@
+-// Copyright 2010-2021, Google Inc.
+-// All rights reserved.
+-//
+-// Redistribution and use in source and binary forms, with or without
+-// modification, are permitted provided that the following conditions are
+-// met:
+-//
+-//     * Redistributions of source code must retain the above copyright
+-// notice, this list of conditions and the following disclaimer.
+-//     * Redistributions in binary form must reproduce the above
+-// copyright notice, this list of conditions and the following disclaimer
+-// in the documentation and/or other materials provided with the
+-// distribution.
+-//     * Neither the name of Google Inc. nor the names of its
+-// contributors may be used to endorse or promote products derived from
+-// this software without specific prior written permission.
+-//
+-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+-#include "base/flags.h"
+-
+-#include <cstring>
+-
+-#include "testing/base/public/gunit.h"
+-
+-using std::string;
+-
+-MOZC_FLAG(string, test_string, "hogehoge", "test_string");
+-MOZC_FLAG(int32, test_int32, 20, "test_int32");
+-MOZC_FLAG(int64, test_int64, 29051773239673121LL, "test_int64");
+-MOZC_FLAG(uint64, test_uint64, 84467440737095516LL, "test_uint64");
+-MOZC_FLAG(bool, test_bool, false, "test_bool");
+-MOZC_FLAG(double, test_double, 0.5, "test_double");
+-
+-namespace mozc {
+-namespace {
+-
+-char *strdup_with_new(const char *str) {
+-  char *result = new char[strlen(str) + 1];
+-  strcpy(result, str);
+-  return result;
+-}
+-
+-class FlagsTest : public testing::Test {
+- protected:
+-  void SetUp() override {
+-    mozc::SetFlag(&FLAGS_test_string, "hogehoge");
+-    mozc::SetFlag(&FLAGS_test_int32, 20);
+-    mozc::SetFlag(&FLAGS_test_int64, 29051773239673121LL);
+-    mozc::SetFlag(&FLAGS_test_uint64, 84467440737095516LL);
+-    mozc::SetFlag(&FLAGS_test_bool, false);
+-    mozc::SetFlag(&FLAGS_test_double, 0.5);
+-  }
+-};
+-
+-TEST_F(FlagsTest, FlagsBasicTest) {
+-  EXPECT_FALSE(mozc::GetFlag(FLAGS_test_bool));
+-  EXPECT_EQ(20, mozc::GetFlag(FLAGS_test_int32));
+-  EXPECT_EQ(int64{29051773239673121}, mozc::GetFlag(FLAGS_test_int64));
+-  EXPECT_EQ(int64{84467440737095516}, mozc::GetFlag(FLAGS_test_uint64));
+-  EXPECT_EQ("hogehoge", mozc::GetFlag(FLAGS_test_string));
+-  EXPECT_LT(0.4, mozc::GetFlag(FLAGS_test_double));
+-  EXPECT_GT(0.6, mozc::GetFlag(FLAGS_test_double));
+-
+-  char **argv = new char *[8];
+-  argv[0] = strdup_with_new("test");
+-  argv[1] = strdup_with_new("--test_int32=11214141");
+-  argv[2] = strdup_with_new("--test_string=test");
+-  argv[3] = strdup_with_new("--test_bool=true");
+-  argv[4] = strdup_with_new("--test_double=1.5");
+-  argv[5] = strdup_with_new("--test_int64=8172141141413124");
+-  argv[6] = strdup_with_new("--test_uint64=9414041694169841");
+-  argv[7] = strdup_with_new("invalid_value");
+-  int argc = 8;
+-  const uint32 used_argc = mozc_flags::ParseCommandLineFlags(&argc, &argv);
+-  for (size_t i = 0; i < argc; ++i) {
+-    delete[] argv[i];
+-  }
+-  delete[] argv;
+-
+-  EXPECT_EQ(8u, used_argc);
+-  EXPECT_EQ(true, mozc::GetFlag(FLAGS_test_bool));
+-  EXPECT_EQ(11214141, mozc::GetFlag(FLAGS_test_int32));
+-  EXPECT_EQ(8172141141413124LL, mozc::GetFlag(FLAGS_test_int64));
+-  EXPECT_EQ(9414041694169841LL, mozc::GetFlag(FLAGS_test_uint64));
+-  EXPECT_EQ("test", mozc::GetFlag(FLAGS_test_string));
+-  EXPECT_LT(1.4, mozc::GetFlag(FLAGS_test_double));
+-  EXPECT_GT(1.6, mozc::GetFlag(FLAGS_test_double));
+-}
+-
+-TEST_F(FlagsTest, NoValuesFlagsTest) {
+-  EXPECT_FALSE(mozc::GetFlag(FLAGS_test_bool));
+-  EXPECT_EQ(20, mozc::GetFlag(FLAGS_test_int32));
+-  EXPECT_EQ(int64{29051773239673121}, mozc::GetFlag(FLAGS_test_int64));
+-  EXPECT_EQ(int64{84467440737095516}, mozc::GetFlag(FLAGS_test_uint64));
+-  EXPECT_EQ("hogehoge", mozc::GetFlag(FLAGS_test_string));
+-  EXPECT_LT(0.4, mozc::GetFlag(FLAGS_test_double));
+-  EXPECT_GT(0.6, mozc::GetFlag(FLAGS_test_double));
+-
+-  char **argv = new char *[3];
+-  // We set only boolean and string values, because other types will stops
+-  // the test process if empty values are set.
+-  argv[0] = strdup_with_new("test");
+-  argv[1] = strdup_with_new("--test_string");
+-  argv[2] = strdup_with_new("--test_bool");
+-  int argc = 3;
+-  const uint32 used_argc = mozc_flags::ParseCommandLineFlags(&argc, &argv);
+-  for (size_t i = 0; i < argc; ++i) {
+-    delete[] argv[i];
+-  }
+-  delete[] argv;
+-
+-  EXPECT_EQ(3u, used_argc);
+-  EXPECT_TRUE(mozc::GetFlag(FLAGS_test_bool));
+-  EXPECT_EQ("", mozc::GetFlag(FLAGS_test_string));
+-  // Following values are kept as default.
+-  EXPECT_EQ(20, mozc::GetFlag(FLAGS_test_int32));
+-  EXPECT_EQ(29051773239673121LL, mozc::GetFlag(FLAGS_test_int64));
+-  EXPECT_EQ(84467440737095516LL, mozc::GetFlag(FLAGS_test_uint64));
+-  EXPECT_LT(0.4, mozc::GetFlag(FLAGS_test_double));
+-  EXPECT_GT(0.6, mozc::GetFlag(FLAGS_test_double));
+-}
+-
+-TEST_F(FlagsTest, SetFlag) {
+-  mozc_flags::SetFlag("test_bool", "true");
+-  EXPECT_TRUE(mozc::GetFlag(FLAGS_test_bool));
+-  mozc_flags::SetFlag("test_bool", "false");
+-  EXPECT_FALSE(mozc::GetFlag(FLAGS_test_bool));
+-
+-  mozc_flags::SetFlag("test_int32", "12345");
+-  EXPECT_EQ(12345, mozc::GetFlag(FLAGS_test_int32));
+-
+-  mozc_flags::SetFlag("test_int64", "10000000000000000");
+-  EXPECT_EQ(10000000000000000LL, mozc::GetFlag(FLAGS_test_int64));
+-
+-  mozc_flags::SetFlag("test_uint64", "50000000000000000");
+-  EXPECT_EQ(50000000000000000LL, mozc::GetFlag(FLAGS_test_uint64));
+-
+-  mozc_flags::SetFlag("test_string", "Tokyo");
+-  EXPECT_EQ("Tokyo", mozc::GetFlag(FLAGS_test_string));
+-
+-  mozc_flags::SetFlag("test_double", "3.14");
+-  EXPECT_DOUBLE_EQ(3.14, mozc::GetFlag(FLAGS_test_double));
+-}
+-
+-}  // namespace
+-}  // namespace mozc
+diff --git base/gen_character_set.py base/gen_character_set.py
+index 87a36e280..2b6b588a2 100644
+--- base/gen_character_set.py
++++ base/gen_character_set.py
+@@ -145,7 +145,7 @@ def _LoadExceptions():
+         0x301C,  # WAVE DASH
+         0xFF5E,  # FULL WIDTH TILDE
+         0x2016,  # DOUBLE VERTICAL LINE
+-        0x2225,  # PARALEL TO
++        0x2225,  # PARALLEL TO
+         0x2212,  # MINUS SIGN
+         0xFF0D,  # FULL WIDTH HYPHEN MINUS
+         0x00A2,  # CENT SIGN
+diff --git base/init_mozc.cc base/init_mozc.cc
+index 010341048..eee8b6226 100644
+--- base/init_mozc.cc
++++ base/init_mozc.cc
+@@ -29,37 +29,40 @@
+ 
+ #include "base/init_mozc.h"
+ 
+-
+ #ifdef OS_WIN
+ #include <windows.h>
+ #endif  // OS_WIN
+ 
+ #include <string>
+ 
+-#include "base/file_util.h"
+-
+-
+-#include "base/flags.h"
+ 
++#include "base/file_util.h"
+ #include "base/logging.h"
++
+ #ifndef MOZC_BUILDTOOL_BUILD
+ #include "base/system_util.h"
+ #endif  // MOZC_BUILDTOOL_BUILD
+ 
++
++#include "absl/flags/flag.h"
++
++#include "absl/flags/parse.h"
++
+ // Even if log_dir is modified in the middle of the process, the
+ // logging directory will not be changed because the logging stream is
+ // initialized in the very early initialization stage.
+-MOZC_FLAG(string, log_dir, "",
++ABSL_FLAG(std::string, log_dir, "",
+           "If specified, logfiles are written into this directory "
+           "instead of the default logging directory.");
+ 
+ 
+-MOZC_FLAG(string, program_invocation_name, "",
++ABSL_FLAG(std::string, program_invocation_name, "",
+           "Program name copied from argv[0].");
+ 
+ namespace mozc {
+ namespace {
+ 
++
+ #ifdef OS_WIN
+ LONG CALLBACK ExitProcessExceptionFilter(EXCEPTION_POINTERS *ExceptionInfo) {
+   // Currently, we haven't found a good way to perform both
+@@ -69,22 +72,33 @@ LONG CALLBACK ExitProcessExceptionFilter(EXCEPTION_POINTERS *ExceptionInfo) {
+ }
+ #endif  // OS_WIN
+ 
+-string GetLogFilePathFromProgramName(const string &program_name) {
+-  const string basename = FileUtil::Basename(program_name) + ".log";
+-  if (mozc::GetFlag(FLAGS_log_dir).empty()) {
++std::string GetLogFilePathFromProgramName(const std::string &program_name) {
++  const std::string basename = FileUtil::Basename(program_name) + ".log";
++  if (absl::GetFlag(FLAGS_log_dir).empty()) {
+ #ifdef MOZC_BUILDTOOL_BUILD
+     return basename;
+ #else   // MOZC_BUILDTOOL_BUILD
+     return FileUtil::JoinPath(SystemUtil::GetLoggingDirectory(), basename);
+ #endif  // MOZC_BUILDTOOL_BUILD
+   }
+-  return FileUtil::JoinPath(mozc::GetFlag(FLAGS_log_dir), basename);
++  return FileUtil::JoinPath(absl::GetFlag(FLAGS_log_dir), basename);
+ }
+ 
++void ParseCommandLineFlags(int argc, char **argv) {
++  absl::flags_internal::ParseCommandLineImpl(
++      argc, argv,
++      absl::flags_internal::ArgvListAction::kRemoveParsedArgs,
++      // Suppress help messages invoked by --help and others.
++      // Use UsageFlagsAction::kHandleUsage to enable it.
++      absl::flags_internal::UsageFlagsAction::kIgnoreUsage,
++      absl::flags_internal::OnUndefinedFlag::kIgnoreUndefined);
++}
++
++
+ }  // namespace
+ 
+ void InitMozc(const char *arg0, int *argc, char ***argv) {
+-  mozc::SetFlag(&FLAGS_program_invocation_name, *argv[0]);
++  absl::SetFlag(&FLAGS_program_invocation_name, *argv[0]);
+ #ifdef OS_WIN
+   // InitMozc() is supposed to be used for code generator or
+   // other programs which are not included in the production code.
+@@ -93,9 +107,9 @@ void InitMozc(const char *arg0, int *argc, char ***argv) {
+   // our continuous build stable.
+   ::SetUnhandledExceptionFilter(ExitProcessExceptionFilter);
+ #endif  // OS_WIN
+-  mozc_flags::ParseCommandLineFlags(argc, argv);
++  ParseCommandLineFlags(*argc, *argv);
+ 
+-  const string program_name = *argc > 0 ? (*argv)[0] : "UNKNOWN";
++  const std::string program_name = *argc > 0 ? (*argv)[0] : "UNKNOWN";
+   Logging::InitLogStream(GetLogFilePathFromProgramName(program_name));
+ 
+ }
+diff --git base/logging.cc base/logging.cc
+index 2ef09dfdc..a00a1badc 100644
+--- base/logging.cc
++++ base/logging.cc
+@@ -57,16 +57,16 @@
+ #include "base/const.h"
+ #endif  // OS_ANDROID
+ #include "base/clock.h"
+-#include "base/flags.h"
+ #include "base/mutex.h"
+ #include "base/singleton.h"
++#include "absl/flags/flag.h"
+ #include "absl/strings/str_cat.h"
+ 
+-MOZC_FLAG(bool, colored_log, true,
++ABSL_FLAG(bool, colored_log, true,
+           "Enables colored log messages on tty devices");
+-MOZC_FLAG(bool, logtostderr, false,
++ABSL_FLAG(bool, logtostderr, false,
+           "log messages go to stderr instead of logfiles");
+-MOZC_FLAG(int32, v, 0, "verbose level");
++ABSL_FLAG(int32, v, 0, "verbose level");
+ 
+ namespace mozc {
+ 
+@@ -176,12 +176,12 @@ class LogStreamImpl {
+   void Reset();
+ 
+   int verbose_level() const {
+-    return std::max(mozc::GetFlag(FLAGS_v), config_verbose_level_);
++    return std::max(absl::GetFlag(FLAGS_v), config_verbose_level_);
+   }
+ 
+   void set_verbose_level(int level) {
+     scoped_lock l(&mutex_);
+-    mozc::SetFlag(&FLAGS_v, level);
++    absl::SetFlag(&FLAGS_v, level);
+   }
+ 
+   void set_config_verbose_level(int level) {
+@@ -273,11 +273,11 @@ void LogStreamImpl::Reset() {
+   // Coloring is disabled on windows
+   // because cmd.exe doesn't support ANSI color escape sequences.
+   // TODO(team): Considers to use SetConsoleTextAttribute on Windows.
+-  use_cerr_ = mozc::GetFlag(FLAGS_logtostderr);
++  use_cerr_ = absl::GetFlag(FLAGS_logtostderr);
+   support_color_ = false;
+ #else   // OS_ANDROID, OS_WIN
+-  use_cerr_ = mozc::GetFlag(FLAGS_logtostderr);
+-  support_color_ = (use_cerr_ && mozc::GetFlag(FLAGS_colored_log) &&
++  use_cerr_ = absl::GetFlag(FLAGS_logtostderr);
++  support_color_ = (use_cerr_ && absl::GetFlag(FLAGS_colored_log) &&
+                     ::isatty(::fileno(stderr)));
+ #endif  // OS_ANDROID, OS_WIN
+ }
+diff --git base/logging.h base/logging.h
+index 180bf552e..5283af14f 100644
+--- base/logging.h
++++ base/logging.h
+@@ -34,8 +34,8 @@
+ #include <iostream>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/port.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ 
+diff --git base/mac_util.h base/mac_util.h
+index bf512ba89..1bc4a508a 100644
+--- base/mac_util.h
++++ base/mac_util.h
+@@ -55,7 +55,7 @@ class MacUtil {
+   // Returns server directory using OS-specific API.
+   static string GetServerDirectory();
+ 
+-  // Returns the "Resouces/" directory in the current application.
++  // Returns the "Resources/" directory in the current application.
+   static string GetResourcesDirectory();
+ 
+   // Returns the machine serial number.
+@@ -83,7 +83,7 @@ class MacUtil {
+   // Returns false if an error occurred.
+   static bool GetFrontmostWindowNameAndOwner(string *name, string *owner);
+ 
+-  // Returns true when Mozc's suggestion UI is expected to be surpressed on
++  // Returns true when Mozc's suggestion UI is expected to be suppressed on
+   // the window specified by |name| and |owner|.
+   static bool IsSuppressSuggestionWindow(const string &name,
+                                          const string &owner);
+diff --git base/mac_util_main.cc base/mac_util_main.cc
+index ba0fb87d1..1632e1ea3 100644
+--- base/mac_util_main.cc
++++ base/mac_util_main.cc
+@@ -31,27 +31,27 @@
+ #include <string>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/mac_util.h"
+ #include "base/util.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(bool, label_for_suffix, false,
++ABSL_FLAG(bool, label_for_suffix, false,
+           "call GetLabelForSuffix when specified");
+-MOZC_FLAG(bool, application_support_directory, false,
++ABSL_FLAG(bool, application_support_directory, false,
+           "call GetApplicationSupportDirectory when specified");
+-MOZC_FLAG(bool, logging_directory, false,
++ABSL_FLAG(bool, logging_directory, false,
+           "call GetLoggingDirectory when specified");
+-MOZC_FLAG(bool, os_version_string, false,
++ABSL_FLAG(bool, os_version_string, false,
+           "call GetOSVersionString when specified");
+-MOZC_FLAG(bool, server_directory, false,
++ABSL_FLAG(bool, server_directory, false,
+           "call GetServerDirectory when specified");
+-MOZC_FLAG(bool, serial_number, false, "call GetSerialNumber when specified");
+-MOZC_FLAG(bool, start_launchd_service, false,
++ABSL_FLAG(bool, serial_number, false, "call GetSerialNumber when specified");
++ABSL_FLAG(bool, start_launchd_service, false,
+           "call StartLaunchdService when specified");
+ 
+-MOZC_FLAG(string, suffix, "", "The argument for GetLabelForSuffix");
+-MOZC_FLAG(string, service_name, "", "The service name to be launched");
++ABSL_FLAG(std::string, suffix, "", "The argument for GetLabelForSuffix");
++ABSL_FLAG(std::string, service_name, "", "The service name to be launched");
+ 
+ #ifdef __APPLE__
+ using mozc::MacUtil;
+@@ -61,37 +61,37 @@ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+ #ifdef __APPLE__
+-  if (mozc::GetFlag(FLAGS_label_for_suffix)) {
+-    std::cout << MacUtil::GetLabelForSuffix(mozc::GetFlag(FLAGS_suffix))
++  if (absl::GetFlag(FLAGS_label_for_suffix)) {
++    std::cout << MacUtil::GetLabelForSuffix(absl::GetFlag(FLAGS_suffix))
+               << std::endl;
+   }
+ 
+-  if (mozc::GetFlag(FLAGS_application_support_directory)) {
++  if (absl::GetFlag(FLAGS_application_support_directory)) {
+     std::cout << MacUtil::GetApplicationSupportDirectory() << std::endl;
+   }
+ 
+-  if (mozc::GetFlag(FLAGS_logging_directory)) {
++  if (absl::GetFlag(FLAGS_logging_directory)) {
+     std::cout << MacUtil::GetLoggingDirectory() << std::endl;
+   }
+ 
+-  if (mozc::GetFlag(FLAGS_os_version_string)) {
++  if (absl::GetFlag(FLAGS_os_version_string)) {
+     std::cout << MacUtil::GetOSVersionString() << std::endl;
+   }
+ 
+-  if (mozc::GetFlag(FLAGS_server_directory)) {
++  if (absl::GetFlag(FLAGS_server_directory)) {
+     std::cout << MacUtil::GetServerDirectory() << std::endl;
+   }
+ 
+-  if (mozc::GetFlag(FLAGS_serial_number)) {
++  if (absl::GetFlag(FLAGS_serial_number)) {
+     std::cout << MacUtil::GetSerialNumber() << std::endl;
+   }
+ 
+-  if (mozc::GetFlag(FLAGS_start_launchd_service)) {
+-    if (mozc::GetFlag(FLAGS_service_name).empty()) {
++  if (absl::GetFlag(FLAGS_start_launchd_service)) {
++    if (absl::GetFlag(FLAGS_service_name).empty()) {
+       std::cout << "Specify the service name to be launched" << std::endl;
+     } else {
+       pid_t pid;
+-      MacUtil::StartLaunchdService(mozc::GetFlag(FLAGS_service_name), &pid);
++      MacUtil::StartLaunchdService(absl::GetFlag(FLAGS_service_name), &pid);
+       std::cout << "pid: " << pid << std::endl;
+     }
+   }
+diff --git base/mmap.h base/mmap.h
+index 028903589..93b52642b 100644
+--- base/mmap.h
++++ base/mmap.h
+@@ -55,7 +55,7 @@ class Mmap : public MmapSyncInterface {
+   // - The storage is (usually) solid state thus page-in/out is expected to
+   //   be faster.
+   // On Linux, in the kernel version >= 2.6.9, user process can mlock. In older
+-  // kernel, it fails if the process is running in user priviledge.
++  // kernel, it fails if the process is running in user privilege.
+   // TODO(team): Check if mlock is really necessary for Mac.
+   static bool IsMLockSupported();
+   static int MaybeMLock(const void *addr, size_t len);
+diff --git base/mmap_test.cc base/mmap_test.cc
+index bdcea1a6f..160fb915b 100644
+--- base/mmap_test.cc
++++ base/mmap_test.cc
+@@ -34,17 +34,17 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+ 
+ TEST(MmapTest, MmapTest) {
+   const std::string filename =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "test.db");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "test.db");
+ 
+   const size_t kFileNameSize[] = {1, 100, 1024, 8192};
+   for (int i = 0; i < arraysize(kFileNameSize); ++i) {
+diff --git base/multifile_test.cc base/multifile_test.cc
+index cb8b70d4a..c43c02eee 100644
+--- base/multifile_test.cc
++++ base/multifile_test.cc
+@@ -34,10 +34,10 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ 
+@@ -51,10 +51,10 @@ TEST(InputMultiFileTest, OpenNonexistentFilesTest) {
+     EXPECT_FALSE(multfile.ReadLine(&line));
+   }
+ 
+-  // Signle path
++  // Single path
+   {
+     const std::string path = FileUtil::JoinPath(
+-        mozc::GetFlag(FLAGS_test_tmpdir), "this_file_does_not_exist");
++        absl::GetFlag(FLAGS_test_tmpdir), "this_file_does_not_exist");
+     InputMultiFile multfile(path);
+     std::string line;
+     EXPECT_FALSE(multfile.ReadLine(&line));
+@@ -66,11 +66,11 @@ TEST(InputMultiFileTest, OpenNonexistentFilesTest) {
+   {
+     std::vector<std::string> filenames;
+     filenames.push_back(
+-        FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "these_files"));
++        FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "these_files"));
+     filenames.push_back(
+-        FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "do_not"));
++        FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "do_not"));
+     filenames.push_back(
+-        FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "exists"));
++        FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "exists"));
+ 
+     std::string joined_path;
+     Util::JoinStrings(filenames, ",", &joined_path);
+@@ -83,9 +83,9 @@ TEST(InputMultiFileTest, OpenNonexistentFilesTest) {
+ }
+ 
+ TEST(InputMultiFileTest, ReadSingleFileTest) {
+-  EXPECT_TRUE(FileUtil::DirectoryExists(mozc::GetFlag(FLAGS_test_tmpdir)));
++  EXPECT_TRUE(FileUtil::DirectoryExists(absl::GetFlag(FLAGS_test_tmpdir)));
+   const std::string path =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "i_am_a_test_file");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "i_am_a_test_file");
+ 
+   // Create a test file
+   std::vector<std::string> expected_lines;
+@@ -113,7 +113,7 @@ TEST(InputMultiFileTest, ReadSingleFileTest) {
+ }
+ 
+ TEST(InputMultiFileTest, ReadMultipleFilesTest) {
+-  EXPECT_TRUE(FileUtil::DirectoryExists(mozc::GetFlag(FLAGS_test_tmpdir)));
++  EXPECT_TRUE(FileUtil::DirectoryExists(absl::GetFlag(FLAGS_test_tmpdir)));
+ 
+   const int kNumFile = 3;
+   const int kNumLinesPerFile = 10;
+@@ -126,7 +126,7 @@ TEST(InputMultiFileTest, ReadMultipleFilesTest) {
+     for (int fileno = 0; fileno < kNumFile; ++fileno) {
+       std::string filename = Util::StringPrintf("testfile%d", fileno);
+       std::string path =
+-          FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), filename);
++          FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), filename);
+       paths.push_back(path);
+ 
+       OutputFileStream ofs(path.c_str());
+diff --git base/number_util.cc base/number_util.cc
+index b1f776978..fb3fe08b7 100644
+--- base/number_util.cc
++++ base/number_util.cc
+@@ -389,7 +389,7 @@ bool NumberUtil::ArabicToSeparatedArabic(absl::string_view input_num,
+ namespace {
+ 
+ // use default for wide Arabic, because half/full width for
+-// normal number is learned by charactor form manager.
++// normal number is learned by character form manager.
+ const NumberStringVariation kSingleDigitsVariations[] = {
+     {kNumKanjiDigits, 10, "漢数字", nullptr, nullptr,
+      NumberUtil::NumberString::NUMBER_KANJI_ARABIC},
+diff --git base/number_util_test.cc base/number_util_test.cc
+index 3582ade3a..3604aa0fa 100644
+--- base/number_util_test.cc
++++ base/number_util_test.cc
+@@ -583,7 +583,7 @@ TEST(NumberUtilTest, KanjiNumberToArabicNumber) {
+ }
+ 
+ TEST(NumberUtilTest, NormalizeNumbers) {
+-  // An element has input, expected Kanji output, and exepcted Arabic output.
++  // An element has input, expected Kanji output, and expected Arabic output.
+   const char *success_data[][3] = {
+       {"一", "一", "1"},
+       {"九", "九", "9"},
+@@ -641,7 +641,7 @@ TEST(NumberUtilTest, NormalizeNumbers) {
+     EXPECT_EQ(success_data[i][2], arabic_output);
+   }
+ 
+-  // An element has input, expected Kanji output, and exepcted Arabic output.
++  // An element has input, expected Kanji output, and expected Arabic output.
+   const char *success_notrim_data[][3] = {
+       {"012", "〇一二", "012"},
+       {"000", "〇〇〇", "000"},
+diff --git base/password_manager.cc base/password_manager.cc
+index 9e35f23c9..0ca8194b7 100644
+--- base/password_manager.cc
++++ base/password_manager.cc
+@@ -135,7 +135,7 @@ bool LoadPassword(std::string *password) {
+     return false;
+   }
+ 
+-  // Seems that the size of DPAPI-encrypted-mesage
++  // Seems that the size of DPAPI-encrypted-message
+   // becomes bigger than the original message.
+   // Typical file size is 32 * 5 = 160byte.
+   // We just set the maximum file size to be 4096byte just in case.
+diff --git base/password_manager_main.cc base/password_manager_main.cc
+index 41fa60428..6af134eb6 100644
+--- base/password_manager_main.cc
++++ base/password_manager_main.cc
+@@ -27,11 +27,11 @@
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/password_manager.h"
+ #include "base/util.h"
++#include "absl/flags/flag.h"
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+diff --git base/password_manager_test.cc base/password_manager_test.cc
+index b9776d00a..35ba43725 100644
+--- base/password_manager_test.cc
++++ base/password_manager_test.cc
+@@ -29,14 +29,14 @@
+ 
+ #include "base/password_manager.h"
+ 
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ TEST(PasswordManager, PasswordManagerTest) {
+-  SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++  SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+ 
+   std::string password1, password2;
+   EXPECT_TRUE(PasswordManager::InitPassword());
+diff --git base/process.h base/process.h
+index ca906f39e..dc3ffe744 100644
+--- base/process.h
++++ base/process.h
+@@ -65,7 +65,7 @@ class Process {
+   static bool WaitProcess(size_t pid, int timeout);
+ 
+   // Returns true if a process having |pid| is still alive.
+-  // if the the current thread has no permission to get the status or
++  // if the current thread has no permission to get the status or
+   // operation failed in system call, it returns |default_result|.
+   // TODO(all):
+   // Note that there is the case where the specified thread/process has already
+diff --git base/process_main.cc base/process_main.cc
+index 7b2405732..dfb2111b5 100644
+--- base/process_main.cc
++++ base/process_main.cc
+@@ -29,24 +29,24 @@
+ 
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/process.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, open_browser, "", "URL");
+-MOZC_FLAG(string, spawn_process, "", "path");
++ABSL_FLAG(std::string, open_browser, "", "URL");
++ABSL_FLAG(std::string, spawn_process, "", "path");
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+-  if (!mozc::GetFlag(FLAGS_open_browser).empty()) {
+-    if (!mozc::Process::OpenBrowser(mozc::GetFlag(FLAGS_open_browser))) {
+-      LOG(INFO) << "Failed to open: " << mozc::GetFlag(FLAGS_open_browser);
++  if (!absl::GetFlag(FLAGS_open_browser).empty()) {
++    if (!mozc::Process::OpenBrowser(absl::GetFlag(FLAGS_open_browser))) {
++      LOG(INFO) << "Failed to open: " << absl::GetFlag(FLAGS_open_browser);
+     }
+   }
+-  if (!mozc::GetFlag(FLAGS_spawn_process).empty()) {
+-    if (!mozc::Process::SpawnProcess(mozc::GetFlag(FLAGS_spawn_process), "")) {
+-      LOG(INFO) << "Failed to spawn: " << mozc::GetFlag(FLAGS_spawn_process);
++  if (!absl::GetFlag(FLAGS_spawn_process).empty()) {
++    if (!mozc::Process::SpawnProcess(absl::GetFlag(FLAGS_spawn_process), "")) {
++      LOG(INFO) << "Failed to spawn: " << absl::GetFlag(FLAGS_spawn_process);
+     }
+   }
+   return 0;
+diff --git base/process_mutex.h base/process_mutex.h
+index 68cf1ed4f..b8e411ea1 100644
+--- base/process_mutex.h
++++ base/process_mutex.h
+@@ -50,7 +50,7 @@
+ // }
+ //
+ // foo.Lock();
+-// /* process named "foo" is never instatiated inside this block */
++// /* process named "foo" is never instantiated inside this block */
+ // foo.Unlock();
+ 
+ namespace mozc {
+diff --git base/process_mutex_main.cc base/process_mutex_main.cc
+index 05bc2f46c..4b44b0111 100644
+--- base/process_mutex_main.cc
++++ base/process_mutex_main.cc
+@@ -34,28 +34,28 @@
+ #endif  // OS_WIN
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(int32, sleep_time, 30, "sleep 30 sec");
+-MOZC_FLAG(string, name, "named_event_test", "name for named event");
++ABSL_FLAG(int32, sleep_time, 30, "sleep 30 sec");
++ABSL_FLAG(std::string, name, "named_event_test", "name for named event");
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  mozc::ProcessMutex mutex(mozc::GetFlag(FLAGS_name).c_str());
++  mozc::ProcessMutex mutex(absl::GetFlag(FLAGS_name).c_str());
+ 
+   if (!mutex.Lock()) {
+-    LOG(INFO) << "Process " << mozc::GetFlag(FLAGS_name)
++    LOG(INFO) << "Process " << absl::GetFlag(FLAGS_name)
+               << " is already running";
+     return -1;
+   }
+ 
+ #ifdef OS_WIN
+-  ::Sleep(mozc::GetFlag(FLAGS_sleep_time) * 1000);
++  ::Sleep(absl::GetFlag(FLAGS_sleep_time) * 1000);
+ #else
+-  ::sleep(mozc::GetFlag(FLAGS_sleep_time));
++  ::sleep(absl::GetFlag(FLAGS_sleep_time));
+ #endif
+ 
+   mutex.UnLock();
+diff --git base/process_mutex_test.cc base/process_mutex_test.cc
+index d3050590f..b29af1c21 100644
+--- base/process_mutex_test.cc
++++ base/process_mutex_test.cc
+@@ -36,12 +36,12 @@
+ #endif  // OS_WIN
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/system_util.h"
+ #include "base/util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+@@ -51,7 +51,7 @@ class ProcessMutexTest : public testing::Test {
+  protected:
+   void SetUp() override {
+     original_user_profile_dir_ = SystemUtil::GetUserProfileDirectory();
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ 
+   void TearDown() override {
+diff --git base/run_level_main.cc base/run_level_main.cc
+index c91f35b91..a12be8d92 100644
+--- base/run_level_main.cc
++++ base/run_level_main.cc
+@@ -31,12 +31,12 @@
+ #include <string>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/run_level.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(bool, server, false, "server mode");
+-MOZC_FLAG(bool, client, false, "client mode");
++ABSL_FLAG(bool, server, false, "server mode");
++ABSL_FLAG(bool, client, false, "client mode");
+ 
+ // This is a simple command line tool
+ // too check RunLevel class
+@@ -45,9 +45,9 @@ int main(int argc, char **argv) {
+ 
+   mozc::RunLevel::RequestType type = mozc::RunLevel::SERVER;
+ 
+-  if (mozc::GetFlag(FLAGS_client)) {
++  if (absl::GetFlag(FLAGS_client)) {
+     type = mozc::RunLevel::CLIENT;
+-  } else if (mozc::GetFlag(FLAGS_server)) {
++  } else if (absl::GetFlag(FLAGS_server)) {
+     type = mozc::RunLevel::SERVER;
+   }
+ 
+diff --git base/scheduler.h base/scheduler.h
+index 75160258c..ec25a26e3 100644
+--- base/scheduler.h
++++ base/scheduler.h
+@@ -30,7 +30,7 @@
+ // Scheduler is a timer, call registered callback at a given interval.
+ // Scheduler has following features.
+ //  1. Backoff when the registered callback returns false.
+-//    - When the backoff is occured, next try will be after 2 * interval msec.
++//    - When the backoff is occurred, next try will be after 2 * interval msec.
+ //    - Interval will be doubled as long as callback returns false, but
+ //      will not exceed max_interval.
+ //  2. Randomised delayed start to reduce server traffic peak.
+diff --git base/singleton_test.cc base/singleton_test.cc
+index dea826ab2..c3b7e2031 100644
+--- base/singleton_test.cc
++++ base/singleton_test.cc
+@@ -81,8 +81,8 @@ TEST(SingletonTest, BasicTest) {
+ }
+ 
+ TEST(SingletonTest, ThreadTest) {
+-  // call Singelton::get() at the same time from
+-  // different threds. Make sure that get() returns
++  // call Singleton::get() at the same time from
++  // different threads. Make sure that get() returns
+   // the same instance
+ 
+   g_counter = 0;
+diff --git base/stopwatch_main.cc base/stopwatch_main.cc
+index 4d52a8350..3a656f8c6 100644
+--- base/stopwatch_main.cc
++++ base/stopwatch_main.cc
+@@ -30,19 +30,19 @@
+ #include <iostream>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/stopwatch.h"
+ #include "base/util.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(int32, sleep_time, 1000, "sleep time");
++ABSL_FLAG(int32, sleep_time, 1000, "sleep time");
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+   mozc::Stopwatch stopwatch;
+   stopwatch.Start();
+-  mozc::Util::Sleep(mozc::GetFlag(FLAGS_sleep_time));
++  mozc::Util::Sleep(absl::GetFlag(FLAGS_sleep_time));
+   stopwatch.Stop();
+   std::cout << stopwatch.GetElapsedMicroseconds() << std::endl;
+ 
+diff --git base/unverified_aes256.h base/unverified_aes256.h
+index e431bf6ea..ffae1e302 100644
+--- base/unverified_aes256.h
++++ base/unverified_aes256.h
+@@ -35,7 +35,7 @@
+ namespace mozc {
+ namespace internal {
+ 
+-// Note that this implemenation is kept just for the backward compatibility
++// Note that this implementation is kept just for the backward compatibility
+ // so that we can read previously obfuscated data.
+ // !!! Not FIPS-certified.
+ // !!! Performance optimization is not well considered.
+diff --git base/unverified_sha1.h base/unverified_sha1.h
+index 988fd1269..5b3a76f62 100644
+--- base/unverified_sha1.h
++++ base/unverified_sha1.h
+@@ -36,7 +36,7 @@
+ namespace mozc {
+ namespace internal {
+ 
+-// Note that this implemenation is kept just for the backward compatibility
++// Note that this implementation is kept just for the backward compatibility
+ // so that we can read previously obfuscated data.
+ // !!! Not FIPS-certified.
+ // !!! Performance optimization is not well considered.
+diff --git base/win_sandbox.cc base/win_sandbox.cc
+index 140ef6baa..fec250bb8 100644
+--- base/win_sandbox.cc
++++ base/win_sandbox.cc
+@@ -257,7 +257,7 @@ std::wstring WinSandbox::GetSDDL(ObjectSecurityType shareble_object_type,
+                                  bool is_windows_8_or_later) {
+   // See
+   // http://social.msdn.microsoft.com/Forums/en-US/windowssecurity/thread/e92502b1-0b9f-4e02-9d72-e4e47e924a8f/
+-  // for how to acess named objects from an AppContainer.
++  // for how to access named objects from an AppContainer.
+ 
+   std::wstring dacl;
+   std::wstring sacl;
+@@ -1393,12 +1393,12 @@ bool WinSandbox::EnsureAllApplicationPackagesPermisssion(
+   // Check if the desired ACE is already specified or not.
+   for (UINT i = 0; i < dacl.GetAceCount(); ++i) {
+     CSid ace_sid;
+-    ACCESS_MASK acess_mask = 0;
++    ACCESS_MASK access_mask = 0;
+     BYTE ace_type = 0;
+-    dacl.GetAclEntry(i, &ace_sid, &acess_mask, &ace_type);
++    dacl.GetAclEntry(i, &ace_sid, &access_mask, &ace_type);
+     if (ace_sid == all_application_packages &&
+         ace_type == ACCESS_ALLOWED_ACE_TYPE &&
+-        (acess_mask & kDesiredMask) == kDesiredMask) {
++        (access_mask & kDesiredMask) == kDesiredMask) {
+       // This is the desired ACE.  There is nothing to do.
+       return true;
+     }
+diff --git build_defs.bzl build_defs.bzl
+index ccf4e6eae..d0d3fc57f 100644
+--- build_defs.bzl
++++ build_defs.bzl
+@@ -35,6 +35,8 @@
+ load("//tools/build_defs:build_cleaner.bzl", "register_extension_info")
+ load("//tools/build_defs:stubs.bzl", "pytype_strict_binary", "pytype_strict_library")
+ load("//tools/build_rules/android_cc_test:def.bzl", "android_cc_test")
++load("//:config.bzl", "BRANDING", "MACOS_BUNDLE_ID_PREFIX", "MACOS_MIN_OS_VER")
++load("@build_bazel_rules_apple//apple:macos.bzl", "macos_application")
+ 
+ def cc_library_mozc(deps = [], **kwargs):
+     """
+@@ -80,12 +82,12 @@ def cc_test_mozc(name, tags = [], deps = [], **kwargs):
+     if "no_android" not in tags:
+         android_cc_test(
+             name = name + "_android",
++            cc_test_name = name,
++            requires_full_emulation = requires_full_emulation,
+             # "manual" prevents this target triggered by a wild card.
+             # So that "blaze test ..." does not contain this target.
+             # Otherwise it is too slow.
+             tags = ["manual", "notap"],
+-            cc_test_name = name,
+-            requires_full_emulation = requires_full_emulation,
+         )
+ 
+ register_extension_info(
+@@ -130,16 +132,45 @@ register_extension_info(
+     label_regex_for_dep = "{extension_name}",
+ )
+ 
+-def objc_library_mozc(name, srcs = [], hdrs = [], deps = [], sdk_frameworks = [], **kwargs):
++def info_plist_mozc(name, srcs = [], outs = []):
++    native.genrule(
++        name = name,
++        srcs = srcs + ["//base:mozc_version_txt"],
++        outs = outs,
++        cmd = ("$(location //build_tools:tweak_info_plist)" +
++               " --output $@" +
++               " --input $(location " + srcs[0] + ")" +
++               " --version_file $(location //base:mozc_version_txt)" +
++               " --branding " + BRANDING),
++        exec_tools = ["//build_tools:tweak_info_plist"],
++    )
++
++def objc_library_mozc(name, srcs = [], hdrs = [], deps = [], proto_deps = [], sdk_frameworks = [], **kwargs):
++    # Because proto_library cannot be in deps of objc_library,
++    # cc_library as a wrapper is necessary as a workaround.
++    proto_deps_name = name + "_proto_deps"
++    native.cc_library(
++        name = proto_deps_name,
++        deps = proto_deps,
++    )
+     native.objc_library(
+         name = name,
+         srcs = srcs,
+         hdrs = hdrs,
+-        deps = deps + ["//:macro"],
++        deps = deps + ["//:macro", proto_deps_name],
+         sdk_frameworks = sdk_frameworks,
+         **kwargs
+     )
+ 
++def macos_application_mozc(name, bundle_name, bundle_id = None, **kwargs):
++    macos_application(
++        name = name,
++        bundle_id = bundle_id or (MACOS_BUNDLE_ID_PREFIX + "." + bundle_name),
++        bundle_name = bundle_name,
++        minimum_os_version = MACOS_MIN_OS_VER,
++        **kwargs
++    )
++
+ def _get_value(args):
+     for arg in args:
+         if arg != None:
+@@ -158,7 +189,8 @@ def select_mozc(
+         oss_android = None,
+         oss_linux = None,
+         oss_macos = None,
+-        wasm = None):
++        wasm = None,
++        windows = None):
+     """select wrapper for target os selection.
+ 
+     The priority of value checking:
+@@ -181,6 +213,7 @@ def select_mozc(
+       oss_linux: value for OSS Linux build.
+       oss_macos: value for OSS macOS build.
+       wasm: value for wasm build.
++      windows: value for Windows build. (placeholder)
+ 
+     Returns:
+       Generated select statement.
+@@ -189,8 +222,9 @@ def select_mozc(
+         "//tools/cc_target_os:android": _get_value([android, client, default]),
+         "//tools/cc_target_os:apple": _get_value([ios, client, default]),
+         "//tools/cc_target_os:chromiumos": _get_value([chromiumos, client, default]),
+-        "//tools/cc_target_os:wasm": _get_value([wasm, client, default]),
+         "//tools/cc_target_os:darwin": _get_value([macos, ios, client, default]),
++        "//tools/cc_target_os:wasm": _get_value([wasm, client, default]),
++        "//tools/cc_target_os:windows": _get_value([windows, client, default]),
+         "//tools/cc_target_os:linux": _get_value([linux, client, default]),
+         "//tools/cc_target_os:oss_android": _get_value([oss_android, oss, android, client, default]),
+         "//tools/cc_target_os:oss_linux": _get_value([oss_linux, oss, linux, client, default]),
+diff --git build_tools/copy_dll_and_symbol.py build_tools/copy_dll_and_symbol.py
+index 0f871190f..e0177c2b0 100644
+--- build_tools/copy_dll_and_symbol.py
++++ build_tools/copy_dll_and_symbol.py
+@@ -82,12 +82,13 @@ def _GetLastModifiedTime(filepath):
+     Args:
+       filepath: A string which represents the filename to be checked.
+ 
+-      Returns:
+-        A Datetime object which represents the last modified time of the
+-        specified filename. If the file does not exist, returns epoch time.
++    Returns:
++      A Datetime object which represents the last modified time of the
++      specified filename. If the file does not exist, returns epoch time +1 day.
+     """
+     if not os.path.isfile(filepath):
+-      return datetime.datetime.fromtimestamp(0)
++      # The epoch time doesn't work in some timezones. 86400 = 24 * 60 * 60.
++      return datetime.datetime.fromtimestamp(86400)
+     return datetime.datetime.fromtimestamp(os.path.getmtime(filepath))
+ 
+   target_file_mtime = _GetLastModifiedTime(target_file_abspath)
+diff --git build_tools/mozc_win32_resource_template.rc build_tools/mozc_win32_resource_template.rc
+index 72f401f66..7776912d8 100644
+Binary files build_tools/mozc_win32_resource_template.rc and build_tools/mozc_win32_resource_template.rc differ
+diff --git client/BUILD client/BUILD
+index 099654818..840880f62 100644
+--- client/BUILD
++++ client/BUILD
+@@ -127,7 +127,6 @@ cc_binary_mozc(
+     deps = [
+         ":client",
+         "//base",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:logging",
+         "//base:process",
+@@ -142,7 +141,6 @@ cc_binary_mozc(
+         ":client",
+         "//base",
+         "//base:file_stream",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:logging",
+         "//base:port",
+@@ -162,7 +160,6 @@ cc_binary_mozc(
+         "//base",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:logging",
+         "//base:port",
+@@ -185,7 +182,6 @@ cc_binary_mozc(
+         ":client",
+         "//base",
+         "//base:file_stream",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:logging",
+         "//base:port",
+@@ -206,9 +202,9 @@ cc_binary_mozc(
+     deps = [
+         ":client",
+         "//base",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:logging",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -237,7 +233,6 @@ cc_binary_mozc(
+         ":client",
+         "//base",
+         "//base:file_stream",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:logging",
+         "//base:multifile",
+diff --git client/client.h client/client.h
+index 3c7224489..0d4d52aed 100644
+--- client/client.h
++++ client/client.h
+@@ -51,7 +51,7 @@ class Config;
+ 
+ namespace client {
+ 
+-// default ServerLauncher implemntation.
++// default ServerLauncher implementation.
+ // This class uses fork&exec (linux/mac) and CreateProcess() (Windows)
+ // to launch server process
+ class ServerLauncher : public ServerLauncherInterface {
+@@ -177,8 +177,9 @@ class Client : public ClientInterface {
+                            const std::string &label) const;
+ 
+   // Start server:
+-  // return true if server is launched sucessfully or server is already running.
+-  // return false if server cannot be launched.
++  // * Return true if server is launched successfully or server is already
++  //   running.
++  // * Return false if server cannot be launched.
+   // If server_program is empty, which is default setting, the path to
+   // GoogleJapaneseInputConverter is determined automatically.
+   // Windows: "C:\Program Files\Google\Google Japanese Input\"
+diff --git client/client_interface.h client/client_interface.h
+index 14f1313c2..8a1ea88bc 100644
+--- client/client_interface.h
++++ client/client_interface.h
+@@ -73,7 +73,7 @@ class ServerLauncherInterface {
+   // Wait server until it terminates
+   virtual bool WaitServer(uint32 pid) = 0;
+ 
+-  // called when fatal error occured.
++  // called when fatal error occurred.
+   virtual void OnFatal(ServerErrorType type) = 0;
+ 
+   // set the full path of server program.
+@@ -121,7 +121,7 @@ class ClientInterface {
+   // Checks protocol/product version.
+   // If a  new version is avaialable, restart the server.
+   // return true the server is available.
+-  // return false some error happend during the server restart.
++  // return false some error happened during the server restart.
+   // This method calls EnsureConnection automatically.
+   virtual bool CheckVersionOrRestartServer() = 0;
+ 
+@@ -181,7 +181,7 @@ class ClientInterface {
+   // Cleanup un-used sessions
+   virtual bool Cleanup() = 0;
+ 
+-  // Resets internal state (changs the state to be SERVER_UNKNWON)
++  // Resets internal state (changs the state to be SERVER_UNKNOWN)
+   virtual void Reset() = 0;
+ 
+   // Returns true if server is alive.
+@@ -200,7 +200,7 @@ class ClientInterface {
+   virtual void set_timeout(int timeout) = 0;
+ 
+   // Sets restricted mode.
+-  // server is launched inside restricted enviroment.
++  // server is launched inside restricted environment.
+   virtual void set_restricted(bool restricted) = 0;
+ 
+   // Sets server program path.
+diff --git client/client_performance_test_main.cc client/client_performance_test_main.cc
+index defdb2eda..3a377628f 100644
+--- client/client_performance_test_main.cc
++++ client/client_performance_test_main.cc
+@@ -35,7 +35,6 @@
+ #include <vector>
+ 
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+@@ -48,8 +47,8 @@
+ #include "session/random_keyevents_generator.h"
+ #include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, server_path, "", "specify server path");
+-MOZC_FLAG(string, log_path, "", "specify log output file path");
++ABSL_FLAG(std::string, server_path, "", "specify server path");
++ABSL_FLAG(std::string, log_path, "", "specify log output file path");
+ 
+ namespace mozc {
+ namespace {
+@@ -100,8 +99,8 @@ class TestScenarioInterface {
+   virtual void Run(Result *result) = 0;
+ 
+   TestScenarioInterface() {
+-    if (!mozc::GetFlag(FLAGS_server_path).empty()) {
+-      client_.set_server_program(mozc::GetFlag(FLAGS_server_path));
++    if (!absl::GetFlag(FLAGS_server_path).empty()) {
++      client_.set_server_program(absl::GetFlag(FLAGS_server_path));
+     }
+     CHECK(client_.IsValidRunLevel()) << "IsValidRunLevel failed";
+     CHECK(client_.EnsureSession()) << "EnsureSession failed";
+@@ -378,8 +377,8 @@ int main(int argc, char **argv) {
+   CHECK_EQ(results.size(), tests.size());
+ 
+   std::ostream *ofs = &std::cout;
+-  if (!mozc::GetFlag(FLAGS_log_path).empty()) {
+-    ofs = new mozc::OutputFileStream(mozc::GetFlag(FLAGS_log_path).c_str());
++  if (!absl::GetFlag(FLAGS_log_path).empty()) {
++    ofs = new mozc::OutputFileStream(absl::GetFlag(FLAGS_log_path).c_str());
+   }
+ 
+   // TODO(taku): generate histogram with ChartAPI
+diff --git client/client_quality_test_main.cc client/client_quality_test_main.cc
+index d43d203f9..a88baac88 100644
+--- client/client_quality_test_main.cc
++++ client/client_quality_test_main.cc
+@@ -34,7 +34,6 @@
+ #include <vector>
+ 
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/multifile.h"
+@@ -43,15 +42,15 @@
+ #include "client/client.h"
+ #include "evaluation/scorer.h"
+ #include "protocol/commands.pb.h"
++#include "absl/flags/flag.h"
+ 
+ // Test data automatically generated by gen_client_quality_test_data.py
+ // TestCase test_cases[] is defined.
+ #include "client/client_quality_test_data.inc"
+-#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, server_path, "", "specify server path");
+-MOZC_FLAG(string, log_path, "", "specify log output file path");
+-MOZC_FLAG(int32, max_case_for_source, 500,
++ABSL_FLAG(std::string, server_path, "", "specify server path");
++ABSL_FLAG(std::string, log_path, "", "specify log output file path");
++ABSL_FLAG(int32, max_case_for_source, 500,
+           "specify max test case number for each test sources");
+ 
+ namespace mozc {
+@@ -203,8 +202,8 @@ int main(int argc, char* argv[]) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+   mozc::client::Client client;
+-  if (!mozc::GetFlag(FLAGS_server_path).empty()) {
+-    client.set_server_program(mozc::GetFlag(FLAGS_server_path));
++  if (!absl::GetFlag(FLAGS_server_path).empty()) {
++    client.set_server_program(absl::GetFlag(FLAGS_server_path));
+   }
+ 
+   CHECK(client.IsValidRunLevel()) << "IsValidRunLevel failed";
+@@ -222,7 +221,7 @@ int main(int argc, char* argv[]) {
+     if (scores.find(source) == scores.end()) {
+       scores[source] = std::vector<double>();
+     }
+-    if (scores[source].size() >= mozc::GetFlag(FLAGS_max_case_for_source)) {
++    if (scores[source].size() >= absl::GetFlag(FLAGS_max_case_for_source)) {
+       continue;
+     }
+ 
+@@ -248,8 +247,8 @@ int main(int argc, char* argv[]) {
+   }
+ 
+   std::ostream* ofs = &std::cout;
+-  if (!mozc::GetFlag(FLAGS_log_path).empty()) {
+-    ofs = new mozc::OutputFileStream(mozc::GetFlag(FLAGS_log_path).c_str());
++  if (!absl::GetFlag(FLAGS_log_path).empty()) {
++    ofs = new mozc::OutputFileStream(absl::GetFlag(FLAGS_log_path).c_str());
+   }
+ 
+   // Average the scores
+diff --git client/client_scenario_test_main.cc client/client_scenario_test_main.cc
+index 584dbb985..acdb700fe 100644
+--- client/client_scenario_test_main.cc
++++ client/client_scenario_test_main.cc
+@@ -39,7 +39,6 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+@@ -54,13 +53,13 @@
+ #include "absl/memory/memory.h"
+ #include "absl/strings/match.h"
+ 
+-MOZC_FLAG(string, input, "", "Input file");
+-MOZC_FLAG(int32, key_duration, 10, "Key duration (msec)");
+-MOZC_FLAG(string, profile_dir, "", "Profile dir");
+-MOZC_FLAG(bool, sentence_mode, false, "Use input as sentences");
+-MOZC_FLAG(string, server_path, "", "Specify server path");
+-MOZC_FLAG(bool, test_renderer, false, "Test renderer");
+-MOZC_FLAG(bool, test_testsendkey, true, "Test TestSendKey");
++ABSL_FLAG(std::string, input, "", "Input file");
++ABSL_FLAG(int32, key_duration, 10, "Key duration (msec)");
++ABSL_FLAG(std::string, profile_dir, "", "Profile dir");
++ABSL_FLAG(bool, sentence_mode, false, "Use input as sentences");
++ABSL_FLAG(std::string, server_path, "", "Specify server path");
++ABSL_FLAG(bool, test_renderer, false, "Test renderer");
++ABSL_FLAG(bool, test_testsendkey, true, "Test TestSendKey");
+ 
+ namespace mozc {
+ namespace {
+@@ -97,8 +96,8 @@ bool ReadKeys(std::istream *input, std::vector<commands::KeyEvent> *keys,
+ 
+ int Loop(std::istream *input) {
+   mozc::client::Client client;
+-  if (!mozc::GetFlag(FLAGS_server_path).empty()) {
+-    client.set_server_program(mozc::GetFlag(FLAGS_server_path));
++  if (!absl::GetFlag(FLAGS_server_path).empty()) {
++    client.set_server_program(absl::GetFlag(FLAGS_server_path));
+   }
+ 
+   CHECK(client.IsValidRunLevel()) << "IsValidRunLevel failed";
+@@ -108,7 +107,7 @@ int Loop(std::istream *input) {
+   std::unique_ptr<mozc::renderer::RendererClient> renderer_client;
+   mozc::commands::RendererCommand renderer_command;
+ 
+-  if (mozc::GetFlag(FLAGS_test_renderer)) {
++  if (absl::GetFlag(FLAGS_test_renderer)) {
+ #ifdef OS_WIN
+     renderer_command.mutable_application_info()->set_process_id(
+         ::GetCurrentProcessId());
+@@ -139,9 +138,9 @@ int Loop(std::istream *input) {
+   while (ReadKeys(input, &keys, &answer)) {
+     CHECK(client.NoOperation()) << "Server is not responding";
+     for (size_t i = 0; i < keys.size(); ++i) {
+-      Util::Sleep(mozc::GetFlag(FLAGS_key_duration));
++      Util::Sleep(absl::GetFlag(FLAGS_key_duration));
+ 
+-      if (mozc::GetFlag(FLAGS_test_testsendkey)) {
++      if (absl::GetFlag(FLAGS_test_testsendkey)) {
+         VLOG(2) << "Sending to Server: " << keys[i].DebugString();
+         client.TestSendKey(keys[i], &output);
+         VLOG(2) << "Output of TestSendKey: " << output.DebugString();
+@@ -175,20 +174,20 @@ int Loop(std::istream *input) {
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  if (!mozc::GetFlag(FLAGS_profile_dir).empty()) {
+-    mozc::FileUtil::CreateDirectory(mozc::GetFlag(FLAGS_profile_dir));
+-    mozc::SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_profile_dir));
++  if (!absl::GetFlag(FLAGS_profile_dir).empty()) {
++    mozc::FileUtil::CreateDirectory(absl::GetFlag(FLAGS_profile_dir));
++    mozc::SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_profile_dir));
+   }
+ 
+   std::unique_ptr<mozc::InputFileStream> input_file;
+   std::istream *input = nullptr;
+ 
+-  if (!mozc::GetFlag(FLAGS_input).empty()) {
++  if (!absl::GetFlag(FLAGS_input).empty()) {
+     // Batch mode loading the input file.
+     input_file = absl::make_unique<mozc::InputFileStream>(
+-        mozc::GetFlag(FLAGS_input).c_str());
++        absl::GetFlag(FLAGS_input).c_str());
+     if (input_file->fail()) {
+-      LOG(ERROR) << "File not opened: " << mozc::GetFlag(FLAGS_input);
++      LOG(ERROR) << "File not opened: " << absl::GetFlag(FLAGS_input);
+       return 1;
+     }
+     input = input_file.get();
+diff --git client/client_stress_test_main.cc client/client_stress_test_main.cc
+index a7e74c134..6b3d892a8 100644
+--- client/client_stress_test_main.cc
++++ client/client_stress_test_main.cc
+@@ -41,7 +41,6 @@
+ #include <memory>
+ 
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+@@ -55,21 +54,21 @@
+ // 1. multi-thread testing
+ // 2. change/config the senario
+ 
+-MOZC_FLAG(int32, max_keyevents, 100000,
++ABSL_FLAG(int32, max_keyevents, 100000,
+           "test at most |max_keyevents| key sequences");
+-MOZC_FLAG(string, server_path, "", "specify server path");
+-MOZC_FLAG(int32, key_duration, 10, "key duration (msec)");
+-MOZC_FLAG(bool, test_renderer, false, "test renderer");
+-MOZC_FLAG(bool, test_testsendkey, true, "test TestSendKey");
++ABSL_FLAG(std::string, server_path, "", "specify server path");
++ABSL_FLAG(int32, key_duration, 10, "key duration (msec)");
++ABSL_FLAG(bool, test_renderer, false, "test renderer");
++ABSL_FLAG(bool, test_testsendkey, true, "test TestSendKey");
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  mozc::SetFlag(&FLAGS_logtostderr, true);
++  absl::SetFlag(&FLAGS_logtostderr, true);
+ 
+   mozc::client::Client client;
+-  if (!mozc::GetFlag(FLAGS_server_path).empty()) {
+-    client.set_server_program(mozc::GetFlag(FLAGS_server_path));
++  if (!absl::GetFlag(FLAGS_server_path).empty()) {
++    client.set_server_program(absl::GetFlag(FLAGS_server_path));
+   }
+ 
+   CHECK(client.IsValidRunLevel()) << "IsValidRunLevel failed";
+@@ -79,7 +78,7 @@ int main(int argc, char **argv) {
+   std::unique_ptr<mozc::renderer::RendererClient> renderer_client;
+   mozc::commands::RendererCommand renderer_command;
+ 
+-  if (mozc::GetFlag(FLAGS_test_renderer)) {
++  if (absl::GetFlag(FLAGS_test_renderer)) {
+ #ifdef OS_WIN
+     renderer_command.mutable_application_info()->set_process_id(
+         ::GetCurrentProcessId());
+@@ -111,17 +110,17 @@ int main(int argc, char **argv) {
+     mozc::session::RandomKeyEventsGenerator::GenerateSequence(&keys);
+     CHECK(client.NoOperation()) << "Server is not responding";
+     for (size_t i = 0; i < keys.size(); ++i) {
+-      mozc::Util::Sleep(mozc::GetFlag(FLAGS_key_duration));
++      mozc::Util::Sleep(absl::GetFlag(FLAGS_key_duration));
+       keyevents_size++;
+       if (keyevents_size % 100 == 0) {
+         std::cout << keyevents_size << " key events finished" << std::endl;
+       }
+-      if (mozc::GetFlag(FLAGS_max_keyevents) < keyevents_size) {
++      if (absl::GetFlag(FLAGS_max_keyevents) < keyevents_size) {
+         std::cout << "key events reached to "
+-                  << mozc::GetFlag(FLAGS_max_keyevents) << std::endl;
++                  << absl::GetFlag(FLAGS_max_keyevents) << std::endl;
+         return 0;
+       }
+-      if (mozc::GetFlag(FLAGS_test_testsendkey)) {
++      if (absl::GetFlag(FLAGS_test_testsendkey)) {
+         VLOG(2) << "Sending to Server: " << keys[i].DebugString();
+         client.TestSendKey(keys[i], &output);
+         VLOG(2) << "Output of TestSendKey: " << output.DebugString();
+diff --git client/ping_server_main.cc client/ping_server_main.cc
+index 879191b73..261a2daf6 100644
+--- client/ping_server_main.cc
++++ client/ping_server_main.cc
+@@ -29,10 +29,10 @@
+ 
+ #include <iostream>  // NOLINT
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "client/client.h"
++#include "absl/flags/flag.h"
+ 
+ // Simple command line tool to ping mozc server
+ int main(int argc, char **argv) {
+diff --git client/server_launcher.cc client/server_launcher.cc
+index 24e37cd8c..c201c5d0a 100644
+--- client/server_launcher.cc
++++ client/server_launcher.cc
+@@ -132,7 +132,7 @@ bool ServerLauncher::StartServer(ClientInterface *client) {
+ #endif
+ 
+ #ifdef DEBUG
+-  // In oreder to test the Session treatment (timeout/size constratins),
++  // In order to test the Session treatment (timeout/size constratins),
+   // Server flags can be configurable on DEBUG build
+   if (!arg.empty()) {
+     arg += " ";
+diff --git client/server_launcher_main.cc client/server_launcher_main.cc
+index 67e045bf7..f3381f500 100644
+--- client/server_launcher_main.cc
++++ client/server_launcher_main.cc
+@@ -29,20 +29,19 @@
+ 
+ #include <iostream>  // NOLINT
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "client/client.h"
+ #include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(bool, shutdown, false, "shutdown server if mozc_server is running");
++ABSL_FLAG(bool, shutdown, false, "shutdown server if mozc_server is running");
+ 
+ // simple command line tool to launch mozc server
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+   mozc::client::Client client;
+ 
+-  if (mozc::GetFlag(FLAGS_shutdown)) {
++  if (absl::GetFlag(FLAGS_shutdown)) {
+     client.Shutdown();
+   }
+ 
+diff --git composer/BUILD composer/BUILD
+index c3a74b721..7d27f0780 100644
+--- composer/BUILD
++++ composer/BUILD
+@@ -49,7 +49,6 @@ cc_library_mozc(
+         ":table",
+         ":type_corrected_query",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:util",
+@@ -66,6 +65,7 @@ cc_library_mozc(
+         "//protocol:config_proto",
+         "//testing:gunit_prod",
+         "//transliteration",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -145,12 +145,12 @@ cc_binary_mozc(
+         ":composition_interface",
+         ":table",
+         "//base",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base/protobuf",
+         "//protocol:commands_proto",
+         "//protocol:config_proto",
+         "//transliteration",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+diff --git composer/composer.cc composer/composer.cc
+index 5c8beb304..077874526 100644
+--- composer/composer.cc
++++ composer/composer.cc
+@@ -31,7 +31,6 @@
+ 
+ #include "composer/composer.h"
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/util.h"
+ #include "composer/internal/composition.h"
+@@ -46,11 +45,12 @@
+ #include "config/config_handler.h"
+ #include "protocol/commands.pb.h"
+ #include "protocol/config.pb.h"
++#include "absl/flags/flag.h"
+ 
+ // Use flags instead of constant for performance evaluation.
+-MOZC_FLAG(uint64, max_typing_correction_query_candidates, 40,
++ABSL_FLAG(uint64, max_typing_correction_query_candidates, 40,
+           "Maximum # of typing correction query temporary candidates.");
+-MOZC_FLAG(uint64, max_typing_correction_query_results, 8,
++ABSL_FLAG(uint64, max_typing_correction_query_results, 8,
+           "Maximum # of typing correction query results.");
+ 
+ namespace mozc {
+@@ -208,8 +208,8 @@ Composer::Composer(const Table *table, const commands::Request *request,
+       shifted_sequence_count_(0),
+       composition_(new Composition(table)),
+       typing_corrector_(
+-          table, mozc::GetFlag(FLAGS_max_typing_correction_query_candidates),
+-          mozc::GetFlag(FLAGS_max_typing_correction_query_results)),
++          table, absl::GetFlag(FLAGS_max_typing_correction_query_candidates),
++          absl::GetFlag(FLAGS_max_typing_correction_query_results)),
+       max_length_(kMaxPreeditLength),
+       request_(request),
+       config_(config) {
+diff --git composer/composer_main.cc composer/composer_main.cc
+index 51acd415b..d98cfbe0f 100644
+--- composer/composer_main.cc
++++ composer/composer_main.cc
+@@ -31,7 +31,6 @@
+ #include <memory>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "composer/composer.h"
+ #include "composer/composition_interface.h"
+@@ -39,8 +38,9 @@
+ #include "protocol/commands.pb.h"
+ #include "protocol/config.pb.h"
+ #include "transliteration/transliteration.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, table, "system://romanji-hiragana.tsv",
++ABSL_FLAG(std::string, table, "system://romanji-hiragana.tsv",
+           "preedit conversion table file.");
+ 
+ using ::mozc::commands::Request;
+@@ -50,7 +50,7 @@ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+   mozc::composer::Table table;
+-  table.LoadFromFile(mozc::GetFlag(FLAGS_table).c_str());
++  table.LoadFromFile(absl::GetFlag(FLAGS_table).c_str());
+   std::unique_ptr<mozc::composer::Composer> composer(
+       new mozc::composer::Composer(&table, &Request::default_instance(),
+                                    &Config::default_instance()));
+diff --git composer/composer_test.cc composer/composer_test.cc
+index c589c542d..2d365a469 100644
+--- composer/composer_test.cc
++++ composer/composer_test.cc
+@@ -2514,7 +2514,7 @@ TEST_F(ComposerTest, InputModesChangeWhenCursorMoves) {
+   }
+ }
+ 
+-TEST_F(ComposerTest, ShuoldCommit) {
++TEST_F(ComposerTest, ShouldCommit) {
+   table_->AddRuleWithAttributes("ka", "[KA]", "", DIRECT_INPUT);
+   table_->AddRuleWithAttributes("tt", "[X]", "t", DIRECT_INPUT);
+   table_->AddRuleWithAttributes("ta", "[TA]", "", NO_TABLE_ATTRIBUTE);
+diff --git composer/internal/BUILD composer/internal/BUILD
+index 9ca7887c5..66f0b7130 100644
+--- composer/internal/BUILD
++++ composer/internal/BUILD
+@@ -184,10 +184,10 @@ cc_binary_mozc(
+     srcs = ["composition_main.cc"],
+     deps = [
+         ":composition",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//composer:composition_interface",
+         "//composer:table",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -243,9 +243,9 @@ cc_binary_mozc(
+     srcs = ["converter_main.cc"],
+     deps = [
+         ":converter",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//composer:table",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -301,7 +301,6 @@ cc_library_mozc(
+         ":composition_input",
+         ":typing_model",
+         "//base",
+-        "//base:flags",
+         "//base:port",
+         "//base/protobuf",
+         "//base/protobuf:repeated_field",
+@@ -310,6 +309,7 @@ cc_library_mozc(
+         "//composer:type_corrected_query",
+         "//config:config_handler",
+         "//protocol:config_proto",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+diff --git composer/internal/char_chunk_test.cc composer/internal/char_chunk_test.cc
+index 9b8c9243c..12dac3eda 100644
+--- composer/internal/char_chunk_test.cc
++++ composer/internal/char_chunk_test.cc
+@@ -1026,7 +1026,7 @@ TEST(CharChunkTest, Combine) {
+     EXPECT_EQ("LRRR", rhs.raw());
+   }
+ 
+-  {  // lhs' ambigous is empty.
++  {  // lhs' ambiguous is empty.
+     CharChunk lhs(Transliterators::CONVERSION_STRING, nullptr);
+     CharChunk rhs(Transliterators::CONVERSION_STRING, nullptr);
+ 
+@@ -1047,7 +1047,7 @@ TEST(CharChunkTest, Combine) {
+     EXPECT_EQ("LRRR", rhs.raw());
+   }
+ 
+-  {  // rhs' ambigous is empty.
++  {  // rhs' ambiguous is empty.
+     CharChunk lhs(Transliterators::CONVERSION_STRING, nullptr);
+     CharChunk rhs(Transliterators::CONVERSION_STRING, nullptr);
+ 
+diff --git composer/internal/composition_main.cc composer/internal/composition_main.cc
+index 82e63fe84..0fec00464 100644
+--- composer/internal/composition_main.cc
++++ composer/internal/composition_main.cc
+@@ -30,19 +30,19 @@
+ #include <iostream>  // NOLINT
+ #include <sstream>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "composer/internal/composition.h"
+ #include "composer/table.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, table, "system://romanji-hiragana.tsv",
++ABSL_FLAG(std::string, table, "system://romanji-hiragana.tsv",
+           "preedit conversion table file.");
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+   mozc::composer::Table table;
+-  table.LoadFromFile(mozc::GetFlag(FLAGS_table).c_str());
++  table.LoadFromFile(absl::GetFlag(FLAGS_table).c_str());
+ 
+   mozc::composer::Composition composition(&table);
+ 
+diff --git composer/internal/converter_main.cc composer/internal/converter_main.cc
+index 2c92d0d31..c091f50dd 100644
+--- composer/internal/converter_main.cc
++++ composer/internal/converter_main.cc
+@@ -30,19 +30,19 @@
+ #include <iostream>  // NOLINT
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "composer/internal/converter.h"
+ #include "composer/table.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, table, "system://romanji-hiragana.tsv",
++ABSL_FLAG(std::string, table, "system://romanji-hiragana.tsv",
+           "preedit conversion table file.");
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+   mozc::composer::Table table;
+-  table.LoadFromFile(mozc::GetFlag(FLAGS_table).c_str());
++  table.LoadFromFile(absl::GetFlag(FLAGS_table).c_str());
+ 
+   mozc::composer::Converter converter(table);
+ 
+diff --git composer/internal/transliterator_interface.h composer/internal/transliterator_interface.h
+index d335b422e..e112761d4 100644
+--- composer/internal/transliterator_interface.h
++++ composer/internal/transliterator_interface.h
+@@ -52,7 +52,7 @@ class TransliteratorInterface {
+   // Split raw and converted strings based on the transliteration
+   // rule.  If raw or converted could not be deterministically split,
+   // fall back strings are fill and false is returned.  The first
+-  // arugment, position, is in character (rather than byte).
++  // argument, position, is in character (rather than byte).
+   //
+   // Expected usage examples:
+   // - HiraganaTransliterator(1, "kk", "っk") => true
+diff --git composer/internal/transliterators.cc composer/internal/transliterators.cc
+index 1f7e52dbb..c57dc3cb0 100644
+--- composer/internal/transliterators.cc
++++ composer/internal/transliterators.cc
+@@ -90,7 +90,7 @@ class ConversionStringSelector : public TransliteratorInterface {
+     return converted;
+   }
+ 
+-  // NOTE(komatsu): The first argument, size_t postion, should not be
++  // NOTE(komatsu): The first argument, size_t position, should not be
+   // const because this function overrides the virtual function of
+   // TransliterateInterface whose first argument is not const.
+   // Otherwise the Windows compiler (cl.exe) raises an error.
+diff --git composer/internal/transliterators.h composer/internal/transliterators.h
+index 650056a4e..e74e3d6ea 100644
+--- composer/internal/transliterators.h
++++ composer/internal/transliterators.h
+@@ -55,7 +55,7 @@ class Transliterators {
+     // Returns half ascii.
+     HALF_ASCII,
+     // Special transliterator.
+-    // Use locally asigned transliterator.
++    // Use locally assigned transliterator.
+     // Many methods don't accept this value.
+     LOCAL,
+ 
+diff --git composer/internal/typing_corrector.cc composer/internal/typing_corrector.cc
+index da444d9ff..e15b3c041 100644
+--- composer/internal/typing_corrector.cc
++++ composer/internal/typing_corrector.cc
+@@ -35,7 +35,6 @@
+ #include <string>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/port.h"
+ #include "composer/internal/composition.h"
+ #include "composer/internal/composition_input.h"
+@@ -44,6 +43,7 @@
+ #include "composer/type_corrected_query.h"
+ #include "config/config_handler.h"
+ #include "protocol/config.pb.h"
++#include "absl/flags/flag.h"
+ #include "absl/strings/string_view.h"
+ 
+ namespace mozc {
+diff --git composer/key_parser_test.cc composer/key_parser_test.cc
+index 200a4bb67..68cfa0034 100644
+--- composer/key_parser_test.cc
++++ composer/key_parser_test.cc
+@@ -125,7 +125,7 @@ TEST(KeyParserTest, SpecialKeys) {
+       std::make_pair("home", commands::KeyEvent::HOME),
+       std::make_pair("end", commands::KeyEvent::END),
+       std::make_pair("space", commands::KeyEvent::SPACE),
+-      std::make_pair("ascii", commands::KeyEvent::TEXT_INPUT),  // depricated
++      std::make_pair("ascii", commands::KeyEvent::TEXT_INPUT),  // deprecated
+       std::make_pair("textinput", commands::KeyEvent::TEXT_INPUT),
+       std::make_pair("tab", commands::KeyEvent::TAB),
+       std::make_pair("pageup", commands::KeyEvent::PAGE_UP),
+diff --git config/BUILD config/BUILD
+index 35e49e053..aaa40f119 100644
+--- config/BUILD
++++ config/BUILD
+@@ -67,7 +67,6 @@ cc_test_mozc(
+         ":config_handler",
+         "//base",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:mozc_hash_set",
+         "//base:port",
+@@ -77,6 +76,7 @@ cc_test_mozc(
+         "//protocol:config_proto",
+         "//testing:gunit_main",
+         "//testing:mozctest",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -108,12 +108,12 @@ cc_test_mozc(
+         ":config_handler",
+         ":stats_config_util",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:singleton",
+         "//base:system_util",
+         "//base:win_api_test_helper",
+         "//protocol:config_proto",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -152,9 +152,9 @@ cc_test_mozc(
+         ":character_form_manager",
+         ":config_handler",
+         "//base",
+-        "//base:flags",
+         "//base:system_util",
+         "//protocol:config_proto",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+diff --git config/character_form_manager.h config/character_form_manager.h
+index 65b3528af..36ae66092 100644
+--- config/character_form_manager.h
++++ config/character_form_manager.h
+@@ -130,7 +130,7 @@ class CharacterFormManager {
+   //  form1=Half form2=Full
+   //
+   // If input1 and input2 have mixed form types and the result
+-  // is ambigous, this function returns false.
++  // is ambiguous, this function returns false.
+   //
+   // Ambiguous case:
+   //  input1="ABC123" input2="ABC123"
+diff --git config/character_form_manager_test.cc config/character_form_manager_test.cc
+index 8e055f30d..d0ef380f2 100644
+--- config/character_form_manager_test.cc
++++ config/character_form_manager_test.cc
+@@ -31,12 +31,12 @@
+ 
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "config/config_handler.h"
+ #include "protocol/config.pb.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace config {
+@@ -45,7 +45,7 @@ class CharacterFormManagerTest : public ::testing::Test {
+  public:
+   void SetUp() override {
+     // set default user profile directory
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     CharacterFormManager *manager =
+         CharacterFormManager::GetCharacterFormManager();
+     manager->SetDefaultRule();
+diff --git config/config_handler.cc config/config_handler.cc
+index de8d56ae8..71e01b20d 100644
+--- config/config_handler.cc
++++ config/config_handler.cc
+@@ -131,7 +131,7 @@ bool ConfigHandlerImpl::GetStoredConfig(Config *config) const {
+   return true;
+ }
+ 
+-// set config and rewirte internal data
++// set config and rewrite internal data
+ bool ConfigHandlerImpl::SetConfigInternal(const Config &config) {
+   stored_config_.CopyFrom(config);
+ 
+diff --git config/config_handler_test.cc config/config_handler_test.cc
+index 01584d6c2..43dd9a5a8 100644
+--- config/config_handler_test.cc
++++ config/config_handler_test.cc
+@@ -37,7 +37,6 @@
+ #include <string>
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/mozc_hash_set.h"
+ #include "base/port.h"
+@@ -48,6 +47,7 @@
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
+ #include "testing/base/public/mozctest.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -57,7 +57,7 @@ namespace {
+ class ConfigHandlerTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     default_config_filename_ = ConfigHandler::GetConfigFileName();
+     Config default_config;
+     ConfigHandler::GetDefaultConfig(&default_config);
+@@ -97,7 +97,7 @@ TEST_F(ConfigHandlerTest, SetConfig) {
+   Config output;
+ 
+   const std::string config_file = FileUtil::JoinPath(
+-      mozc::GetFlag(FLAGS_test_tmpdir), "mozc_config_test_tmp");
++      absl::GetFlag(FLAGS_test_tmpdir), "mozc_config_test_tmp");
+   FileUtil::Unlink(config_file);
+   ScopedSetConfigFileName scoped_config_file_name(config_file);
+   EXPECT_EQ(config_file, ConfigHandler::GetConfigFileName());
+@@ -157,7 +157,7 @@ TEST_F(ConfigHandlerTest, SetImposedConfig) {
+   Config output;
+ 
+   const std::string config_file = FileUtil::JoinPath(
+-      mozc::GetFlag(FLAGS_test_tmpdir), "mozc_config_test_tmp");
++      absl::GetFlag(FLAGS_test_tmpdir), "mozc_config_test_tmp");
+   FileUtil::Unlink(config_file);
+   ScopedSetConfigFileName scoped_config_file_name(config_file);
+   ASSERT_TRUE(ConfigHandler::Reload())
+@@ -232,7 +232,7 @@ TEST_F(ConfigHandlerTest, ConfigFileNameConfig) {
+       std::string("config") + std::to_string(config::CONFIG_VERSION);
+ 
+   const std::string filename =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), config_file);
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), config_file);
+   FileUtil::Unlink(filename);
+   Config input;
+   ConfigHandler::SetConfig(input);
+diff --git config/stats_config_util_test.cc config/stats_config_util_test.cc
+index 4efe077c7..1dd968409 100644
+--- config/stats_config_util_test.cc
++++ config/stats_config_util_test.cc
+@@ -33,12 +33,12 @@
+ #include <string>
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/singleton.h"
+ #include "base/system_util.h"
+ #include "base/win_api_test_helper.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ #ifdef OS_ANDROID
+ #include "config/config_handler.h"
+@@ -672,7 +672,7 @@ TEST(StatsConfigUtilTestWin, IsEnabled) {
+ #ifdef OS_ANDROID
+ TEST(StatsConfigUtilTestAndroid, DefaultValueTest) {
+   const string config_file = FileUtil::JoinPath(
+-      mozc::GetFlag(FLAGS_test_tmpdir), "mozc_stats_config_util_test_tmp");
++      absl::GetFlag(FLAGS_test_tmpdir), "mozc_stats_config_util_test_tmp");
+   FileUtil::Unlink(config_file);
+   ConfigHandler::SetConfigFileName(config_file);
+   EXPECT_EQ(config_file, ConfigHandler::GetConfigFileName());
+diff --git converter/BUILD converter/BUILD
+index 76c50e178..67c9e4ca2 100644
+--- converter/BUILD
++++ converter/BUILD
+@@ -596,9 +596,9 @@ cc_test_mozc(
+         "//base",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//testing:gunit_main",
+         "//testing:mozctest",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -625,7 +625,6 @@ cc_binary_mozc(
+         "//base",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:logging",
+         "//base:number_util",
+@@ -641,6 +640,7 @@ cc_binary_mozc(
+         "//protocol:config_proto",
+         "//request:conversion_request",
+         "//session:request_test_util",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -788,11 +788,11 @@ cc_binary_mozc(
+     deps = [
+         ":quality_regression_util",
+         "//base",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:util",
+         "//engine:engine_factory",
+         "//engine:engine_interface",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+diff --git converter/candidate_filter.cc converter/candidate_filter.cc
+index a0543a08c..0033766b2 100644
+--- converter/candidate_filter.cc
++++ converter/candidate_filter.cc
+@@ -65,7 +65,7 @@ const size_t kMaxCandidatesSize = 200;  // how many candidates we expand
+ // cost(B) - cost(A) = -500 * [log(prob(B)) - log (C * prob(B)) ]
+ //                   = -500 * [-log(C) + log(prob(B)) - log(prob(B))]
+ //                   = 500 * log(C)
+-// This implies that it is more reasonable to filter candiates
++// This implies that it is more reasonable to filter candidates
+ // by an absolute difference of costs between cost(B) and cost(A).
+ //
+ // Here's "C" and cost-diff relation:
+diff --git converter/candidate_filter_test.cc converter/candidate_filter_test.cc
+index f99174d49..9fbb6aa40 100644
+--- converter/candidate_filter_test.cc
++++ converter/candidate_filter_test.cc
+@@ -173,7 +173,7 @@ TEST_F(CandidateFilterTest, FilterTest) {
+     filter->Reset();
+   }
+ 
+-  // Check if a canidate is active before appending many candidates.
++  // Check if a candidate is active before appending many candidates.
+   Segment::Candidate *c4 = NewCandidate();
+   for (size_t i = 0; i < arraysize(kRequestTypes); ++i) {
+     EXPECT_EQ(CandidateFilter::GOOD_CANDIDATE,
+diff --git converter/converter_interface.h converter/converter_interface.h
+index 12074f946..2553fc2b2 100644
+--- converter/converter_interface.h
++++ converter/converter_interface.h
+@@ -159,7 +159,7 @@ class ConverterInterface {
+       Segments *segments, const std::vector<size_t> &candidate_index) const = 0;
+ 
+   // Resize segment_index-th segment by offset_length.
+-  // offset_lenth can be negative.
++  // offset_length can be negative.
+   virtual bool ResizeSegment(Segments *segments,
+                              const ConversionRequest &request,
+                              size_t segment_index, int offset_length) const = 0;
+diff --git converter/converter_main.cc converter/converter_main.cc
+index 0f513914b..b9e745a01 100644
+--- converter/converter_main.cc
++++ converter/converter_main.cc
+@@ -36,7 +36,6 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/number_util.h"
+@@ -56,24 +55,25 @@
+ #include "protocol/config.pb.h"
+ #include "request/conversion_request.h"
+ #include "session/request_test_util.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(int32, max_conversion_candidates_size, 200,
++ABSL_FLAG(int32, max_conversion_candidates_size, 200,
+           "maximum candidates size");
+-MOZC_FLAG(string, user_profile_dir, "", "path to user profile directory");
+-MOZC_FLAG(string, engine_name, "default",
++ABSL_FLAG(std::string, user_profile_dir, "", "path to user profile directory");
++ABSL_FLAG(std::string, engine_name, "default",
+           "Shortcut to select engine_data_path from name: (default|oss|mock)");
+-MOZC_FLAG(string, engine_type, "desktop", "Engine type: (desktop|mobile)");
+-MOZC_FLAG(bool, output_debug_string, true,
++ABSL_FLAG(std::string, engine_type, "desktop", "Engine type: (desktop|mobile)");
++ABSL_FLAG(bool, output_debug_string, true,
+           "output debug string for each input");
+-MOZC_FLAG(bool, show_meta_candidates, false, "if true, show meta candidates");
++ABSL_FLAG(bool, show_meta_candidates, false, "if true, show meta candidates");
+ 
+ // Advanced options for data files.  These are automatically set when --engine
+ // is used but they can be overridden by specifying these flags.
+-MOZC_FLAG(string, engine_data_path, "",
++ABSL_FLAG(std::string, engine_data_path, "",
+           "Path to engine data file. This overrides the default data path "
+           "for engine_name.");
+-MOZC_FLAG(string, magic, "", "Expected magic number of data file");
+-MOZC_FLAG(string, id_def, "",
++ABSL_FLAG(std::string, magic, "", "Expected magic number of data file");
++ABSL_FLAG(std::string, id_def, "",
+           "id.def file for POS IDs. If provided, show human readable "
+           "POS instead of ID number");
+ 
+@@ -93,7 +93,7 @@ class PosIdPrintUtil {
+ 
+  private:
+   PosIdPrintUtil()
+-      : pos_id_(new InputFileStream(mozc::GetFlag(FLAGS_id_def).c_str())),
++      : pos_id_(new InputFileStream(absl::GetFlag(FLAGS_id_def).c_str())),
+         pos_id_printer_(new internal::PosIdPrinter(pos_id_.get())) {}
+ 
+   std::string IdToStringInternal(int id) const {
+@@ -238,7 +238,7 @@ void PrintSegment(size_t num, size_t segments_size, const Segment &segment,
+         << SegmentTypeToString(segment.segment_type()) << "] ----------"
+         << std::endl
+         << segment.key() << std::endl;
+-  if (mozc::GetFlag(FLAGS_show_meta_candidates)) {
++  if (absl::GetFlag(FLAGS_show_meta_candidates)) {
+     for (int i = 0; i < segment.meta_candidates_size(); ++i) {
+       PrintCandidate(segment, -i - 1, segment.meta_candidate(i), os);
+     }
+@@ -271,7 +271,7 @@ bool ExecCommand(const ConverterInterface &converter, Segments *segments,
+   const Config config;
+ 
+   segments->set_max_conversion_candidates_size(
+-      mozc::GetFlag(FLAGS_max_conversion_candidates_size));
++      absl::GetFlag(FLAGS_max_conversion_candidates_size));
+ 
+   if (func == "startconversion" || func == "start" || func == "s") {
+     CHECK_FIELDS_LENGTH(2);
+@@ -441,56 +441,56 @@ bool IsConsistentEngineNameAndType(const std::string &engine_name,
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  if (!mozc::GetFlag(FLAGS_user_profile_dir).empty()) {
++  if (!absl::GetFlag(FLAGS_user_profile_dir).empty()) {
+     mozc::SystemUtil::SetUserProfileDirectory(
+-        mozc::GetFlag(FLAGS_user_profile_dir));
++        absl::GetFlag(FLAGS_user_profile_dir));
+   }
+ 
+   std::string mozc_runfiles_dir = ".";
+-  if (mozc::GetFlag(FLAGS_engine_data_path).empty()) {
++  if (absl::GetFlag(FLAGS_engine_data_path).empty()) {
+     const auto path_and_magic = mozc::SelectDataFileFromName(
+-        mozc_runfiles_dir, mozc::GetFlag(FLAGS_engine_name));
+-    mozc::SetFlag(&FLAGS_engine_data_path, path_and_magic.first);
+-    mozc::SetFlag(&FLAGS_magic, path_and_magic.second);
++        mozc_runfiles_dir, absl::GetFlag(FLAGS_engine_name));
++    absl::SetFlag(&FLAGS_engine_data_path, path_and_magic.first);
++    absl::SetFlag(&FLAGS_magic, path_and_magic.second);
+   }
+-  CHECK(!mozc::GetFlag(FLAGS_engine_data_path).empty())
++  CHECK(!absl::GetFlag(FLAGS_engine_data_path).empty())
+       << "--engine_data_path or --engine is invalid: "
+-      << "--engine_data_path=" << mozc::GetFlag(FLAGS_engine_data_path) << " "
+-      << "--engine_name=" << mozc::GetFlag(FLAGS_engine_name);
++      << "--engine_data_path=" << absl::GetFlag(FLAGS_engine_data_path) << " "
++      << "--engine_name=" << absl::GetFlag(FLAGS_engine_name);
+ 
+-  if (mozc::GetFlag(FLAGS_id_def).empty()) {
+-    mozc::SetFlag(&FLAGS_id_def,
++  if (absl::GetFlag(FLAGS_id_def).empty()) {
++    absl::SetFlag(&FLAGS_id_def,
+                   mozc::SelectIdDefFromName(mozc_runfiles_dir,
+-                                            mozc::GetFlag(FLAGS_engine_name)));
++                                            absl::GetFlag(FLAGS_engine_name)));
+   }
+ 
+-  std::cout << "Engine type: " << mozc::GetFlag(FLAGS_engine_type)
+-            << "\nData file: " << mozc::GetFlag(FLAGS_engine_data_path)
+-            << "\nid.def: " << mozc::GetFlag(FLAGS_id_def) << std::endl;
++  std::cout << "Engine type: " << absl::GetFlag(FLAGS_engine_type)
++            << "\nData file: " << absl::GetFlag(FLAGS_engine_data_path)
++            << "\nid.def: " << absl::GetFlag(FLAGS_id_def) << std::endl;
+ 
+   std::unique_ptr<mozc::DataManager> data_manager(new mozc::DataManager);
+   const auto status = data_manager->InitFromFile(
+-      mozc::GetFlag(FLAGS_engine_data_path), mozc::GetFlag(FLAGS_magic));
++      absl::GetFlag(FLAGS_engine_data_path), absl::GetFlag(FLAGS_magic));
+   CHECK_EQ(status, mozc::DataManager::Status::OK);
+ 
+   mozc::commands::Request request;
+   std::unique_ptr<mozc::EngineInterface> engine;
+-  if (mozc::GetFlag(FLAGS_engine_type) == "desktop") {
++  if (absl::GetFlag(FLAGS_engine_type) == "desktop") {
+     engine = mozc::Engine::CreateDesktopEngine(std::move(data_manager)).value();
+-  } else if (mozc::GetFlag(FLAGS_engine_type) == "mobile") {
++  } else if (absl::GetFlag(FLAGS_engine_type) == "mobile") {
+     engine = mozc::Engine::CreateMobileEngine(std::move(data_manager)).value();
+     mozc::commands::RequestForUnitTest::FillMobileRequest(&request);
+   } else {
+     LOG(FATAL) << "Invalid type: --engine_type="
+-               << mozc::GetFlag(FLAGS_engine_type);
++               << absl::GetFlag(FLAGS_engine_type);
+     return 0;
+   }
+ 
+   mozc::ConverterInterface *converter = engine->GetConverter();
+   CHECK(converter);
+ 
+-  if (!mozc::IsConsistentEngineNameAndType(mozc::GetFlag(FLAGS_engine_name),
+-                                           mozc::GetFlag(FLAGS_engine_type))) {
++  if (!mozc::IsConsistentEngineNameAndType(absl::GetFlag(FLAGS_engine_name),
++                                           absl::GetFlag(FLAGS_engine_type))) {
+     LOG(WARNING) << "Engine name and type do not match.";
+   }
+ 
+@@ -499,7 +499,7 @@ int main(int argc, char **argv) {
+ 
+   while (!std::getline(std::cin, line).fail()) {
+     if (mozc::ExecCommand(*converter, &segments, line, request)) {
+-      if (mozc::GetFlag(FLAGS_output_debug_string)) {
++      if (absl::GetFlag(FLAGS_output_debug_string)) {
+         mozc::PrintSegments(segments, &std::cout);
+       }
+     } else {
+diff --git converter/converter_test.cc converter/converter_test.cc
+index e4b63f55a..2617035e0 100644
+--- converter/converter_test.cc
++++ converter/converter_test.cc
+@@ -836,7 +836,7 @@ TEST_F(ConverterTest, Regression3437022) {
+   const std::string kValue2 = "電話";
+ 
+   {
+-    // Make sure converte result is one segment
++    // Make sure convert result is one segment
+     EXPECT_TRUE(converter->StartConversion(&segments, kKey1 + kKey2));
+     EXPECT_EQ(1, segments.conversion_segments_size());
+     EXPECT_EQ(kValue1 + kValue2,
+diff --git converter/gen_segmenter_bitarray.cc converter/gen_segmenter_bitarray.cc
+index 6de0d6c43..f055857c6 100644
+--- converter/gen_segmenter_bitarray.cc
++++ converter/gen_segmenter_bitarray.cc
+@@ -55,7 +55,7 @@ class StateTable {
+     idarray_.resize(size);
+   }
+ 
+-  // |str| is an 1-dimentional row (or column) represented in byte array.
++  // |str| is an 1-dimensional row (or column) represented in byte array.
+   void Add(uint16 id, absl::string_view str) {
+     CHECK_LT(id, idarray_.size());
+ #ifdef ABSL_USES_STD_STRING_VIEW
+diff --git converter/immutable_converter.cc converter/immutable_converter.cc
+index 72b17bc47..9cdd92fe3 100644
+--- converter/immutable_converter.cc
++++ converter/immutable_converter.cc
+@@ -332,14 +332,14 @@ void ImmutableConverterImpl::InsertDummyCandidates(Segment *segment,
+           ? nullptr
+           : segment->mutable_candidate(segment->candidates_size() - 1);
+ 
+-  // Insert a dummy candiate whose content_value is katakana.
++  // Insert a dummy candidate whose content_value is katakana.
+   // If functional_key() is empty, no need to make a dummy candidate.
+   if (segment->candidates_size() > 0 &&
+       segment->candidates_size() < expand_size &&
+       !segment->candidate(0).functional_key().empty() &&
+       Util::GetScriptType(segment->candidate(0).content_key) ==
+           Util::HIRAGANA) {
+-    // Use last_candidate as a refernce of cost.
++    // Use last_candidate as a reference of cost.
+     // Use top_candidate as a refarence of lid/rid and key/value.
+     DCHECK(top_candidate);
+     DCHECK(last_candidate);
+@@ -469,7 +469,7 @@ bool ImmutableConverterImpl::ResegmentArabicNumberAndSuffix(
+         continue;
+       }
+ 
+-      // not compatibile
++      // not compatible
+       if (number_value != number_key) {
+         LOG(WARNING) << "Incompatible key/value number pair";
+         continue;
+@@ -545,7 +545,7 @@ bool ImmutableConverterImpl::ResegmentPrefixAndArabicNumber(
+         continue;
+       }
+ 
+-      // not compatibile
++      // not compatible
+       if (number_value != number_key) {
+         LOG(WARNING) << "Incompatible key/value number pair";
+         continue;
+diff --git converter/immutable_converter_interface.h converter/immutable_converter_interface.h
+index ac34db102..b116d092e 100644
+--- converter/immutable_converter_interface.h
++++ converter/immutable_converter_interface.h
+@@ -48,7 +48,7 @@ class ImmutableConverterInterface {
+   virtual bool Convert(Segments *segments) const;
+ 
+   // This method should be pure-virtual method in theory.
+-  // However, to keep the backward compatibility untill the deprecation of
++  // However, to keep the backward compatibility until the deprecation of
+   // Conversion method, we provide the default implementation.
+   // Please see the .cc file.
+   virtual bool ConvertForRequest(const ConversionRequest &request,
+diff --git converter/key_corrector.cc converter/key_corrector.cc
+index dc6574b2c..0eaa94a1f 100644
+--- converter/key_corrector.cc
++++ converter/key_corrector.cc
+@@ -452,7 +452,7 @@ bool KeyCorrector::CorrectKey(const std::string &key, InputMode mode,
+         rev_alignment_.push_back(len + i);
+       }
+     } else {
+-      // NOT a one to one maping, we take fist/last alignment only
++      // NOT a one to one mapping, we take fist/last alignment only
+       alignment_.push_back(org_len);
+       for (size_t i = 1; i < mblen; ++i) {
+         alignment_.push_back(kInvalidPos);
+diff --git converter/lattice.h converter/lattice.h
+index 3d92b1f47..269d55237 100644
+--- converter/lattice.h
++++ converter/lattice.h
+@@ -48,7 +48,7 @@ class Lattice {
+ 
+   NodeAllocator *node_allocator() const;
+ 
+-  // set key and initalizes lattice with key.
++  // set key and initializes lattice with key.
+   void SetKey(absl::string_view key);
+ 
+   // return key.
+diff --git converter/nbest_generator.cc converter/nbest_generator.cc
+index 8d1f56bbd..6014eb3b4 100644
+--- converter/nbest_generator.cc
++++ converter/nbest_generator.cc
+@@ -289,7 +289,7 @@ bool NBestGenerator::Next(const std::string &original_key,
+   //
+   // Example:
+   // |left_node| => |node1| => |node2| => |node3| => |right_node|.
+-  // |node1| .. |node2| consists of a candidate.
++  // |node1| .. |node3| consists of a candidate.
+   //
+   // cost = (left_node->cost - begin_node_->cost) +
+   //        trans(left_node, node1) + node1->wcost +
+@@ -313,7 +313,7 @@ bool NBestGenerator::Next(const std::string &original_key,
+   // Insert Viterbi best result here to make sure that
+   // the top result is Viterbi best result.
+   if (!viterbi_result_checked_) {
+-    // Use CandiadteFilter so that filter is initialized with the
++    // Use CandidateFilter so that filter is initialized with the
+     // Viterbi-best path.
+     switch (InsertTopResult(original_key, candidate, request_type)) {
+       case CandidateFilter::GOOD_CANDIDATE:
+@@ -495,7 +495,7 @@ NBestGenerator::BoundaryCheckResult NBestGenerator::CheckOnlyMid(
+     return VALID;
+   }
+ 
+-  // is_boundary is true if there is a grammer-based boundary
++  // is_boundary is true if there is a grammar-based boundary
+   // between lnode and rnode
+   const bool is_boundary = (lnode->node_type == Node::HIS_NODE ||
+                             segmenter_->IsBoundary(*lnode, *rnode, false));
+@@ -521,7 +521,7 @@ NBestGenerator::BoundaryCheckResult NBestGenerator::CheckOnlyEdge(
+     return VALID;
+   }
+ 
+-  // is_boundary is true if there is a grammer-based boundary
++  // is_boundary is true if there is a grammar-based boundary
+   // between lnode and rnode
+   const bool is_boundary = (lnode->node_type == Node::HIS_NODE ||
+                             segmenter_->IsBoundary(*lnode, *rnode, true));
+@@ -542,7 +542,7 @@ NBestGenerator::BoundaryCheckResult NBestGenerator::CheckStrict(
+     return VALID;
+   }
+ 
+-  // is_boundary is true if there is a grammer-based boundary
++  // is_boundary is true if there is a grammar-based boundary
+   // between lnode and rnode
+   const bool is_boundary = (lnode->node_type == Node::HIS_NODE ||
+                             segmenter_->IsBoundary(*lnode, *rnode, false));
+diff --git converter/nbest_generator.h converter/nbest_generator.h
+index 1eedd3006..958c892f8 100644
+--- converter/nbest_generator.h
++++ converter/nbest_generator.h
+@@ -57,7 +57,7 @@ class NBestGenerator {
+     //   Candidate edge:      |  candidate  |
+     //   Nodes:        |Node A|Node B|Node C|Node D|
+ 
+-    // For normal converison.
++    // For normal conversion.
+     //  Candidate boundary is strictly same as inner boundary.
+     // A-B: Should be the boundary
+     // B-C: Should not be the boundary
+@@ -79,7 +79,7 @@ class NBestGenerator {
+     ONLY_EDGE,
+   };
+ 
+-  // Try to enumurate N-best results between begin_node and end_node.
++  // Try to enumerate N-best results between begin_node and end_node.
+   NBestGenerator(
+       const dictionary::SuppressionDictionary *suppression_dictionary,
+       const Segmenter *segmenter, const Connector *connector,
+diff --git converter/pos_id_printer_test.cc converter/pos_id_printer_test.cc
+index 0d099d6e9..be8a2437f 100644
+--- converter/pos_id_printer_test.cc
++++ converter/pos_id_printer_test.cc
+@@ -34,9 +34,9 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "testing/base/public/gunit.h"
+ #include "testing/base/public/mozctest.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+diff --git converter/quality_regression_main.cc converter/quality_regression_main.cc
+index 94b6aa905..0b7cea0b4 100644
+--- converter/quality_regression_main.cc
++++ converter/quality_regression_main.cc
+@@ -32,14 +32,14 @@
+ #include <string>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/util.h"
+ #include "converter/quality_regression_util.h"
+ #include "engine/engine_factory.h"
+ #include "engine/engine_interface.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, test_file, "", "regression test file");
++ABSL_FLAG(std::string, test_file, "", "regression test file");
+ 
+ using mozc::EngineFactory;
+ using mozc::EngineInterface;
+@@ -52,7 +52,7 @@ int main(int argc, char **argv) {
+   QualityRegressionUtil util(engine->GetConverter());
+ 
+   std::vector<QualityRegressionUtil::TestItem> items;
+-  QualityRegressionUtil::ParseFile(mozc::GetFlag(FLAGS_test_file), &items);
++  QualityRegressionUtil::ParseFile(absl::GetFlag(FLAGS_test_file), &items);
+ 
+   for (size_t i = 0; i < items.size(); ++i) {
+     std::string actual_value;
+diff --git converter/segmenter.cc converter/segmenter.cc
+index 9d31f8fce..362461e1d 100644
+--- converter/segmenter.cc
++++ converter/segmenter.cc
+@@ -91,7 +91,7 @@ bool Segmenter::IsBoundary(const Node &lnode, const Node &rnode,
+   // This hack is for handling ambiguous bunsetsu segmentation.
+   // e.g. "かみ|にかく" => "紙|に書く" or "紙二角".
+   // If we segment "に書く" into two segments, "二角" is never be shown.
+-  // There exits some implicit assumpution that user expects that his/her input
++  // There exits some implicit assumpution that user expects that their input
+   // becomes one bunsetu. So, it would be better to keep "二角" even after "紙".
+   if (lnode.attributes & Node::STARTS_WITH_PARTICLE) {
+     return false;
+diff --git data/images/mac/BUILD data/images/mac/BUILD
+index bd6eb9bcc..9fc04923a 100644
+--- data/images/mac/BUILD
++++ data/images/mac/BUILD
+@@ -30,5 +30,11 @@
+ 
+ exports_files([
+     "candidate_window_logo.tiff",
++    "direct.tiff",
++    "full_ascii.tiff",
++    "full_katakana.tiff",
++    "half_ascii.tiff",
++    "half_katakana.tiff",
++    "hiragana.tiff",
+     "product_icon.icns",
+ ])
+diff --git data/installer/BUILD data/installer/BUILD
+index dcd9e0736..78dc3c546 100644
+--- data/installer/BUILD
++++ data/installer/BUILD
+@@ -28,7 +28,7 @@
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+-exports_files(glob(["*"]))
++exports_files(["credits_en.html"])
+ 
+ genrule(
+     name = "android_asset_licenses",
+diff --git data/installer/credits_en.html data/installer/credits_en.html
+index df694e8ad..ab1796683 100644
+--- data/installer/credits_en.html
++++ data/installer/credits_en.html
+@@ -47,7 +47,7 @@
+   white-space:pre-wrap;
+ }
+ .licence h3 {
+-  margin-top:0px;
++  margin-top:0;
+ }
+ </style>
+ </head>
+diff --git data/test/calculator/gen_test.py data/test/calculator/gen_test.py
+index 98f99d84b..fa11d6118 100644
+--- data/test/calculator/gen_test.py
++++ data/test/calculator/gen_test.py
+@@ -47,7 +47,7 @@
+ # values of ans are really correct, the script itself does "test-for-test"
+ # using python's eval() function. Namely, after building an expression tree,
+ # we generate a python expression corresponding to the tree and compare its
+-# value with that of the the direct evaluation. This test runs automatically
++# value with that of the direct evaluation. This test runs automatically
+ # inside the script, but you can also write it to a file by specifying
+ # --py_output option. Furthermore, passing --cc_output options enables you to
+ # generate C++ code, respectively, that warns about expressions if results in
+@@ -287,7 +287,7 @@ def eval(self):
+ 
+   def build_test_expr(self):
+     # If the child expression is one of the following, then we can omit
+-    # parentheses becase of precedence.
++    # parentheses because of precedence.
+     if (isinstance(self._expr, Number) or
+         isinstance(self._expr, UnaryExpr) or
+         isinstance(self._expr, Group)):
+diff --git data/version/mozc_version_template.bzl data/version/mozc_version_template.bzl
+index b60a9ccbb..4c848ce8f 100644
+--- data/version/mozc_version_template.bzl
++++ data/version/mozc_version_template.bzl
+@@ -33,7 +33,7 @@ MAJOR = 2
+ MINOR = 26
+ 
+ # Number to be increased. This value may be replaced by other tools.
+-BUILD = 4276
++BUILD = 4282
+ 
+ # Represent the platform and release channel.
+ REVISION = 100
+diff --git data_manager/BUILD data_manager/BUILD
+index 98732e8ff..951241038 100644
+--- data_manager/BUILD
++++ data_manager/BUILD
+@@ -172,11 +172,11 @@ cc_test_mozc(
+         ":dataset_writer",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:obfuscator_support",
+         "//base:util",
+         "//testing:gunit_main",
+         "//testing:mozctest",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -189,11 +189,11 @@ cc_binary_mozc(
+         "//base",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:init_mozc_buildtool",
+         "//base:logging",
+         "//base:number_util",
+         "//base:util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+diff --git data_manager/dataset_writer_main.cc data_manager/dataset_writer_main.cc
+index dc279bdda..2ada473b1 100644
+--- data_manager/dataset_writer_main.cc
++++ data_manager/dataset_writer_main.cc
+@@ -47,23 +47,23 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/number_util.h"
+ #include "base/util.h"
+ #include "data_manager/dataset_writer.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, magic, "", "Hex-encoded magic number to be embedded");
+-MOZC_FLAG(string, output, "", "Output file");
++ABSL_FLAG(std::string, magic, "", "Hex-encoded magic number to be embedded");
++ABSL_FLAG(std::string, output, "", "Output file");
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+   std::string magic;
+-  CHECK(mozc::Util::Unescape(mozc::GetFlag(FLAGS_magic), &magic))
++  CHECK(mozc::Util::Unescape(absl::GetFlag(FLAGS_magic), &magic))
+       << "magic number is not a proper hex-escaped string: "
+-      << mozc::GetFlag(FLAGS_magic);
++      << absl::GetFlag(FLAGS_magic);
+ 
+   struct Input {
+     Input(const std::string &n, int a, const std::string &f)
+@@ -87,12 +87,12 @@ int main(int argc, char **argv) {
+                         params[2]);
+   }
+ 
+-  CHECK(!mozc::GetFlag(FLAGS_output).empty()) << "--output is required";
++  CHECK(!absl::GetFlag(FLAGS_output).empty()) << "--output is required";
+ 
+   // DataSetWriter directly writes to the specified stream, so if it fails for
+   // an input, the output contains a partial result.  To avoid such partial file
+   // creation, write to a temporary file then rename it.
+-  const std::string tmpfile = mozc::GetFlag(FLAGS_output) + ".tmp";
++  const std::string tmpfile = absl::GetFlag(FLAGS_output) + ".tmp";
+   {
+     mozc::DataSetWriter writer(magic);
+     for (const auto &input : inputs) {
+@@ -105,9 +105,9 @@ int main(int argc, char **argv) {
+     writer.Finish(&output);
+     output.close();
+   }
+-  CHECK(mozc::FileUtil::AtomicRename(tmpfile, mozc::GetFlag(FLAGS_output)))
++  CHECK(mozc::FileUtil::AtomicRename(tmpfile, absl::GetFlag(FLAGS_output)))
+       << "Failed to rename " << tmpfile << " to "
+-      << mozc::GetFlag(FLAGS_output);
++      << absl::GetFlag(FLAGS_output);
+ 
+   return 0;
+ }
+diff --git data_manager/dataset_writer_test.cc data_manager/dataset_writer_test.cc
+index 14a5664ed..c76b537c3 100644
+--- data_manager/dataset_writer_test.cc
++++ data_manager/dataset_writer_test.cc
+@@ -34,12 +34,12 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/unverified_sha1.h"
+ #include "base/util.h"
+ #include "data_manager/dataset.pb.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+@@ -54,7 +54,7 @@ void SetEntry(const string &name, uint64 offset, uint64 size,
+ TEST(DatasetWriterTest, Write) {
+   // Create a dummy file to be packed.
+   const string &in =
+-      FileUtil::JoinPath({mozc::GetFlag(FLAGS_test_tmpdir), "in"});
++      FileUtil::JoinPath({absl::GetFlag(FLAGS_test_tmpdir), "in"});
+   {
+     OutputFileStream f(in.c_str(), std::ios_base::out | std::ios_base::binary);
+     f.write("m\0zc\xEF", 5);
+diff --git data_manager/mozc_data.bzl data_manager/mozc_data.bzl
+index 276158a66..3bd943718 100644
+--- data_manager/mozc_data.bzl
++++ data_manager/mozc_data.bzl
+@@ -404,10 +404,10 @@ def mozc_dataset(
+         copts = ["-Wno-parentheses"],
+         deps = [
+             "//base",
+-            "//base:flags",
+             "//base:init_mozc_buildtool",
+             "//converter:gen_segmenter_bitarray",
+             "//:macro",
++            "@com_google_absl//absl/flags:flag",
+         ],
+     )
+ 
+diff --git data_manager/oss/gen_oss_segmenter_bitarray_main.cc data_manager/oss/gen_oss_segmenter_bitarray_main.cc
+index 6d5675933..7eb971b65 100644
+--- data_manager/oss/gen_oss_segmenter_bitarray_main.cc
++++ data_manager/oss/gen_oss_segmenter_bitarray_main.cc
+@@ -27,24 +27,25 @@
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "converter/gen_segmenter_bitarray.h"
++#include "absl/flags/flag.h"
+ 
+ namespace {
+ #include "data_manager/oss/segmenter_inl.inc"
+ }
+ 
+-MOZC_FLAG(string, output_size_info, "", "Serialized SegmenterDataSizeInfo");
+-MOZC_FLAG(string, output_ltable, "", "LTable array");
+-MOZC_FLAG(string, output_rtable, "", "RTable array");
+-MOZC_FLAG(string, output_bitarray, "", "Segmenter bitarray");
++ABSL_FLAG(std::string, output_size_info, "",
++          "Serialized SegmenterDataSizeInfo");
++ABSL_FLAG(std::string, output_ltable, "", "LTable array");
++ABSL_FLAG(std::string, output_rtable, "", "RTable array");
++ABSL_FLAG(std::string, output_bitarray, "", "Segmenter bitarray");
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+   mozc::SegmenterBitarrayGenerator::GenerateBitarray(
+       kLSize, kRSize, &IsBoundaryInternal,
+-      mozc::GetFlag(FLAGS_output_size_info), mozc::GetFlag(FLAGS_output_ltable),
+-      mozc::GetFlag(FLAGS_output_rtable), mozc::GetFlag(FLAGS_output_bitarray));
++      absl::GetFlag(FLAGS_output_size_info), absl::GetFlag(FLAGS_output_ltable),
++      absl::GetFlag(FLAGS_output_rtable), absl::GetFlag(FLAGS_output_bitarray));
+   return 0;
+ }
+diff --git data_manager/testing/gen_mock_segmenter_bitarray_main.cc data_manager/testing/gen_mock_segmenter_bitarray_main.cc
+index 4b4739a2f..15a692a88 100644
+--- data_manager/testing/gen_mock_segmenter_bitarray_main.cc
++++ data_manager/testing/gen_mock_segmenter_bitarray_main.cc
+@@ -27,24 +27,25 @@
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "converter/gen_segmenter_bitarray.h"
++#include "absl/flags/flag.h"
+ 
+ namespace {
+ #include "data_manager/testing/segmenter_inl.inc"
+ }
+ 
+-MOZC_FLAG(string, output_size_info, "", "Serialized SegmenterDataSizeInfo");
+-MOZC_FLAG(string, output_ltable, "", "LTable array");
+-MOZC_FLAG(string, output_rtable, "", "RTable array");
+-MOZC_FLAG(string, output_bitarray, "", "Segmenter bitarray");
++ABSL_FLAG(std::string, output_size_info, "",
++          "Serialized SegmenterDataSizeInfo");
++ABSL_FLAG(std::string, output_ltable, "", "LTable array");
++ABSL_FLAG(std::string, output_rtable, "", "RTable array");
++ABSL_FLAG(std::string, output_bitarray, "", "Segmenter bitarray");
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+   mozc::SegmenterBitarrayGenerator::GenerateBitarray(
+       kLSize, kRSize, &IsBoundaryInternal,
+-      mozc::GetFlag(FLAGS_output_size_info), mozc::GetFlag(FLAGS_output_ltable),
+-      mozc::GetFlag(FLAGS_output_rtable), mozc::GetFlag(FLAGS_output_bitarray));
++      absl::GetFlag(FLAGS_output_size_info), absl::GetFlag(FLAGS_output_ltable),
++      absl::GetFlag(FLAGS_output_rtable), absl::GetFlag(FLAGS_output_bitarray));
+   return 0;
+ }
+diff --git dictionary/BUILD dictionary/BUILD
+index 18655cb58..d14deb922 100644
+--- dictionary/BUILD
++++ dictionary/BUILD
+@@ -188,7 +188,6 @@ cc_test_mozc(
+         ":user_pos",
+         ":user_pos_interface",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:singleton",
+@@ -201,6 +200,7 @@ cc_test_mozc(
+         "//testing:mozctest",
+         "//usage_stats",
+         "//usage_stats:usage_stats_testing_util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+         "@com_google_absl//absl/strings",
+     ],
+@@ -299,11 +299,11 @@ cc_test_mozc(
+         ":user_dictionary_storage",
+         "//base",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:system_util",
+         "//protocol:user_dictionary_storage_proto",
+         "//testing:gunit_main",
+         "//testing:testing_util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -337,13 +337,13 @@ cc_test_mozc(
+         ":user_dictionary_session_handler",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:system_util",
+         "//base/protobuf",
+         "//base/protobuf:repeated_field",
+         "//protocol:user_dictionary_storage_proto",
+         "//testing:gunit_main",
+         "//testing:testing_util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -380,12 +380,12 @@ cc_test_mozc(
+         "//base",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:mmap",
+         "//base:system_util",
+         "//base:util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -481,7 +481,6 @@ cc_library_mozc(
+         ":pos_matcher_lib",
+         "//base",
+         "//base:file_stream",
+-        "//base:flags",
+         "//base:iterator_adapter",
+         "//base:logging",
+         "//base:multifile",
+@@ -490,6 +489,7 @@ cc_library_mozc(
+         "//base:stl_util",
+         "//base:util",
+         "//testing:gunit_prod",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -507,10 +507,10 @@ cc_test_mozc(
+         ":text_dictionary_loader",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:util",
+         "//data_manager/testing:mock_data_manager",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -646,12 +646,12 @@ cc_binary_mozc(
+         ":text_dictionary_loader",
+         "//base",
+         "//base:file_stream",
+-        "//base:flags",
+         "//base:init_mozc_buildtool",
+         "//base:logging",
+         "//base:util",
+         "//data_manager",
+         "//dictionary/system:system_dictionary_builder",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+diff --git dictionary/file/BUILD dictionary/file/BUILD
+index 408609501..69b8cdc9f 100644
+--- dictionary/file/BUILD
++++ dictionary/file/BUILD
+@@ -84,9 +84,9 @@ cc_test_mozc(
+         ":dictionary_file_builder",
+         "//base",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -166,10 +166,10 @@ cc_test_mozc(
+         "//base",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+diff --git dictionary/file/codec_test.cc dictionary/file/codec_test.cc
+index 44c1721d5..258d816f9 100644
+--- dictionary/file/codec_test.cc
++++ dictionary/file/codec_test.cc
+@@ -33,7 +33,6 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/util.h"
+ #include "dictionary/file/codec_factory.h"
+@@ -41,6 +40,7 @@
+ #include "dictionary/file/section.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -49,7 +49,7 @@ namespace {
+ 
+ class CodecTest : public ::testing::Test {
+  public:
+-  CodecTest() : test_file_(mozc::GetFlag(FLAGS_test_tmpdir) + "testfile.txt") {}
++  CodecTest() : test_file_(absl::GetFlag(FLAGS_test_tmpdir) + "testfile.txt") {}
+ 
+  protected:
+   void SetUp() override {
+diff --git dictionary/file/dictionary_file_test.cc dictionary/file/dictionary_file_test.cc
+index 2ad145f51..4e8e76621 100644
+--- dictionary/file/dictionary_file_test.cc
++++ dictionary/file/dictionary_file_test.cc
+@@ -33,21 +33,21 @@
+ #include <string>
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "dictionary/file/codec_factory.h"
+ #include "dictionary/file/dictionary_file_builder.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace dictionary {
+ namespace {
+ 
+ TEST(DictionaryFileTest, Basic) {
+-  const std::string dfn = mozc::GetFlag(FLAGS_test_tmpdir) + "/test-dictionary";
+-  const std::string fn1 = mozc::GetFlag(FLAGS_test_tmpdir) + "/sec1";
+-  const std::string fn2 = mozc::GetFlag(FLAGS_test_tmpdir) + "/sec2";
++  const std::string dfn = absl::GetFlag(FLAGS_test_tmpdir) + "/test-dictionary";
++  const std::string fn1 = absl::GetFlag(FLAGS_test_tmpdir) + "/sec1";
++  const std::string fn2 = absl::GetFlag(FLAGS_test_tmpdir) + "/sec2";
+ 
+   FILE *fp1 = fopen(fn1.c_str(), "w");
+   CHECK(fp1) << "failed to open temporary file";
+diff --git dictionary/gen_system_dictionary_data_main.cc dictionary/gen_system_dictionary_data_main.cc
+index 81400bf04..e10fc8e28 100644
+--- dictionary/gen_system_dictionary_data_main.cc
++++ dictionary/gen_system_dictionary_data_main.cc
+@@ -39,7 +39,6 @@
+ #include <vector>
+ 
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/util.h"
+@@ -48,11 +47,12 @@
+ #include "dictionary/pos_matcher.h"
+ #include "dictionary/system/system_dictionary_builder.h"
+ #include "dictionary/text_dictionary_loader.h"
++#include "absl/flags/flag.h"
+ #include "absl/strings/string_view.h"
+ 
+-MOZC_FLAG(string, input, "", "space separated input text files");
+-MOZC_FLAG(string, user_pos_manager_data, "", "user pos manager data");
+-MOZC_FLAG(string, output, "", "output binary file");
++ABSL_FLAG(std::string, input, "", "space separated input text files");
++ABSL_FLAG(std::string, user_pos_manager_data, "", "user pos manager data");
++ABSL_FLAG(std::string, output, "", "output binary file");
+ 
+ namespace mozc {
+ namespace {
+@@ -95,7 +95,7 @@ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+   std::string system_dictionary_input, reading_correction_input;
+-  mozc::GetInputFileName(mozc::GetFlag(FLAGS_input), &system_dictionary_input,
++  mozc::GetInputFileName(absl::GetFlag(FLAGS_input), &system_dictionary_input,
+                          &reading_correction_input);
+ 
+   // User POS manager data for build tools has no magic number.
+@@ -103,10 +103,10 @@ int main(int argc, char **argv) {
+   mozc::DataManager data_manager;
+   const mozc::DataManager::Status status =
+       data_manager.InitUserPosManagerDataFromFile(
+-          mozc::GetFlag(FLAGS_user_pos_manager_data), kMagicNumber);
++          absl::GetFlag(FLAGS_user_pos_manager_data), kMagicNumber);
+   CHECK_EQ(status, mozc::DataManager::Status::OK)
+       << "Failed to initialize data manager from "
+-      << mozc::GetFlag(FLAGS_user_pos_manager_data);
++      << absl::GetFlag(FLAGS_user_pos_manager_data);
+ 
+   const mozc::dictionary::POSMatcher pos_matcher(
+       data_manager.GetPOSMatcherData());
+@@ -118,8 +118,8 @@ int main(int argc, char **argv) {
+   builder.BuildFromTokens(loader.tokens());
+ 
+   std::unique_ptr<std::ostream> output_stream(new mozc::OutputFileStream(
+-      mozc::GetFlag(FLAGS_output).c_str(), std::ios::out | std::ios::binary));
+-  builder.WriteToStream(mozc::GetFlag(FLAGS_output), output_stream.get());
++      absl::GetFlag(FLAGS_output).c_str(), std::ios::out | std::ios::binary));
++  builder.WriteToStream(absl::GetFlag(FLAGS_output), output_stream.get());
+ 
+   return 0;
+ }
+diff --git dictionary/suppression_dictionary.cc dictionary/suppression_dictionary.cc
+index ed5e6219e..9720aaa03 100644
+--- dictionary/suppression_dictionary.cc
++++ dictionary/suppression_dictionary.cc
+@@ -98,7 +98,7 @@ bool SuppressionDictionary::IsEmpty() const {
+ bool SuppressionDictionary::SuppressEntry(const std::string &key,
+                                           const std::string &value) const {
+   if (dic_.empty()) {
+-    // Almost all users don't use word supresssion function.
++    // Almost all users don't use word suppression function.
+     // We can return false as early as possible
+     return false;
+   }
+diff --git dictionary/suppression_dictionary.h dictionary/suppression_dictionary.h
+index 80669eeb6..dd71fa626 100644
+--- dictionary/suppression_dictionary.h
++++ dictionary/suppression_dictionary.h
+@@ -46,10 +46,10 @@ class SuppressionDictionary {
+ 
+   // Locks dictionary.
+   // Need to lock before calling AddEntry() or Clear().
+-  // When the dictionary is locked, Supress() return false.
++  // When the dictionary is locked, Suppress() return false.
+   //
+   // NOTE:
+-  // Lock() and SupressWord() must be called synchronously.
++  // Lock() and SuppressWord() must be called synchronously.
+   void Lock();
+ 
+   // Unlocks dictionary.
+@@ -67,7 +67,7 @@ class SuppressionDictionary {
+   // Returns true if SuppressionDictionary doesn't have any entries.
+   bool IsEmpty() const;
+ 
+-  // Returns true if |word| should be suppressed.  If the current dictionay is
++  // Returns true if |word| should be suppressed.  If the current dictionary is
+   // "locked" via Lock() method, this function always return false.  Lock() and
+   // SuppressWord() must be called synchronously.
+   bool SuppressEntry(const std::string &key, const std::string &value) const;
+diff --git dictionary/suppression_dictionary_test.cc dictionary/suppression_dictionary_test.cc
+index 086d3924a..5e275af51 100644
+--- dictionary/suppression_dictionary_test.cc
++++ dictionary/suppression_dictionary_test.cc
+@@ -42,7 +42,7 @@ namespace mozc {
+ namespace dictionary {
+ namespace {
+ 
+-TEST(SupressionDictionary, BasicTest) {
++TEST(SuppressionDictionary, BasicTest) {
+   SuppressionDictionary *dic = Singleton<SuppressionDictionary>::get();
+   CHECK(dic);
+ 
+@@ -126,7 +126,7 @@ class DictionaryLoaderThread : public Thread {
+   }
+ };
+ 
+-TEST(SupressionDictionary, ThreadTest) {
++TEST(SuppressionDictionary, ThreadTest) {
+   SuppressionDictionary *dic = Singleton<SuppressionDictionary>::get();
+   CHECK(dic);
+ 
+diff --git dictionary/system/BUILD dictionary/system/BUILD
+index abe03f02e..e7e52dc34 100644
+--- dictionary/system/BUILD
++++ dictionary/system/BUILD
+@@ -164,7 +164,6 @@ cc_library_mozc(
+         ":codec",
+         ":words_info",
+         "//base:file_stream",
+-        "//base:flags",
+         "//base:logging",
+         "//base:mozc_hash_set",
+         "//base:port",
+@@ -200,7 +199,6 @@ cc_test_mozc(
+         ":system_dictionary",
+         ":system_dictionary_builder",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:stl_util",
+@@ -253,13 +251,13 @@ cc_test_mozc(
+         ":system_dictionary",
+         "//base",
+         "//base:file_stream",
+-        "//base:flags",
+         "//base:logging",
+         "//base:util",
+         "//dictionary:dictionary_test_util",
+         "//request:conversion_request",
+         "//testing:gunit_main",
+         "//testing/base/public:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+diff --git dictionary/system/system_dictionary.cc dictionary/system/system_dictionary.cc
+index 2cffb3ab1..d0d19a0bd 100644
+--- dictionary/system/system_dictionary.cc
++++ dictionary/system/system_dictionary.cc
+@@ -862,7 +862,7 @@ class ReverseLookupCallbackWrapper : public DictionaryInterface::Callback {
+ 
+ }  // namespace
+ 
+-// Recursive implemention of depth-first prefix search with key expansion.
++// Recursive implementation of depth-first prefix search with key expansion.
+ // Input parameters:
+ //   key:
+ //     The head address of the original key before applying codec.
+diff --git dictionary/system/system_dictionary_builder.cc dictionary/system/system_dictionary_builder.cc
+index f4645851e..6ddc84082 100644
+--- dictionary/system/system_dictionary_builder.cc
++++ dictionary/system/system_dictionary_builder.cc
+@@ -35,7 +35,6 @@
+ #include <sstream>
+ 
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/mozc_hash_set.h"
+ #include "base/util.h"
+@@ -51,9 +50,9 @@
+ #include "storage/louds/louds_trie_builder.h"
+ #include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(bool, preserve_intermediate_dictionary, false,
++ABSL_FLAG(bool, preserve_intermediate_dictionary, false,
+           "preserve inetemediate dictionary file.");
+-MOZC_FLAG(int32, min_key_length_to_use_small_cost_encoding, 6,
++ABSL_FLAG(int32, min_key_length_to_use_small_cost_encoding, 6,
+           "minimum key length to use 1 byte cost encoding.");
+ 
+ namespace mozc {
+@@ -163,7 +162,7 @@ void SystemDictionaryBuilder::WriteToStream(
+       file_codec_->GetSectionName(codec_->GetSectionNameForPos()));
+   sections.push_back(frequent_pos_section);
+ 
+-  if (mozc::GetFlag(FLAGS_preserve_intermediate_dictionary) &&
++  if (absl::GetFlag(FLAGS_preserve_intermediate_dictionary) &&
+       !intermediate_output_file_base_path.empty()) {
+     // Write out intermediate results to files.
+     const std::string &basepath = intermediate_output_file_base_path;
+@@ -366,7 +365,7 @@ void SystemDictionaryBuilder::SetCostType(KeyInfoList *key_info_list) const {
+       TokenInfo *token_info = &key_info->tokens[i];
+       const int key_len = Util::CharsLen(token_info->token->key);
+       if (key_len >=
+-          mozc::GetFlag(FLAGS_min_key_length_to_use_small_cost_encoding)) {
++          absl::GetFlag(FLAGS_min_key_length_to_use_small_cost_encoding)) {
+         token_info->cost_type = TokenInfo::CAN_USE_SMALL_ENCODING;
+       }
+     }
+diff --git dictionary/system/system_dictionary_test.cc dictionary/system/system_dictionary_test.cc
+index c0ceee35f..9409fc597 100644
+--- dictionary/system/system_dictionary_test.cc
++++ dictionary/system/system_dictionary_test.cc
+@@ -38,7 +38,6 @@
+ #include <vector>
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "base/stl_util.h"
+@@ -58,13 +57,15 @@
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
+ #include "testing/base/public/mozctest.h"
++#include "absl/flags/declare.h"
++#include "absl/flags/flag.h"
+ #include "absl/strings/string_view.h"
+ 
+-MOZC_FLAG(int32, dictionary_test_size, 100000,
++ABSL_FLAG(int32, dictionary_test_size, 100000,
+           "Dictionary size for this test.");
+-MOZC_FLAG(int32, dictionary_reverse_lookup_test_size, 1000,
++ABSL_FLAG(int32, dictionary_reverse_lookup_test_size, 1000,
+           "Number of tokens to run reverse lookup test.");
+-MOZC_DECLARE_FLAG(int32, min_key_length_to_use_small_cost_encoding);
++ABSL_DECLARE_FLAG(int32, min_key_length_to_use_small_cost_encoding);
+ 
+ namespace mozc {
+ namespace dictionary {
+@@ -75,11 +76,11 @@ class SystemDictionaryTest : public ::testing::Test {
+       : pos_matcher_(mock_data_manager_.GetPOSMatcherData()),
+         text_dict_(new TextDictionaryLoader(pos_matcher_)),
+         dic_fn_(
+-            FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "mozc.dic")) {
++            FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "mozc.dic")) {
+     const std::string dic_path = mozc::testing::GetSourceFileOrDie(
+         {"data", "dictionary_oss", "dictionary00.txt"});
+     text_dict_->LoadWithLineLimit(dic_path, "",
+-                                  mozc::GetFlag(FLAGS_dictionary_test_size));
++                                  absl::GetFlag(FLAGS_dictionary_test_size));
+ 
+     convreq_.set_request(&request_);
+     convreq_.set_config(&config_);
+@@ -88,8 +89,8 @@ class SystemDictionaryTest : public ::testing::Test {
+   void SetUp() override {
+     // Don't use small cost encoding by default.
+     original_flags_min_key_length_to_use_small_cost_encoding_ =
+-        mozc::GetFlag(FLAGS_min_key_length_to_use_small_cost_encoding);
+-    mozc::SetFlag(&FLAGS_min_key_length_to_use_small_cost_encoding,
++        absl::GetFlag(FLAGS_min_key_length_to_use_small_cost_encoding);
++    absl::SetFlag(&FLAGS_min_key_length_to_use_small_cost_encoding,
+                   std::numeric_limits<int32>::max());
+ 
+     request_.Clear();
+@@ -97,7 +98,7 @@ class SystemDictionaryTest : public ::testing::Test {
+   }
+ 
+   void TearDown() override {
+-    mozc::SetFlag(&FLAGS_min_key_length_to_use_small_cost_encoding,
++    absl::SetFlag(&FLAGS_min_key_length_to_use_small_cost_encoding,
+                   original_flags_min_key_length_to_use_small_cost_encoding_);
+ 
+     // This config initialization will be removed once ConversionRequest can
+@@ -265,7 +266,7 @@ TEST_F(SystemDictionaryTest, NormalWord) {
+   t0->rid = 70;
+   source_tokens.push_back(t0.get());
+   BuildSystemDictionary(source_tokens,
+-                        mozc::GetFlag(FLAGS_dictionary_test_size));
++                        absl::GetFlag(FLAGS_dictionary_test_size));
+ 
+   std::unique_ptr<SystemDictionary> system_dic =
+       SystemDictionary::Builder(dic_fn_).Build().value();
+@@ -322,7 +323,7 @@ TEST_F(SystemDictionaryTest, SameWord) {
+     source_tokens.push_back(&tokens[i]);
+   }
+   BuildSystemDictionary(source_tokens,
+-                        mozc::GetFlag(FLAGS_dictionary_test_size));
++                        absl::GetFlag(FLAGS_dictionary_test_size));
+ 
+   std::unique_ptr<SystemDictionary> system_dic =
+       SystemDictionary::Builder(dic_fn_).Build().value();
+@@ -337,7 +338,7 @@ TEST_F(SystemDictionaryTest, SameWord) {
+ TEST_F(SystemDictionaryTest, LookupAllWords) {
+   const std::vector<Token *> &source_tokens = text_dict_->tokens();
+   BuildSystemDictionary(source_tokens,
+-                        mozc::GetFlag(FLAGS_dictionary_test_size));
++                        absl::GetFlag(FLAGS_dictionary_test_size));
+ 
+   std::unique_ptr<SystemDictionary> system_dic =
+       SystemDictionary::Builder(dic_fn_).Build().value();
+@@ -708,7 +709,7 @@ TEST_F(SystemDictionaryTest, LookupReverse) {
+   ASSERT_TRUE(system_dic) << "Failed to open dictionary source:" << dic_fn_;
+   const size_t test_size =
+       std::min(static_cast<size_t>(
+-                   mozc::GetFlag(FLAGS_dictionary_reverse_lookup_test_size)),
++                   absl::GetFlag(FLAGS_dictionary_reverse_lookup_test_size)),
+                source_tokens.size());
+   for (size_t source_index = 0; source_index < test_size; ++source_index) {
+     const Token &source_token = *source_tokens[source_index];
+@@ -767,7 +768,7 @@ TEST_F(SystemDictionaryTest, LookupReverse) {
+ TEST_F(SystemDictionaryTest, LookupReverseIndex) {
+   const std::vector<Token *> &source_tokens = text_dict_->tokens();
+   BuildSystemDictionary(source_tokens,
+-                        mozc::GetFlag(FLAGS_dictionary_test_size));
++                        absl::GetFlag(FLAGS_dictionary_test_size));
+ 
+   std::unique_ptr<SystemDictionary> system_dic_without_index =
+       SystemDictionary::Builder(dic_fn_)
+@@ -785,7 +786,7 @@ TEST_F(SystemDictionaryTest, LookupReverseIndex) {
+       << "Failed to open dictionary source:" << dic_fn_;
+ 
+   std::vector<Token *>::const_iterator it;
+-  int size = mozc::GetFlag(FLAGS_dictionary_reverse_lookup_test_size);
++  int size = absl::GetFlag(FLAGS_dictionary_reverse_lookup_test_size);
+   for (it = source_tokens.begin(); size > 0 && it != source_tokens.end();
+        ++it, --size) {
+     const Token &t = **it;
+diff --git dictionary/text_dictionary_loader.cc dictionary/text_dictionary_loader.cc
+index 5aea84a6a..d2b3618ab 100644
+--- dictionary/text_dictionary_loader.cc
++++ dictionary/text_dictionary_loader.cc
+@@ -40,7 +40,6 @@
+ #include <vector>
+ 
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/iterator_adapter.h"
+ #include "base/logging.h"
+ #include "base/multifile.h"
+@@ -49,9 +48,10 @@
+ #include "base/util.h"
+ #include "dictionary/dictionary_token.h"
+ #include "dictionary/pos_matcher.h"
++#include "absl/flags/flag.h"
+ #include "absl/strings/string_view.h"
+ 
+-MOZC_FLAG(int32, tokens_reserve_size, 1400000,
++ABSL_FLAG(int32, tokens_reserve_size, 1400000,
+           "Reserve the specified size of token buffer in advance.");
+ 
+ namespace mozc {
+@@ -168,7 +168,7 @@ void TextDictionaryLoader::LoadWithLineLimit(
+ 
+   // Roughly allocate buffers for Token pointers.
+   if (limit < 0) {
+-    tokens_.reserve(mozc::GetFlag(FLAGS_tokens_reserve_size));
++    tokens_.reserve(absl::GetFlag(FLAGS_tokens_reserve_size));
+     limit = std::numeric_limits<int>::max();
+   } else {
+     tokens_.reserve(limit);
+diff --git dictionary/text_dictionary_loader_test.cc dictionary/text_dictionary_loader_test.cc
+index 7bf174c6c..2f061f8db 100644
+--- dictionary/text_dictionary_loader_test.cc
++++ dictionary/text_dictionary_loader_test.cc
+@@ -35,13 +35,13 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/util.h"
+ #include "data_manager/testing/mock_data_manager.h"
+ #include "dictionary/dictionary_token.h"
+ #include "dictionary/pos_matcher.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ using std::unique_ptr;
+ 
+@@ -89,7 +89,7 @@ TEST_F(TextDictionaryLoaderTest, BasicTest) {
+   }
+ 
+   const std::string filename =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "test.tsv");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "test.tsv");
+   {
+     OutputFileStream ofs(filename.c_str());
+     ofs << kTextLines;
+@@ -214,9 +214,9 @@ TEST_F(TextDictionaryLoaderTest, RewriteSpecialTokenTest) {
+ 
+ TEST_F(TextDictionaryLoaderTest, LoadMultipleFilesTest) {
+   const std::string filename1 =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "test1.tsv");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "test1.tsv");
+   const std::string filename2 =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "test2.tsv");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "test2.tsv");
+   const std::string filename = filename1 + "," + filename2;
+ 
+   {
+@@ -242,9 +242,9 @@ TEST_F(TextDictionaryLoaderTest, ReadingCorrectionTest) {
+   unique_ptr<TextDictionaryLoader> loader(CreateTextDictionaryLoader());
+ 
+   const std::string dic_filename =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "test.tsv");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "test.tsv");
+   const std::string reading_correction_filename = FileUtil::JoinPath(
+-      mozc::GetFlag(FLAGS_test_tmpdir), "reading_correction.tsv");
++      absl::GetFlag(FLAGS_test_tmpdir), "reading_correction.tsv");
+ 
+   {
+     OutputFileStream ofs(dic_filename.c_str());
+diff --git dictionary/user_dictionary_session.h dictionary/user_dictionary_session.h
+index 82d3a251a..2137cdd80 100644
+--- dictionary/user_dictionary_session.h
++++ dictionary/user_dictionary_session.h
+@@ -71,7 +71,7 @@ class UserDictionarySession {
+   // or not), creates an empty dictionary in the storage with the default name.
+   UserDictionaryCommandStatus::Status LoadWithEnsuringNonEmptyStorage();
+ 
+-  // Saves the data to local stroage.
++  // Saves the data to local storage.
+   UserDictionaryCommandStatus::Status Save();
+ 
+   // Undoes the last operation.
+diff --git dictionary/user_dictionary_session_handler_test.cc dictionary/user_dictionary_session_handler_test.cc
+index b45638cc5..c2208ec13 100644
+--- dictionary/user_dictionary_session_handler_test.cc
++++ dictionary/user_dictionary_session_handler_test.cc
+@@ -35,7 +35,6 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/protobuf/protobuf.h"
+ #include "base/protobuf/repeated_field.h"
+ #include "base/system_util.h"
+@@ -43,6 +42,7 @@
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
+ #include "testing/base/public/testing_util.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -68,7 +68,7 @@ class UserDictionarySessionHandlerTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+     original_user_profile_directory_ = SystemUtil::GetUserProfileDirectory();
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     FileUtil::Unlink(GetUserDictionaryFile());
+ 
+     handler_ = absl::make_unique<UserDictionarySessionHandler>();
+@@ -89,7 +89,7 @@ class UserDictionarySessionHandlerTest : public ::testing::Test {
+   }
+ 
+   static std::string GetUserDictionaryFile() {
+-    return FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "test.db");
++    return FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "test.db");
+   }
+ 
+   uint64 CreateSession() {
+diff --git dictionary/user_dictionary_session_test.cc dictionary/user_dictionary_session_test.cc
+index 229117cfc..3b9729aa4 100644
+--- dictionary/user_dictionary_session_test.cc
++++ dictionary/user_dictionary_session_test.cc
+@@ -34,13 +34,13 @@
+ #endif  // OS_WIN
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "dictionary/user_dictionary_storage.h"
+ #include "protocol/user_dictionary_storage.pb.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
+ #include "testing/base/public/testing_util.h"
++#include "absl/flags/flag.h"
+ 
+ namespace {
+ 
+@@ -61,7 +61,7 @@ class UserDictionarySessionTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+     original_user_profile_directory_ = SystemUtil::GetUserProfileDirectory();
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     FileUtil::Unlink(GetUserDictionaryFile());
+   }
+ 
+@@ -72,9 +72,9 @@ class UserDictionarySessionTest : public ::testing::Test {
+ 
+   static std::string GetUserDictionaryFile() {
+ #ifndef OS_WIN
+-    chmod(mozc::GetFlag(FLAGS_test_tmpdir).c_str(), 0777);
++    chmod(absl::GetFlag(FLAGS_test_tmpdir).c_str(), 0777);
+ #endif  // OS_WIN
+-    return FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "test.db");
++    return FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "test.db");
+   }
+ 
+   void ResetEntry(const std::string &key, const std::string &value,
+@@ -217,7 +217,7 @@ TEST_F(UserDictionarySessionTest, DeleteDictionary) {
+   EXPECT_EQ(kDummyId, session.storage().dictionaries(0).id());
+ }
+ 
+-TEST_F(UserDictionarySessionTest, DeleteDictionaryWithEnsuringNonEmptyStroage) {
++TEST_F(UserDictionarySessionTest, DeleteDictionaryWithEnsuringNonEmptyStorage) {
+   UserDictionarySession session(GetUserDictionaryFile());
+   session.SetDefaultDictionaryName("abcde");
+ 
+diff --git dictionary/user_dictionary_storage.h dictionary/user_dictionary_storage.h
+index 6d9e7ebb2..dd5b0cd43 100644
+--- dictionary/user_dictionary_storage.h
++++ dictionary/user_dictionary_storage.h
+@@ -113,7 +113,7 @@ class UserDictionaryStorage {
+   //       is kept as is.
+   bool Load();
+ 
+-  // Serialzie user dictionary to local file.
++  // Serialize user dictionary to local file.
+   // Need to call Lock() the dictionary before calling Save().
+   bool Save();
+ 
+@@ -166,7 +166,7 @@ class UserDictionaryStorage {
+   static int CountSyncableDictionaries(
+       const user_dictionary::UserDictionaryStorage &storage);
+ 
+-  // maxium number of dictionaries this storage can hold
++  // maximum number of dictionaries this storage can hold
+   static size_t max_dictionary_size();
+ 
+   // maximum number of entries one dictionary can hold
+diff --git dictionary/user_dictionary_storage_test.cc dictionary/user_dictionary_storage_test.cc
+index 8af3b888c..d153f0fac 100644
+--- dictionary/user_dictionary_storage_test.cc
++++ dictionary/user_dictionary_storage_test.cc
+@@ -34,7 +34,6 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/mmap.h"
+ #include "base/system_util.h"
+@@ -43,6 +42,7 @@
+ #include "dictionary/user_dictionary_util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+@@ -66,7 +66,7 @@ class UserDictionaryStorageTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+     backup_user_profile_directory_ = SystemUtil::GetUserProfileDirectory();
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     FileUtil::Unlink(GetUserDictionaryFile());
+   }
+ 
+@@ -76,7 +76,7 @@ class UserDictionaryStorageTest : public ::testing::Test {
+   }
+ 
+   static std::string GetUserDictionaryFile() {
+-    return FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "test.db");
++    return FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "test.db");
+   }
+ 
+  private:
+@@ -217,7 +217,7 @@ TEST_F(UserDictionaryStorageTest, ExportTest) {
+   }
+ 
+   const std::string export_file =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "export.txt");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "export.txt");
+ 
+   EXPECT_FALSE(storage.ExportDictionary(id + 1, export_file));
+   EXPECT_TRUE(storage.ExportDictionary(id, export_file));
+@@ -432,7 +432,7 @@ TEST_F(UserDictionaryStorageTest, ConvertSyncDictionariesToNormalDictionaries) {
+ TEST_F(UserDictionaryStorageTest, Export) {
+   const int kDummyDictionaryId = 10;
+   const std::string kPath =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "exported_file");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "exported_file");
+ 
+   {
+     UserDictionaryStorage storage(GetUserDictionaryFile());
+diff --git dictionary/user_dictionary_test.cc dictionary/user_dictionary_test.cc
+index 1b1ea8b70..da3af7d32 100644
+--- dictionary/user_dictionary_test.cc
++++ dictionary/user_dictionary_test.cc
+@@ -38,7 +38,6 @@
+ #include <vector>
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "base/singleton.h"
+@@ -59,6 +58,7 @@
+ #include "testing/base/public/mozctest.h"
+ #include "usage_stats/usage_stats.h"
+ #include "usage_stats/usage_stats_testing_util.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ #include "absl/strings/string_view.h"
+ 
+@@ -508,7 +508,7 @@ TEST_F(UserDictionaryTest, TestLookupExactWithSuggestionOnlyWords) {
+ 
+   // Create dictionary
+   const std::string filename = FileUtil::JoinPath(
+-      mozc::GetFlag(FLAGS_test_tmpdir), "suggestion_only_test.db");
++      absl::GetFlag(FLAGS_test_tmpdir), "suggestion_only_test.db");
+   FileUtil::Unlink(filename);
+   UserDictionaryStorage storage(filename);
+   {
+@@ -571,7 +571,7 @@ TEST_F(UserDictionaryTest, IncognitoModeTest) {
+ 
+ TEST_F(UserDictionaryTest, AsyncLoadTest) {
+   const std::string filename = FileUtil::JoinPath(
+-      mozc::GetFlag(FLAGS_test_tmpdir), "async_load_test.db");
++      absl::GetFlag(FLAGS_test_tmpdir), "async_load_test.db");
+   FileUtil::Unlink(filename);
+ 
+   // Create dictionary
+@@ -624,7 +624,7 @@ TEST_F(UserDictionaryTest, TestSuppressionDictionary) {
+   user_dic->WaitForReloader();
+ 
+   const std::string filename = FileUtil::JoinPath(
+-      mozc::GetFlag(FLAGS_test_tmpdir), "suppression_test.db");
++      absl::GetFlag(FLAGS_test_tmpdir), "suppression_test.db");
+   FileUtil::Unlink(filename);
+ 
+   UserDictionaryStorage storage(filename);
+@@ -699,7 +699,7 @@ TEST_F(UserDictionaryTest, TestSuggestionOnlyWord) {
+   user_dic->WaitForReloader();
+ 
+   const std::string filename = FileUtil::JoinPath(
+-      mozc::GetFlag(FLAGS_test_tmpdir), "suggestion_only_test.db");
++      absl::GetFlag(FLAGS_test_tmpdir), "suggestion_only_test.db");
+   FileUtil::Unlink(filename);
+ 
+   UserDictionaryStorage storage(filename);
+diff --git engine/BUILD engine/BUILD
+index 8527861ab..1ca71a3ea 100644
+--- engine/BUILD
++++ engine/BUILD
+@@ -79,11 +79,11 @@ cc_test_mozc(
+     deps = [
+         ":engine_builder",
+         "//base:file_util",
+-        "//base:flags",
+         "//prediction:predictor_interface",
+         "//protocol:engine_builder_proto",
+         "//testing:gunit_main",
+         "//testing:mozctest",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+diff --git engine/engine_builder_interface.h engine/engine_builder_interface.h
+index 4c635e1b9..8e059e3bd 100644
+--- engine/engine_builder_interface.h
++++ engine/engine_builder_interface.h
+@@ -48,7 +48,7 @@ class EngineBuilderInterface {
+ 
+   // Accepts data load request and sets |response->status()| to one of the
+   // following values:
+-  //   * ACCEPTED: Request is successfuly accepted.
++  //   * ACCEPTED: Request is successfully accepted.
+   //   * ALREADY_RUNNING: The previous request is still being processed.
+   virtual void PrepareAsync(const EngineReloadRequest &request,
+                             EngineReloadResponse *response) = 0;
+diff --git engine/engine_builder_test.cc engine/engine_builder_test.cc
+index 6a5f65194..a5ff00e1c 100644
+--- engine/engine_builder_test.cc
++++ engine/engine_builder_test.cc
+@@ -32,11 +32,11 @@
+ #include <string>
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "prediction/predictor_interface.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
+ #include "testing/base/public/mozctest.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+@@ -83,11 +83,11 @@ TEST_F(EngineBuilderTest, PrepareAsync) {
+     // Test request with install.  Since the requested file is moved,
+     // |mock_data_path_| is copied to a temporary file.
+     const std::string src_path =
+-        FileUtil::JoinPath({mozc::GetFlag(FLAGS_test_tmpdir), "src.data"});
++        FileUtil::JoinPath({absl::GetFlag(FLAGS_test_tmpdir), "src.data"});
+     ASSERT_TRUE(FileUtil::CopyFile(mock_data_path_, src_path));
+ 
+     const std::string install_path =
+-        FileUtil::JoinPath({mozc::GetFlag(FLAGS_test_tmpdir), "dst.data"});
++        FileUtil::JoinPath({absl::GetFlag(FLAGS_test_tmpdir), "dst.data"});
+     request_.set_engine_type(EngineReloadRequest::MOBILE);
+     request_.set_file_path(src_path);
+     request_.set_install_location(install_path);
+@@ -152,9 +152,9 @@ TEST_F(EngineBuilderTest, AsyncBuildWithInstall) {
+       {EngineReloadRequest::MOBILE, "MobilePredictor"},
+   };
+   const std::string &tmp_src =
+-      FileUtil::JoinPath({mozc::GetFlag(FLAGS_test_tmpdir), "src.data"});
++      FileUtil::JoinPath({absl::GetFlag(FLAGS_test_tmpdir), "src.data"});
+   const std::string install_path =
+-      FileUtil::JoinPath({mozc::GetFlag(FLAGS_test_tmpdir), "dst.data"});
++      FileUtil::JoinPath({absl::GetFlag(FLAGS_test_tmpdir), "dst.data"});
+ 
+   for (const auto &test_case : kTestCases) {
+     Clear();
+diff --git gui/BUILD gui/BUILD
+index e04879829..7dd39dfb8 100644
+--- gui/BUILD
++++ gui/BUILD
+@@ -28,23 +28,14 @@
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+-load("//:config.bzl", "BRANDING")
++load("//:build_defs.bzl", "info_plist_mozc")
+ 
+ package(
+     default_visibility = ["//gui:__subpackages__"],
+ )
+ 
+-genrule(
+-    name = "gen_mozc_tool_info_plist",
+-    srcs = [
+-        "//base:mozc_version_txt",
+-        "//data/mac:mozc_tool_info",
+-    ],
++info_plist_mozc(
++    name = "mozc_tool_info_plist",
++    srcs = ["//data/mac:mozc_tool_info"],
+     outs = ["mozc_tool_info.plist"],
+-    cmd = ("$(location //build_tools:tweak_info_plist)" +
+-           " --output $@" +
+-           " --input $(location //data/mac:mozc_tool_info)" +
+-           " --version_file $(location //base:mozc_version_txt)" +
+-           " --branding " + BRANDING),
+-    exec_tools = ["//build_tools:tweak_info_plist"],
+ )
+diff --git gui/config_dialog/config_dialog.h gui/config_dialog/config_dialog.h
+index 14e1e6bf3..3627b9ca8 100644
+--- gui/config_dialog/config_dialog.h
++++ gui/config_dialog/config_dialog.h
+@@ -60,7 +60,7 @@ class ConfigDialog : public QDialog, private Ui::ConfigDialog {
+   ConfigDialog();
+   ~ConfigDialog() override;
+ 
+-  // Methods defined in the 'slots' section (Qt's extention) will be processed
++  // Methods defined in the 'slots' section (Qt's extension) will be processed
+   // by Qt's moc tool (moc.exe on Windows). Unfortunately, preprocessor macros
+   // defined for C/C++ are not automatically passed into the moc tool.
+   // For example, you need to call the moc tool with '-D' option as
+diff --git gui/config_dialog/generic_table_editor.h gui/config_dialog/generic_table_editor.h
+index d59695b66..d44ec03e3 100644
+--- gui/config_dialog/generic_table_editor.h
++++ gui/config_dialog/generic_table_editor.h
+@@ -70,7 +70,7 @@ class GenericTableEditorDialog : public QDialog,
+   QTableWidget *mutable_table_widget();
+   QMenu *mutable_edit_menu();
+ 
+-  // impliments a method which returns default fileame
++  // implements a method which returns default fileame
+   virtual std::string GetDefaultFilename() const = 0;
+ 
+   // implements a method which loads
+diff --git gui/config_dialog/keybinding_editor.h gui/config_dialog/keybinding_editor.h
+index f08006ebc..b5f0d69ff 100644
+--- gui/config_dialog/keybinding_editor.h
++++ gui/config_dialog/keybinding_editor.h
+@@ -58,7 +58,7 @@ class KeyBindingEditor : public QDialog, private Ui::KeyBindingEditor {
+   void SetBinding(const QString &binding);
+ 
+   // For some reason, KeyBindingEditor lanuched by
+-  // QItemDelegate looses focus. We overwrite
++  // QItemDelegate loses focus. We overwrite
+   // setVisible() function to call raise() and activateWindow().
+   void setVisible(bool visible) override {
+     QWidget::setVisible(visible);
+diff --git gui/config_dialog/keymap_editor.cc gui/config_dialog/keymap_editor.cc
+index 8d329c633..48e62463e 100644
+--- gui/config_dialog/keymap_editor.cc
++++ gui/config_dialog/keymap_editor.cc
+@@ -104,7 +104,7 @@ class KeyMapValidator {
+ #if defined(__APPLE__)
+     // On Mac, we cannot customize keybindings for IME ON/OFF
+     // So we do not show them.
+-    // TODO(toshiyuki): remove them after implimenting IME ON/OFF for Mac
++    // TODO(toshiyuki): remove them after implementing IME ON/OFF for Mac
+     invisible_commands_.insert(kIMEOnCommand);
+     invisible_commands_.insert(kIMEOffCommand);
+ #endif  // __APPLE__
+diff --git gui/dictionary_tool/BUILD gui/dictionary_tool/BUILD
+index f0987c52b..5030263b8 100644
+--- gui/dictionary_tool/BUILD
++++ gui/dictionary_tool/BUILD
+@@ -180,9 +180,9 @@ cc_qt_library_mozc(
+     srcs = ["dictionary_tool_main.cc"],
+     deps = [
+         ":dictionary_tool",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//gui/base:gui_base",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+diff --git gui/dictionary_tool/dictionary_tool.h gui/dictionary_tool/dictionary_tool.h
+index cc26021ed..0024cae94 100644
+--- gui/dictionary_tool/dictionary_tool.h
++++ gui/dictionary_tool/dictionary_tool.h
+@@ -126,7 +126,7 @@ class DictionaryTool : public QMainWindow, private Ui::DictionaryTool {
+ 
+   // Show a dialog and get text for dictionary name from the user. The
+   // first parameter is default text printed in a form. The second is
+-  // message printed on the dialog. It returns an empty stirng
++  // message printed on the dialog. It returns an empty string
+   // whenever a proper value for dictionary name is input.
+   QString PromptForDictionaryName(const QString &text, const QString &label);
+ 
+@@ -137,7 +137,7 @@ class DictionaryTool : public QMainWindow, private Ui::DictionaryTool {
+   // These two functions are to start/stop monitoring data on the
+   // table widget being changed. We validate the value on the widget
+   // when the user edit it but the data can be modified
+-  // programatically and validation is not necessary.
++  // programmatically and validation is not necessary.
+   void StartMonitoringUserEdit();
+   void StopMonitoringUserEdit();
+ 
+@@ -155,7 +155,7 @@ class DictionaryTool : public QMainWindow, private Ui::DictionaryTool {
+   // send Reload command to the server.
+   void SaveAndReloadServer();
+ 
+-  // 1. Shows a dialog box and get new |commnet|.
++  // 1. Shows a dialog box and get new |comment|.
+   // 2. Changes the comemnt of all selected.
+   void EditComment();
+ 
+@@ -192,12 +192,12 @@ class DictionaryTool : public QMainWindow, private Ui::DictionaryTool {
+   // not been saved.
+   bool modified_;
+ 
+-  // Holds information on whether dictionary entires are sorted, key
++  // Holds information on whether dictionary entries are sorted, key
+   // column of sort and order of sort.
+   //
+   // Current implementation of sort may not be perfect. It doesn't
+   // check if entries are already sorted when they are loaded nor
+-  // whether modification is made keeping sorted entires sorted.
++  // whether modification is made keeping sorted entries sorted.
+   struct SortState {
+     bool sorted;
+     int column;
+diff --git gui/dictionary_tool/dictionary_tool_main.cc gui/dictionary_tool/dictionary_tool_main.cc
+index c6701cb7f..cdf445431 100644
+--- gui/dictionary_tool/dictionary_tool_main.cc
++++ gui/dictionary_tool/dictionary_tool_main.cc
+@@ -27,8 +27,8 @@
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
++#include "absl/flags/flag.h"
+ 
+ #ifdef OS_WIN
+ #include "base/winmain.h"
+diff --git gui/error_message_dialog/BUILD gui/error_message_dialog/BUILD
+index abc150ff4..9f85bcdd0 100644
+--- gui/error_message_dialog/BUILD
++++ gui/error_message_dialog/BUILD
+@@ -73,7 +73,6 @@ cc_qt_library_mozc(
+     ],
+     deps = [
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:process",
+@@ -84,6 +83,7 @@ cc_qt_library_mozc(
+         "//base:version",
+         "//gui/base:gui_base",
+         "//gui/base:singleton_window_helper",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+diff --git gui/error_message_dialog/error_message_dialog.cc gui/error_message_dialog/error_message_dialog.cc
+index 87b344e60..9acf8fc8a 100644
+--- gui/error_message_dialog/error_message_dialog.cc
++++ gui/error_message_dialog/error_message_dialog.cc
+@@ -34,10 +34,10 @@
+ #include <QtWidgets/QAbstractButton>
+ #include <QtWidgets/QMessageBox>
+ 
+-#include "base/flags.h"
+ #include "gui/base/util.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, error_type, "", "type of error");
++ABSL_FLAG(std::string, error_type, "", "type of error");
+ 
+ namespace mozc {
+ namespace gui {
+@@ -82,36 +82,36 @@ void DeleyedMessageDialogHandler::EnableOkButton() {
+ void ErrorMessageDialog::Show() {
+   // defining all literal messages inside Show() method
+   // for easy i18n/i10n
+-  if (mozc::GetFlag(FLAGS_error_type) == "server_timeout") {
++  if (absl::GetFlag(FLAGS_error_type) == "server_timeout") {
+     OnFatal(
+         QObject::tr("Conversion engine is not responding. "
+                     "Please restart this application."));
+-  } else if (mozc::GetFlag(FLAGS_error_type) == "server_broken_message") {
++  } else if (absl::GetFlag(FLAGS_error_type) == "server_broken_message") {
+     OnFatal(QObject::tr(
+         "Connecting to an incompatible conversion engine. "
+         "Please restart your computer to enable [ProductName]. "
+         "If this problem persists, please uninstall [ProductName] "
+         "and install it again."));
+-  } else if (mozc::GetFlag(FLAGS_error_type) == "server_version_mismatch") {
++  } else if (absl::GetFlag(FLAGS_error_type) == "server_version_mismatch") {
+     OnFatal(QObject::tr(
+         "Conversion engine has been upgraded. "
+         "Please restart this application to enable conversion engine. "
+         "If the problem persists, please restart your computer."));
+-  } else if (mozc::GetFlag(FLAGS_error_type) == "server_shutdown") {
++  } else if (absl::GetFlag(FLAGS_error_type) == "server_shutdown") {
+     OnFatal(
+         QObject::tr("Conversion engine is killed unexceptionally. "
+                     "Restarting the engine..."));
+-  } else if (mozc::GetFlag(FLAGS_error_type) == "server_fatal") {
++  } else if (absl::GetFlag(FLAGS_error_type) == "server_fatal") {
+     OnFatal(
+         QObject::tr("Cannot start conversion engine. "
+                     "Please restart your computer."));
+-  } else if (mozc::GetFlag(FLAGS_error_type) == "renderer_version_mismatch") {
++  } else if (absl::GetFlag(FLAGS_error_type) == "renderer_version_mismatch") {
+     OnFatal(
+         QObject::tr("Candidate window renderer has been upgraded. "
+                     "Please restart this application to enable new candidate "
+                     "window renderer. "
+                     "If the problem persists, please restart your computer."));
+-  } else if (mozc::GetFlag(FLAGS_error_type) == "renderer_fatal") {
++  } else if (absl::GetFlag(FLAGS_error_type) == "renderer_fatal") {
+     OnFatal(
+         QObject::tr("Cannot start candidate window renderer. "
+                     "Please restart your computer."));
+diff --git gui/tool/BUILD gui/tool/BUILD
+index a3beece3f..c6a358f72 100644
+--- gui/tool/BUILD
++++ gui/tool/BUILD
+@@ -40,11 +40,11 @@ cc_library_mozc(
+     name = "prelauncher_lib",
+     srcs = ["prelauncher_libmain.cc"],
+     deps = [
+-        "//base:flags",
+         "//base:mac_util",
+         "//client",
+         "//client:client_interface",
+         "//renderer:renderer_client",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -59,7 +59,7 @@ cc_qt_library_mozc(
+     deps = [
+         "//base:crash_report_handler",
+         "//base:file_util",
+-        "//base:flags",
++        "@com_google_absl//absl/flags:flag",
+         "//base:init_mozc",
+         "//base:logging",
+         "//base:port",
+diff --git gui/tool/mozc_tool.rc gui/tool/mozc_tool.rc
+index b98f3a66a..ab446ce43 100644
+Binary files gui/tool/mozc_tool.rc and gui/tool/mozc_tool.rc differ
+diff --git gui/tool/mozc_tool_libmain.cc gui/tool/mozc_tool_libmain.cc
+index 38cdda7c3..584465cf0 100644
+--- gui/tool/mozc_tool_libmain.cc
++++ gui/tool/mozc_tool_libmain.cc
+@@ -44,13 +44,14 @@
+ 
+ #include "base/crash_report_handler.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/run_level.h"
+ #include "base/util.h"
+ #include "config/stats_config_util.h"
+ #include "gui/base/debug_util.h"
++#include "absl/flags/declare.h"
++#include "absl/flags/flag.h"
+ 
+ #ifdef __APPLE__
+ #include "base/const.h"
+@@ -60,8 +61,8 @@
+ #include "gui/base/win_util.h"
+ #endif  // OS_WIN
+ 
+-MOZC_FLAG(string, mode, "about_dialog", "mozc_tool mode");
+-MOZC_DECLARE_FLAG(string, error_type);
++ABSL_FLAG(std::string, mode, "about_dialog", "mozc_tool mode");
++ABSL_DECLARE_FLAG(string, error_type);
+ 
+ // Run* are defiend in each qt module
+ int RunAboutDialog(int argc, char *argv[]);
+@@ -87,12 +88,12 @@ namespace {
+ void SetFlagsFromEnv() {
+   const char *mode = std::getenv("FLAGS_mode");
+   if (mode != nullptr) {
+-    mozc::SetFlag(&FLAGS_mode, mode);
++    absl::SetFlag(&FLAGS_mode, mode);
+   }
+ 
+   const char *error_type = std::getenv("FLAGS_error_type");
+   if (error_type != nullptr) {
+-    mozc::SetFlag(&FLAGS_error_type, error_type);
++    absl::SetFlag(&FLAGS_error_type, error_type);
+   }
+ }
+ 
+@@ -115,24 +116,24 @@ int RunMozcTool(int argc, char *argv[]) {
+   // name.
+   string binary_name = mozc::FileUtil::Basename(argv[0]);
+   if (binary_name == "AboutDialog") {
+-    mozc::SetFlag(&FLAGS_mode, "about_dialog");
++    absl::SetFlag(&FLAGS_mode, "about_dialog");
+   } else if (binary_name == "ConfigDialog") {
+-    mozc::SetFlag(&FLAGS_mode, "config_dialog");
++    absl::SetFlag(&FLAGS_mode, "config_dialog");
+   } else if (binary_name == "DictionaryTool") {
+-    mozc::SetFlag(&FLAGS_mode, "dictionary_tool");
++    absl::SetFlag(&FLAGS_mode, "dictionary_tool");
+   } else if (binary_name == "ErrorMessageDialog") {
+-    mozc::SetFlag(&FLAGS_mode, "error_message_dialog");
++    absl::SetFlag(&FLAGS_mode, "error_message_dialog");
+   } else if (binary_name == "WordRegisterDialog") {
+-    mozc::SetFlag(&FLAGS_mode, "word_register_dialog");
++    absl::SetFlag(&FLAGS_mode, "word_register_dialog");
+   } else if (binary_name == kProductPrefix "Prelauncher") {
+     // The binary name of prelauncher is user visible in
+     // "System Preferences" -> "Accounts" -> "Login items".
+     // So we set kProductPrefix to the binary name.
+-    mozc::SetFlag(&FLAGS_mode, "prelauncher");
++    absl::SetFlag(&FLAGS_mode, "prelauncher");
+   }
+ #endif
+ 
+-  if (mozc::GetFlag(FLAGS_mode) != "administration_dialog" &&
++  if (absl::GetFlag(FLAGS_mode) != "administration_dialog" &&
+       !mozc::RunLevel::IsValidClientRunLevel()) {
+     return -1;
+   }
+@@ -145,34 +146,34 @@ int RunMozcTool(int argc, char *argv[]) {
+   mozc::gui::WinUtil::KeepJumpListUpToDate();
+ #endif  // OS_WIN
+ 
+-  if (mozc::GetFlag(FLAGS_mode) == "config_dialog") {
++  if (absl::GetFlag(FLAGS_mode) == "config_dialog") {
+     return RunConfigDialog(argc, argv);
+-  } else if (mozc::GetFlag(FLAGS_mode) == "dictionary_tool") {
++  } else if (absl::GetFlag(FLAGS_mode) == "dictionary_tool") {
+     return RunDictionaryTool(argc, argv);
+-  } else if (mozc::GetFlag(FLAGS_mode) == "word_register_dialog") {
++  } else if (absl::GetFlag(FLAGS_mode) == "word_register_dialog") {
+     return RunWordRegisterDialog(argc, argv);
+-  } else if (mozc::GetFlag(FLAGS_mode) == "error_message_dialog") {
++  } else if (absl::GetFlag(FLAGS_mode) == "error_message_dialog") {
+     return RunErrorMessageDialog(argc, argv);
+-  } else if (mozc::GetFlag(FLAGS_mode) == "about_dialog") {
++  } else if (absl::GetFlag(FLAGS_mode) == "about_dialog") {
+     return RunAboutDialog(argc, argv);
+ #ifdef OS_WIN
+-  } else if (mozc::GetFlag(FLAGS_mode) == "set_default_dialog") {
++  } else if (absl::GetFlag(FLAGS_mode) == "set_default_dialog") {
+     // set_default_dialog is used on Windows only.
+     return RunSetDefaultDialog(argc, argv);
+-  } else if (mozc::GetFlag(FLAGS_mode) == "post_install_dialog") {
++  } else if (absl::GetFlag(FLAGS_mode) == "post_install_dialog") {
+     // post_install_dialog is used on Windows only.
+     return RunPostInstallDialog(argc, argv);
+-  } else if (mozc::GetFlag(FLAGS_mode) == "administration_dialog") {
++  } else if (absl::GetFlag(FLAGS_mode) == "administration_dialog") {
+     // administration_dialog is used on Windows only.
+     return RunAdministrationDialog(argc, argv);
+ #endif  // OS_WIN
+ #ifdef __APPLE__
+-  } else if (mozc::GetFlag(FLAGS_mode) == "prelauncher") {
++  } else if (absl::GetFlag(FLAGS_mode) == "prelauncher") {
+     // Prelauncher is used on Mac only.
+     return RunPrelaunchProcesses(argc, argv);
+ #endif  // __APPLE__
+   } else {
+-    LOG(ERROR) << "Unknown mode: " << mozc::GetFlag(FLAGS_mode);
++    LOG(ERROR) << "Unknown mode: " << absl::GetFlag(FLAGS_mode);
+     return -1;
+   }
+ 
+diff --git gui/tool/prelauncher_libmain.cc gui/tool/prelauncher_libmain.cc
+index d149eaf8f..39d677c4b 100644
+--- gui/tool/prelauncher_libmain.cc
++++ gui/tool/prelauncher_libmain.cc
+@@ -31,7 +31,7 @@
+ 
+ #include <memory>
+ 
+-#include "base/flags.h"
++#include "absl/flags/flag.h"
+ #ifdef __APPLE__
+ #include "base/mac_util.h"
+ #endif  // __APPLE__
+@@ -39,13 +39,13 @@
+ #include "renderer/renderer_client.h"
+ 
+ #ifdef __APPLE__
+-MOZC_FLAG(bool, register_prelauncher, false,
++ABSL_FLAG(bool, register_prelauncher, false,
+           "Register prelauncher to login item.");
+ #endif  // __APPLE__
+ 
+ int RunPrelaunchProcesses(int argc, char *argv[]) {
+ #ifdef __APPLE__
+-  if (mozc::GetFlag(FLAGS_register_prelauncher)) {
++  if (absl::GetFlag(FLAGS_register_prelauncher)) {
+     mozc::MacUtil::AddPrelauncherLoginItem();
+   }
+ #endif  // __APPLE__
+diff --git ios/BUILD ios/BUILD
+index 719fa5e64..7461df3fa 100644
+--- ios/BUILD
++++ ios/BUILD
+@@ -42,7 +42,6 @@ cc_library_mozc(
+     ],
+     deps = [
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:mutex",
+         "//base:port",
+@@ -58,6 +57,7 @@ cc_library_mozc(
+         "//session:session_handler",
+         "//session:session_handler_interface",
+         "@com_google_absl//absl/base:core_headers",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -67,11 +67,11 @@ cc_binary_mozc(
+     data = ["//data_manager/google:mozc.data"],
+     deps = [
+         ":ios_engine",
+-        "//base:flags",
+         "//base:init_mozc_buildtool",
+         "//base:logging",
+         "//base:util",
+         "//protocol:candidates_proto",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+diff --git ios/ios_engine.cc ios/ios_engine.cc
+index ea915128f..d5314342d 100644
+--- ios/ios_engine.cc
++++ ios/ios_engine.cc
+@@ -33,7 +33,6 @@
+ #include <string>
+ #include <utility>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/mutex.h"
+ #include "config/config_handler.h"
+@@ -46,6 +45,7 @@
+ #include "session/session.h"
+ #include "session/session_handler.h"
+ #include "session/session_handler_interface.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace ios {
+@@ -169,7 +169,7 @@ IosEngine::InputConfigTuple IosEngine::GetInputConfigTupleFromLayoutName(
+ void IosEngine::InitMozc() {
+   // Output logs to stderr so that they are displayed in XCode's console.
+   // This must be set before Logging::InitLogStream().
+-  mozc::SetFlag(&FLAGS_logtostderr, true);
++  absl::SetFlag(&FLAGS_logtostderr, true);
+   Logging::InitLogStream("MOZC_IOS_ENGINE");
+ }
+ 
+diff --git ios/ios_engine.h ios/ios_engine.h
+index 934ffe398..dd93f1fa7 100644
+--- ios/ios_engine.h
++++ ios/ios_engine.h
+@@ -108,8 +108,8 @@ class IosEngine {
+   //   * Another thread is using the underlying engine.
+   // The second case is expected because this method is intended to be called by
+   // a timer thread only when there's no key event for a while after a key press
+-  // event is occured.  The use of underlying engine means some events have
+-  // occured when the timer thread calls this method, so it's expected not to
++  // event is occurred.  The use of underlying engine means some events have
++  // occurred when the timer thread calls this method, so it's expected not to
+   // send the special key to the engine.
+   bool MaybeCreateNewChunk(commands::Command *command);
+ 
+diff --git ios/ios_engine_main.cc ios/ios_engine_main.cc
+index 21d6e5e71..d7724c6d5 100644
+--- ios/ios_engine_main.cc
++++ ios/ios_engine_main.cc
+@@ -31,17 +31,17 @@
+ #include <iostream>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/util.h"
+ #include "ios/ios_engine.h"
+ #include "protocol/candidates.pb.h"
++#include "absl/flags/flag.h"
+ 
+ // mozc/data_manager/testing:mozc_dataset_for_testing is one of datafile.
+-MOZC_FLAG(string, datafile, "", "Path to a data file to be used");
+-MOZC_FLAG(int32, candsize, 3, "Maximum number of candidates");
+-MOZC_FLAG(bool, show_full, false, "Display the debug string of output command");
++ABSL_FLAG(std::string, datafile, "", "Path to a data file to be used");
++ABSL_FLAG(int32, candsize, 3, "Maximum number of candidates");
++ABSL_FLAG(bool, show_full, false, "Display the debug string of output command");
+ 
+ namespace {
+ 
+@@ -69,7 +69,7 @@ void Convert(const std::string &query, mozc::ios::IosEngine *engine,
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  mozc::ios::IosEngine ios_engine(mozc::GetFlag(FLAGS_datafile));
++  mozc::ios::IosEngine ios_engine(absl::GetFlag(FLAGS_datafile));
+ 
+   mozc::commands::Command command;
+   mozc::config::Config config;
+@@ -97,13 +97,13 @@ int main(int argc, char **argv) {
+ 
+     Convert(query, &ios_engine, &command);
+ 
+-    if (mozc::GetFlag(FLAGS_show_full)) {
++    if (absl::GetFlag(FLAGS_show_full)) {
+       std::cout << command.Utf8DebugString() << std::endl;
+     } else {
+       std::cout << "----- preedit -----\n"
+                 << command.output().preedit().Utf8DebugString() << std::endl;
+       const auto &cands = command.output().candidates();
+-      const int size = std::min(mozc::GetFlag(FLAGS_candsize),
++      const int size = std::min(absl::GetFlag(FLAGS_candsize),
+                                 cands.candidate_size());
+       for (int i = 0; i < size; ++i) {
+         std::cout << "----- candidate " << i << " -----\n"
+diff --git ipc/BUILD ipc/BUILD
+index f947ecf33..94fd5a445 100644
+--- ipc/BUILD
++++ ipc/BUILD
+@@ -130,7 +130,6 @@ cc_test_mozc(
+         "//base",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:port",
+         "//base:process_mutex",
+         "//base:system_util",
+@@ -138,6 +137,7 @@ cc_test_mozc(
+         "//base:util",
+         "//base:version",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -174,12 +174,12 @@ cc_test_mozc(
+         ":ipc",
+         ":ipc_test_util",
+         "//base",
+-        "//base:flags",
+         "//base:port",
+         "//base:system_util",
+         "//base:thread",
+         "//base:util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -221,12 +221,12 @@ cc_test_mozc(
+         ":named_event",
+         "//base",
+         "//base:clock",
+-        "//base:flags",
+         "//base:port",
+         "//base:system_util",
+         "//base:thread",
+         "//base:util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -268,12 +268,12 @@ cc_library_mozc(
+ #     deps = [
+ #         ":process_watch_dog",
+ #         "//base",
+-#         "//base:flags",
+ #         "//base:init_mozc",
+ #         "//base:logging",
+ #         "//base:number_util",
+ #         "//base:port",
+ #         "//base:util",
++#         "@com_google_absl//absl/flags:flag",
+ #     ],
+ # )
+ 
+diff --git ipc/ipc.h ipc/ipc.h
+index 296656791..fe4c67128 100644
+--- ipc/ipc.h
++++ ipc/ipc.h
+@@ -184,7 +184,7 @@ class IPCClientFactoryInterface {
+   virtual IPCClientInterface *NewClient(const std::string &name,
+                                         const std::string &path_name) = 0;
+ 
+-  // old interface for backward compatiblity.
++  // old interface for backward compatibility.
+   // same as NewClient(name, "");
+   virtual IPCClientInterface *NewClient(const std::string &name) = 0;
+ };
+@@ -194,11 +194,11 @@ class IPCClientFactory : public IPCClientFactoryInterface {
+  public:
+   ~IPCClientFactory() override;
+ 
+-  // new inteface
++  // new interface
+   IPCClientInterface *NewClient(const std::string &name,
+                                 const std::string &path_name) override;
+ 
+-  // old interface for backward compatiblity.
++  // old interface for backward compatibility.
+   // same as NewClient(name, "");
+   IPCClientInterface *NewClient(const std::string &name) override;
+ 
+@@ -232,7 +232,7 @@ class IPCServer {
+   IPCServer(const std::string &name, int32 num_connections, int32 timeout);
+   virtual ~IPCServer();
+ 
+-  // Return true if the connectoin is available
++  // Return true if the connection is available
+   bool Connected() const;
+ 
+   // Implement a server algorithm in subclass.
+diff --git ipc/ipc_main.cc ipc/ipc_main.cc
+index dc81d5eec..60df8b319 100644
+--- ipc/ipc_main.cc
++++ ipc/ipc_main.cc
+@@ -32,20 +32,20 @@
+ #include <string>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "base/thread.h"
+ #include "ipc/ipc.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, server_address, "ipc_test", "");
+-MOZC_FLAG(bool, test, false, "automatic test mode");
+-MOZC_FLAG(bool, server, false, "invoke as server mode");
+-MOZC_FLAG(bool, client, false, "invoke as client mode");
+-MOZC_FLAG(string, server_path, "", "server path");
+-MOZC_FLAG(int32, num_threads, 10, "number of threads");
+-MOZC_FLAG(int32, num_requests, 100, "number of requests");
++ABSL_FLAG(std::string, server_address, "ipc_test", "");
++ABSL_FLAG(bool, test, false, "automatic test mode");
++ABSL_FLAG(bool, server, false, "invoke as server mode");
++ABSL_FLAG(bool, client, false, "invoke as client mode");
++ABSL_FLAG(std::string, server_path, "", "server path");
++ABSL_FLAG(int32, num_threads, 10, "number of threads");
++ABSL_FLAG(int32, num_requests, 100, "number of requests");
+ 
+ namespace mozc {
+ 
+@@ -53,9 +53,9 @@ class MultiConnections : public Thread {
+  public:
+   void Run() {
+     char buf[8192];
+-    for (int i = 0; i < mozc::GetFlag(FLAGS_num_requests); ++i) {
++    for (int i = 0; i < absl::GetFlag(FLAGS_num_requests); ++i) {
+       mozc::IPCClient con(FLAGS_server_address,
+-                          mozc::GetFlag(FLAGS_server_path));
++                          absl::GetFlag(FLAGS_server_path));
+       CHECK(con.Connected());
+       string input = "testtesttesttest";
+       size_t length = sizeof(buf);
+@@ -94,13 +94,13 @@ class EchoServerThread : public Thread {
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  if (mozc::GetFlag(FLAGS_test)) {
+-    mozc::EchoServer con(mozc::GetFlag(FLAGS_server_address), 10, 1000);
++  if (absl::GetFlag(FLAGS_test)) {
++    mozc::EchoServer con(absl::GetFlag(FLAGS_server_address), 10, 1000);
+     mozc::EchoServerThread server_thread_main(&con);
+     server_thread_main.SetJoinable(true);
+     server_thread_main.Start("IpcMain");
+ 
+-    std::vector<mozc::MultiConnections> cons(mozc::GetFlag(FLAGS_num_threads));
++    std::vector<mozc::MultiConnections> cons(absl::GetFlag(FLAGS_num_threads));
+     for (size_t i = 0; i < cons.size(); ++i) {
+       cons[i].SetJoinable(true);
+       cons[i].Start("MultiConnections");
+@@ -110,7 +110,7 @@ int main(int argc, char **argv) {
+     }
+ 
+     mozc::IPCClient kill(FLAGS_server_address,
+-                         mozc::GetFlag(FLAGS_server_path));
++                         absl::GetFlag(FLAGS_server_path));
+     const char kill_cmd[32] = "kill";
+     char output[32];
+     size_t output_size = sizeof(output);
+@@ -119,17 +119,17 @@ int main(int argc, char **argv) {
+ 
+     LOG(INFO) << "Done";
+ 
+-  } else if (mozc::GetFlag(FLAGS_server)) {
+-    mozc::EchoServer con(mozc::GetFlag(FLAGS_server_address), 10, -1);
++  } else if (absl::GetFlag(FLAGS_server)) {
++    mozc::EchoServer con(absl::GetFlag(FLAGS_server_address), 10, -1);
+     CHECK(con.Connected());
+-    LOG(INFO) << "Start Server at " << mozc::GetFlag(FLAGS_server_address);
++    LOG(INFO) << "Start Server at " << absl::GetFlag(FLAGS_server_address);
+     con.Loop();
+-  } else if (mozc::GetFlag(FLAGS_client)) {
++  } else if (absl::GetFlag(FLAGS_client)) {
+     string line;
+     char response[8192];
+     while (getline(cin, line)) {
+       mozc::IPCClient con(FLAGS_server_address,
+-                          mozc::GetFlag(FLAGS_server_path));
++                          absl::GetFlag(FLAGS_server_path));
+       CHECK(con.Connected());
+       size_t response_size = sizeof(response);
+       CHECK(con.Call(line.data(), line.size(), response, &response_size, 1000));
+diff --git ipc/ipc_path_manager_main.cc ipc/ipc_path_manager_main.cc
+index 3317a812c..8fdf64985 100644
+--- ipc/ipc_path_manager_main.cc
++++ ipc/ipc_path_manager_main.cc
+@@ -29,34 +29,34 @@
+ 
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "base/util.h"
+ #include "ipc/ipc_path_manager.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(bool, client, false, "client mode");
+-MOZC_FLAG(bool, server, false, "server mode");
+-MOZC_FLAG(string, name, "test", "ipc name");
++ABSL_FLAG(bool, client, false, "client mode");
++ABSL_FLAG(bool, server, false, "server mode");
++ABSL_FLAG(std::string, name, "test", "ipc name");
+ 
+ // command line tool to check the behavior of IPCPathManager
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+   mozc::IPCPathManager *manager =
+-      mozc::IPCPathManager::GetIPCPathManager(mozc::GetFlag(FLAGS_name));
++      mozc::IPCPathManager::GetIPCPathManager(absl::GetFlag(FLAGS_name));
+   CHECK(manager);
+ 
+   string path;
+ 
+-  if (mozc::GetFlag(FLAGS_client)) {
++  if (absl::GetFlag(FLAGS_client)) {
+     CHECK(manager->GetPathName(&path));
+     LOG(INFO) << "PathName: " << path;
+     return 0;
+   }
+ 
+-  if (mozc::GetFlag(FLAGS_server)) {
++  if (absl::GetFlag(FLAGS_server)) {
+     CHECK(manager->CreateNewPathName());
+     CHECK(manager->SavePathName());
+     CHECK(manager->GetPathName(&path));
+diff --git ipc/ipc_path_manager_test.cc ipc/ipc_path_manager_test.cc
+index 466bec00f..46f429094 100644
+--- ipc/ipc_path_manager_test.cc
++++ ipc/ipc_path_manager_test.cc
+@@ -38,7 +38,6 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/port.h"
+ #include "base/process_mutex.h"
+ #include "base/system_util.h"
+@@ -49,6 +48,7 @@
+ #include "ipc/ipc.pb.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+@@ -87,7 +87,7 @@ class BatchGetPathNameThread : public Thread {
+ class IPCPathManagerTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ };
+ 
+diff --git ipc/ipc_test.cc ipc/ipc_test.cc
+index a5ed6be6a..25f6c2b40 100644
+--- ipc/ipc_test.cc
++++ ipc/ipc_test.cc
+@@ -32,7 +32,6 @@
+ #include <algorithm>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/port.h"
+ #include "base/system_util.h"
+ #include "base/thread.h"
+@@ -40,6 +39,7 @@
+ #include "ipc/ipc_test_util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace {
+ 
+@@ -117,7 +117,7 @@ class EchoServer : public mozc::IPCServer {
+ }  // namespace
+ 
+ TEST(IPCTest, IPCTest) {
+-  mozc::SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++  mozc::SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+ #ifdef __APPLE__
+   mozc::TestMachPortManager manager;
+ #endif
+diff --git ipc/named_event.h ipc/named_event.h
+index 5985c4f0b..77959dc8a 100644
+--- ipc/named_event.h
++++ ipc/named_event.h
+@@ -47,7 +47,7 @@
+ // Example:
+ //
+ // (Process 1)
+-// NamedEventListener listner("foo");   // Create named event listener named foo
++// NamedEventListener listener("foo");  // Create named event listener named foo
+ // CHECK(listener.IsAvailable());
+ // listener.Wait(10000);  // Wait until an event comes.
+ // Access shared resource
+@@ -107,8 +107,8 @@ class NamedEventListener {
+   // Return true if NamedEventListener is available
+   bool IsAvailable() const;
+ 
+-  // return true if NamedEventListner is created by this instance.
+-  // If NamedEventListner opened an exiting handle, return false.
++  // return true if NamedEventListener is created by this instance.
++  // If NamedEventListener opened an exiting handle, return false.
+   bool IsOwner() const;
+ 
+   // Wait until the listener receives a notification
+@@ -118,7 +118,7 @@ class NamedEventListener {
+   bool Wait(int msec);
+ 
+   // Wait until the listener receives a notification or
+-  // the process specfied with pid is terminated.
++  // the process specified with pid is terminated.
+   // return TIMEOUT: reached timeout
+   // return EVENT_SIGNALED: event is signaled.
+   // return PROCESS_SIGNALED: process is signaled.
+diff --git ipc/named_event_main.cc ipc/named_event_main.cc
+index bf95251a9..02d87d0de 100644
+--- ipc/named_event_main.cc
++++ ipc/named_event_main.cc
+@@ -29,39 +29,39 @@
+ 
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "ipc/named_event.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(bool, listener, true, "listener mode");
+-MOZC_FLAG(bool, notifier, false, "notifier mode");
+-MOZC_FLAG(int32, timeout, -1, "timeout (msec)");
+-MOZC_FLAG(int32, pid, -1, "process id");
+-MOZC_FLAG(string, name, "named_event_test", "name for named event");
++ABSL_FLAG(bool, listener, true, "listener mode");
++ABSL_FLAG(bool, notifier, false, "notifier mode");
++ABSL_FLAG(int32, timeout, -1, "timeout (msec)");
++ABSL_FLAG(int32, pid, -1, "process id");
++ABSL_FLAG(std::string, name, "named_event_test", "name for named event");
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  if (mozc::GetFlag(FLAGS_notifier)) {
+-    mozc::NamedEventNotifier notifier(mozc::GetFlag(FLAGS_name).c_str());
++  if (absl::GetFlag(FLAGS_notifier)) {
++    mozc::NamedEventNotifier notifier(absl::GetFlag(FLAGS_name).c_str());
+     CHECK(notifier.IsAvailable()) << "NamedEventNotifier is not available";
+ 
+     notifier.Notify();
+     LOG(INFO) << "Notification has been sent";
+ 
+-  } else if (mozc::GetFlag(FLAGS_listener)) {
+-    mozc::NamedEventListener listener(mozc::GetFlag(FLAGS_name).c_str());
++  } else if (absl::GetFlag(FLAGS_listener)) {
++    mozc::NamedEventListener listener(absl::GetFlag(FLAGS_name).c_str());
+     CHECK(listener.IsAvailable()) << "NamedEventListener is not available";
+ 
+     LOG_IF(INFO, listener.IsOwner()) << "This instance owns event handle";
+ 
+-    LOG(INFO) << "Waiting event " << mozc::GetFlag(FLAGS_name);
+-    if (mozc::GetFlag(FLAGS_pid) != -1) {
++    LOG(INFO) << "Waiting event " << absl::GetFlag(FLAGS_name);
++    if (absl::GetFlag(FLAGS_pid) != -1) {
+       switch (listener.WaitEventOrProcess(
+-          mozc::GetFlag(FLAGS_timeout),
+-          static_cast<size_t>(mozc::GetFlag(FLAGS_pid)))) {
++          absl::GetFlag(FLAGS_timeout),
++          static_cast<size_t>(absl::GetFlag(FLAGS_pid)))) {
+         case mozc::NamedEventListener::TIMEOUT:
+           LOG(INFO) << "timeout";
+           break;
+@@ -76,7 +76,7 @@ int main(int argc, char **argv) {
+           break;
+       }
+     } else {
+-      if (listener.Wait(mozc::GetFlag(FLAGS_timeout))) {
++      if (listener.Wait(absl::GetFlag(FLAGS_timeout))) {
+         LOG(INFO) << "Event comes";
+       }
+     }
+diff --git ipc/named_event_test.cc ipc/named_event_test.cc
+index aa7c629f6..a64ea8138 100644
+--- ipc/named_event_test.cc
++++ ipc/named_event_test.cc
+@@ -34,13 +34,13 @@
+ #include <string>
+ 
+ #include "base/clock.h"
+-#include "base/flags.h"
+ #include "base/port.h"
+ #include "base/system_util.h"
+ #include "base/thread.h"
+ #include "base/util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -87,7 +87,7 @@ class NamedEventListenerThread : public Thread {
+ class NamedEventTest : public testing::Test {
+   void SetUp() override {
+     original_user_profile_directory_ = SystemUtil::GetUserProfileDirectory();
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ 
+   void TearDown() override {
+diff --git ipc/process_watch_dog_main.cc ipc/process_watch_dog_main.cc
+index ee0ef0739..691c75114 100644
+--- ipc/process_watch_dog_main.cc
++++ ipc/process_watch_dog_main.cc
+@@ -31,15 +31,15 @@
+ #include <string>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/number_util.h"
+ #include "base/port.h"
+ #include "base/util.h"
+ #include "ipc/process_watch_dog.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(int32, timeout, -1, "set timeout");
++ABSL_FLAG(int32, timeout, -1, "set timeout");
+ 
+ namespace mozc {
+ class TestProcessWatchDog : public ProcessWatchDog {
+@@ -75,7 +75,7 @@ int main(int argc, char **argv) {
+ 
+     if (!dog.SetID(static_cast<mozc::ProcessWatchDog::ProcessID>(process_id),
+                    static_cast<mozc::ProcessWatchDog::ThreadID>(thread_id),
+-                   mozc::GetFlag(FLAGS_timeout))) {
++                   absl::GetFlag(FLAGS_timeout))) {
+       std::cout << "Error" << std::endl;
+     } else {
+       std::cout << "OK" << std::endl;
+diff --git ipc/win32_ipc.cc ipc/win32_ipc.cc
+index c6f9fc889..d954a0f04 100644
+--- ipc/win32_ipc.cc
++++ ipc/win32_ipc.cc
+@@ -554,7 +554,7 @@ void IPCServer::Loop() {
+                                       INFINITE, &overlapped, &ignored,
+                                       &ipc_error, kReadTypeData)) {
+           if (ipc_error == IPC_QUIT_EVENT_SIGNALED) {
+-            VLOG(1) << "Recived Conrol event from other thread";
++            VLOG(1) << "Received Conrol event from other thread";
+             connected_ = false;
+             return;
+           }
+@@ -614,7 +614,7 @@ void IPCServer::Loop() {
+     if (!RecvIPCMessage(pipe_handle_.get(), pipe_event_.get(), ack_request,
+                         &ack_request_size, kAckTimeout, kReadTypeACK,
+                         &last_ipc_error)) {
+-      // This case happens when the client did not recive the server's response
++      // This case happens when the client did not receive the server's response
+       // within timeout. Anyway we will close the connection so that the server
+       // will not be blocked.
+       LOG(WARNING) << "Client didn't respond within " << kAckTimeout
+diff --git mac/BUILD mac/BUILD
+index 5151898ff..54ee9ec39 100644
+--- mac/BUILD
++++ mac/BUILD
+@@ -28,11 +28,156 @@
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+-load("//:build_defs.bzl", "objc_library_mozc")
++load(
++    "//:build_defs.bzl",
++    "info_plist_mozc",
++    "macos_application_mozc",
++    "objc_library_mozc",
++    "py_binary_mozc",
++)
++load(
++    "//:config.bzl",
++    "BRANDING",
++    "MACOS_BUNDLE_ID_PREFIX",
++)
+ 
+ package(default_visibility = ["//:__subpackages__"])
+ 
++macos_application_mozc(
++    name = "mozc_macos",
++    app_icons = ["//data/images/mac:product_icon.icns"],
++    bundle_id = MACOS_BUNDLE_ID_PREFIX,
++    bundle_name = BRANDING,
++    infoplists = [":info_plist"],
++    resources = [
++        "//data/images/mac:direct.tiff",
++        "//data/images/mac:full_ascii.tiff",
++        "//data/images/mac:full_katakana.tiff",
++        "//data/images/mac:half_ascii.tiff",
++        "//data/images/mac:half_katakana.tiff",
++        "//data/images/mac:hiragana.tiff",
++        "//data/installer:credits_en.html",
++    ],
++    deps = ["mozc_macos_main_lib"],
++)
++
+ objc_library_mozc(
+     name = "common",
+     hdrs = ["common.h"],
+ )
++
++objc_library_mozc(
++    name = "mozc_macos_main_lib",
++    srcs = ["main.mm"],
++    sdk_frameworks = ["InputMethodKit"],
++    deps = [
++        ":imk_controller",
++        ":imk_server",
++        "//base:crash_report_handler",
++        "//base:init_mozc",
++        "//base:logging",
++        "//base:run_level",
++        "//client",
++        "//config:stats_config_util",
++    ],
++)
++
++objc_library_mozc(
++    name = "imk_controller",
++    srcs = [
++        "GoogleJapaneseInputController.mm",
++    ],
++    hdrs = [
++        "GoogleJapaneseInputController.h",
++    ],
++    proto_deps = [
++        "//protocol:commands_proto",
++        "//protocol:config_proto",
++        "//protocol:renderer_proto",
++    ],
++    textual_hdrs = [
++        "GoogleJapaneseInputControllerInterface.h",
++    ],
++    deps = [
++        ":common",
++        ":imk_server",
++        ":keycode_map",
++        "//base:logging",
++        "//base:mac_process",
++        "//base:mac_util",
++        "//base:mutex",
++        "//base:util",
++        "//client",
++        "//ipc",
++        "//renderer:renderer_client",
++        "//session:ime_switch_util",
++    ],
++)
++
++objc_library_mozc(
++    name = "imk_server",
++    srcs = ["GoogleJapaneseInputServer.mm"],
++    hdrs = ["GoogleJapaneseInputServer.h"],
++    proto_deps = ["//protocol:commands_proto"],
++    deps = [
++        ":common",
++        "//base:logging",
++        "//base:mutex",
++    ],
++)
++
++objc_library_mozc(
++    name = "keycode_map",
++    srcs = ["KeyCodeMap.mm"],
++    hdrs = ["KeyCodeMap.h"],
++    proto_deps = ["//protocol:commands_proto"],
++    textual_hdrs = [
++        ":init_kanamap",
++        ":init_specialkeymap",
++        ":init_specialcharmap",
++    ],
++    deps = [
++        "//base:logging",
++        "//base:mutex",
++    ],
++)
++
++py_binary_mozc(
++    name = "generate_mapping",
++    srcs = ["generate_mapping.py"],
++    deps = [],
++)
++
++genrule(
++    name = "init_kanamap",
++    srcs = ["//data/preedit:mac-kana.tsv"],
++    outs = ["init_kanamap.h"],
++    cmd = ("$(location :generate_mapping) --mapname=KanaMap" +
++           " --result_type='const char *' --filename $< > $@"),
++    exec_tools = [":generate_mapping"],
++)
++
++genrule(
++    name = "init_specialkeymap",
++    srcs = ["//data/preedit:mac-specialkeys.tsv"],
++    outs = ["init_specialkeymap.h"],
++    cmd = ("$(location :generate_mapping) --mapname=SpecialKeyMap" +
++           " --result_type=KeyEvent::SpecialKey --filename $< > $@"),
++    exec_tools = [":generate_mapping"],
++)
++
++genrule(
++    name = "init_specialcharmap",
++    srcs = ["//data/preedit:mac-specialchars.tsv"],
++    outs = ["init_specialcharmap.h"],
++    cmd = ("$(location :generate_mapping) --mapname=SpecialCharMap" +
++           " --key_type=unichar --result_type=KeyEvent::SpecialKey" +
++           " --filename $< > $@"),
++    exec_tools = [":generate_mapping"],
++)
++
++info_plist_mozc(
++    name = "info_plist",
++    srcs = ["Info.plist"],
++    outs = [BRANDING + "Info.plist"],
++)
+diff --git mac/GoogleJapaneseInputControllerInterface.h mac/GoogleJapaneseInputControllerInterface.h
+index 62c9a5a8d..7d811ec0b 100644
+--- mac/GoogleJapaneseInputControllerInterface.h
++++ mac/GoogleJapaneseInputControllerInterface.h
+@@ -80,7 +80,7 @@
+ 
+ // Set up the client capability
+ - (void)setupCapability;
+-// Set up the cilent bundle for the sender.
++// Set up the client bundle for the sender.
+ - (void)setupClientBundle:(id)sender;
+ 
+ // Launch the word register tool with the current selection range.
+diff --git mac/GoogleJapaneseInputServer.mm mac/GoogleJapaneseInputServer.mm
+index 4a668144e..041c6fa8b 100644
+--- mac/GoogleJapaneseInputServer.mm
++++ mac/GoogleJapaneseInputServer.mm
+@@ -29,8 +29,6 @@
+ 
+ #import "mac/GoogleJapaneseInputServer.h"
+ 
+-#import "mac/GoogleJapaneseInputController.h"
+-
+ #include <string>
+ 
+ #include "base/const.h"
+diff --git mac/Uninstaller/Uninstaller_main.mm mac/Uninstaller/Uninstaller_main.mm
+index 4e4cd15b1..5d808ac9b 100644
+--- mac/Uninstaller/Uninstaller_main.mm
++++ mac/Uninstaller/Uninstaller_main.mm
+@@ -32,8 +32,8 @@
+ #import "DialogsController.h"
+ #import "Uninstaller.h"
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
++#include "absl/flags/flag.h"
+ 
+ int main(int argc, char *argv[]) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+diff --git mac/main.mm mac/main.mm
+index c53be5fd3..a16eeb391 100644
+--- mac/main.mm
++++ mac/main.mm
+@@ -38,12 +38,12 @@
+ 
+ #include "base/const.h"
+ #include "base/crash_report_handler.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/run_level.h"
+ #include "client/client.h"
+ #include "config/stats_config_util.h"
++#include "absl/flags/flag.h"
+ 
+ int main(int argc, char *argv[]) {
+   if (!mozc::RunLevel::IsValidClientRunLevel()) {
+diff --git prediction/BUILD prediction/BUILD
+index de816004f..e4afa4f2f 100644
+--- prediction/BUILD
++++ prediction/BUILD
+@@ -77,7 +77,6 @@ cc_library_mozc(
+         "//base",
+         "//base:clock",
+         "//base:config_file_stream",
+-        "//base:flags",
+         "//base:freelist",
+         "//base:hash",
+         "//base:logging",
+@@ -99,6 +98,7 @@ cc_library_mozc(
+         "//storage:lru_cache",
+         "//testing:gunit_prod",
+         "//usage_stats",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+         "@com_google_absl//absl/strings",
+     ],
+@@ -117,7 +117,6 @@ cc_test_mozc(
+         "//base:clock_mock",
+         "//base:encryptor",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:system_util",
+@@ -137,6 +136,7 @@ cc_test_mozc(
+         "//testing:gunit_main",
+         "//usage_stats",
+         "//usage_stats:usage_stats_testing_util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+         "@com_google_absl//absl/strings",
+     ],
+@@ -153,7 +153,6 @@ cc_library_mozc(
+         ":suggestion_filter",
+         ":zero_query_dict",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:mozc_hash_map",
+         "//base:number_util",
+@@ -176,6 +175,7 @@ cc_library_mozc(
+         "//request:conversion_request",
+         "//testing:gunit_prod",
+         "//usage_stats",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+     alwayslink = 1,
+@@ -194,7 +194,6 @@ cc_test_mozc(
+         ":suggestion_filter",
+         ":zero_query_dict",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:serialized_string_array",
+@@ -230,6 +229,7 @@ cc_test_mozc(
+         "//transliteration",
+         "//usage_stats",
+         "//usage_stats:usage_stats_testing_util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+         "@com_google_absl//absl/strings",
+     ],
+@@ -242,13 +242,13 @@ cc_library_mozc(
+     deps = [
+         ":predictor_interface",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//config:config_handler",
+         "//converter:segments",
+         "//protocol:commands_proto",
+         "//protocol:config_proto",
+         "//request:conversion_request",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+     alwayslink = 1,
+@@ -330,12 +330,12 @@ cc_binary_mozc(
+         "//base",
+         "//base:codegen_bytearray_stream",
+         "//base:file_stream",
+-        "//base:flags",
+         "//base:hash",
+         "//base:init_mozc_buildtool",
+         "//base:logging",
+         "//base:util",
+         "//storage:existence_filter",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+diff --git prediction/dictionary_predictor.cc prediction/dictionary_predictor.cc
+index c3158b41b..8dd70a92a 100644
+--- prediction/dictionary_predictor.cc
++++ prediction/dictionary_predictor.cc
+@@ -40,7 +40,6 @@
+ #include <utility>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/mozc_hash_map.h"
+ #include "base/number_util.h"
+@@ -61,6 +60,7 @@
+ #include "protocol/config.pb.h"
+ #include "request/conversion_request.h"
+ #include "usage_stats/usage_stats.h"
++#include "absl/flags/flag.h"
+ #include "absl/strings/string_view.h"
+ 
+ #ifndef NDEBUG
+@@ -233,7 +233,7 @@ class DictionaryPredictor::PredictiveLookupCallback
+     // If the token is from user dictionary and its POS is unknown, it is
+     // suggest-only words.  Such words are looked up only when their keys
+     // exactly match |key|.  Otherwise, unigram suggestion can be annoying.  For
+-    // example, suppose a user registers his/her email address as める.  Then,
++    // example, suppose a user registers their email address as める.  Then,
+     // we don't want to show the email address from め but exactly from める.
+     if ((token.attributes & Token::USER_DICTIONARY) != 0 &&
+         token.lid == unknown_id_) {
+diff --git prediction/dictionary_predictor_test.cc prediction/dictionary_predictor_test.cc
+index 5d62e295c..d550d9630 100644
+--- prediction/dictionary_predictor_test.cc
++++ prediction/dictionary_predictor_test.cc
+@@ -37,7 +37,6 @@
+ #include <utility>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "base/serialized_string_array.h"
+@@ -76,6 +75,7 @@
+ #include "transliteration/transliteration.h"
+ #include "usage_stats/usage_stats.h"
+ #include "usage_stats/usage_stats_testing_util.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ #include "absl/strings/string_view.h"
+ 
+@@ -362,7 +362,7 @@ class MockTypingModel : public mozc::composer::TypingModel {
+ class DictionaryPredictorTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     request_ = absl::make_unique<commands::Request>();
+     config_ = absl::make_unique<config::Config>();
+     config::ConfigHandler::GetDefaultConfig(config_.get());
+@@ -2837,42 +2837,42 @@ TEST_F(DictionaryPredictorTest, SetLMCostForUserDictionaryWord) {
+ 
+   {
+     // Cost of words in user dictionary should be decreased.
+-    const int kOrigianlWordCost = 10000;
++    const int kOriginalWordCost = 10000;
+     std::vector<TestableDictionaryPredictor::Result> results;
+     AddTestableDictionaryPredictorResult(
+-        kAikaHiragana, kAikaKanji, kOrigianlWordCost,
++        kAikaHiragana, kAikaKanji, kOriginalWordCost,
+         TestableDictionaryPredictor::UNIGRAM, Token::USER_DICTIONARY, &results);
+ 
+     predictor->SetLMCost(segments, &results);
+ 
+     EXPECT_EQ(1, results.size());
+     EXPECT_EQ(kAikaKanji, results[0].value);
+-    EXPECT_GT(kOrigianlWordCost, results[0].cost);
++    EXPECT_GT(kOriginalWordCost, results[0].cost);
+     EXPECT_LE(1, results[0].cost);
+   }
+ 
+   {
+     // Cost of words in user dictionary should not be decreased to below 1.
+-    const int kOrigianlWordCost = 10;
++    const int kOriginalWordCost = 10;
+     std::vector<TestableDictionaryPredictor::Result> results;
+     AddTestableDictionaryPredictorResult(
+-        kAikaHiragana, kAikaKanji, kOrigianlWordCost,
++        kAikaHiragana, kAikaKanji, kOriginalWordCost,
+         TestableDictionaryPredictor::UNIGRAM, Token::USER_DICTIONARY, &results);
+ 
+     predictor->SetLMCost(segments, &results);
+ 
+     EXPECT_EQ(1, results.size());
+     EXPECT_EQ(kAikaKanji, results[0].value);
+-    EXPECT_GT(kOrigianlWordCost, results[0].cost);
++    EXPECT_GT(kOriginalWordCost, results[0].cost);
+     EXPECT_LE(1, results[0].cost);
+   }
+ 
+   {
+     // Cost of general symbols should not be decreased.
+-    const int kOrigianlWordCost = 10000;
++    const int kOriginalWordCost = 10000;
+     std::vector<TestableDictionaryPredictor::Result> results;
+     AddTestableDictionaryPredictorResult(
+-        kAikaHiragana, kAikaKanji, kOrigianlWordCost,
++        kAikaHiragana, kAikaKanji, kOriginalWordCost,
+         TestableDictionaryPredictor::UNIGRAM, Token::USER_DICTIONARY, &results);
+     ASSERT_EQ(1, results.size());
+     results[0].lid = data_and_predictor->pos_matcher().GetGeneralSymbolId();
+@@ -2881,22 +2881,22 @@ TEST_F(DictionaryPredictorTest, SetLMCostForUserDictionaryWord) {
+ 
+     EXPECT_EQ(1, results.size());
+     EXPECT_EQ(kAikaKanji, results[0].value);
+-    EXPECT_LE(kOrigianlWordCost, results[0].cost);
++    EXPECT_LE(kOriginalWordCost, results[0].cost);
+   }
+ 
+   {
+     // Cost of words not in user dictionary should not be decreased.
+-    const int kOrigianlWordCost = 10000;
++    const int kOriginalWordCost = 10000;
+     std::vector<TestableDictionaryPredictor::Result> results;
+     AddTestableDictionaryPredictorResult(
+-        kAikaHiragana, kAikaKanji, kOrigianlWordCost,
++        kAikaHiragana, kAikaKanji, kOriginalWordCost,
+         TestableDictionaryPredictor::UNIGRAM, Token::NONE, &results);
+ 
+     predictor->SetLMCost(segments, &results);
+ 
+     EXPECT_EQ(1, results.size());
+     EXPECT_EQ(kAikaKanji, results[0].value);
+-    EXPECT_EQ(kOrigianlWordCost, results[0].cost);
++    EXPECT_EQ(kOriginalWordCost, results[0].cost);
+   }
+ }
+ 
+diff --git prediction/gen_suggestion_filter_main.cc prediction/gen_suggestion_filter_main.cc
+index bff0d615d..264e6d57c 100644
+--- prediction/gen_suggestion_filter_main.cc
++++ prediction/gen_suggestion_filter_main.cc
+@@ -33,17 +33,17 @@
+ 
+ #include "base/codegen_bytearray_stream.h"
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/hash.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/util.h"
+ #include "storage/existence_filter.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, input, "", "per-line suggestion filter list");
+-MOZC_FLAG(string, output, "", "output bloom filter");
+-MOZC_FLAG(bool, header, true, "make header file instead of raw bloom filter");
+-MOZC_FLAG(string, name, "SuggestionFilterData",
++ABSL_FLAG(std::string, input, "", "per-line suggestion filter list");
++ABSL_FLAG(std::string, output, "", "output bloom filter");
++ABSL_FLAG(bool, header, true, "make header file instead of raw bloom filter");
++ABSL_FLAG(std::string, name, "SuggestionFilterData",
+           "name for variable name in the header file");
+ 
+ namespace {
+@@ -70,15 +70,15 @@ using mozc::storage::ExistenceFilter;
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  if ((mozc::GetFlag(FLAGS_input).empty() ||
+-       mozc::GetFlag(FLAGS_output).empty()) && argc > 2) {
+-    mozc::SetFlag(&FLAGS_input, argv[1]);
+-    mozc::SetFlag(&FLAGS_output, argv[2]);
++  if ((absl::GetFlag(FLAGS_input).empty() ||
++       absl::GetFlag(FLAGS_output).empty()) && argc > 2) {
++    absl::SetFlag(&FLAGS_input, argv[1]);
++    absl::SetFlag(&FLAGS_output, argv[2]);
+   }
+ 
+   std::vector<uint64> words;
+ 
+-  ReadWords(mozc::GetFlag(FLAGS_input), &words);
++  ReadWords(absl::GetFlag(FLAGS_input), &words);
+ 
+   LOG(INFO) << words.size() << " words found";
+ 
+@@ -99,19 +99,19 @@ int main(int argc, char **argv) {
+   char *buf = nullptr;
+   size_t size = 0;
+ 
+-  LOG(INFO) << "writing bloomfilter: " << mozc::GetFlag(FLAGS_output);
++  LOG(INFO) << "writing bloomfilter: " << absl::GetFlag(FLAGS_output);
+   filter->Write(&buf, &size);
+ 
+-  if (mozc::GetFlag(FLAGS_header)) {
+-    mozc::OutputFileStream ofs(mozc::GetFlag(FLAGS_output).c_str());
++  if (absl::GetFlag(FLAGS_header)) {
++    mozc::OutputFileStream ofs(absl::GetFlag(FLAGS_output).c_str());
+     mozc::CodeGenByteArrayOutputStream codegen_stream(
+         &ofs, mozc::codegenstream::NOT_OWN_STREAM);
+-    codegen_stream.OpenVarDef(mozc::GetFlag(FLAGS_name));
++    codegen_stream.OpenVarDef(absl::GetFlag(FLAGS_name));
+     codegen_stream.write(buf, size);
+     codegen_stream.CloseVarDef();
+   } else {
+     mozc::OutputFileStream ofs(
+-        mozc::GetFlag(FLAGS_output).c_str(),
++        absl::GetFlag(FLAGS_output).c_str(),
+         std::ios::out | std::ios::trunc | std::ios::binary);
+     ofs.write(buf, size);
+   }
+diff --git prediction/predictor.cc prediction/predictor.cc
+index 3937dc836..b7c0e8e28 100644
+--- prediction/predictor.cc
++++ prediction/predictor.cc
+@@ -34,11 +34,11 @@
+ #include <utility>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "converter/segments.h"
+ #include "protocol/commands.pb.h"
+ #include "protocol/config.pb.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+diff --git prediction/predictor_test.cc prediction/predictor_test.cc
+index 702b48d5e..de65565fd 100644
+--- prediction/predictor_test.cc
++++ prediction/predictor_test.cc
+@@ -202,7 +202,7 @@ TEST_F(MobilePredictorTest, CallPredictorsForMobilePartialPrediction) {
+   EXPECT_TRUE(predictor->PredictForRequest(*convreq_, &segments));
+ }
+ 
+-TEST_F(MobilePredictorTest, CallPredictForRequetMobile) {
++TEST_F(MobilePredictorTest, CallPredictForRequestMobile) {
+   auto predictor1 = absl::make_unique<MockPredictor>();
+   auto predictor2 = absl::make_unique<MockPredictor>();
+   EXPECT_CALL(*predictor1, PredictForRequest(_, _))
+@@ -310,7 +310,7 @@ TEST_F(PredictorTest, CallPredictorsForPrediction) {
+   EXPECT_TRUE(predictor->PredictForRequest(*convreq_, &segments));
+ }
+ 
+-TEST_F(PredictorTest, CallPredictForRequet) {
++TEST_F(PredictorTest, CallPredictForRequest) {
+   auto predictor1 = absl::make_unique<MockPredictor>();
+   auto predictor2 = absl::make_unique<MockPredictor>();
+   EXPECT_CALL(*predictor1, PredictForRequest(_, _))
+diff --git prediction/user_history_predictor.cc prediction/user_history_predictor.cc
+index 4d5b64847..9c6712965 100644
+--- prediction/user_history_predictor.cc
++++ prediction/user_history_predictor.cc
+@@ -38,7 +38,6 @@
+ 
+ #include "base/clock.h"
+ #include "base/config_file_stream.h"
+-#include "base/flags.h"
+ #include "base/hash.h"
+ #include "base/logging.h"
+ #include "base/mozc_hash_set.h"
+@@ -59,6 +58,7 @@
+ #include "storage/encrypted_string_storage.h"
+ #include "storage/lru_cache.h"
+ #include "usage_stats/usage_stats.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -241,7 +241,7 @@ bool UserHistoryStorage::Load() {
+       << num_deleted << " old entries were not loaded "
+       << proto_.entries_size();
+ 
+-  VLOG(1) << "Loaded user histroy, size=" << proto_.entries_size();
++  VLOG(1) << "Loaded user history, size=" << proto_.entries_size();
+   return true;
+ }
+ 
+@@ -473,7 +473,7 @@ bool UserHistoryPredictor::Load(const UserHistoryStorage &history) {
+                  history.GetProto().entries(i));
+   }
+ 
+-  VLOG(1) << "Loaded user histroy, size=" << history.GetProto().entries_size();
++  VLOG(1) << "Loaded user history, size=" << history.GetProto().entries_size();
+ 
+   return true;
+ }
+diff --git prediction/user_history_predictor_test.cc prediction/user_history_predictor_test.cc
+index 71e56c912..ef2f0bab6 100644
+--- prediction/user_history_predictor_test.cc
++++ prediction/user_history_predictor_test.cc
+@@ -35,7 +35,6 @@
+ 
+ #include "base/clock_mock.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/password_manager.h"
+ #include "base/port.h"
+@@ -57,6 +56,7 @@
+ #include "testing/base/public/gunit.h"
+ #include "usage_stats/usage_stats.h"
+ #include "usage_stats/usage_stats_testing_util.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ #include "absl/strings/string_view.h"
+ 
+@@ -207,7 +207,7 @@ bool FindCandidateByValue(const std::string &value, const Segments &segments) {
+ class UserHistoryPredictorTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     request_ = absl::make_unique<Request>();
+     config_ = absl::make_unique<Config>();
+     config::ConfigHandler::GetDefaultConfig(config_.get());
+@@ -926,7 +926,7 @@ TEST_F(UserHistoryPredictorTest, HistoryToPunctuation) {
+ 
+   Segments segments;
+ 
+-  // Scenario 1: A user have commited "亜" by prediction and then commit "。".
++  // Scenario 1: A user have committed "亜" by prediction and then commit "。".
+   // Then, the unigram "亜" is learned but the bigram "亜。" shouldn't.
+   SetUpInputForPrediction("あ", composer_.get(), &segments);
+   AddCandidate(0, "亜", &segments);
+@@ -979,7 +979,7 @@ TEST_F(UserHistoryPredictorTest, HistoryToPunctuation) {
+   EXPECT_EQ("お疲れ様です。", segments.segment(0).candidate(1).value);
+ }
+ 
+-TEST_F(UserHistoryPredictorTest, UserHistoryPredictorPreceedingPunctuation) {
++TEST_F(UserHistoryPredictorTest, UserHistoryPredictorPrecedingPunctuation) {
+   UserHistoryPredictor *predictor = GetUserHistoryPredictorWithClearedHistory();
+ 
+   Segments segments;
+@@ -2002,7 +2002,7 @@ const bool kNonSensitive = false;
+ 
+ const PrivacySensitiveTestData kNonSensitiveCases[] = {
+     {kNonSensitive,  // We might want to revisit this behavior
+-     "Type privacy sensitive number but it is commited as full-width number "
++     "Type privacy sensitive number but it is committed as full-width number "
+      "by mistake.",
+      "0007", "0007"},
+     {kNonSensitive, "Type a ZIP number.", "100-0001", "東京都千代田区千代田"},
+@@ -2237,7 +2237,7 @@ TEST_F(UserHistoryPredictorTest, UserHistoryStorageContainingOldEntries) {
+   // Test Load().
+   {
+     const std::string filename =
+-        FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "testload");
++        FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "testload");
+     // Write directly to the file to keep old entries for testing.
+     storage::EncryptedStringStorage file_storage(filename);
+     ASSERT_TRUE(file_storage.Save(history.SerializeAsString()));
+@@ -2256,7 +2256,7 @@ TEST_F(UserHistoryPredictorTest, UserHistoryStorageContainingOldEntries) {
+   // Test Save().
+   {
+     const std::string filename =
+-        FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "testsave");
++        FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "testsave");
+     UserHistoryStorage storage(filename);
+     storage.GetProto() = history;
+     ASSERT_TRUE(storage.Save());
+diff --git protocol/commands.proto protocol/commands.proto
+index 403fdfa01..87f5ab5ad 100644
+--- protocol/commands.proto
++++ protocol/commands.proto
+@@ -310,7 +310,7 @@ message GenericStorageEntry {
+   // Such byte stream cannot be treaed by Java's String class, which
+   // is used for PB's string type.
+   // Instead, PB's bytes type is converted into ByteString in Java,
+-  // which can treat C laguage style string described above.
++  // which can treat C language style string described above.
+   repeated bytes value = 3;
+ }
+ 
+@@ -361,7 +361,7 @@ message SessionCommand {
+     // submitting segments from first one to focused one (inclusive).
+     //
+     // If no focused candidate (Suggestion, including ZeroQuery suggestion),
+-    // first (and only) segment's candiadte of which id is equal to id field of
++    // first (and only) segment's candidate of which id is equal to id field of
+     // Input message is submitted.
+     // This behavior should be fixed because current cursor position affects
+     // nothing. In future, the characters after the cursor should be kept
+@@ -683,7 +683,7 @@ message Request {
+     // input, the previous composition will be committed.  For
+     // example, "ab<space>dc" results "ab " as a committed string and
+     // "dc" as a composition.
+-    SPACE_OR_CONVERT_COMMITING_COMPOSITION = 1;
++    SPACE_OR_CONVERT_COMMITTING_COMPOSITION = 1;
+ 
+     // Commit the composition and a space.
+     COMMIT = 2;
+@@ -779,7 +779,7 @@ message Request {
+     // cursor key, we'd like to commit the abcde and move the caret to right.
+     // So the user will get:
+     //   XXXXabcdeY|YYYY
+-    // Here, what we need is commiting the "abcde" with the appropriate
++    // Here, what we need is committing the "abcde" with the appropriate
+     // caret position. (Note that we need to handle the left cursor key, too).
+     // Also, we should *NOT* consume the key, so that the key event will be
+     // handled appropriately by the target application.
+diff --git protocol/config.proto protocol/config.proto
+index 56fd2f23b..8deb5a803 100644
+--- protocol/config.proto
++++ protocol/config.proto
+@@ -212,7 +212,7 @@ message Config {
+   // auto IME turn off feature
+   optional bool use_auto_ime_turn_off = 56 [default = true];
+ 
+-  // Toggle to use cascanding window for debuging.
++  // Toggle to use cascanding window for debugging.
+   optional bool use_cascading_window = 58 [default = true];
+ 
+   // Shift key mode switch
+diff --git protocol/engine_builder.proto protocol/engine_builder.proto
+index 90b5f3bb3..1b73b0bb4 100644
+--- protocol/engine_builder.proto
++++ protocol/engine_builder.proto
+@@ -72,7 +72,7 @@ message EngineReloadResponse {
+ 
+     // The following are errors.
+ 
+-    // Failed to start reload becuase another reload job is currently running.
++    // Failed to start reload because another reload job is currently running.
+     ALREADY_RUNNING = 3;
+ 
+     // Erros in data file.
+diff --git protocol/renderer_command.proto protocol/renderer_command.proto
+index 80ef98c03..27da46cd8 100644
+--- protocol/renderer_command.proto
++++ protocol/renderer_command.proto
+@@ -155,7 +155,7 @@ message RendererCommand {
+     // HWND of the window where composition is displayed.
+     optional uint32 target_window_handle = 4;
+     // used in Windows:
+-    // Preffered font for composition string.
++    // Preferred font for composition string.
+     optional WinLogFont composition_font = 5;
+ 
+     // Represents IM Framework used in the client.
+@@ -185,7 +185,7 @@ message RendererCommand {
+ 
+     // used in Windows:
+     // Indicates if a UI element is expected to be displayed or not.  Note
+-    // taht |RendererCommand::visible| should be prior to these flags, that is,
++    // that |RendererCommand::visible| should be prior to these flags, that is,
+     // you should hide all UI elements if |RendererCommand::visible| is false
+     // regardless of the visibility specified in this field.
+     enum UIVisibility {
+diff --git protocol/user_dictionary_storage.proto protocol/user_dictionary_storage.proto
+index 4fdc7019e..ee47cd554 100644
+--- protocol/user_dictionary_storage.proto
++++ protocol/user_dictionary_storage.proto
+@@ -92,7 +92,7 @@ message UserDictionary {
+ 
+   // set false if this dictionary is not used.
+   // Even if |enabled| is false, the dictionary
+-  // it self is visible to user.
++  // itself is visible to user.
+   optional bool enabled = 2 [default = true];
+ 
+   // name of dictionary
+@@ -284,7 +284,7 @@ message UserDictionaryCommandStatus {
+     FILE_NOT_FOUND = 6;
+     INVALID_FILE_FORMAT = 7;
+ 
+-    // Note: currently if we recieve this error status,
++    // Note: currently if we receive this error status,
+     // the file is actually saved.
+     FILE_SIZE_LIMIT_EXCEEDED = 8;
+     DICTIONARY_SIZE_LIMIT_EXCEEDED = 9;
+diff --git renderer/BUILD renderer/BUILD
+index 0d905fcbf..bf71b05eb 100644
+--- renderer/BUILD
++++ renderer/BUILD
+@@ -33,6 +33,8 @@ load(
+     "cc_binary_mozc",
+     "cc_library_mozc",
+     "cc_test_mozc",
++    "info_plist_mozc",
++    "macos_application_mozc",
+     "objc_library_mozc",
+     "select_mozc",
+ )
+@@ -40,9 +42,7 @@ load(
+     "//:config.bzl",
+     "BRANDING",
+     "MACOS_BUNDLE_ID_PREFIX",
+-    "MACOS_MIN_OS_VER",
+ )
+-load("@build_bazel_rules_apple//apple:macos.bzl", "macos_application")
+ 
+ package(default_visibility = ["//:__subpackages__"])
+ 
+@@ -101,7 +101,6 @@ cc_library_mozc(
+     deps = [
+         ":renderer_interface",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:system_util",
+@@ -113,6 +112,7 @@ cc_library_mozc(
+         "//ipc:process_watch_dog",
+         "//protocol:config_proto",
+         "//protocol:renderer_proto",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -128,7 +128,6 @@ cc_test_mozc(
+         ":renderer_interface",
+         ":renderer_server",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:system_util",
+@@ -136,6 +135,7 @@ cc_test_mozc(
+         "//ipc:ipc_test_util",
+         "//protocol:renderer_proto",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -310,7 +310,7 @@ cc_binary_mozc(
+     deps = [
+         ":mozc_renderer_lib",
+         "//base:crash_report_handler",
+-        "//base:flags",
++        "@com_google_absl//absl/flags:flag",
+         "//base:init_mozc",
+         "//base:run_level",
+         "//base:system_util",
+@@ -364,13 +364,12 @@ cc_test_mozc(
+ )
+ 
+ # macOS
+-macos_application(
++macos_application_mozc(
+     name = "mozc_renderer_macos",
+     app_icons = ["//data/images/mac:product_icon.icns"],
+     bundle_id = MACOS_BUNDLE_ID_PREFIX + ".Renderer",
+     bundle_name = BRANDING + "Renderer",
+-    infoplists = [":gen_mozc_renderer_info_plist"],
+-    minimum_os_version = MACOS_MIN_OS_VER,
++    infoplists = [":mozc_renderer_info_plist"],
+     resources = ["//data/images/mac:candidate_window_logo.tiff"],
+     deps = [":mozc_renderer_main_macos"],
+     # When we support Breakpad, uncomment the following block.
+@@ -385,12 +384,12 @@ cc_library_mozc(
+     deps = [
+         ":mozc_renderer_lib_macos",
+         "//base:crash_report_handler",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:run_level",
+         "//base:system_util",
+         "//base:util",
+         "//config:stats_config_util",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -448,17 +447,8 @@ objc_library_mozc(
+     ]),
+ )
+ 
+-genrule(
+-    name = "gen_mozc_renderer_info_plist",
+-    srcs = [
+-        "mac/Info.plist",
+-        "//base:mozc_version_txt",
+-    ],
++info_plist_mozc(
++    name = "mozc_renderer_info_plist",
++    srcs = ["mac/Info.plist"],
+     outs = ["Info.plist"],
+-    cmd = ("$(location //build_tools:tweak_info_plist)" +
+-           " --output $@" +
+-           " --input $(location mac/Info.plist)" +
+-           " --version_file $(location //base:mozc_version_txt)" +
+-           " --branding " + BRANDING),
+-    exec_tools = ["//build_tools:tweak_info_plist"],
+ )
+diff --git renderer/mac/CandidateController.mm renderer/mac/CandidateController.mm
+index 587f432e1..f6c6ee741 100644
+--- renderer/mac/CandidateController.mm
++++ renderer/mac/CandidateController.mm
+@@ -239,7 +239,7 @@ int GetBaseScreenHeight() {
+   const mozc::Rect display_rect = GetNearestDisplayRect(preedit_rect);
+ 
+   // Align candidate window.
+-  // Initialize the the position.  We use (left, bottom) of preedit as
++  // Initialize the position.  We use (left, bottom) of preedit as
+   // the top-left position of the window because we want to show the
+   // window just below of the preedit.
+   const TableLayout *candidate_layout = candidate_window_->GetTableLayout();
+diff --git renderer/mozc_renderer.rc renderer/mozc_renderer.rc
+index bf07eb278..962b84b80 100644
+Binary files renderer/mozc_renderer.rc and renderer/mozc_renderer.rc differ
+diff --git renderer/mozc_renderer_main.cc renderer/mozc_renderer_main.cc
+index 61fa81d7c..4aa5c9bf2 100644
+--- renderer/mozc_renderer_main.cc
++++ renderer/mozc_renderer_main.cc
+@@ -34,12 +34,13 @@
+ #endif  // OS_WIN, ENABLE_GTK_RENDERER
+ 
+ #include "base/crash_report_handler.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/run_level.h"
+ #include "base/system_util.h"
+ #include "base/util.h"
+ #include "config/stats_config_util.h"
++#include "absl/flags/declare.h"
++#include "absl/flags/flag.h"
+ 
+ #ifdef OS_WIN
+ #include "base/win_util.h"
+@@ -64,7 +65,7 @@
+ #include "renderer/unix/window_manager.h"
+ #endif  // OS_WIN, __APPLE__, ENABLE_GTK_RENDERER
+ 
+-MOZC_DECLARE_FLAG(bool, restricted);
++ABSL_DECLARE_FLAG(bool, restricted);
+ 
+ int main(int argc, char *argv[]) {
+   const mozc::RunLevel::RunLevelType run_level =
+@@ -91,7 +92,7 @@ int main(int argc, char *argv[]) {
+ 
+   // restricted mode
+   if (run_level == mozc::RunLevel::RESTRICTED) {
+-    mozc::SetFlag(&FLAGS_restricted, true);
++    absl::SetFlag(&FLAGS_restricted, true);
+   }
+ 
+   if (mozc::config::StatsConfigUtil::IsEnabled()) {
+diff --git renderer/renderer_client.h renderer/renderer_client.h
+index 25ca55ef2..4a063c1e0 100644
+--- renderer/renderer_client.h
++++ renderer/renderer_client.h
+@@ -57,7 +57,7 @@ class RendererLauncherInterface {
+   // do not use this method unless protocol version mismatch
+   virtual bool ForceTerminateRenderer(const std::string &name) = 0;
+ 
+-  // called when fatal error occured
++  // called when fatal error occurred
+   virtual void OnFatal(RendererErrorType type) = 0;
+ 
+   // return true if the renderer is running
+diff --git renderer/renderer_server.cc renderer/renderer_server.cc
+index fcbed2d54..b57dec26d 100644
+--- renderer/renderer_server.cc
++++ renderer/renderer_server.cc
+@@ -37,7 +37,6 @@
+ 
+ #include "base/compiler_specific.h"
+ #include "base/const.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "base/system_util.h"
+@@ -49,12 +48,13 @@
+ #include "protocol/config.pb.h"
+ #include "protocol/renderer_command.pb.h"
+ #include "renderer/renderer_interface.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ // By default, mozc_renderer quits when user-input continues to be
+ // idle for 10min.
+-MOZC_FLAG(int32, timeout, 10 * 60, "timeout of candidate server (sec)");
+-MOZC_FLAG(bool, restricted, false,
++ABSL_FLAG(int32, timeout, 10 * 60, "timeout of candidate server (sec)");
++ABSL_FLAG(bool, restricted, false,
+           "launch candidates server with restricted mode");
+ 
+ namespace mozc {
+@@ -174,14 +174,14 @@ RendererServer::RendererServer()
+       send_command_(new RendererServerSendCommand) {
+   watch_dog_ = absl::make_unique<ParentApplicationWatchDog>(this);
+   watch_dog_->StartWatchDog();
+-  if (mozc::GetFlag(FLAGS_restricted)) {
+-    mozc::SetFlag(&FLAGS_timeout,
++  if (absl::GetFlag(FLAGS_restricted)) {
++    absl::SetFlag(&FLAGS_timeout,
+                   // set 60sec with restricted mode
+-                  std::min(mozc::GetFlag(FLAGS_timeout), 60));
++                  std::min(absl::GetFlag(FLAGS_timeout), 60));
+   }
+ 
+   timeout_ = 1000 * std::max(3, std::min(24 * 60 * 60,
+-                                         mozc::GetFlag(FLAGS_timeout)));
++                                         absl::GetFlag(FLAGS_timeout)));
+   VLOG(2) << "timeout is set to be : " << timeout_;
+ 
+ #ifndef MOZC_NO_LOGGING
+diff --git renderer/renderer_server_test.cc renderer/renderer_server_test.cc
+index e0540cdcb..8f209a611 100644
+--- renderer/renderer_server_test.cc
++++ renderer/renderer_server_test.cc
+@@ -32,7 +32,6 @@
+ #include <memory>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "base/system_util.h"
+@@ -43,6 +42,7 @@
+ #include "renderer/renderer_interface.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace renderer {
+@@ -121,12 +121,12 @@ class DummyRendererLauncher : public RendererLauncherInterface {
+ class RendererServerTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ };
+ 
+ TEST_F(RendererServerTest, IPCTest) {
+-  SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++  SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   mozc::IPCClientFactoryOnMemory on_memory_client_factory;
+ 
+   std::unique_ptr<TestRendererServer> server(new TestRendererServer);
+diff --git renderer/unix/candidate_window_test.cc renderer/unix/candidate_window_test.cc
+index 3bedcf1f7..506ec1188 100644
+--- renderer/unix/candidate_window_test.cc
++++ renderer/unix/candidate_window_test.cc
+@@ -60,7 +60,7 @@ namespace renderer {
+ namespace gtk {
+ 
+ namespace {
+-// Following variable is used testing and it is contant but due to API
++// Following variable is used testing and it is constant but due to API
+ // restriction, can not modify const modifier.
+ GtkWidget *kDummyWindow = reinterpret_cast<GtkWidget *>(0x12345678);
+ GtkWidget *kDummyCanvas = reinterpret_cast<GtkWidget *>(0x87654321);
+@@ -1395,7 +1395,7 @@ TEST_F(CandidateWindowTest, OnMouseLeftUpTest) {
+     FinalizeTestKit(&testkit);
+   }
+   {
+-    SCOPED_TRACE("Exepcted ID will be set by candidate index.");
++    SCOPED_TRACE("Expected ID will be set by candidate index.");
+     const size_t kTestRound = 10;
+     for (size_t i = 0; i < kTestRound; ++i) {
+       SendCommandInterfaceMock interface_mock;
+diff --git renderer/unix/draw_tool_interface.h renderer/unix/draw_tool_interface.h
+index 266d53eee..b9d22d7df 100644
+--- renderer/unix/draw_tool_interface.h
++++ renderer/unix/draw_tool_interface.h
+@@ -58,7 +58,7 @@ class DrawToolInterface {
+   virtual void Save() = 0;
+   virtual void Restore() = 0;
+ 
+-  // Draws rectangle and fill inside of it with spcified color.
++  // Draws rectangle and fill inside of it with specified color.
+   virtual void FillRect(const Rect &rect, const RGBA &color) = 0;
+ 
+   // Draws rectangle with specified color.
+diff --git renderer/unix/gtk_window_base_test.cc renderer/unix/gtk_window_base_test.cc
+index 35f066367..67b9897ca 100644
+--- renderer/unix/gtk_window_base_test.cc
++++ renderer/unix/gtk_window_base_test.cc
+@@ -44,7 +44,7 @@ namespace renderer {
+ namespace gtk {
+ 
+ namespace {
+-// Following variable is used testing and it is contant but due to API
++// Following variable is used testing and it is constant but due to API
+ // restriction, can not modify const modifier.
+ GtkWidget *kDummyWindow = reinterpret_cast<GtkWidget *>(0x12345678);
+ GtkWidget *kDummyCanvas = reinterpret_cast<GtkWidget *>(0x87654321);
+diff --git renderer/unix/infolist_window.h renderer/unix/infolist_window.h
+index fe182534a..e717ac1f9 100644
+--- renderer/unix/infolist_window.h
++++ renderer/unix/infolist_window.h
+@@ -78,13 +78,13 @@ class InfolistWindow : public GtkWindowBase {
+ 
+   void Draw();
+ 
+-  // Draws specified description row and returns it's height.
++  // Draws specified description row and returns its height.
+   int DrawRow(int row, int ypos);
+ 
+   // Gets target rendering rects.
+   RenderingRowRects GetRowRects(int row, int ypos);
+ 
+-  // Draws caption string and returns it's height.
++  // Draws caption string and returns its height.
+   int DrawCaption();
+ 
+   // Draws infolist window frame line.
+diff --git renderer/unix/infolist_window_test.cc renderer/unix/infolist_window_test.cc
+index 540ce2943..98be2cb23 100644
+--- renderer/unix/infolist_window_test.cc
++++ renderer/unix/infolist_window_test.cc
+@@ -49,7 +49,7 @@ namespace renderer {
+ namespace gtk {
+ 
+ namespace {
+-// Following variable is used testing and it is contant but due to API
++// Following variable is used testing and it is constant but due to API
+ // restriction, can not modify const modifier.
+ GtkWidget *kDummyWindow = reinterpret_cast<GtkWidget *>(0x12345678);
+ GtkWidget *kDummyCanvas = reinterpret_cast<GtkWidget *>(0x87654321);
+diff --git renderer/unix/unix_renderer_test.cc renderer/unix/unix_renderer_test.cc
+index fc9f954ae..0c1c98fed 100644
+--- renderer/unix/unix_renderer_test.cc
++++ renderer/unix/unix_renderer_test.cc
+@@ -69,7 +69,7 @@ TEST(UnixRendererTest, ExecCommand) {
+     EXPECT_FALSE(renderer.ExecCommand(command));
+   }
+   {
+-    SCOPED_TRACE("UPDATE with visibile = true update layout");
++    SCOPED_TRACE("UPDATE with visible = true update layout");
+ 
+     WindowManagerMock *wm_mock = new WindowManagerMock();
+     commands::RendererCommand command;
+@@ -83,7 +83,7 @@ TEST(UnixRendererTest, ExecCommand) {
+     EXPECT_TRUE(renderer.ExecCommand(command));
+   }
+   {
+-    SCOPED_TRACE("UPDATE with visibile = false call HideAllWindows");
++    SCOPED_TRACE("UPDATE with visible = false call HideAllWindows");
+ 
+     WindowManagerMock *wm_mock = new WindowManagerMock();
+     commands::RendererCommand command;
+diff --git renderer/unix/unix_server.h renderer/unix/unix_server.h
+index e152f38da..7a100320f 100644
+--- renderer/unix/unix_server.h
++++ renderer/unix/unix_server.h
+@@ -67,9 +67,9 @@ class UnixServer : public RendererServer {
+   Mutex mutex_;
+   std::unique_ptr<GtkWrapperInterface> gtk_;
+ 
+-  // Following pipe is used to communicate IPC recieving thread and
++  // Following pipe is used to communicate IPC receiving thread and
+   // rendering(gtk-main) thread. The gtk-main loop polls following pipe and IPC
+-  // recieving thread writes small data to notify gtk-main thread to update when
++  // receiving thread writes small data to notify gtk-main thread to update when
+   // new packet is arrived.
+   int pipefd_[2];
+ 
+diff --git renderer/unix/unix_server_test.cc renderer/unix/unix_server_test.cc
+index 1324a97e2..d11cc3963 100644
+--- renderer/unix/unix_server_test.cc
++++ renderer/unix/unix_server_test.cc
+@@ -29,11 +29,11 @@
+ 
+ #include "renderer/unix/unix_server.h"
+ 
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "renderer/unix/gtk_wrapper_mock.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ using testing::_;
+ using testing::Return;
+@@ -46,7 +46,7 @@ namespace gtk {
+ class UnixServerTest : public testing::Test {
+  protected:
+   virtual void SetUp() {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ };
+ 
+diff --git renderer/win32/gen_pbgra32_bitmap.cc renderer/win32/gen_pbgra32_bitmap.cc
+index fa3376794..58fbf4f6c 100644
+--- renderer/win32/gen_pbgra32_bitmap.cc
++++ renderer/win32/gen_pbgra32_bitmap.cc
+@@ -34,14 +34,14 @@
+ #include <memory>
+ 
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "base/util.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, src, "", "path to the input PNG file");
+-MOZC_FLAG(string, dest, "", "path to the output BMP file");
++ABSL_FLAG(std::string, src, "", "path to the input PNG file");
++ABSL_FLAG(std::string, dest, "", "path to the output BMP file");
+ 
+ using ::std::max;
+ using ::std::min;
+@@ -61,7 +61,7 @@ const uint32 kMaxBitmapHeight = 16384;
+ 
+ bool ConvertMain() {
+   std::wstring wide_src;
+-  mozc::Util::UTF8ToWide(mozc::GetFlag(FLAGS_src), &wide_src);
++  mozc::Util::UTF8ToWide(absl::GetFlag(FLAGS_src), &wide_src);
+   std::unique_ptr<Gdiplus::Bitmap> image(
+       Gdiplus::Bitmap::FromFile(wide_src.c_str()));
+ 
+@@ -119,7 +119,7 @@ bool ConvertMain() {
+   header.pixel_data_size = pixel_data_bytes;
+ 
+   mozc::OutputFileStream output_file(
+-      mozc::GetFlag(FLAGS_dest).c_str(),
++      absl::GetFlag(FLAGS_dest).c_str(),
+       std::ios::out | std::ios::binary | std::ios::trunc);
+   if (!output_file.good()) {
+     return false;
+@@ -145,11 +145,11 @@ bool ConvertMain() {
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  if (mozc::GetFlag(FLAGS_src).empty()) {
++  if (absl::GetFlag(FLAGS_src).empty()) {
+     std::cout << "Specify --src option";
+     return kErrorLevelFail;
+   }
+-  if (mozc::GetFlag(FLAGS_dest).empty()) {
++  if (absl::GetFlag(FLAGS_dest).empty()) {
+     std::cout << "Specify --dest option";
+     return kErrorLevelFail;
+   }
+diff --git renderer/win32/win32_renderer_client.cc renderer/win32/win32_renderer_client.cc
+index 400865117..bcfe7f9fb 100644
+--- renderer/win32/win32_renderer_client.cc
++++ renderer/win32/win32_renderer_client.cc
+@@ -55,7 +55,7 @@ Mutex *g_mutex = nullptr;
+ // Represents the module handle of this module.
+ volatile HMODULE g_module = nullptr;
+ 
+-// True if the the DLL received DLL_PROCESS_DETACH notification.
++// True if the DLL received DLL_PROCESS_DETACH notification.
+ volatile bool g_module_unloaded = false;
+ 
+ // Represents the number of UI threads that are recognized by this module.
+diff --git rewriter/BUILD rewriter/BUILD
+index 84ca5e340..ae183e7d5 100644
+--- rewriter/BUILD
++++ rewriter/BUILD
+@@ -60,7 +60,6 @@ cc_test_mozc(
+     deps = [
+         ":merger_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:stl_util",
+         "//base:system_util",
+         "//config:config_handler",
+@@ -69,6 +68,7 @@ cc_test_mozc(
+         "//protocol:config_proto",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -83,7 +83,6 @@ cc_library_mozc(
+         ":collocation_util",
+         ":rewriter_interface",
+         "//base",
+-        "//base:flags",
+         "//base:hash",
+         "//base:logging",
+         "//base:port",
+@@ -94,6 +93,7 @@ cc_library_mozc(
+         "//protocol:commands_proto",
+         "//request:conversion_request",
+         "//storage:existence_filter",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+         "@com_google_absl//absl/strings",
+     ],
+@@ -107,7 +107,6 @@ cc_test_mozc(
+     deps = [
+         ":collocation_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:system_util",
+         "//config:config_handler",
+@@ -115,6 +114,7 @@ cc_test_mozc(
+         "//dictionary:pos_matcher_lib",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -162,7 +162,6 @@ cc_test_mozc(
+         "//base:clock",
+         "//base:clock_mock",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:number_util",
+         "//base:system_util",
+@@ -177,6 +176,7 @@ cc_test_mozc(
+         "//protocol:config_proto",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -190,7 +190,6 @@ cc_library_mozc(
+         "//base",
+         "//base:config_file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:util",
+@@ -202,6 +201,7 @@ cc_library_mozc(
+         "//request:conversion_request",
+         "//storage:lru_storage",
+         "//usage_stats",
++        "@com_google_absl//absl/flags:flag",
+     ],
+     alwayslink = 1,
+ )
+@@ -215,7 +215,6 @@ cc_test_mozc(
+         ":user_boundary_history_rewriter",
+         "//base",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:system_util",
+         "//config:config_handler",
+         "//converter:converter_mock",
+@@ -223,6 +222,7 @@ cc_test_mozc(
+         "//protocol:config_proto",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -467,7 +467,6 @@ cc_test_mozc(
+     requires_full_emulation = False,
+     deps = [
+         ":version_rewriter",
+-        "//base:flags",
+         "//base:system_util",
+         "//base:util",
+         "//config:config_handler",
+@@ -475,6 +474,7 @@ cc_test_mozc(
+         "//protocol:commands_proto",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -514,7 +514,6 @@ cc_test_mozc(
+     deps = [
+         ":symbol_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:system_util",
+         "//base:util",
+@@ -527,6 +526,7 @@ cc_test_mozc(
+         "//request:conversion_request",
+         "//session:request_test_util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+         "@com_google_absl//absl/strings",
+     ],
+@@ -647,12 +647,12 @@ cc_test_mozc(
+     deps = [
+         ":english_variants_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:system_util",
+         "//converter:segments",
+         "//protocol:commands_proto",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -683,12 +683,12 @@ cc_test_mozc(
+     deps = [
+         ":fortune_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:system_util",
+         "//converter:segments",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -717,11 +717,11 @@ cc_test_mozc(
+     deps = [
+         ":dice_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:system_util",
+         "//converter:segments",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -755,7 +755,6 @@ cc_test_mozc(
+     deps = [
+         ":calculator_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:system_util",
+         "//config:config_handler",
+@@ -770,6 +769,7 @@ cc_test_mozc(
+         "//rewriter/calculator",
+         "//rewriter/calculator:calculator_mock",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -802,7 +802,6 @@ cc_test_mozc(
+     deps = [
+         ":unicode_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:port",
+         "//base:system_util",
+         "//base:util",
+@@ -815,6 +814,7 @@ cc_test_mozc(
+         "//protocol:config_proto",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -844,13 +844,13 @@ cc_test_mozc(
+     deps = [
+         ":user_dictionary_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:system_util",
+         "//base:util",
+         "//converter:segments",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -894,12 +894,12 @@ cc_binary_mozc(
+         "//base",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:init_mozc_buildtool",
+         "//base:logging",
+         "//base:util",
+         "//data_manager",
+         "//data_manager:serialized_dictionary",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -909,12 +909,12 @@ cc_binary_mozc(
+     deps = [
+         ":rewriter_interface",
+         "//base:file_stream",
+-        "//base:flags",
+         "//base:init_mozc_buildtool",
+         "//base:logging",
+         "//base:mozc_hash_map",
+         "//base:util",
+         "//data_manager:serialized_dictionary",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -1042,10 +1042,10 @@ cc_binary_mozc(
+     name = "gen_single_kanji_noun_prefix_data",
+     srcs = ["gen_single_kanji_noun_prefix_data.cc"],
+     deps = [
+-        "//base:flags",
+         "//base:init_mozc_buildtool",
+         "//base:port",
+         "//data_manager:serialized_dictionary",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -1056,7 +1056,6 @@ cc_test_mozc(
+     requires_full_emulation = False,
+     deps = [
+         ":single_kanji_rewriter",
+-        "//base:flags",
+         "//base:system_util",
+         "//base:util",
+         "//config:config_handler",
+@@ -1067,6 +1066,7 @@ cc_test_mozc(
+         "//request:conversion_request",
+         "//session:request_test_util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -1122,7 +1122,6 @@ cc_test_mozc(
+     deps = [
+         ":focus_candidate_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:number_util",
+         "//base:system_util",
+         "//config:config_handler",
+@@ -1130,6 +1129,7 @@ cc_test_mozc(
+         "//data_manager/testing:mock_data_manager",
+         "//testing:gunit_main",
+         "//transliteration",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+         "@com_google_absl//absl/strings",
+     ],
+@@ -1243,7 +1243,6 @@ cc_test_mozc(
+     deps = [
+         ":command_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:system_util",
+         "//config:config_handler",
+         "//converter:segments",
+@@ -1251,6 +1250,7 @@ cc_test_mozc(
+         "//protocol:config_proto",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -1278,11 +1278,11 @@ cc_test_mozc(
+     deps = [
+         ":normalization_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:system_util",
+         "//converter:segments",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -1322,11 +1322,11 @@ cc_binary_mozc(
+     deps = [
+         "//base",
+         "//base:file_stream",
+-        "//base:flags",
+         "//base:init_mozc_buildtool",
+         "//base:logging",
+         "//base:serialized_string_array",
+         "//base:util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+@@ -1367,7 +1367,6 @@ cc_test_mozc(
+         ":rewriter_interface",
+         ":usage_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:system_util",
+         "//config:config_handler",
+         "//converter:segments",
+@@ -1381,6 +1380,7 @@ cc_test_mozc(
+         "//protocol:config_proto",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+         "@com_google_absl//absl/strings",
+     ],
+@@ -1484,7 +1484,6 @@ cc_library_mozc(
+         ":version_rewriter",
+         ":zipcode_rewriter",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//converter:converter_interface",
+@@ -1492,6 +1491,7 @@ cc_library_mozc(
+         "//dictionary:dictionary_interface",
+         "//dictionary:pos_group",
+         "//dictionary:pos_matcher_lib",
++        "@com_google_absl//absl/flags:flag",
+     ],
+     alwayslink = 1,
+ )
+@@ -1532,7 +1532,6 @@ cc_test_mozc(
+         "rewriter",
+         ":rewriter_interface",
+         "//base",
+-        "//base:flags",
+         "//base:system_util",
+         "//config:config_handler",
+         "//converter:converter_mock",
+@@ -1541,6 +1540,7 @@ cc_test_mozc(
+         "//dictionary:pos_group",
+         "//request:conversion_request",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -1588,9 +1588,9 @@ cc_binary_mozc(
+     deps = [
+         ":gen_existence_data",
+         "//base:file_stream",
+-        "//base:flags",
+         "//base:init_mozc_buildtool",
+         "//base:logging",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -1600,10 +1600,10 @@ cc_binary_mozc(
+     deps = [
+         ":gen_existence_data",
+         "//base:file_stream",
+-        "//base:flags",
+         "//base:init_mozc_buildtool",
+         "//base:logging",
+         "//base:util",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+diff --git rewriter/calculator/calculator_test.cc rewriter/calculator/calculator_test.cc
+index 299107812..16c50311b 100644
+--- rewriter/calculator/calculator_test.cc
++++ rewriter/calculator/calculator_test.cc
+@@ -85,7 +85,7 @@ TEST(CalculatorTest, BasicTest) {
+   // These are not expressions
+   // apparently
+   VerifyRejection(calculator, "test");
+-  // Expressoin must be ended with equal '='.
++  // Expression must be ended with equal '='.
+   VerifyRejection(calculator, "5+4");
+   // Expression must include at least one operator other than parentheses.
+   VerifyRejection(calculator, "111=");
+diff --git rewriter/calculator_rewriter_test.cc rewriter/calculator_rewriter_test.cc
+index f34401cf7..01daa68ca 100644
+--- rewriter/calculator_rewriter_test.cc
++++ rewriter/calculator_rewriter_test.cc
+@@ -32,7 +32,6 @@
+ #include <memory>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/system_util.h"
+ #include "config/config_handler.h"
+@@ -48,6 +47,7 @@
+ #include "rewriter/calculator/calculator_mock.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -116,7 +116,7 @@ class CalculatorRewriterTest : public ::testing::Test {
+   }
+ 
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+ 
+     // use mock
+     CalculatorFactory::SetCalculator(&calculator_mock_);
+diff --git rewriter/collocation_rewriter.cc rewriter/collocation_rewriter.cc
+index 913fac238..ecc3943c9 100644
+--- rewriter/collocation_rewriter.cc
++++ rewriter/collocation_rewriter.cc
+@@ -34,7 +34,6 @@
+ #include <string>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/hash.h"
+ #include "base/logging.h"
+ #include "base/util.h"
+@@ -44,11 +43,12 @@
+ #include "request/conversion_request.h"
+ #include "rewriter/collocation_util.h"
+ #include "storage/existence_filter.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ #include "absl/strings/str_cat.h"
+ #include "absl/strings/string_view.h"
+ 
+-MOZC_FLAG(bool, use_collocation, true, "use collocation rewrite");
++ABSL_FLAG(bool, use_collocation, true, "use collocation rewrite");
+ 
+ namespace mozc {
+ 
+@@ -261,7 +261,7 @@ bool IsNaturalContent(const Segment::Candidate &cand,
+   const size_t aux_value_len = Util::CharsLen(aux_value);
+   const size_t value_len = Util::CharsLen(value);
+ 
+-  // "<XXいる|>" can be rewrited to "<YY|いる>" and vice versa
++  // "<XXいる|>" can be rewrote to "<YY|いる>" and vice versa
+   {
+     static const char kPat[] = "いる";  // "いる"
+     const absl::string_view kSuffix(kPat, arraysize(kPat) - 1);
+@@ -286,7 +286,7 @@ bool IsNaturalContent(const Segment::Candidate &cand,
+     }
+   }
+ 
+-  // "<XXせる|>" can be rewrited to "<YY|せる>" and vice versa
++  // "<XXせる|>" can be rewrote to "<YY|せる>" and vice versa
+   {
+     const char kPat[] = "せる";
+     const absl::string_view kSuffix(kPat, arraysize(kPat) - 1);
+@@ -313,7 +313,7 @@ bool IsNaturalContent(const Segment::Candidate &cand,
+ 
+   const Util::ScriptType content_script_type = Util::GetScriptType(content);
+ 
+-  // "<XX|する>" can be rewrited using "<XXす|る>" and "<XX|する>"
++  // "<XX|する>" can be rewrote using "<XXす|る>" and "<XX|する>"
+   // in "<XX|する>", XX must be single script type
+   {
+     static const char kPat[] = "する";
+@@ -334,7 +334,7 @@ bool IsNaturalContent(const Segment::Candidate &cand,
+     }
+   }
+ 
+-  // "<XXる>" can be rewrited using "<XX|る>"
++  // "<XXる>" can be rewrote using "<XX|る>"
+   // "まとめる", "衰える"
+   {
+     static const char kPat[] = "る";
+@@ -349,7 +349,7 @@ bool IsNaturalContent(const Segment::Candidate &cand,
+     }
+   }
+ 
+-  // "<XXす>" can be rewrited using "XXする"
++  // "<XXす>" can be rewrote using "XXする"
+   {
+     static const char kPat[] = "す";
+     const absl::string_view kSuffix(kPat, arraysize(kPat) - 1);
+@@ -366,7 +366,7 @@ bool IsNaturalContent(const Segment::Candidate &cand,
+     }
+   }
+ 
+-  // "<XXし|た>" can be rewrited using "<XX|した>"
++  // "<XXし|た>" can be rewrote using "<XX|した>"
+   {
+     static const char kPat[] = "した";
+     const absl::string_view kShi(kPat, 3), kTa(kPat + 3, 3);
+@@ -448,7 +448,7 @@ bool CollocationRewriter::RewriteCollocation(Segments *segments) const {
+ 
+   for (size_t i = segments->history_segments_size();
+        i < segments->segments_size(); ++i) {
+-    bool rewrited_next = false;
++    bool rewrote_next = false;
+ 
+     if (IsKeyUnknown(segments->segment(i))) {
+       continue;
+@@ -458,12 +458,12 @@ bool CollocationRewriter::RewriteCollocation(Segments *segments) const {
+         RewriteUsingNextSegment(segments->mutable_segment(i + 1),
+                                 segments->mutable_segment(i))) {
+       changed = true;
+-      rewrited_next = true;
++      rewrote_next = true;
+       segs_changed[i] = true;
+       segs_changed[i + 1] = true;
+     }
+ 
+-    if (!segs_changed[i] && !rewrited_next && i > 0 &&
++    if (!segs_changed[i] && !rewrote_next && i > 0 &&
+         RewriteFromPrevSegment(segments->segment(i - 1).candidate(0),
+                                segments->mutable_segment(i))) {
+       changed = true;
+@@ -566,7 +566,7 @@ CollocationRewriter::~CollocationRewriter() {}
+ 
+ bool CollocationRewriter::Rewrite(const ConversionRequest &request,
+                                   Segments *segments) const {
+-  if (!mozc::GetFlag(FLAGS_use_collocation)) {
++  if (!absl::GetFlag(FLAGS_use_collocation)) {
+     return false;
+   }
+   return RewriteCollocation(segments);
+diff --git rewriter/collocation_rewriter_test.cc rewriter/collocation_rewriter_test.cc
+index 62c08f8b4..14295dc04 100644
+--- rewriter/collocation_rewriter_test.cc
++++ rewriter/collocation_rewriter_test.cc
+@@ -33,7 +33,6 @@
+ #include <memory>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/system_util.h"
+ #include "config/config_handler.h"
+@@ -42,6 +41,7 @@
+ #include "request/conversion_request.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -80,7 +80,7 @@ class CollocationRewriterTest : public ::testing::Test {
+   ~CollocationRewriterTest() override = default;
+ 
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+ 
+     const mozc::testing::MockDataManager data_manager;
+     pos_matcher_.Set(data_manager.GetPOSMatcherData());
+diff --git rewriter/command_rewriter_test.cc rewriter/command_rewriter_test.cc
+index e5b2d7e2c..21c3e26f1 100644
+--- rewriter/command_rewriter_test.cc
++++ rewriter/command_rewriter_test.cc
+@@ -31,7 +31,6 @@
+ 
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "config/config_handler.h"
+ #include "converter/segments.h"
+@@ -40,6 +39,7 @@
+ #include "request/conversion_request.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+@@ -73,7 +73,7 @@ class CommandRewriterTest : public ::testing::Test {
+   }
+ 
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     config::ConfigHandler::GetDefaultConfig(&config_);
+     request_.Clear();
+   }
+diff --git rewriter/date_rewriter_test.cc rewriter/date_rewriter_test.cc
+index d1f4a9eda..d40256b19 100644
+--- rewriter/date_rewriter_test.cc
++++ rewriter/date_rewriter_test.cc
+@@ -269,7 +269,7 @@ TEST_F(DateRewriterTest, DateRewriteTest) {
+                                      "4月18日",
+                                      "月曜日"};
+ 
+-    // If initial count of candidate is 1, date rewrited candidate start from 1.
++    // If initial count of candidate is 1, date rewrote candidate start from 1.
+     // "きょう", "今日"
+     InitSegment("きょう", "今日", &segments);
+     EXPECT_TRUE(rewriter.Rewrite(request, &segments));
+@@ -282,7 +282,7 @@ TEST_F(DateRewriterTest, DateRewriteTest) {
+     }
+ 
+     // If initial count of candidate is 5 and target candidate is located at
+-    // index 4, date rewrited candidate start from 5.
++    // index 4, date rewrote candidate start from 5.
+     // "きょう", "今日"
+     InitSegment("きょう", "今日", &segments);
+ 
+@@ -303,7 +303,7 @@ TEST_F(DateRewriterTest, DateRewriteTest) {
+     }
+ 
+     // If initial count of candidate is 5 and target candidate is located at
+-    // index 0, date rewrited candidate start from kMinimumDateCandidateIdx.
++    // index 0, date rewrote candidate start from kMinimumDateCandidateIdx.
+     // "きょう", "今日"
+     InitSegment("きょう", "今日", &segments);
+ 
+diff --git rewriter/dice_rewriter_test.cc rewriter/dice_rewriter_test.cc
+index c1d15baab..69d2c5638 100644
+--- rewriter/dice_rewriter_test.cc
++++ rewriter/dice_rewriter_test.cc
+@@ -32,12 +32,12 @@
+ #include <cstddef>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "converter/segments.h"
+ #include "request/conversion_request.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+@@ -111,7 +111,7 @@ size_t GetDiceNumberIndex(const Segment &segment) {
+ class DiceRewriterTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ };
+ 
+diff --git rewriter/emoticon_rewriter.cc rewriter/emoticon_rewriter.cc
+index 32524c842..442447afb 100644
+--- rewriter/emoticon_rewriter.cc
++++ rewriter/emoticon_rewriter.cc
+@@ -75,7 +75,7 @@ void InsertCandidates(SerializedDictionary::const_iterator begin,
+                       size_t initial_insert_pos, size_t initial_insert_size,
+                       bool is_no_learning, Segment *segment) {
+   if (segment->candidates_size() == 0) {
+-    LOG(WARNING) << "candiadtes_size is 0";
++    LOG(WARNING) << "candidates_size is 0";
+     return;
+   }
+ 
+@@ -90,7 +90,7 @@ void InsertCandidates(SerializedDictionary::const_iterator begin,
+ 
+   std::sort(sorted_value.begin(), sorted_value.end(), ValueCostCompare());
+ 
+-  // after sorting the valeus by |cost|, adjacent candidates
++  // after sorting the values by |cost|, adjacent candidates
+   // will have the same value. It is almost OK to use std::unique to
+   // remove dup entries, it is not a perfect way though.
+   sorted_value.erase(
+diff --git rewriter/english_variants_rewriter.cc rewriter/english_variants_rewriter.cc
+index f701397a2..b5a15cbd9 100644
+--- rewriter/english_variants_rewriter.cc
++++ rewriter/english_variants_rewriter.cc
+@@ -120,7 +120,7 @@ bool EnglishVariantsRewriter::ExpandEnglishVariantsWithSegment(
+     DCHECK(original_candidate);
+ 
+     // http://b/issue?id=5137299
+-    // If the entry is comming from user dictionary,
++    // If the entry is coming from user dictionary,
+     // expand English variants.
+     if (original_candidate->attributes &
+             Segment::Candidate::NO_VARIANTS_EXPANSION &&
+diff --git rewriter/english_variants_rewriter_test.cc rewriter/english_variants_rewriter_test.cc
+index f8cb95778..7f803c6dc 100644
+--- rewriter/english_variants_rewriter_test.cc
++++ rewriter/english_variants_rewriter_test.cc
+@@ -32,20 +32,20 @@
+ #include <cstddef>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "converter/segments.h"
+ #include "protocol/commands.pb.h"
+ #include "request/conversion_request.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ 
+ class EnglishVariantsRewriterTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ 
+   bool GetRankFromValue(const Segment &segment, const std::string &value,
+diff --git rewriter/focus_candidate_rewriter.cc rewriter/focus_candidate_rewriter.cc
+index 019df99f0..00266bc0b 100644
+--- rewriter/focus_candidate_rewriter.cc
++++ rewriter/focus_candidate_rewriter.cc
+@@ -51,7 +51,7 @@ bool IsConnectorSegment(const Segment &segment) {
+   return (segment.key() == "と" || segment.key() == "や");
+ }
+ 
+-// Finds value from the candidates list and move the canidate to the top.
++// Finds value from the candidates list and move the candidate to the top.
+ bool RewriteCandidate(Segment *segment, const std::string &value) {
+   for (int i = 0; i < segment->candidates_size(); ++i) {
+     if (segment->candidate(i).content_value == value) {
+diff --git rewriter/focus_candidate_rewriter.h rewriter/focus_candidate_rewriter.h
+index b2c1b874b..e592f269c 100644
+--- rewriter/focus_candidate_rewriter.h
++++ rewriter/focus_candidate_rewriter.h
+@@ -73,7 +73,7 @@ class FocusCandidateRewriter : public RewriterInterface {
+                              absl::string_view ref_suffix) const;
+ 
+   // Parses the value of a candidate into number and counter suffix.
+-  // Simultaneously checks the script type of number.  Here, number candiate is
++  // Simultaneously checks the script type of number.  Here, number candidate is
+   // defined to be the following pattern:
+   //   * [数][助数詞][並立助詞]?  (e.g., 一階, 二回, 3階や, etc.)
+   // Returns false if the value of candidate doesn't match the pattern.
+diff --git rewriter/focus_candidate_rewriter_test.cc rewriter/focus_candidate_rewriter_test.cc
+index df9d47b63..a92d5fcce 100644
+--- rewriter/focus_candidate_rewriter_test.cc
++++ rewriter/focus_candidate_rewriter_test.cc
+@@ -33,7 +33,6 @@
+ #include <string>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/number_util.h"
+ #include "base/system_util.h"
+ #include "config/config_handler.h"
+@@ -42,6 +41,7 @@
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
+ #include "transliteration/transliteration.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -67,7 +67,7 @@ void AddCandidateWithContentValue(Segment *segment, const std::string &value,
+ class FocusCandidateRewriterTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     rewriter_ = absl::make_unique<FocusCandidateRewriter>(&mock_data_manager_);
+   }
+ 
+diff --git rewriter/fortune_rewriter_test.cc rewriter/fortune_rewriter_test.cc
+index 48186d906..00231e504 100644
+--- rewriter/fortune_rewriter_test.cc
++++ rewriter/fortune_rewriter_test.cc
+@@ -32,13 +32,13 @@
+ #include <cstddef>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/system_util.h"
+ #include "converter/segments.h"
+ #include "request/conversion_request.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+@@ -74,7 +74,7 @@ bool HasFortune(const Segments &segments) {
+ class FortuneRewriterTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ };
+ 
+diff --git rewriter/gen_collocation_data_main.cc rewriter/gen_collocation_data_main.cc
+index bcb99debb..b4fe04a03 100644
+--- rewriter/gen_collocation_data_main.cc
++++ rewriter/gen_collocation_data_main.cc
+@@ -41,21 +41,21 @@
+ #include <vector>
+ 
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "rewriter/gen_existence_data.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, collocation_data, "", "collocation data text");
+-MOZC_FLAG(string, output, "", "output file name (default: stdout)");
+-MOZC_FLAG(double, error_rate, 0.00001, "error rate");
+-MOZC_FLAG(bool, binary_mode, false, "outputs binary file");
++ABSL_FLAG(std::string, collocation_data, "", "collocation data text");
++ABSL_FLAG(std::string, output, "", "output file name (default: stdout)");
++ABSL_FLAG(double, error_rate, 0.00001, "error rate");
++ABSL_FLAG(bool, binary_mode, false, "outputs binary file");
+ 
+ namespace mozc {
+ namespace {
+ 
+ void Convert() {
+-  InputFileStream ifs(mozc::GetFlag(FLAGS_collocation_data).c_str());
++  InputFileStream ifs(absl::GetFlag(FLAGS_collocation_data).c_str());
+   std::string line;
+   std::vector<std::string> entries;
+   while (!std::getline(ifs, line).fail()) {
+@@ -66,21 +66,21 @@ void Convert() {
+   }
+ 
+   std::ostream *ofs = &std::cout;
+-  if (!mozc::GetFlag(FLAGS_output).empty()) {
+-    if (mozc::GetFlag(FLAGS_binary_mode)) {
+-      ofs = new OutputFileStream(mozc::GetFlag(FLAGS_output).c_str(),
++  if (!absl::GetFlag(FLAGS_output).empty()) {
++    if (absl::GetFlag(FLAGS_binary_mode)) {
++      ofs = new OutputFileStream(absl::GetFlag(FLAGS_output).c_str(),
+                                  std::ios::out | std::ios::binary);
+     } else {
+-      ofs = new OutputFileStream(mozc::GetFlag(FLAGS_output).c_str());
++      ofs = new OutputFileStream(absl::GetFlag(FLAGS_output).c_str());
+     }
+   }
+ 
+-  if (mozc::GetFlag(FLAGS_binary_mode)) {
+-    OutputExistenceBinary(entries, ofs, mozc::GetFlag(FLAGS_error_rate));
++  if (absl::GetFlag(FLAGS_binary_mode)) {
++    OutputExistenceBinary(entries, ofs, absl::GetFlag(FLAGS_error_rate));
+   } else {
+     const std::string kNameSpace = "CollocationData";
+     OutputExistenceHeader(entries, kNameSpace, ofs,
+-                          mozc::GetFlag(FLAGS_error_rate));
++                          absl::GetFlag(FLAGS_error_rate));
+   }
+ 
+   if (ofs != &std::cout) {
+@@ -93,11 +93,11 @@ void Convert() {
+ int main(int argc, char *argv[]) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  if (mozc::GetFlag(FLAGS_collocation_data).empty() && argc > 1) {
+-    mozc::SetFlag(&FLAGS_collocation_data, argv[1]);
++  if (absl::GetFlag(FLAGS_collocation_data).empty() && argc > 1) {
++    absl::SetFlag(&FLAGS_collocation_data, argv[1]);
+   }
+ 
+-  LOG(INFO) << mozc::GetFlag(FLAGS_collocation_data);
++  LOG(INFO) << absl::GetFlag(FLAGS_collocation_data);
+ 
+   mozc::Convert();
+ 
+diff --git rewriter/gen_collocation_suppression_data_main.cc rewriter/gen_collocation_suppression_data_main.cc
+index 0d14199d3..3a44da990 100644
+--- rewriter/gen_collocation_suppression_data_main.cc
++++ rewriter/gen_collocation_suppression_data_main.cc
+@@ -44,16 +44,16 @@
+ #include <vector>
+ 
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/util.h"
+ #include "rewriter/gen_existence_data.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, suppression_data, "", "suppression data text");
+-MOZC_FLAG(string, output, "", "output file name (default: stdout)");
+-MOZC_FLAG(double, error_rate, 0.00001, "error rate");
+-MOZC_FLAG(bool, binary_mode, false, "outputs binary file");
++ABSL_FLAG(std::string, suppression_data, "", "suppression data text");
++ABSL_FLAG(std::string, output, "", "output file name (default: stdout)");
++ABSL_FLAG(double, error_rate, 0.00001, "error rate");
++ABSL_FLAG(bool, binary_mode, false, "outputs binary file");
+ 
+ namespace mozc {
+ namespace {
+@@ -62,11 +62,11 @@ void Convert() {
+   const char kSeparator[] = "\t";
+   std::vector<std::string> entries;
+ 
+-  if (mozc::GetFlag(FLAGS_suppression_data).empty()) {
++  if (absl::GetFlag(FLAGS_suppression_data).empty()) {
+     const std::string kDummyStr = "__NO_DATA__";
+     entries.push_back(kDummyStr + kSeparator + kDummyStr);
+   } else {
+-    InputFileStream ifs(mozc::GetFlag(FLAGS_suppression_data).c_str());
++    InputFileStream ifs(absl::GetFlag(FLAGS_suppression_data).c_str());
+     std::string line;
+ 
+     while (!std::getline(ifs, line).fail()) {
+@@ -81,21 +81,21 @@ void Convert() {
+   }
+ 
+   std::ostream *ofs = &std::cout;
+-  if (!mozc::GetFlag(FLAGS_output).empty()) {
+-    if (mozc::GetFlag(FLAGS_binary_mode)) {
+-      ofs = new OutputFileStream(mozc::GetFlag(FLAGS_output).c_str(),
++  if (!absl::GetFlag(FLAGS_output).empty()) {
++    if (absl::GetFlag(FLAGS_binary_mode)) {
++      ofs = new OutputFileStream(absl::GetFlag(FLAGS_output).c_str(),
+                                  std::ios::out | std::ios::binary);
+     } else {
+-      ofs = new OutputFileStream(mozc::GetFlag(FLAGS_output).c_str());
++      ofs = new OutputFileStream(absl::GetFlag(FLAGS_output).c_str());
+     }
+   }
+ 
+-  if (mozc::GetFlag(FLAGS_binary_mode)) {
+-    OutputExistenceBinary(entries, ofs, mozc::GetFlag(FLAGS_error_rate));
++  if (absl::GetFlag(FLAGS_binary_mode)) {
++    OutputExistenceBinary(entries, ofs, absl::GetFlag(FLAGS_error_rate));
+   } else {
+     const std::string kNameSpace = "CollocationSuppressionData";
+     OutputExistenceHeader(entries, kNameSpace, ofs,
+-                          mozc::GetFlag(FLAGS_error_rate));
++                          absl::GetFlag(FLAGS_error_rate));
+   }
+ 
+   if (ofs != &std::cout) {
+@@ -108,7 +108,7 @@ void Convert() {
+ int main(int argc, char *argv[]) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  LOG(INFO) << mozc::GetFlag(FLAGS_suppression_data);
++  LOG(INFO) << absl::GetFlag(FLAGS_suppression_data);
+ 
+   mozc::Convert();
+ 
+diff --git rewriter/gen_emoticon_rewriter_data.cc rewriter/gen_emoticon_rewriter_data.cc
+index ce866d574..a79f5e12f 100644
+--- rewriter/gen_emoticon_rewriter_data.cc
++++ rewriter/gen_emoticon_rewriter_data.cc
+@@ -33,17 +33,17 @@
+ #include <vector>
+ 
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/mozc_hash_map.h"
+ #include "base/util.h"
+ #include "data_manager/serialized_dictionary.h"
++#include "absl/flags/flag.h"
+ #include "absl/strings/string_view.h"
+ 
+-MOZC_FLAG(string, input, "", "Emoticon dictionary file");
+-MOZC_FLAG(string, output_token_array, "", "Output token array");
+-MOZC_FLAG(string, output_string_array, "", "Output string array");
++ABSL_FLAG(std::string, input, "", "Emoticon dictionary file");
++ABSL_FLAG(std::string, output_token_array, "", "Output token array");
++ABSL_FLAG(std::string, output_string_array, "", "Output string array");
+ 
+ namespace mozc {
+ namespace {
+@@ -129,9 +129,9 @@ std::map<std::string, TokenList> ReadEmoticonTsv(const std::string &path) {
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+-  const auto &input_data = mozc::ReadEmoticonTsv(mozc::GetFlag(FLAGS_input));
++  const auto &input_data = mozc::ReadEmoticonTsv(absl::GetFlag(FLAGS_input));
+   mozc::SerializedDictionary::CompileToFiles(
+-      input_data, mozc::GetFlag(FLAGS_output_token_array),
+-      mozc::GetFlag(FLAGS_output_string_array));
++      input_data, absl::GetFlag(FLAGS_output_token_array),
++      absl::GetFlag(FLAGS_output_string_array));
+   return 0;
+ }
+diff --git rewriter/gen_single_kanji_noun_prefix_data.cc rewriter/gen_single_kanji_noun_prefix_data.cc
+index 0ef651e0f..61df3ab9b 100644
+--- rewriter/gen_single_kanji_noun_prefix_data.cc
++++ rewriter/gen_single_kanji_noun_prefix_data.cc
+@@ -30,14 +30,14 @@
+ #include <map>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/port.h"
+ #include "data_manager/serialized_dictionary.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, output_token_array, "",
++ABSL_FLAG(std::string, output_token_array, "",
+           "Output token array of noun prefix dictionary");
+-MOZC_FLAG(string, output_string_array, "",
++ABSL_FLAG(std::string, output_string_array, "",
+           "Output string array of noun prefix dictionary");
+ 
+ namespace {
+@@ -99,7 +99,7 @@ int main(int argc, char **argv) {
+     tokens[entry.key].emplace_back(std::move(token));
+   }
+   mozc::SerializedDictionary::CompileToFiles(
+-      tokens, mozc::GetFlag(FLAGS_output_token_array),
+-      mozc::GetFlag(FLAGS_output_string_array));
++      tokens, absl::GetFlag(FLAGS_output_token_array),
++      absl::GetFlag(FLAGS_output_string_array));
+   return 0;
+ }
+diff --git rewriter/gen_symbol_rewriter_dictionary_main.cc rewriter/gen_symbol_rewriter_dictionary_main.cc
+index bdafb0ecc..790d27387 100644
+--- rewriter/gen_symbol_rewriter_dictionary_main.cc
++++ rewriter/gen_symbol_rewriter_dictionary_main.cc
+@@ -45,20 +45,22 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/util.h"
+ #include "data_manager/data_manager.h"
+ #include "data_manager/serialized_dictionary.h"
+ #include "rewriter/dictionary_generator.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, sorting_table, "", "sorting table file");
+-MOZC_FLAG(string, ordering_rule, "", "sorting order file");
+-MOZC_FLAG(string, input, "", "symbol dictionary file");
+-MOZC_FLAG(string, user_pos_manager_data, "", "user pos manager data file");
+-MOZC_FLAG(string, output_token_array, "", "output token array binary file");
+-MOZC_FLAG(string, output_string_array, "", "output string array binary file");
++ABSL_FLAG(std::string, sorting_table, "", "sorting table file");
++ABSL_FLAG(std::string, ordering_rule, "", "sorting order file");
++ABSL_FLAG(std::string, input, "", "symbol dictionary file");
++ABSL_FLAG(std::string, user_pos_manager_data, "", "user pos manager data file");
++ABSL_FLAG(std::string, output_token_array, "",
++          "output token array binary file");
++ABSL_FLAG(std::string, output_string_array, "",
++          "output string array binary file");
+ 
+ namespace mozc {
+ namespace {
+@@ -202,34 +204,34 @@ void MakeDictionary(const std::string &symbol_dictionary_file,
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  if ((mozc::GetFlag(FLAGS_input).empty() ||
+-       mozc::GetFlag(FLAGS_sorting_table).empty() ||
+-       mozc::GetFlag(FLAGS_ordering_rule).empty()) &&
++  if ((absl::GetFlag(FLAGS_input).empty() ||
++       absl::GetFlag(FLAGS_sorting_table).empty() ||
++       absl::GetFlag(FLAGS_ordering_rule).empty()) &&
+       argc > 3) {
+-    mozc::SetFlag(&FLAGS_input, argv[1]);
+-    mozc::SetFlag(&FLAGS_sorting_table, argv[2]);
+-    mozc::SetFlag(&FLAGS_ordering_rule, argv[3]);
++    absl::SetFlag(&FLAGS_input, argv[1]);
++    absl::SetFlag(&FLAGS_sorting_table, argv[2]);
++    absl::SetFlag(&FLAGS_ordering_rule, argv[3]);
+   }
+ 
+   const std::string tmp_text_file =
+-      mozc::GetFlag(FLAGS_output_token_array) + ".txt";
++      absl::GetFlag(FLAGS_output_token_array) + ".txt";
+ 
+   // User pos manager data for build tools has no magic number.
+   const char *kMagciNumber = "";
+   mozc::DataManager data_manager;
+   const mozc::DataManager::Status status =
+       data_manager.InitUserPosManagerDataFromFile(
+-          mozc::GetFlag(FLAGS_user_pos_manager_data), kMagciNumber);
++          absl::GetFlag(FLAGS_user_pos_manager_data), kMagciNumber);
+   CHECK_EQ(status, mozc::DataManager::Status::OK);
+ 
+   mozc::rewriter::DictionaryGenerator dictionary(data_manager);
+-  mozc::MakeDictionary(mozc::GetFlag(FLAGS_input),
+-                       mozc::GetFlag(FLAGS_sorting_table),
+-                       mozc::GetFlag(FLAGS_ordering_rule), &dictionary);
++  mozc::MakeDictionary(absl::GetFlag(FLAGS_input),
++                       absl::GetFlag(FLAGS_sorting_table),
++                       absl::GetFlag(FLAGS_ordering_rule), &dictionary);
+   dictionary.Output(tmp_text_file);
+   mozc::SerializedDictionary::CompileToFiles(
+-      tmp_text_file, mozc::GetFlag(FLAGS_output_token_array),
+-      mozc::GetFlag(FLAGS_output_string_array));
++      tmp_text_file, absl::GetFlag(FLAGS_output_token_array),
++      absl::GetFlag(FLAGS_output_string_array));
+   mozc::FileUtil::Unlink(tmp_text_file);
+ 
+   return 0;
+diff --git rewriter/gen_usage_rewriter_dictionary_main.cc rewriter/gen_usage_rewriter_dictionary_main.cc
+index aaf4c069e..d92504f00 100644
+--- rewriter/gen_usage_rewriter_dictionary_main.cc
++++ rewriter/gen_usage_rewriter_dictionary_main.cc
+@@ -100,23 +100,24 @@
+ #include <vector>
+ 
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/serialized_string_array.h"
+ #include "base/util.h"
++#include "absl/flags/flag.h"
+ #include "absl/strings/string_view.h"
+ 
+-MOZC_FLAG(string, usage_data_file, "", "usage data file");
+-MOZC_FLAG(string, cforms_file, "", "cforms file");
+-MOZC_FLAG(string, output_base_conjugation_suffix, "",
++ABSL_FLAG(std::string, usage_data_file, "", "usage data file");
++ABSL_FLAG(std::string, cforms_file, "", "cforms file");
++ABSL_FLAG(std::string, output_base_conjugation_suffix, "",
+           "output base conjugation suffix array");
+-MOZC_FLAG(string, output_conjugation_suffix, "",
++ABSL_FLAG(std::string, output_conjugation_suffix, "",
+           "output conjugation suffix array");
+-MOZC_FLAG(string, output_conjugation_index, "",
++ABSL_FLAG(std::string, output_conjugation_index, "",
+           "output conjugation index array");
+-MOZC_FLAG(string, output_usage_item_array, "", "output array of usage items");
+-MOZC_FLAG(string, output_string_array, "", "output string array");
++ABSL_FLAG(std::string, output_usage_item_array, "",
++          "output array of usage items");
++ABSL_FLAG(std::string, output_string_array, "", "output string array");
+ 
+ namespace mozc {
+ namespace {
+@@ -257,13 +258,13 @@ void Convert() {
+   // Load cforms_file
+   std::map<std::string, std::vector<ConjugationType>> inflection_map;
+   std::map<std::string, ConjugationType> baseform_map;
+-  LoadConjugation(mozc::GetFlag(FLAGS_cforms_file), &inflection_map,
++  LoadConjugation(absl::GetFlag(FLAGS_cforms_file), &inflection_map,
+                   &baseform_map);
+ 
+   // Load usage_data_file
+   std::vector<UsageItem> usage_entries;
+   std::vector<std::string> conjugation_list;
+-  LoadUsage(mozc::GetFlag(FLAGS_usage_data_file), &usage_entries,
++  LoadUsage(absl::GetFlag(FLAGS_usage_data_file), &usage_entries,
+             &conjugation_list);
+   RemoveBaseformConjugationSuffix(baseform_map, &usage_entries);
+   std::sort(usage_entries.begin(), usage_entries.end(), UsageItemKeynameCmp);
+@@ -299,7 +300,7 @@ void Convert() {
+   // Output base conjugation suffix data.
+   {
+     OutputFileStream ostream(
+-        mozc::GetFlag(FLAGS_output_base_conjugation_suffix).c_str(),
++        absl::GetFlag(FLAGS_output_base_conjugation_suffix).c_str(),
+         std::ios_base::out | std::ios_base::binary);
+     for (const auto &conj : conjugation_list) {
+       const uint32 key_suffix_index =
+@@ -315,7 +316,7 @@ void Convert() {
+   std::vector<int> conjugation_index(conjugation_list.size() + 1);
+   {
+     OutputFileStream ostream(
+-        mozc::GetFlag(FLAGS_output_conjugation_suffix).c_str(),
++        absl::GetFlag(FLAGS_output_conjugation_suffix).c_str(),
+         std::ios_base::out | std::ios_base::binary);
+     int out_count = 0;
+     for (size_t i = 0; i < conjugation_list.size(); ++i) {
+@@ -349,7 +350,7 @@ void Convert() {
+   // Output conjugation suffix data index.
+   {
+     OutputFileStream ostream(
+-        mozc::GetFlag(FLAGS_output_conjugation_index).c_str(),
++        absl::GetFlag(FLAGS_output_conjugation_index).c_str(),
+         std::ios_base::out | std::ios_base::binary);
+     ostream.write(reinterpret_cast<const char *>(conjugation_index.data()),
+                   4 * conjugation_index.size());
+@@ -358,7 +359,7 @@ void Convert() {
+   // Output usage data.
+   {
+     OutputFileStream ostream(
+-        mozc::GetFlag(FLAGS_output_usage_item_array).c_str(),
++        absl::GetFlag(FLAGS_output_usage_item_array).c_str(),
+         std::ios_base::out | std::ios_base::binary);
+     int32 usage_id = 0;
+     for (const UsageItem &item : usage_entries) {
+@@ -383,7 +384,7 @@ void Convert() {
+       strs.emplace_back(kv.first);
+     }
+     SerializedStringArray::SerializeToFile(
+-        strs, mozc::GetFlag(FLAGS_output_string_array));
++        strs, absl::GetFlag(FLAGS_output_string_array));
+   }
+ }
+ 
+diff --git rewriter/katakana_promotion_rewriter.h rewriter/katakana_promotion_rewriter.h
+index 5c7d4384b..197f2f5fc 100644
+--- rewriter/katakana_promotion_rewriter.h
++++ rewriter/katakana_promotion_rewriter.h
+@@ -30,9 +30,9 @@
+ // Rewriter to promote katakana transliterated candidate for mobile devices.
+ // For mobile, we do not provide the shortcut to input katakana transliterated
+ // candidate.
+-// If the katakana candiadte is not ranked high, users need to scroll candidate
++// If the katakana candidate is not ranked high, users need to scroll candidate
+ // page and find katakana.
+-// This rewriter promotes katakana candiate so that users can find katakana
++// This rewriter promotes katakana candidate so that users can find katakana
+ // at first glance.
+ 
+ #ifndef MOZC_REWRITER_KATAKANA_PROMOTION_REWRITER_H_
+diff --git rewriter/merger_rewriter_test.cc rewriter/merger_rewriter_test.cc
+index 828d71709..b47947f2a 100644
+--- rewriter/merger_rewriter_test.cc
++++ rewriter/merger_rewriter_test.cc
+@@ -31,7 +31,6 @@
+ 
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "config/config_handler.h"
+ #include "converter/segments.h"
+@@ -39,6 +38,7 @@
+ #include "request/conversion_request.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ 
+@@ -103,7 +103,7 @@ class TestRewriter : public RewriterInterface {
+ class MergerRewriterTest : public testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ };
+ 
+diff --git rewriter/normalization_rewriter.cc rewriter/normalization_rewriter.cc
+index c95190063..f822bcffa 100644
+--- rewriter/normalization_rewriter.cc
++++ rewriter/normalization_rewriter.cc
+@@ -57,7 +57,7 @@ bool NormalizeCandidate(Segment::Candidate *candidate, CandidateType type) {
+       TextNormalizer::NormalizeText(candidate->content_value, &content_value);
+       break;
+     default:
+-      LOG(ERROR) << "unkown type";
++      LOG(ERROR) << "unknown type";
+       return false;
+   }
+ 
+diff --git rewriter/normalization_rewriter_test.cc rewriter/normalization_rewriter_test.cc
+index 4d1ee86de..e69397b86 100644
+--- rewriter/normalization_rewriter_test.cc
++++ rewriter/normalization_rewriter_test.cc
+@@ -31,12 +31,12 @@
+ 
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "converter/segments.h"
+ #include "request/conversion_request.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+@@ -58,7 +58,7 @@ class NormalizationRewriterTest : public ::testing::Test {
+   ~NormalizationRewriterTest() override = default;
+ 
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ };
+ 
+diff --git rewriter/number_rewriter.cc rewriter/number_rewriter.cc
+index fd2e55856..24ab9acb5 100644
+--- rewriter/number_rewriter.cc
++++ rewriter/number_rewriter.cc
+@@ -449,7 +449,7 @@ bool NumberRewriter::Rewrite(const ConversionRequest &request,
+ 
+   bool modified = false;
+   // Radix conversion is done only for conversion mode.
+-  // Showing radix candidates is annoying for an user.
++  // Showing radix candidates is annoying for a user.
+   const bool exec_radix_conversion =
+       (segments->conversion_segments_size() == 1 &&
+        segments->request_type() == Segments::CONVERSION);
+diff --git rewriter/number_rewriter_test.cc rewriter/number_rewriter_test.cc
+index 7e95f7964..6801c2cff 100644
+--- rewriter/number_rewriter_test.cc
++++ rewriter/number_rewriter_test.cc
+@@ -96,7 +96,7 @@ bool HasDescription(const Segment &segment, const std::string &description) {
+   return false;
+ }
+ 
+-// Find candiadte id
++// Find candidate id
+ bool FindCandidateId(const Segment &segment, const std::string &value,
+                      int *id) {
+   for (size_t i = 0; i < segment.candidates_size(); ++i) {
+@@ -835,7 +835,7 @@ TEST_F(NumberRewriterTest, SeparatedArabicsTest) {
+ // - POS: GeneralNoun (not *Number*)
+ // In this case, NumberRewriter should not clear
+ // Segment::Candidate::USER_DICTIONARY bit in the base candidate.
+-TEST_F(NumberRewriterTest, PreserveUserDictionaryAttibute) {
++TEST_F(NumberRewriterTest, PreserveUserDictionaryAttribute) {
+   std::unique_ptr<NumberRewriter> number_rewriter(CreateNumberRewriter());
+   {
+     Segments segments;
+diff --git rewriter/rewriter.cc rewriter/rewriter.cc
+index 0b1c0b7e9..ed5f4dc9d 100644
+--- rewriter/rewriter.cc
++++ rewriter/rewriter.cc
+@@ -29,7 +29,6 @@
+ 
+ #include "rewriter/rewriter.h"
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "converter/converter_interface.h"
+ #include "data_manager/data_manager_interface.h"
+@@ -63,11 +62,12 @@
+ #include "rewriter/variants_rewriter.h"
+ #include "rewriter/version_rewriter.h"
+ #include "rewriter/zipcode_rewriter.h"
++#include "absl/flags/flag.h"
+ #ifndef NO_USAGE_REWRITER
+ #include "rewriter/usage_rewriter.h"
+ #endif  // NO_USAGE_REWRITER
+ 
+-MOZC_FLAG(bool, use_history_rewriter, true, "Use history rewriter or not.");
++ABSL_FLAG(bool, use_history_rewriter, true, "Use history rewriter or not.");
+ 
+ namespace mozc {
+ namespace {
+@@ -104,7 +104,7 @@ RewriterImpl::RewriterImpl(const ConverterInterface *parent_converter,
+   AddRewriter(new ZipcodeRewriter(&pos_matcher_));
+   AddRewriter(new DiceRewriter);
+ 
+-  if (mozc::GetFlag(FLAGS_use_history_rewriter)) {
++  if (absl::GetFlag(FLAGS_use_history_rewriter)) {
+     AddRewriter(new UserBoundaryHistoryRewriter(parent_converter));
+     AddRewriter(new UserSegmentHistoryRewriter(&pos_matcher_, pos_group));
+   }
+diff --git rewriter/rewriter_test.cc rewriter/rewriter_test.cc
+index 2ec18ba6e..23609cf05 100644
+--- rewriter/rewriter_test.cc
++++ rewriter/rewriter_test.cc
+@@ -33,7 +33,6 @@
+ #include <memory>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "config/config_handler.h"
+ #include "converter/converter_mock.h"
+@@ -44,6 +43,7 @@
+ #include "rewriter/rewriter_interface.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -68,7 +68,7 @@ size_t CommandCandidatesSize(const Segment &segment) {
+ class RewriterTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     converter_mock_ = absl::make_unique<ConverterMock>();
+     const testing::MockDataManager data_manager;
+     pos_group_ = absl::make_unique<PosGroup>(data_manager.GetPosGroupData());
+diff --git rewriter/single_kanji_rewriter_test.cc rewriter/single_kanji_rewriter_test.cc
+index 53d3a20ef..c47670f78 100644
+--- rewriter/single_kanji_rewriter_test.cc
++++ rewriter/single_kanji_rewriter_test.cc
+@@ -33,7 +33,6 @@
+ #include <memory>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "base/util.h"
+ #include "config/config_handler.h"
+@@ -44,6 +43,7 @@
+ #include "request/conversion_request.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -60,7 +60,7 @@ class SingleKanjiRewriterTest : public ::testing::Test {
+   ~SingleKanjiRewriterTest() override = default;
+ 
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ 
+   SingleKanjiRewriter *CreateSingleKanjiRewriter() const {
+diff --git rewriter/symbol_rewriter.cc rewriter/symbol_rewriter.cc
+index ab2a417d8..74cfc02ba 100644
+--- rewriter/symbol_rewriter.cc
++++ rewriter/symbol_rewriter.cc
+@@ -170,7 +170,7 @@ void SymbolRewriter::InsertCandidates(
+     size_t default_offset, const SerializedDictionary::IterRange &range,
+     bool context_sensitive, Segment *segment) {
+   if (segment->candidates_size() == 0) {
+-    LOG(WARNING) << "candiadtes_size is 0";
++    LOG(WARNING) << "candidates_size is 0";
+     return;
+   }
+ 
+@@ -181,7 +181,7 @@ void SymbolRewriter::InsertCandidates(
+   // register space to CharacterFormManager.
+   ExpandSpace(segment);
+ 
+-  // If the original candidates given by ImmutableConveter already
++  // If the original candidates given by ImmutableConverter already
+   // include the target symbols, do assign description to these candidates.
+   AddDescForCurrentCandidates(range, segment);
+ 
+diff --git rewriter/symbol_rewriter_test.cc rewriter/symbol_rewriter_test.cc
+index 29f5d9fca..6460c1e8b 100644
+--- rewriter/symbol_rewriter_test.cc
++++ rewriter/symbol_rewriter_test.cc
+@@ -32,7 +32,6 @@
+ #include <memory>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/system_util.h"
+ #include "base/util.h"
+@@ -46,6 +45,7 @@
+ #include "session/request_test_util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -102,7 +102,7 @@ class SymbolRewriterTest : public ::testing::Test {
+   ~SymbolRewriterTest() override = default;
+ 
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+ 
+     // We cannot use mock converter here because SymbolRewriter uses
+     // ResizeSegment of converter implementation. However, SymbolRewriter is
+diff --git rewriter/unicode_rewriter_test.cc rewriter/unicode_rewriter_test.cc
+index e4af2c32f..aaffba108 100644
+--- rewriter/unicode_rewriter_test.cc
++++ rewriter/unicode_rewriter_test.cc
+@@ -34,7 +34,6 @@
+ #include <memory>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/port.h"
+ #include "base/system_util.h"
+ #include "base/util.h"
+@@ -48,6 +47,7 @@
+ #include "request/conversion_request.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+@@ -87,7 +87,7 @@ class UnicodeRewriterTest : public ::testing::Test {
+   ~UnicodeRewriterTest() override {}
+ 
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     engine_.reset(MockDataEngineFactory::Create());
+   }
+ 
+diff --git rewriter/usage_rewriter.cc rewriter/usage_rewriter.cc
+index 53aec1d9e..f07a18922 100644
+--- rewriter/usage_rewriter.cc
++++ rewriter/usage_rewriter.cc
+@@ -139,7 +139,7 @@ std::string UsageRewriter::GetKanjiPrefixAndOneHiragana(
+ UsageRewriter::UsageDictItemIterator
+ UsageRewriter::LookupUnmatchedUsageHeuristically(
+     const Segment::Candidate &candidate) const {
+-  // We check Unknwon POS ("名詞,サ変接続") as well, since
++  // We check Unknown POS ("名詞,サ変接続") as well, since
+   // target verbs/adjectives may be in web dictionary.
+   if (!pos_matcher_.IsContentWordWithConjugation(candidate.lid) &&
+       !pos_matcher_.IsUnknown(candidate.lid)) {
+diff --git rewriter/usage_rewriter_test.cc rewriter/usage_rewriter_test.cc
+index 197e3f944..f45ddf27a 100644
+--- rewriter/usage_rewriter_test.cc
++++ rewriter/usage_rewriter_test.cc
+@@ -34,7 +34,6 @@
+ #include <memory>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "config/config_handler.h"
+ #include "converter/segments.h"
+@@ -49,6 +48,7 @@
+ #include "request/conversion_request.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -79,7 +79,7 @@ class UsageRewriterTest : public ::testing::Test {
+   }
+ 
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     config::ConfigHandler::GetDefaultConfig(&config_);
+ 
+     data_manager_ = absl::make_unique<testing::MockDataManager>();
+diff --git rewriter/user_boundary_history_rewriter_test.cc rewriter/user_boundary_history_rewriter_test.cc
+index 5e90260d8..b226c0f8a 100644
+--- rewriter/user_boundary_history_rewriter_test.cc
++++ rewriter/user_boundary_history_rewriter_test.cc
+@@ -34,7 +34,6 @@
+ #include <string>
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "config/config_handler.h"
+ #include "converter/converter_mock.h"
+@@ -43,6 +42,7 @@
+ #include "request/conversion_request.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+@@ -83,7 +83,7 @@ class UserBoundaryHistoryRewriterTest : public ::testing::Test {
+   UserBoundaryHistoryRewriterTest() { request_.set_config(&config_); }
+ 
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     config::ConfigHandler::GetDefaultConfig(&config_);
+   }
+ 
+@@ -114,7 +114,7 @@ class UserBoundaryHistoryRewriterTest : public ::testing::Test {
+ TEST_F(UserBoundaryHistoryRewriterTest, CreateFile) {
+   UserBoundaryHistoryRewriter rewriter(&mock());
+   const std::string history_file =
+-      mozc::GetFlag(FLAGS_test_tmpdir) + "/boundary.db";
++      absl::GetFlag(FLAGS_test_tmpdir) + "/boundary.db";
+   EXPECT_TRUE(FileUtil::FileExists(history_file));
+ }
+ 
+@@ -227,8 +227,8 @@ TEST_F(UserBoundaryHistoryRewriterTest, NoInsertWhenIncognito) {
+   SetIncognito(false);  // no_incognito when rewrite
+   EXPECT_FALSE(rewriter.Rewrite(request_, &segments));
+ 
+-  const std::string segments_rewrited_str = segments.DebugString();
+-  EXPECT_EQ(segments_str, segments_rewrited_str);
++  const std::string segments_rewritten_str = segments.DebugString();
++  EXPECT_EQ(segments_str, segments_rewritten_str);
+ }
+ 
+ TEST_F(UserBoundaryHistoryRewriterTest, NoInsertWhenReadOnly) {
+@@ -250,8 +250,8 @@ TEST_F(UserBoundaryHistoryRewriterTest, NoInsertWhenReadOnly) {
+ 
+   EXPECT_FALSE(rewriter.Rewrite(request_, &segments));
+ 
+-  const std::string segments_rewrited_str = segments.DebugString();
+-  EXPECT_EQ(segments_str, segments_rewrited_str);
++  const std::string segments_rewritten_str = segments.DebugString();
++  EXPECT_EQ(segments_str, segments_rewritten_str);
+ }
+ 
+ TEST_F(UserBoundaryHistoryRewriterTest, NoInsertWhenDisableUserHistory) {
+@@ -273,8 +273,8 @@ TEST_F(UserBoundaryHistoryRewriterTest, NoInsertWhenDisableUserHistory) {
+ 
+   EXPECT_FALSE(rewriter.Rewrite(request_, &segments));
+ 
+-  const std::string segments_rewrited_str = segments.DebugString();
+-  EXPECT_EQ(segments_str, segments_rewrited_str);
++  const std::string segments_rewritten_str = segments.DebugString();
++  EXPECT_EQ(segments_str, segments_rewritten_str);
+ }
+ 
+ TEST_F(UserBoundaryHistoryRewriterTest, NoInsertWhenNotResized) {
+@@ -296,8 +296,8 @@ TEST_F(UserBoundaryHistoryRewriterTest, NoInsertWhenNotResized) {
+ 
+   EXPECT_FALSE(rewriter.Rewrite(request_, &segments));
+ 
+-  const std::string segments_rewrited_str = segments.DebugString();
+-  EXPECT_EQ(segments_str, segments_rewrited_str);
++  const std::string segments_rewritten_str = segments.DebugString();
++  EXPECT_EQ(segments_str, segments_rewritten_str);
+ }
+ 
+ TEST_F(UserBoundaryHistoryRewriterTest, NoRewriteAfterClear) {
+@@ -322,8 +322,8 @@ TEST_F(UserBoundaryHistoryRewriterTest, NoRewriteAfterClear) {
+   const std::string segments_str = segments.DebugString();
+   EXPECT_FALSE(rewriter.Rewrite(request_, &segments));
+ 
+-  const std::string segments_rewrited_str = segments.DebugString();
+-  EXPECT_EQ(segments_str, segments_rewrited_str);
++  const std::string segments_rewritten_str = segments.DebugString();
++  EXPECT_EQ(segments_str, segments_rewritten_str);
+ }
+ 
+ TEST_F(UserBoundaryHistoryRewriterTest, NoRewriteWhenIncognito) {
+@@ -346,8 +346,8 @@ TEST_F(UserBoundaryHistoryRewriterTest, NoRewriteWhenIncognito) {
+   SetIncognito(true);
+   EXPECT_FALSE(rewriter.Rewrite(request_, &segments));
+ 
+-  const std::string segments_rewrited_str = segments.DebugString();
+-  EXPECT_EQ(segments_str, segments_rewrited_str);
++  const std::string segments_rewritten_str = segments.DebugString();
++  EXPECT_EQ(segments_str, segments_rewritten_str);
+ }
+ 
+ TEST_F(UserBoundaryHistoryRewriterTest, NoRewriteWhenNoHistory) {
+@@ -370,8 +370,8 @@ TEST_F(UserBoundaryHistoryRewriterTest, NoRewriteWhenNoHistory) {
+   SetLearningLevel(config::Config::NO_HISTORY);
+   EXPECT_FALSE(rewriter.Rewrite(request_, &segments));
+ 
+-  const std::string segments_rewrited_str = segments.DebugString();
+-  EXPECT_EQ(segments_str, segments_rewrited_str);
++  const std::string segments_rewritten_str = segments.DebugString();
++  EXPECT_EQ(segments_str, segments_rewritten_str);
+ }
+ 
+ TEST_F(UserBoundaryHistoryRewriterTest, NoRewriteWhenDisabledUserHistory) {
+@@ -393,8 +393,8 @@ TEST_F(UserBoundaryHistoryRewriterTest, NoRewriteWhenDisabledUserHistory) {
+   const std::string segments_str = segments.DebugString();
+   EXPECT_FALSE(rewriter.Rewrite(request_, &segments));
+ 
+-  const std::string segments_rewrited_str = segments.DebugString();
+-  EXPECT_EQ(segments_str, segments_rewrited_str);
++  const std::string segments_rewritten_str = segments.DebugString();
++  EXPECT_EQ(segments_str, segments_rewritten_str);
+ }
+ 
+ TEST_F(UserBoundaryHistoryRewriterTest, NoRewriteWhenAlreadyResized) {
+@@ -417,7 +417,7 @@ TEST_F(UserBoundaryHistoryRewriterTest, NoRewriteWhenAlreadyResized) {
+   const std::string segments_str = segments.DebugString();
+   EXPECT_FALSE(rewriter.Rewrite(request_, &segments));
+ 
+-  const std::string segments_rewrited_str = segments.DebugString();
+-  EXPECT_EQ(segments_str, segments_rewrited_str);
++  const std::string segments_rewritten_str = segments.DebugString();
++  EXPECT_EQ(segments_str, segments_rewritten_str);
+ }
+ }  // namespace mozc
+diff --git rewriter/user_dictionary_rewriter_test.cc rewriter/user_dictionary_rewriter_test.cc
+index f54ddc22b..7cccdb11d 100644
+--- rewriter/user_dictionary_rewriter_test.cc
++++ rewriter/user_dictionary_rewriter_test.cc
+@@ -33,7 +33,6 @@
+ #include <string>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/system_util.h"
+ #include "base/util.h"
+@@ -41,6 +40,7 @@
+ #include "request/conversion_request.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ 
+@@ -85,7 +85,7 @@ class UserDictionaryRewriterTest : public testing::Test {
+   ~UserDictionaryRewriterTest() override {}
+ 
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ 
+   void TearDown() override {}
+diff --git rewriter/user_segment_history_rewriter.cc rewriter/user_segment_history_rewriter.cc
+index 5d1f0bd24..d4e3448b2 100644
+--- rewriter/user_segment_history_rewriter.cc
++++ rewriter/user_segment_history_rewriter.cc
+@@ -142,10 +142,10 @@ class ScoreTypeCompare {
+   }
+ };
+ 
+-// return the first candiadte which has "BEST_CANDIDATE" attribute
++// return the first candidate which has "BEST_CANDIDATE" attribute
+ inline int GetDefaultCandidateIndex(const Segment &segment) {
+   // Check up to kMaxRerankSize + 1 candidates because candidate with
+-  // BEST_CANDIATE is highly possibly in that range (http://b/9992330).
++  // BEST_CANDIDATE is highly possibly in that range (http://b/9992330).
+   const int size =
+       static_cast<int>(std::min(segment.candidates_size(), kMaxRerankSize + 1));
+   for (int i = 0; i < size; ++i) {
+@@ -690,7 +690,7 @@ void UserSegmentHistoryRewriter::RememberFirstCandidate(
+   const std::string &all_key = seg.key();
+   const std::string &content_key = candidate.content_key;
+ 
+-  // even if the candiate was the top (default) candidate,
++  // even if the candidate was the top (default) candidate,
+   // ERANKED will be set when user changes the ranking
+   const bool force_insert =
+       ((candidate.attributes & Segment::Candidate::RERANKED) != 0);
+diff --git rewriter/user_segment_history_rewriter_test.cc rewriter/user_segment_history_rewriter_test.cc
+index c3271a7d8..d34069bbe 100644
+--- rewriter/user_segment_history_rewriter_test.cc
++++ rewriter/user_segment_history_rewriter_test.cc
+@@ -35,7 +35,6 @@
+ #include "base/clock.h"
+ #include "base/clock_mock.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/number_util.h"
+ #include "base/system_util.h"
+@@ -52,6 +51,7 @@
+ #include "rewriter/variants_rewriter.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -113,7 +113,7 @@ class UserSegmentHistoryRewriterTest : public ::testing::Test {
+   UserSegmentHistoryRewriterTest() { request_.set_config(&config_); }
+ 
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+ 
+     ConfigHandler::GetDefaultConfig(&config_);
+     for (int i = 0; i < config_.character_form_rules_size(); ++i) {
+@@ -181,7 +181,7 @@ TEST_F(UserSegmentHistoryRewriterTest, CreateFile) {
+   std::unique_ptr<UserSegmentHistoryRewriter> rewriter(
+       CreateUserSegmentHistoryRewriter());
+   const std::string history_file =
+-      FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir), "/segment.db");
++      FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir), "/segment.db");
+   EXPECT_TRUE(FileUtil::FileExists(history_file));
+ }
+ 
+diff --git rewriter/variants_rewriter.cc rewriter/variants_rewriter.cc
+index 51cf50a09..9082b9461 100644
+--- rewriter/variants_rewriter.cc
++++ rewriter/variants_rewriter.cc
+@@ -313,7 +313,7 @@ bool VariantsRewriter::RewriteSegment(RewriteType type, Segment *seg) const {
+     if (original_candidate->attributes &
+         Segment::Candidate::NO_VARIANTS_EXPANSION) {
+       SetDescriptionForCandidate(pos_matcher_, original_candidate);
+-      VLOG(1) << "Canidate has NO_NORMALIZATION node";
++      VLOG(1) << "Candidate has NO_NORMALIZATION node";
+       continue;
+     }
+ 
+diff --git rewriter/variants_rewriter_test.cc rewriter/variants_rewriter_test.cc
+index 7b92e09ec..78bef9ed5 100644
+--- rewriter/variants_rewriter_test.cc
++++ rewriter/variants_rewriter_test.cc
+@@ -426,7 +426,7 @@ TEST_F(VariantsRewriterTest, SetDescriptionForCandidate) {
+     candidate.content_key = "ねずみ";
+     candidate.description = "絵文字";
+     VariantsRewriter::SetDescriptionForCandidate(pos_matcher_, &candidate);
+-    // "絵文字 <機種依存文字>" for Desktop, "絵文字 <機種依存>" for Andorid
++    // "絵文字 <機種依存文字>" for Desktop, "絵文字 <機種依存>" for Android
+     std::string expected(
+         "絵文字"
+         " ");
+diff --git rewriter/version_rewriter_test.cc rewriter/version_rewriter_test.cc
+index 53ea65640..c7b91c5d1 100644
+--- rewriter/version_rewriter_test.cc
++++ rewriter/version_rewriter_test.cc
+@@ -32,7 +32,6 @@
+ #include <cstddef>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "base/util.h"
+ #include "config/config_handler.h"
+@@ -41,6 +40,7 @@
+ #include "request/conversion_request.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+@@ -52,7 +52,7 @@ const char *kDummyDataVersion = "dataversion";
+ class VersionRewriterTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ 
+   static void AddSegment(const std::string &key, const std::string &value,
+diff --git server/BUILD server/BUILD
+index c65968856..af14825f9 100644
+--- server/BUILD
++++ server/BUILD
+@@ -64,7 +64,6 @@ cc_library_mozc(
+     deps = [
+         "//base",
+         "//base:crash_report_handler",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:logging",
+         "//base:port",
+@@ -85,7 +84,6 @@ cc_binary_mozc(
+     srcs = ["mozc_rpc_server_main.cc"],
+     deps = [
+         "//base",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:singleton",
+         "//base:system_util",
+diff --git server/cache_service_manager.cc server/cache_service_manager.cc
+index 5fcd064f3..48cbf045a 100644
+--- server/cache_service_manager.cc
++++ server/cache_service_manager.cc
+@@ -148,14 +148,14 @@ bool DeserializeFromBase64WString(const std::wstring &src,
+ //  - It turns out w/o any error that the cache service is not installed.
+ //    In this case, |handle| owns a NULL handle.
+ // Otherwise, returns false.
+-bool GetCacheService(DWORD service_controler_rights, DWORD service_rights,
++bool GetCacheService(DWORD service_controller_rights, DWORD service_rights,
+                      ScopedSCHandle *handle) {
+   if (NULL == handle) {
+     return false;
+   }
+ 
+   ScopedSCHandle sc_handle(
+-      ::OpenSCManager(NULL, NULL, service_controler_rights));
++      ::OpenSCManager(NULL, NULL, service_controller_rights));
+   if (NULL == sc_handle.get()) {
+     LOG(ERROR) << "OpenSCManager failed: " << ::GetLastError();
+     return false;
+@@ -314,7 +314,7 @@ bool RestoreStateInternal(const cache_service::Win32ServiceState &state) {
+ 
+   const bool now_running = IsServiceRunning(service_handle);
+ 
+-  // If the service was runnning and is not running now, start it unless the
++  // If the service was running and is not running now, start it unless the
+   // load type is not DISABLED.
+   if (state.running() && !now_running &&
+       (state.load_type() != cache_service::Win32ServiceState::DISABLED)) {
+@@ -326,7 +326,7 @@ bool RestoreStateInternal(const cache_service::Win32ServiceState &state) {
+       }
+     }
+     return StartServiceInternal(service_handle, arguments);
+-    // If the service is now runnning and was not running, stop it.
++    // If the service is now running and was not running, stop it.
+   } else if (!state.running() && now_running) {
+     return StopService(service_handle);
+     // Nothing to do.
+@@ -407,7 +407,7 @@ bool CacheServiceManager::IsEnabled() {
+   }
+ 
+   // This byte array will contain both QUERY_SERVICE_CONFIG and some
+-  // string buffers which are reffered by corresponding members of
++  // string buffers which are referred by corresponding members of
+   // QUERY_SERVICE_CONFIG.  We have to keep the array until we complete
+   // all tasks which use the contents of QUERY_SERVICE_CONFIG.
+   std::unique_ptr<char[]> buffer;
+@@ -539,7 +539,7 @@ bool CacheServiceManager::BackupStateAsString(std::wstring *result) {
+     state.set_running(true);
+   } else {
+     // This byte array will contain both QUERY_SERVICE_CONFIG and some
+-    // string buffers which are reffered by corresponding members of
++    // string buffers which are referred by corresponding members of
+     // QUERY_SERVICE_CONFIG.  We have to keep the array until we complete
+     // all tasks which use the contents of QUERY_SERVICE_CONFIG.
+     std::unique_ptr<char[]> buffer;
+diff --git server/mozc_cache_service.rc server/mozc_cache_service.rc
+index aa89ce828..9bb7c8d95 100644
+Binary files server/mozc_cache_service.rc and server/mozc_cache_service.rc differ
+diff --git server/mozc_rpc_server_main.cc server/mozc_rpc_server_main.cc
+index 296e0373f..6160b6cd2 100644
+--- server/mozc_rpc_server_main.cc
++++ server/mozc_rpc_server_main.cc
+@@ -27,7 +27,6 @@
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+-#include "absl/flags/flag.h"
+ #ifdef OS_WIN
+ #include <windows.h>
+ #include <ws2tcpip.h>
+@@ -47,7 +46,6 @@ using ssize_t = SSIZE_T;
+ #include <string>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/singleton.h"
+ #include "base/system_util.h"
+@@ -56,14 +54,15 @@ using ssize_t = SSIZE_T;
+ #include "session/random_keyevents_generator.h"
+ #include "session/session_handler.h"
+ #include "session/session_usage_observer.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, host, "localhost", "server host name");
+-MOZC_FLAG(bool, server, true, "server mode");
+-MOZC_FLAG(bool, client, false, "client mode");
+-MOZC_FLAG(int32, client_test_size, 100, "client test size");
+-MOZC_FLAG(int32, port, 8000, "port of RPC server");
+-MOZC_FLAG(int32, rpc_timeout, 60000, "timeout");
+-MOZC_FLAG(string, user_profile_directory, "", "user profile directory");
++ABSL_FLAG(std::string, host, "localhost", "server host name");
++ABSL_FLAG(bool, server, true, "server mode");
++ABSL_FLAG(bool, client, false, "client mode");
++ABSL_FLAG(int32, client_test_size, 100, "client test size");
++ABSL_FLAG(int32, port, 8000, "port of RPC server");
++ABSL_FLAG(int32, rpc_timeout, 60000, "timeout");
++ABSL_FLAG(std::string, user_profile_directory, "", "user profile directory");
+ 
+ namespace mozc {
+ 
+@@ -144,7 +143,7 @@ class RPCServer {
+ #endif
+ 
+     ::memset(&sin, 0, sizeof(sin));
+-    sin.sin_port = htons(mozc::GetFlag(FLAGS_port));
++    sin.sin_port = htons(absl::GetFlag(FLAGS_port));
+     sin.sin_family = AF_INET;
+     sin.sin_addr.s_addr = htonl(INADDR_ANY);
+ 
+@@ -182,7 +181,7 @@ class RPCServer {
+       uint32 request_size = 0;
+       // Receive the size of data.
+       if (!Recv(client_socket, reinterpret_cast<char *>(&request_size),
+-                sizeof(request_size), mozc::GetFlag(FLAGS_rpc_timeout))) {
++                sizeof(request_size), absl::GetFlag(FLAGS_rpc_timeout))) {
+         LOG(ERROR) << "Cannot receive request_size header.";
+         CloseSocket(client_socket);
+         continue;
+@@ -194,7 +193,7 @@ class RPCServer {
+       // Receive the body of serialized protobuf.
+       std::unique_ptr<char[]> request_str(new char[request_size]);
+       if (!Recv(client_socket, request_str.get(), request_size,
+-                mozc::GetFlag(FLAGS_rpc_timeout))) {
++                absl::GetFlag(FLAGS_rpc_timeout))) {
+         LOG(ERROR) << "cannot receive body of request.";
+         CloseSocket(client_socket);
+         continue;
+@@ -220,9 +219,9 @@ class RPCServer {
+       output_size = htonl(output_size);
+ 
+       if (!Send(client_socket, reinterpret_cast<char *>(&output_size),
+-                sizeof(output_size), mozc::GetFlag(FLAGS_rpc_timeout)) ||
++                sizeof(output_size), absl::GetFlag(FLAGS_rpc_timeout)) ||
+           !Send(client_socket, output_str.data(), output_str.size(),
+-                mozc::GetFlag(FLAGS_rpc_timeout))) {
++                absl::GetFlag(FLAGS_rpc_timeout))) {
+         LOG(ERROR) << "Cannot send reply.";
+       }
+ 
+@@ -284,8 +283,8 @@ class RPCClient {
+     hints.ai_socktype = SOCK_STREAM;
+     hints.ai_family = AF_INET;
+ 
+-    const std::string port_str = std::to_string(mozc::GetFlag(FLAGS_port));
+-    CHECK_EQ(::getaddrinfo(mozc::GetFlag(FLAGS_host).c_str(), port_str.c_str(),
++    const std::string port_str = std::to_string(absl::GetFlag(FLAGS_port));
++    CHECK_EQ(::getaddrinfo(absl::GetFlag(FLAGS_host).c_str(), port_str.c_str(),
+                            &hints, &res),
+              0)
+         << "getaddrinfo failed";
+@@ -304,20 +303,20 @@ class RPCClient {
+     request_size = htonl(request_size);
+ 
+     CHECK(Send(client_socket, reinterpret_cast<char *>(&request_size),
+-               sizeof(request_size), mozc::GetFlag(FLAGS_rpc_timeout)));
++               sizeof(request_size), absl::GetFlag(FLAGS_rpc_timeout)));
+     CHECK(Send(client_socket, request_str.data(), request_str.size(),
+-               mozc::GetFlag(FLAGS_rpc_timeout)));
++               absl::GetFlag(FLAGS_rpc_timeout)));
+ 
+     uint32 output_size = 0;
+     CHECK(Recv(client_socket, reinterpret_cast<char *>(&output_size),
+-               sizeof(output_size), mozc::GetFlag(FLAGS_rpc_timeout)));
++               sizeof(output_size), absl::GetFlag(FLAGS_rpc_timeout)));
+     output_size = ntohl(output_size);
+     CHECK_GT(output_size, 0);
+     CHECK_LT(output_size, kMaxOutputSize);
+ 
+     std::unique_ptr<char[]> output_str(new char[output_size]);
+     CHECK(Recv(client_socket, output_str.get(), output_size,
+-               mozc::GetFlag(FLAGS_rpc_timeout)));
++               absl::GetFlag(FLAGS_rpc_timeout)));
+ 
+     CHECK(output->ParseFromArray(output_str.get(), output_size));
+ 
+@@ -355,17 +354,17 @@ int main(int argc, char *argv[]) {
+ 
+   mozc::ScopedWSAData wsadata;
+ 
+-  if (!mozc::GetFlag(FLAGS_user_profile_directory).empty()) {
++  if (!absl::GetFlag(FLAGS_user_profile_directory).empty()) {
+     LOG(INFO) << "Setting user profile directory to "
+-              << mozc::GetFlag(FLAGS_user_profile_directory);
++              << absl::GetFlag(FLAGS_user_profile_directory);
+     mozc::SystemUtil::SetUserProfileDirectory(
+-        mozc::GetFlag(FLAGS_user_profile_directory));
++        absl::GetFlag(FLAGS_user_profile_directory));
+   }
+ 
+-  if (mozc::GetFlag(FLAGS_client)) {
++  if (absl::GetFlag(FLAGS_client)) {
+     mozc::RPCClient client;
+     CHECK(client.CreateSession());
+-    for (int n = 0; n < mozc::GetFlag(FLAGS_client_test_size); ++n) {
++    for (int n = 0; n < absl::GetFlag(FLAGS_client_test_size); ++n) {
+       std::vector<mozc::commands::KeyEvent> keys;
+       mozc::session::RandomKeyEventsGenerator::GenerateSequence(&keys);
+       for (size_t i = 0; i < keys.size(); ++i) {
+@@ -377,7 +376,7 @@ int main(int argc, char *argv[]) {
+     }
+     CHECK(client.DeleteSession());
+     return 0;
+-  } else if (mozc::GetFlag(FLAGS_server)) {
++  } else if (absl::GetFlag(FLAGS_server)) {
+     mozc::RPCServer server;
+     server.Loop();
+   } else {
+diff --git server/mozc_server.cc server/mozc_server.cc
+index 228344f9d..bd3ecd39c 100644
+--- server/mozc_server.cc
++++ server/mozc_server.cc
+@@ -29,8 +29,6 @@
+ 
+ #include "server/mozc_server.h"
+ 
+-#include "absl/flags/flag.h"
+-
+ #ifdef OS_WIN
+ #include <windows.h>
+ #endif
+@@ -40,7 +38,6 @@
+ #include <string>
+ 
+ #include "base/crash_report_handler.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/process_mutex.h"
+@@ -50,8 +47,10 @@
+ #include "base/util.h"
+ #include "config/stats_config_util.h"
+ #include "session/session_server.h"
++#include "absl/flags/declare.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_DECLARE_FLAG(bool, restricted);  // in SessionHandler
++ABSL_DECLARE_FLAG(bool, restricted);  // in SessionHandler
+ 
+ namespace {
+ mozc::SessionServer *g_session_server = NULL;
+@@ -92,7 +91,7 @@ void InitMozcAndMozcServer(const char *arg0, int *argc, char ***argv,
+ 
+   if (run_level == mozc::RunLevel::RESTRICTED) {
+     VLOG(1) << "Mozc server starts with timeout mode";
+-    mozc::SetFlag(&FLAGS_restricted, true);
++    absl::SetFlag(&FLAGS_restricted, true);
+   }
+ }
+ 
+diff --git server/mozc_server.rc server/mozc_server.rc
+index fd97c8767..d78370110 100644
+Binary files server/mozc_server.rc and server/mozc_server.rc differ
+diff --git session/BUILD session/BUILD
+index cc47ec3cf..07c7cf81e 100644
+--- session/BUILD
++++ session/BUILD
+@@ -73,7 +73,6 @@ cc_library_mozc(
+         ":session_converter_interface",
+         ":session_usage_stats_util",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:text_normalizer",
+@@ -90,6 +89,7 @@ cc_library_mozc(
+         "//session/internal:session_output",
+         "//transliteration",
+         "//usage_stats",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -103,7 +103,6 @@ cc_test_mozc(
+         ":request_test_util",
+         ":session_converter",
+         "//base",
+-        "//base:flags",
+         "//base:logging",
+         "//base:system_util",
+         "//base:util",
+@@ -123,6 +122,7 @@ cc_test_mozc(
+         "//transliteration",
+         "//usage_stats",
+         "//usage_stats:usage_stats_testing_util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -136,7 +136,6 @@ cc_test_mozc(
+         ":session_converter",
+         "//base",
+         "//base:clock",
+-        "//base:flags",
+         "//base:port",
+         "//base:system_util",
+         "//base:util",
+@@ -148,6 +147,7 @@ cc_test_mozc(
+         "//protocol:commands_proto",
+         "//protocol:config_proto",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -251,7 +251,6 @@ cc_test_mozc(
+         ":session_handler",
+         "//base",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:system_util",
+@@ -269,6 +268,7 @@ cc_test_mozc(
+         "//session/internal:ime_context",
+         "//session/internal:keymap",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -341,7 +341,7 @@ cc_library_mozc(
+         "//usage_stats",
+         "@com_google_absl//absl/memory",
+     ] + [
+-        "//base:flags",
++        "@com_google_absl//absl/flags:flag",
+         "//base:logging",
+         "//base:port",
+         "//base:singleton",
+@@ -371,7 +371,6 @@ cc_library_mozc(
+         "//base",
+         "//base:config_file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:system_util",
+@@ -389,6 +388,7 @@ cc_library_mozc(
+         "//testing",
+         "//testing:gunit_prod",
+         "//usage_stats:usage_stats_testing_util",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -405,7 +405,6 @@ cc_test_mozc(
+         ":session_handler_test_util",
+         "//base",
+         "//base:clock_mock",
+-        "//base:flags",
+         "//base:port",
+         "//base:stopwatch",
+         "//base:util",
+@@ -421,6 +420,7 @@ cc_test_mozc(
+         "//testing:gunit_main",
+         "//usage_stats",
+         "//usage_stats:usage_stats_testing_util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -456,10 +456,10 @@ cc_test_mozc(
+     deps = [
+         ":session_server",
+         "//base",
+-        "//base:flags",
+         "//base:scheduler",
+         "//base:system_util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -503,7 +503,6 @@ cc_binary_mozc(
+         "//base",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:logging",
+         "//base:port",
+@@ -514,6 +513,7 @@ cc_binary_mozc(
+         "//engine:engine_interface",
+         "//protocol:commands_proto",
+         "//protocol:config_proto",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -524,9 +524,9 @@ cc_binary_mozc(
+     copts = ["$(STACK_FRAME_UNLIMITED)"],  # session_server_main.cc
+     deps = [
+         ":session_server",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//protocol:commands_proto",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings:str_format",
+     ],
+ )
+@@ -599,7 +599,6 @@ cc_test_mozc(
+         ":session_usage_observer",
+         "//base",
+         "//base:clock_mock",
+-        "//base:flags",
+         "//base:logging",
+         "//base:scheduler",
+         "//base:scheduler_stub",
+@@ -612,6 +611,7 @@ cc_test_mozc(
+         "//usage_stats",
+         "//usage_stats:usage_stats_proto",
+         "//usage_stats:usage_stats_testing_util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+@@ -782,7 +782,6 @@ cc_binary_mozc(
+     deps = [
+         ":session_handler_tool",
+         "//base:file_stream",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:status",
+         "//base:system_util",
+@@ -791,6 +790,7 @@ cc_binary_mozc(
+         "//data_manager/oss:oss_data_manager",
+         "//engine",
+         "//protocol:commands_proto",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+diff --git session/ime_switch_util.h session/ime_switch_util.h
+index c7246e84e..12e27ab66 100644
+--- session/ime_switch_util.h
++++ session/ime_switch_util.h
+@@ -51,7 +51,7 @@ class ImeSwitchUtil {
+   // Returns true if 'key' is assigned for any command in direct mode.
+   // We want to know this configuration before starting mozc server,
+   // because we use this config to start mozc server.
+-  // Please call this fuction only when the server is not runnning.
++  // Please call this fuction only when the server is not running.
+   static bool IsDirectModeCommand(const commands::KeyEvent &key);
+ 
+   static void ReloadConfig(const Config &config);
+diff --git session/internal/BUILD session/internal/BUILD
+index f33e8bb6e..4dfb9019d 100644
+--- session/internal/BUILD
++++ session/internal/BUILD
+@@ -187,13 +187,13 @@ cc_test_mozc(
+         ":keymap",
+         ":keymap_factory",
+         "//base:config_file_stream",
+-        "//base:flags",
+         "//base:system_util",
+         "//composer:key_parser",
+         "//config:config_handler",
+         "//protocol:commands_proto",
+         "//protocol:config_proto",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+diff --git session/internal/key_event_transformer.cc session/internal/key_event_transformer.cc
+index 79ab34c5e..9ed550dd5 100644
+--- session/internal/key_event_transformer.cc
++++ session/internal/key_event_transformer.cc
+@@ -157,7 +157,7 @@ bool KeyEventTransformer::TransformKeyEventForNumpad(
+   }
+ 
+   // All key event except for KeyEvent::SEPARATOR should have key code
+-  // and it's value should represent a ASCII character since it is generated
++  // and its value should represent a ASCII character since it is generated
+   // from numpad key.
+   DCHECK(key_event->has_key_code());
+   const uint32 key_code = key_event->key_code();
+diff --git session/internal/keymap_interface.h session/internal/keymap_interface.h
+index 91840a4d6..e2a585c18 100644
+--- session/internal/keymap_interface.h
++++ session/internal/keymap_interface.h
+@@ -102,7 +102,7 @@ struct CompositionState {
+     INSERT_ALTERNATE_SPACE,
+     INSERT_HALF_SPACE,   // Input half-width space
+     INSERT_FULL_SPACE,   // Input full-width space
+-    CANCEL,              // Move to Precomposition stauts.
++    CANCEL,              // Move to Precomposition status.
+     CANCEL_AND_IME_OFF,  // Cancel composition and turn off IME
+     UNDO,
+     MOVE_CURSOR_LEFT,
+diff --git session/internal/keymap_test.cc session/internal/keymap_test.cc
+index 76ed26f1b..90f07e17c 100644
+--- session/internal/keymap_test.cc
++++ session/internal/keymap_test.cc
+@@ -36,7 +36,6 @@
+ #include <vector>
+ 
+ #include "base/config_file_stream.h"
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "composer/key_parser.h"
+ #include "config/config_handler.h"
+@@ -46,6 +45,7 @@
+ #include "session/internal/keymap_factory.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace keymap {
+@@ -53,7 +53,7 @@ namespace keymap {
+ class KeyMapTest : public testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ 
+   bool isInputModeXCommandSupported() const {
+diff --git session/session.cc session/session.cc
+index 878f1ec9d..d7d9cc61b 100644
+--- session/session.cc
++++ session/session.cc
+@@ -1443,7 +1443,7 @@ bool Session::InsertCharacter(commands::Command *command) {
+   bool should_commit = (context_->state() == ImeContext::CONVERSION);
+ 
+   if (context_->GetRequest().space_on_alphanumeric() ==
+-          commands::Request::SPACE_OR_CONVERT_COMMITING_COMPOSITION &&
++          commands::Request::SPACE_OR_CONVERT_COMMITTING_COMPOSITION &&
+       context_->state() == ImeContext::COMPOSITION &&
+       // TODO(komatsu): Support FullWidthSpace
+       Util::EndsWith(composition, " ")) {
+@@ -2289,7 +2289,7 @@ bool Session::Convert(commands::Command *command) {
+         return Commit(command);
+       } else {
+         // SPACE_OR_CONVERT_KEEPING_COMPOSITION or
+-        // SPACE_OR_CONVERT_COMMITING_COMPOSITION.
++        // SPACE_OR_CONVERT_COMMITTING_COMPOSITION.
+ 
+         // If the last character is not space, space is inserted to the
+         // composition.
+diff --git session/session.h session/session.h
+index 6d3e09dd8..08748d2c2 100644
+--- session/session.h
++++ session/session.h
+@@ -266,7 +266,7 @@ class Session : public SessionInterface {
+   // return 0 (default value) if no command is executed in this session.
+   uint64 last_command_time() const override;
+ 
+-  // TODO(komatsu): delete this funciton.
++  // TODO(komatsu): delete this function.
+   // For unittest only
+   mozc::composer::Composer *get_internal_composer_only_for_unittest();
+ 
+diff --git session/session_client_main.cc session/session_client_main.cc
+index 6b787cbe0..548d336d2 100644
+--- session/session_client_main.cc
++++ session/session_client_main.cc
+@@ -33,7 +33,6 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+@@ -44,11 +43,12 @@
+ #include "engine/engine_interface.h"
+ #include "protocol/commands.pb.h"
+ #include "session/session.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+-MOZC_FLAG(string, input, "", "Input file");
+-MOZC_FLAG(string, output, "", "Output file");
+-MOZC_FLAG(string, profile_dir, "", "Profile dir");
++ABSL_FLAG(std::string, input, "", "Input file");
++ABSL_FLAG(std::string, output, "", "Output file");
++ABSL_FLAG(std::string, profile_dir, "", "Profile dir");
+ 
+ namespace mozc {
+ 
+@@ -94,9 +94,9 @@ int main(int argc, char **argv) {
+   std::istream *input = nullptr;
+   std::ostream *output = nullptr;
+ 
+-  const std::string flags_profile_dir = mozc::GetFlag(FLAGS_profile_dir);
+-  const std::string flags_input = mozc::GetFlag(FLAGS_input);
+-  const std::string flags_output = mozc::GetFlag(FLAGS_output);
++  const std::string flags_profile_dir = absl::GetFlag(FLAGS_profile_dir);
++  const std::string flags_input = absl::GetFlag(FLAGS_input);
++  const std::string flags_output = absl::GetFlag(FLAGS_output);
+ 
+   if (!flags_profile_dir.empty()) {
+     // TODO(komatsu): Make a tmp dir and use it.
+diff --git session/session_converter.cc session/session_converter.cc
+index a0a4e8b0c..77ae3a28e 100644
+--- session/session_converter.cc
++++ session/session_converter.cc
+@@ -35,7 +35,6 @@
+ #include <limits>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "base/text_normalizer.h"
+@@ -53,6 +52,7 @@
+ #include "session/session_usage_stats_util.h"
+ #include "transliteration/transliteration.h"
+ #include "usage_stats/usage_stats.h"
++#include "absl/flags/flag.h"
+ 
+ using mozc::usage_stats::UsageStats;
+ 
+@@ -62,7 +62,7 @@ const bool kDefaultUseActualConverterForRealtimeConversion = false;
+ const bool kDefaultUseActualConverterForRealtimeConversion = true;
+ #endif  // OS_ANDROID
+ 
+-MOZC_FLAG(bool, use_actual_converter_for_realtime_conversion,
++ABSL_FLAG(bool, use_actual_converter_for_realtime_conversion,
+           kDefaultUseActualConverterForRealtimeConversion,
+           "If true, use the actual (non-immutable) converter for real "
+           "time conversion.");
+@@ -428,7 +428,7 @@ bool SessionConverter::SuggestWithPreferences(
+     conversion_request.set_create_partial_candidates(
+         request_->auto_partial_suggestion());
+     conversion_request.set_use_actual_converter_for_realtime_conversion(
+-        mozc::GetFlag(FLAGS_use_actual_converter_for_realtime_conversion));
++        absl::GetFlag(FLAGS_use_actual_converter_for_realtime_conversion));
+     if (!converter_->StartSuggestionForRequest(conversion_request,
+                                                segments_.get())) {
+       // TODO(komatsu): Because suggestion is a prefix search, once
+@@ -504,7 +504,7 @@ bool SessionConverter::PredictWithPreferences(
+   if (predict_expand || predict_first) {
+     ConversionRequest conversion_request(&composer, request_, config_);
+     conversion_request.set_use_actual_converter_for_realtime_conversion(
+-        mozc::GetFlag(FLAGS_use_actual_converter_for_realtime_conversion));
++        absl::GetFlag(FLAGS_use_actual_converter_for_realtime_conversion));
+     if (!converter_->StartPredictionForRequest(conversion_request,
+                                                segments_.get())) {
+       LOG(WARNING) << "StartPredictionForRequest() failed";
+@@ -576,7 +576,7 @@ bool SessionConverter::ExpandSuggestionWithPreferences(
+     conversion_request.set_create_partial_candidates(
+         request_->auto_partial_suggestion());
+     conversion_request.set_use_actual_converter_for_realtime_conversion(
+-        mozc::GetFlag(FLAGS_use_actual_converter_for_realtime_conversion));
++        absl::GetFlag(FLAGS_use_actual_converter_for_realtime_conversion));
+     // This is abuse of StartPrediction().
+     // TODO(matsuzakit or yamaguchi): Add ExpandSuggestion method
+     //    to Converter class.
+diff --git session/session_converter.h session/session_converter.h
+index b1ac98895..fe5614e55 100644
+--- session/session_converter.h
++++ session/session_converter.h
+@@ -395,7 +395,7 @@ class SessionConverter : public SessionConverterInterface {
+   std::vector<int> selected_candidate_indices_;
+ 
+   // Revision number of client context with which the converter determines when
+-  // the history segments should be invalidated. See the implemenation of
++  // the history segments should be invalidated. See the implementation of
+   // OnStartComposition for details.
+   int32 client_revision_;
+ 
+diff --git session/session_converter_interface.h session/session_converter_interface.h
+index 32068a1ce..ba5b7f671 100644
+--- session/session_converter_interface.h
++++ session/session_converter_interface.h
+@@ -192,9 +192,9 @@ class SessionConverterInterface {
+ 
+   // Commit prefix of the preedit string represented by Composer.
+   // The caller should delete characters from composer based on returned
+-  // |commited_size|.
++  // |committed_size|.
+   virtual void CommitHead(size_t count, const composer::Composer &composer,
+-                          size_t *commited_size) = 0;
++                          size_t *committed_size) = 0;
+ 
+   // Revert the last "Commit" operation
+   virtual void Revert() = 0;
+diff --git session/session_converter_stress_test.cc session/session_converter_stress_test.cc
+index cf112d022..36a4a2f7c 100644
+--- session/session_converter_stress_test.cc
++++ session/session_converter_stress_test.cc
+@@ -31,7 +31,6 @@
+ #include <string>
+ 
+ #include "base/clock.h"
+-#include "base/flags.h"
+ #include "base/port.h"
+ #include "base/system_util.h"
+ #include "base/util.h"
+@@ -45,13 +44,14 @@
+ #include "session/session_converter.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(bool, test_deterministic, true,
++ABSL_FLAG(bool, test_deterministic, true,
+           "if true, srand() is initialized by \"test_srand_seed\"."
+           "if false, srand() is initialized by current time "
+           "and \"test_srand_seed\" is ignored");
+ 
+-MOZC_FLAG(int32, test_srand_seed, 0,
++ABSL_FLAG(int32, test_srand_seed, 0,
+           "seed number for srand(). "
+           "used only when \"test_deterministic\" is true");
+ 
+@@ -64,16 +64,16 @@ namespace session {
+ class SessionConverterStressTest : public ::testing::Test {
+  public:
+   SessionConverterStressTest() {
+-    if (!mozc::GetFlag(FLAGS_test_deterministic)) {
+-      mozc::SetFlag(&FLAGS_test_srand_seed,
++    if (!absl::GetFlag(FLAGS_test_deterministic)) {
++      absl::SetFlag(&FLAGS_test_srand_seed,
+                     static_cast<int32>(Clock::GetTime()));
+     }
+     Util::SetRandomSeed(
+-        static_cast<uint32>(mozc::GetFlag(FLAGS_test_srand_seed)));
++        static_cast<uint32>(absl::GetFlag(FLAGS_test_srand_seed)));
+   }
+ 
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     config::Config config;
+     config::ConfigHandler::GetDefaultConfig(&config);
+     config::ConfigHandler::SetConfig(config);
+diff --git session/session_converter_test.cc session/session_converter_test.cc
+index 8133d3dd1..d5c22add4 100644
+--- session/session_converter_test.cc
++++ session/session_converter_test.cc
+@@ -40,7 +40,6 @@
+ #include <string>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/system_util.h"
+ #include "base/util.h"
+@@ -62,6 +61,7 @@
+ #include "transliteration/transliteration.h"
+ #include "usage_stats/usage_stats.h"
+ #include "usage_stats/usage_stats_testing_util.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -86,7 +86,7 @@ class SessionConverterTest : public ::testing::Test {
+ 
+   void SetUp() override {
+     convertermock_ = absl::make_unique<ConverterMock>();
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     mozc::usage_stats::UsageStats::ClearAllStatsForTest();
+ 
+     config_ = absl::make_unique<Config>();
+@@ -352,13 +352,13 @@ class SessionConverterTest : public ::testing::Test {
+   }
+ 
+   static void SetCommandCandidate(Segments *segments, int segment_index,
+-                                  int canidate_index,
++                                  int candidate_index,
+                                   Segment::Candidate::Command command) {
+     segments->mutable_conversion_segment(segment_index)
+-        ->mutable_candidate(canidate_index)
++        ->mutable_candidate(candidate_index)
+         ->attributes |= Segment::Candidate::COMMAND_CANDIDATE;
+     segments->mutable_conversion_segment(segment_index)
+-        ->mutable_candidate(canidate_index)
++        ->mutable_candidate(candidate_index)
+         ->command = command;
+   }
+ 
+diff --git session/session_handler.cc session/session_handler.cc
+index 176e75283..9132ed5eb 100644
+--- session/session_handler.cc
++++ session/session_handler.cc
+@@ -38,9 +38,9 @@
+ #include <vector>
+ 
+ #include "base/clock.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/port.h"
++#include "absl/flags/flag.h"
+ #ifndef MOZC_DISABLE_SESSION_WATCHDOG
+ #include "base/process.h"
+ #endif  // MOZC_DISABLE_SESSION_WATCHDOG
+@@ -66,31 +66,31 @@
+ 
+ using mozc::usage_stats::UsageStats;
+ 
+-MOZC_FLAG(int32, timeout, -1,
++ABSL_FLAG(int32, timeout, -1,
+           "server timeout. "
+           "if sessions get empty for \"timeout\", "
+           "shutdown message is automatically emitted");
+ 
+-MOZC_FLAG(int32, max_session_size, 64,
++ABSL_FLAG(int32, max_session_size, 64,
+           "maximum sessions size. "
+           "if size of sessions reaches to \"max_session_size\", "
+           "oldest session is removed");
+ 
+-MOZC_FLAG(int32, create_session_min_interval, 0,
++ABSL_FLAG(int32, create_session_min_interval, 0,
+           "minimum interval (sec) for create session");
+ 
+-MOZC_FLAG(int32, watch_dog_interval, 180, "watch dog timer intaval (sec)");
++ABSL_FLAG(int32, watch_dog_interval, 180, "watch dog timer intaval (sec)");
+ 
+-MOZC_FLAG(int32, last_command_timeout, 3600,
++ABSL_FLAG(int32, last_command_timeout, 3600,
+           "remove session if it is not accessed for "
+           "\"last_command_timeout\" sec");
+ 
+-MOZC_FLAG(int32, last_create_session_timeout, 300,
++ABSL_FLAG(int32, last_create_session_timeout, 300,
+           "remove session if it is not accessed for "
+           "\"last_create_session_timeout\" sec "
+           "after create session command");
+ 
+-MOZC_FLAG(bool, restricted, false, "Launch server with restricted setting");
++ABSL_FLAG(bool, restricted, false, "Launch server with restricted setting");
+ 
+ namespace mozc {
+ 
+@@ -147,30 +147,30 @@ void SessionHandler::Init(
+   request_ = absl::make_unique<commands::Request>();
+   config_ = absl::make_unique<config::Config>();
+ 
+-  if (mozc::GetFlag(FLAGS_restricted)) {
++  if (absl::GetFlag(FLAGS_restricted)) {
+     VLOG(1) << "Server starts with restricted mode";
+     // --restricted is almost always specified when mozc_client is inside Job.
+     // The typical case is Startup processes on Vista.
+     // On Vista, StartUp processes are in Job for 60 seconds. In order
+     // to launch new mozc_server inside sandbox, we set the timeout
+     // to be 60sec. Client application hopefully re-launch mozc_server.
+-    mozc::SetFlag(&FLAGS_timeout, 60);
+-    mozc::SetFlag(&FLAGS_max_session_size, 8);
+-    mozc::SetFlag(&FLAGS_watch_dog_interval, 15);
+-    mozc::SetFlag(&FLAGS_last_create_session_timeout, 60);
+-    mozc::SetFlag(&FLAGS_last_command_timeout, 60);
++    absl::SetFlag(&FLAGS_timeout, 60);
++    absl::SetFlag(&FLAGS_max_session_size, 8);
++    absl::SetFlag(&FLAGS_watch_dog_interval, 15);
++    absl::SetFlag(&FLAGS_last_create_session_timeout, 60);
++    absl::SetFlag(&FLAGS_last_command_timeout, 60);
+   }
+ 
+ #ifndef MOZC_DISABLE_SESSION_WATCHDOG
+   session_watch_dog_ = absl::make_unique<SessionWatchDog>(
+-      mozc::GetFlag(FLAGS_watch_dog_interval));
++      absl::GetFlag(FLAGS_watch_dog_interval));
+ #endif  // MOZC_DISABLE_SESSION_WATCHDOG
+ 
+   config::ConfigHandler::GetConfig(config_.get());
+ 
+   // allow [2..128] sessions
+   max_session_size_ =
+-      std::max(2, std::min(mozc::GetFlag(FLAGS_max_session_size), 128));
++      std::max(2, std::min(absl::GetFlag(FLAGS_max_session_size), 128));
+   session_map_ = absl::make_unique<SessionMap>(max_session_size_);
+ 
+   if (!engine_) {
+@@ -493,7 +493,7 @@ bool SessionHandler::CreateSession(commands::Command *command) {
+   // prevent DOS attack
+   // don't allow CreateSession in very short period.
+   const int create_session_minimum_interval =
+-      std::max(0, std::min(mozc::GetFlag(FLAGS_create_session_min_interval),
++      std::max(0, std::min(absl::GetFlag(FLAGS_create_session_min_interval),
+                            10));
+ 
+   uint64 current_time = Clock::GetTime();
+@@ -610,13 +610,13 @@ bool SessionHandler::Cleanup(commands::Command *command) {
+   // allow [1..600] sec. default: 300
+   const uint64 create_session_timeout =
+       suspend_time +
+-      std::max(1, std::min(mozc::GetFlag(FLAGS_last_create_session_timeout),
++      std::max(1, std::min(absl::GetFlag(FLAGS_last_create_session_timeout),
+                            600));
+ 
+   // allow [10..7200] sec. default 3600
+   const uint64 last_command_timeout =
+       suspend_time +
+-      std::max(10, std::min(mozc::GetFlag(FLAGS_last_command_timeout), 7200));
++      std::max(10, std::min(absl::GetFlag(FLAGS_last_command_timeout), 7200));
+ 
+   std::vector<SessionID> remove_ids;
+   for (SessionElement *element =
+@@ -649,9 +649,9 @@ bool SessionHandler::Cleanup(commands::Command *command) {
+   engine_->GetUserDataManager()->Sync();
+ 
+   // timeout is enabled.
+-  if (mozc::GetFlag(FLAGS_timeout) > 0 && last_session_empty_time_ != 0 &&
++  if (absl::GetFlag(FLAGS_timeout) > 0 && last_session_empty_time_ != 0 &&
+       (current_time - last_session_empty_time_) >=
+-          suspend_time + mozc::GetFlag(FLAGS_timeout)) {
++          suspend_time + absl::GetFlag(FLAGS_timeout)) {
+     Shutdown(command);
+   }
+ 
+diff --git session/session_handler.h session/session_handler.h
+index 5f6d38912..8351e4e4c 100644
+--- session/session_handler.h
++++ session/session_handler.h
+@@ -83,7 +83,7 @@ class SessionHandler : public SessionHandlerInterface {
+   // Starts watch dog timer to cleanup sessions.
+   bool StartWatchDog() override;
+ 
+-  // NewSession returns new Sessoin.
++  // NewSession returns new Session.
+   // Client needs to delete it properly
+   session::SessionInterface *NewSession();
+ 
+diff --git session/session_handler_main.cc session/session_handler_main.cc
+index acd9e34cf..a2cc71536 100644
+--- session/session_handler_main.cc
++++ session/session_handler_main.cc
+@@ -56,7 +56,6 @@ SHOW_LOG_BY_VALUE       ございました
+ #include <string>
+ 
+ #include "base/file_stream.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/status.h"
+ #include "base/system_util.h"
+@@ -66,12 +65,14 @@ SHOW_LOG_BY_VALUE       ございました
+ #include "engine/engine.h"
+ #include "protocol/commands.pb.h"
+ #include "session/session_handler_tool.h"
++#include "absl/flags/flag.h"
+ #include "absl/strings/str_split.h"
+ 
+-MOZC_FLAG(string, input, "", "Input file");
+-MOZC_FLAG(string, profile, "", "User profile directory");
+-MOZC_FLAG(string, engine, "", "Conversion engine: 'mobile' or 'desktop'");
+-MOZC_FLAG(string, dictionary, "", "Dictionary: 'google', 'android' or 'oss'");
++ABSL_FLAG(std::string, input, "", "Input file");
++ABSL_FLAG(std::string, profile, "", "User profile directory");
++ABSL_FLAG(std::string, engine, "", "Conversion engine: 'mobile' or 'desktop'");
++ABSL_FLAG(std::string, dictionary, "",
++          "Dictionary: 'google', 'android' or 'oss'");
+ 
+ namespace mozc {
+ void Show(const commands::Output &output) {
+@@ -175,11 +176,11 @@ mozc::StatusOr<std::unique_ptr<Engine>> CreateEngine(
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+-  if (!mozc::GetFlag(FLAGS_profile).empty()) {
+-    mozc::SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_profile));
++  if (!absl::GetFlag(FLAGS_profile).empty()) {
++    mozc::SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_profile));
+   }
+-  auto engine = mozc::CreateEngine(mozc::GetFlag(FLAGS_engine),
+-                                   mozc::GetFlag(FLAGS_dictionary));
++  auto engine = mozc::CreateEngine(absl::GetFlag(FLAGS_engine),
++                                   absl::GetFlag(FLAGS_dictionary));
+   if (!engine.ok()) {
+     std::cout << "engine init error" << std::endl;
+     return 1;
+@@ -187,8 +188,8 @@ int main(int argc, char **argv) {
+   mozc::session::SessionHandlerInterpreter handler(*std::move(engine));
+ 
+   std::string line;
+-  if (!mozc::GetFlag(FLAGS_input).empty()) {
+-    mozc::InputFileStream input(mozc::GetFlag(FLAGS_input).c_str());
++  if (!absl::GetFlag(FLAGS_input).empty()) {
++    mozc::InputFileStream input(absl::GetFlag(FLAGS_input).c_str());
+     while (std::getline(input, line)) {
+       mozc::ParseLine(handler, line);
+     }
+diff --git session/session_handler_stress_test.cc session/session_handler_stress_test.cc
+index f54e42016..22cf72891 100644
+--- session/session_handler_stress_test.cc
++++ session/session_handler_stress_test.cc
+@@ -33,7 +33,6 @@
+ #include <vector>
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/port.h"
+ #include "engine/engine_factory.h"
+ #include "protocol/commands.pb.h"
+@@ -42,6 +41,7 @@
+ #include "session/session_handler_tool.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace {
+ uint32 GenerateRandomSeed() {
+@@ -52,7 +52,7 @@ uint32 GenerateRandomSeed() {
+ }  // namespace
+ 
+ // There is no DEFINE_uint32.
+-MOZC_FLAG(uint64, random_seed, GenerateRandomSeed(),
++ABSL_FLAG(uint64, random_seed, GenerateRandomSeed(),
+           "Random seed value. "
+           "This value will be interpreted as uint32.");
+ 
+@@ -71,7 +71,7 @@ TEST(SessionHandlerStressTest, BasicStressTest) {
+   ASSERT_TRUE(client.CreateSession());
+ 
+   const uint32 random_seed =
+-      static_cast<uint32>(mozc::GetFlag(FLAGS_random_seed));
++      static_cast<uint32>(absl::GetFlag(FLAGS_random_seed));
+   LOG(INFO) << "Random seed: " << random_seed;
+   session::RandomKeyEventsGenerator::InitSeed(random_seed);
+   while (keyevents_size < kMaxEventSize) {
+diff --git session/session_handler_test.cc session/session_handler_test.cc
+index 281ef0e90..92abaa457 100644
+--- session/session_handler_test.cc
++++ session/session_handler_test.cc
+@@ -36,7 +36,6 @@
+ #include <vector>
+ 
+ #include "base/clock_mock.h"
+-#include "base/flags.h"
+ #include "base/port.h"
+ #include "base/util.h"
+ #include "config/config_handler.h"
+@@ -53,12 +52,14 @@
+ #include "testing/base/public/gunit.h"
+ #include "usage_stats/usage_stats.h"
+ #include "usage_stats/usage_stats_testing_util.h"
++#include "absl/flags/declare.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+-MOZC_DECLARE_FLAG(int32, max_session_size);
+-MOZC_DECLARE_FLAG(int32, create_session_min_interval);
+-MOZC_DECLARE_FLAG(int32, last_command_timeout);
+-MOZC_DECLARE_FLAG(int32, last_create_session_timeout);
++ABSL_DECLARE_FLAG(int32, max_session_size);
++ABSL_DECLARE_FLAG(int32, create_session_min_interval);
++ABSL_DECLARE_FLAG(int32, last_command_timeout);
++ABSL_DECLARE_FLAG(int32, last_create_session_timeout);
+ 
+ namespace mozc {
+ 
+@@ -197,13 +198,13 @@ class SessionHandlerTest : public SessionHandlerTestBase {
+ TEST_F(SessionHandlerTest, MaxSessionSizeTest) {
+   uint32 expected_session_created_num = 0;
+   const int32 interval_time = 10;  // 10 sec
+-  mozc::SetFlag(&FLAGS_create_session_min_interval, interval_time);
++  absl::SetFlag(&FLAGS_create_session_min_interval, interval_time);
+   ClockMock clock(1000, 0);
+   Clock::SetClockForUnitTest(&clock);
+ 
+   // The oldest item is removed
+   const size_t session_size = 3;
+-  mozc::SetFlag(&FLAGS_max_session_size, static_cast<int32>(session_size));
++  absl::SetFlag(&FLAGS_max_session_size, static_cast<int32>(session_size));
+   {
+     SessionHandler handler(CreateMockDataEngine());
+ 
+@@ -227,7 +228,7 @@ TEST_F(SessionHandlerTest, MaxSessionSizeTest) {
+     }
+   }
+ 
+-  mozc::SetFlag(&FLAGS_max_session_size, static_cast<int32>(session_size));
++  absl::SetFlag(&FLAGS_max_session_size, static_cast<int32>(session_size));
+   {
+     SessionHandler handler(CreateMockDataEngine());
+ 
+@@ -265,7 +266,7 @@ TEST_F(SessionHandlerTest, MaxSessionSizeTest) {
+ 
+ TEST_F(SessionHandlerTest, CreateSessionMinInterval) {
+   const int32 interval_time = 10;  // 10 sec
+-  mozc::SetFlag(&FLAGS_create_session_min_interval, interval_time);
++  absl::SetFlag(&FLAGS_create_session_min_interval, interval_time);
+   ClockMock clock(1000, 0);
+   Clock::SetClockForUnitTest(&clock);
+ 
+@@ -286,7 +287,7 @@ TEST_F(SessionHandlerTest, CreateSessionMinInterval) {
+ 
+ TEST_F(SessionHandlerTest, LastCreateSessionTimeout) {
+   const int32 timeout = 10;  // 10 sec
+-  mozc::SetFlag(&FLAGS_last_create_session_timeout, timeout);
++  absl::SetFlag(&FLAGS_last_create_session_timeout, timeout);
+   ClockMock clock(1000, 0);
+   Clock::SetClockForUnitTest(&clock);
+ 
+@@ -306,7 +307,7 @@ TEST_F(SessionHandlerTest, LastCreateSessionTimeout) {
+ 
+ TEST_F(SessionHandlerTest, LastCommandTimeout) {
+   const int32 timeout = 10;  // 10 sec
+-  mozc::SetFlag(&FLAGS_last_command_timeout, timeout);
++  absl::SetFlag(&FLAGS_last_command_timeout, timeout);
+   ClockMock clock(1000, 0);
+   Clock::SetClockForUnitTest(&clock);
+ 
+diff --git session/session_handler_test_util.cc session/session_handler_test_util.cc
+index ce3a30596..dd94c41d0 100644
+--- session/session_handler_test_util.cc
++++ session/session_handler_test_util.cc
+@@ -33,7 +33,6 @@
+ 
+ #include "base/config_file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/system_util.h"
+ #include "config/character_form_manager.h"
+@@ -47,13 +46,15 @@
+ #include "session/session_usage_observer.h"
+ #include "storage/registry.h"
+ #include "testing/base/public/googletest.h"
++#include "absl/flags/declare.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_DECLARE_FLAG(int32, max_session_size);
+-MOZC_DECLARE_FLAG(int32, create_session_min_interval);
+-MOZC_DECLARE_FLAG(int32, watch_dog_interval);
+-MOZC_DECLARE_FLAG(int32, last_command_timeout);
+-MOZC_DECLARE_FLAG(int32, last_create_session_timeout);
+-MOZC_DECLARE_FLAG(bool, restricted);
++ABSL_DECLARE_FLAG(int32, max_session_size);
++ABSL_DECLARE_FLAG(int32, create_session_min_interval);
++ABSL_DECLARE_FLAG(int32, watch_dog_interval);
++ABSL_DECLARE_FLAG(int32, last_command_timeout);
++ABSL_DECLARE_FLAG(int32, last_create_session_timeout);
++ABSL_DECLARE_FLAG(bool, restricted);
+ 
+ namespace mozc {
+ namespace session {
+@@ -110,18 +111,18 @@ SessionHandlerTestBase::SessionHandlerTestBase() {}
+ SessionHandlerTestBase::~SessionHandlerTestBase() {}
+ 
+ void SessionHandlerTestBase::SetUp() {
+-  flags_max_session_size_backup_ = mozc::GetFlag(FLAGS_max_session_size);
++  flags_max_session_size_backup_ = absl::GetFlag(FLAGS_max_session_size);
+   flags_create_session_min_interval_backup_ =
+-      mozc::GetFlag(FLAGS_create_session_min_interval);
+-  flags_watch_dog_interval_backup_ = mozc::GetFlag(FLAGS_watch_dog_interval);
++      absl::GetFlag(FLAGS_create_session_min_interval);
++  flags_watch_dog_interval_backup_ = absl::GetFlag(FLAGS_watch_dog_interval);
+   flags_last_command_timeout_backup_ =
+-      mozc::GetFlag(FLAGS_last_command_timeout);
++      absl::GetFlag(FLAGS_last_command_timeout);
+   flags_last_create_session_timeout_backup_ =
+-      mozc::GetFlag(FLAGS_last_create_session_timeout);
+-  flags_restricted_backup_ = mozc::GetFlag(FLAGS_restricted);
++      absl::GetFlag(FLAGS_last_create_session_timeout);
++  flags_restricted_backup_ = absl::GetFlag(FLAGS_restricted);
+ 
+   user_profile_directory_backup_ = SystemUtil::GetUserProfileDirectory();
+-  SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++  SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   ConfigHandler::GetConfig(&config_backup_);
+   ClearState();
+ }
+@@ -131,15 +132,15 @@ void SessionHandlerTestBase::TearDown() {
+   ConfigHandler::SetConfig(config_backup_);
+   SystemUtil::SetUserProfileDirectory(user_profile_directory_backup_);
+ 
+-  mozc::SetFlag(&FLAGS_max_session_size, flags_max_session_size_backup_);
+-  mozc::SetFlag(&FLAGS_create_session_min_interval,
++  absl::SetFlag(&FLAGS_max_session_size, flags_max_session_size_backup_);
++  absl::SetFlag(&FLAGS_create_session_min_interval,
+                 flags_create_session_min_interval_backup_);
+-  mozc::SetFlag(&FLAGS_watch_dog_interval, flags_watch_dog_interval_backup_);
+-  mozc::SetFlag(&FLAGS_last_command_timeout,
++  absl::SetFlag(&FLAGS_watch_dog_interval, flags_watch_dog_interval_backup_);
++  absl::SetFlag(&FLAGS_last_command_timeout,
+                 flags_last_command_timeout_backup_);
+-  mozc::SetFlag(&FLAGS_last_create_session_timeout,
++  absl::SetFlag(&FLAGS_last_create_session_timeout,
+                 flags_last_create_session_timeout_backup_);
+-  mozc::SetFlag(&FLAGS_restricted, flags_restricted_backup_);
++  absl::SetFlag(&FLAGS_restricted, flags_restricted_backup_);
+ }
+ 
+ void SessionHandlerTestBase::ClearState() {
+diff --git session/session_regression_test.cc session/session_regression_test.cc
+index 2d64e9010..2b806fab3 100644
+--- session/session_regression_test.cc
++++ session/session_regression_test.cc
+@@ -35,7 +35,6 @@
+ #include <utility>
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "base/system_util.h"
+@@ -58,9 +57,11 @@
+ #include "session/session_handler.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/declare.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+-MOZC_DECLARE_FLAG(bool, use_history_rewriter);
++ABSL_DECLARE_FLAG(bool, use_history_rewriter);
+ 
+ namespace mozc {
+ namespace {
+@@ -91,10 +92,10 @@ void InitSessionToPrecomposition(session::Session *session) {
+ class SessionRegressionTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+ 
+-    orig_use_history_rewriter_ = mozc::GetFlag(FLAGS_use_history_rewriter);
+-    mozc::SetFlag(&FLAGS_use_history_rewriter, true);
++    orig_use_history_rewriter_ = absl::GetFlag(FLAGS_use_history_rewriter);
++    absl::SetFlag(&FLAGS_use_history_rewriter, true);
+ 
+     // Note: engine must be created after setting all the flags, as it
+     // internally depends on global flags, e.g., for creation of rewriters.
+@@ -117,7 +118,7 @@ class SessionRegressionTest : public ::testing::Test {
+     config::ConfigHandler::GetDefaultConfig(&config);
+     config::ConfigHandler::SetConfig(config);
+ 
+-    mozc::SetFlag(&FLAGS_use_history_rewriter, orig_use_history_rewriter_);
++    absl::SetFlag(&FLAGS_use_history_rewriter, orig_use_history_rewriter_);
+   }
+ 
+   bool SendKey(const std::string &key, commands::Command *command) {
+@@ -215,7 +216,7 @@ TEST_F(SessionRegressionTest, ConvertToTransliterationWithMultipleSegments) {
+ }
+ 
+ TEST_F(SessionRegressionTest,
+-       ExitTemporaryAlphanumModeAfterCommitingSugesstion) {
++       ExitTemporaryAlphanumModeAfterCommittingSugesstion) {
+   // This is a regression test against http://b/2977131.
+   {
+     InitSessionToPrecomposition(session_.get());
+@@ -247,7 +248,7 @@ TEST_F(SessionRegressionTest, HistoryLearning) {
+   std::string candidate1;
+   std::string candidate2;
+ 
+-  {  // First session.  Second candidate is commited.
++  {  // First session.  Second candidate is committed.
+     InsertCharacterChars("kanji", &command);
+ 
+     command.Clear();
+diff --git session/session_server_main.cc session/session_server_main.cc
+index e9eae5b1c..4956d517d 100644
+--- session/session_server_main.cc
++++ session/session_server_main.cc
+@@ -30,10 +30,10 @@
+ // Mocked Session Server runner used just for testing.
+ #include <cstdio>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "protocol/commands.pb.h"
+ #include "session/session_server.h"
++#include "absl/flags/flag.h"
+ #include "absl/strings/str_format.h"
+ 
+ static const int kMaxBufSize = 1024;
+diff --git session/session_server_test.cc session/session_server_test.cc
+index 3b1439113..7a64d543f 100644
+--- session/session_server_test.cc
++++ session/session_server_test.cc
+@@ -33,11 +33,11 @@
+ #include <string>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/scheduler.h"
+ #include "base/system_util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace {
+@@ -68,7 +68,7 @@ class JobRecorder : public Scheduler::SchedulerInterface {
+ class SessionServerTest : public testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+   }
+ };
+ 
+diff --git session/session_test.cc session/session_test.cc
+index c7c1296bc..2c44228b5 100644
+--- session/session_test.cc
++++ session/session_test.cc
+@@ -3212,7 +3212,7 @@ TEST_F(SessionTest, SpaceOnAlphanumeric) {
+ 
+   {
+     request.set_space_on_alphanumeric(
+-        commands::Request::SPACE_OR_CONVERT_COMMITING_COMPOSITION);
++        commands::Request::SPACE_OR_CONVERT_COMMITTING_COMPOSITION);
+ 
+     Session session(engine_.get());
+     InitSessionToPrecomposition(&session, request);
+@@ -3687,7 +3687,7 @@ TEST_F(SessionTest, InsertCharacterWithShiftKey) {
+   }
+ }
+ 
+-TEST_F(SessionTest, ExitTemporaryAlphanumModeAfterCommitingSugesstion) {
++TEST_F(SessionTest, ExitTemporaryAlphanumModeAfterCommittingSugesstion) {
+   // This is a unittest against http://b/2977131.
+   {
+     std::unique_ptr<Session> session(new Session(engine_.get()));
+@@ -8638,7 +8638,7 @@ TEST_F(SessionTest, CancelInPasswordMode_Issue5955618) {
+     InitSessionToConversionWithAiueo(&session);
+     SwitchInputFieldType(commands::Context::PASSWORD, &session);
+ 
+-    // Actualy this works well because Cancel command in conversion mode
++    // Actually this works well because Cancel command in conversion mode
+     // is mapped into ConvertCancel not EditCancel.
+     commands::Command command;
+     EXPECT_TRUE(TestSendKey("ESC", &session, &command));
+@@ -8664,7 +8664,7 @@ TEST_F(SessionTest, CancelInPasswordMode_Issue5955618) {
+     SetupMockForReverseConversion("[MO]", "MO");
+     EXPECT_TRUE(session.SendCommand(&command));
+ 
+-    // Actualy this works well because Cancel command in conversion mode
++    // Actually this works well because Cancel command in conversion mode
+     // is mapped into ConvertCancel not EditCancel.
+     EXPECT_TRUE(TestSendKey("ESC", &session, &command));
+     EXPECT_TRUE(command.output().consumed());
+@@ -8890,7 +8890,7 @@ TEST_F(SessionTest, SuppressSuggestion) {
+   SendKey("d", &session, &command);
+   EXPECT_TRUE(command.output().has_candidates());
+ 
+-  // With an invalid identifer.  It should be the same with the
++  // With an invalid identifier.  It should be the same with the
+   // default behavior.
+   SetSendKeyCommand("i", &command);
+   command.mutable_input()->mutable_context()->add_experimental_features(
+diff --git session/session_usage_observer.cc session/session_usage_observer.cc
+index e78135318..42ac1f3c3 100644
+--- session/session_usage_observer.cc
++++ session/session_usage_observer.cc
+@@ -101,13 +101,13 @@ bool IsSessionIndependentCommand(commands::Input::CommandType type) {
+ }  // namespace
+ 
+ SessionUsageObserver::SessionUsageObserver() {
+-  // Explicitly calls Sync() to delete usage stats existing data inlcuding
++  // Explicitly calls Sync() to delete usage stats existing data including
+   // metadata for migration.
+   UsageStats::Sync();
+ }
+ 
+ SessionUsageObserver::~SessionUsageObserver() {
+-  // Explicitly calls Sync() to delete usage stats existing data inlcuding
++  // Explicitly calls Sync() to delete usage stats existing data including
+   // metadata for migration.
+   UsageStats::Sync();
+ }
+diff --git session/session_usage_observer.h session/session_usage_observer.h
+index 0667e77d1..ba754fa1e 100644
+--- session/session_usage_observer.h
++++ session/session_usage_observer.h
+@@ -103,7 +103,7 @@ class SessionUsageObserver : public SessionObserverInterface {
+ 
+   // last_touchevents_ is used to keep the touch_events of last SEND_KEY
+   // message.
+-  // When the subsequent command will be recieved, if the command is BACKSPACE
++  // When the subsequent command will be received, if the command is BACKSPACE
+   // last_touchevents_ will be aggregated to miss_touch_event_stat_cache_,
+   // if the command is not BACKSPACE last_touchevents_ will be aggregated to
+   // touch_event_stat_cache_.
+diff --git session/session_usage_observer_test.cc session/session_usage_observer_test.cc
+index 337a910f7..1b858e880 100644
+--- session/session_usage_observer_test.cc
++++ session/session_usage_observer_test.cc
+@@ -34,7 +34,6 @@
+ 
+ #include "base/clock.h"
+ #include "base/clock_mock.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/scheduler.h"
+ #include "base/scheduler_stub.h"
+@@ -48,6 +47,7 @@
+ #include "usage_stats/usage_stats.h"
+ #include "usage_stats/usage_stats.pb.h"
+ #include "usage_stats/usage_stats_testing_util.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ using mozc::usage_stats::Stats;
+@@ -59,7 +59,7 @@ namespace session {
+ class SessionUsageObserverTest : public testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     UsageStats::ClearAllStatsForTest();
+ 
+     Clock::SetClockForUnitTest(nullptr);
+diff --git storage/BUILD storage/BUILD
+index 5d55b0a8e..93fa640f1 100644
+--- storage/BUILD
++++ storage/BUILD
+@@ -109,11 +109,11 @@ cc_test_mozc(
+         "//base:clock_mock",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -161,9 +161,9 @@ cc_test_mozc(
+         ":tiny_storage",
+         "//base",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:port",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings:str_format",
+     ],
+ )
+@@ -216,9 +216,9 @@ cc_test_mozc(
+     deps = [
+         ":registry",
+         "//base",
+-        "//base:flags",
+         "//base:system_util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -246,10 +246,10 @@ cc_test_mozc(
+         ":encrypted_string_storage",
+         "//base:file_stream",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:system_util",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/memory",
+     ],
+ )
+diff --git storage/encrypted_string_storage_test.cc storage/encrypted_string_storage_test.cc
+index 0ddaeb456..c4e0b4d8e 100644
+--- storage/encrypted_string_storage_test.cc
++++ storage/encrypted_string_storage_test.cc
+@@ -34,11 +34,11 @@
+ 
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/system_util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ #include "absl/memory/memory.h"
+ 
+ namespace mozc {
+@@ -82,7 +82,7 @@ typedef EncryptedStringStorage TestEncryptedStringStorage;
+ class EncryptedStringStorageTest : public testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     filename_ = FileUtil::JoinPath(SystemUtil::GetUserProfileDirectory(),
+                                    "encrypted_string_storage_for_test.db");
+ 
+@@ -122,7 +122,7 @@ TEST_F(EncryptedStringStorageTest, Encrypt) {
+   ASSERT_TRUE(ifs.eof());
+   const std::string result(buf, read_size);
+ 
+-  // Saved stirng is longer than original string since it has some data
++  // Saved string is longer than original string since it has some data
+   // used for encryption.
+   EXPECT_LT(original_data.size(), result.size());
+   EXPECT_TRUE(result.find(original_data) == std::string::npos);
+diff --git storage/existence_filter_main.cc storage/existence_filter_main.cc
+index e2731b4a0..cfdcda837 100644
+--- storage/existence_filter_main.cc
++++ storage/existence_filter_main.cc
+@@ -29,12 +29,12 @@
+ 
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "base/util.h"
+ #include "storage/existence_filter.h"
++#include "absl/flags/flag.h"
+ 
+ using mozc::storage::ExistenceFilter;
+ 
+diff --git storage/lru_cache_main.cc storage/lru_cache_main.cc
+index 61372ec23..e8a8e33e6 100644
+--- storage/lru_cache_main.cc
++++ storage/lru_cache_main.cc
+@@ -30,10 +30,10 @@
+ #include <iostream>  // NOLINT
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/util.h"
+ #include "storage/lru_cache.h"
++#include "absl/flags/flag.h"
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+diff --git storage/lru_storage.h storage/lru_storage.h
+index 03e31af5c..4a85c4502 100644
+--- storage/lru_storage.h
++++ storage/lru_storage.h
+@@ -54,7 +54,7 @@ class LRUStorage {
+   bool Open(const char *filename);
+   void Close();
+ 
+-  // Try to open exisiting database
++  // Try to open existing database
+   // If the file is broken or cannot open, tries to recreate
+   // new file
+   bool OpenOrCreate(const char *filename, size_t new_value_size,
+diff --git storage/lru_storage_main.cc storage/lru_storage_main.cc
+index 7dd758ab0..92d5b9276 100644
+--- storage/lru_storage_main.cc
++++ storage/lru_storage_main.cc
+@@ -29,29 +29,29 @@
+ 
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "base/util.h"
+ #include "storage/lru_storage.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(bool, create_db, false, "initialize database");
+-MOZC_FLAG(string, file, "test.db", "");
+-MOZC_FLAG(int32, size, 10, "size");
++ABSL_FLAG(bool, create_db, false, "initialize database");
++ABSL_FLAG(std::string, file, "test.db", "");
++ABSL_FLAG(int32, size, 10, "size");
+ 
+ using mozc::storage::LRUStorage;
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+ 
+-  if (mozc::GetFlag(FLAGS_create_db)) {
++  if (absl::GetFlag(FLAGS_create_db)) {
+     CHECK(LRUStorage::CreateStorageFile(FLAGS_file.c_str(),
+                                         static_cast<uint32>(4),
+-                                        mozc::GetFlag(FLAGS_size), 0xff02));
++                                        absl::GetFlag(FLAGS_size), 0xff02));
+   }
+ 
+   LRUStorage s;
+-  CHECK(s.Open(mozc::GetFlag(FLAGS_file).c_str()));
++  CHECK(s.Open(absl::GetFlag(FLAGS_file).c_str()));
+ 
+   LOG(INFO) << "size=" << s.size();
+   LOG(INFO) << "used_size=" << s.used_size();
+diff --git storage/lru_storage_test.cc storage/lru_storage_test.cc
+index 90f3c189c..37dfd2f1d 100644
+--- storage/lru_storage_test.cc
++++ storage/lru_storage_test.cc
+@@ -38,13 +38,13 @@
+ #include "base/clock_mock.h"
+ #include "base/file_stream.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/port.h"
+ #include "base/util.h"
+ #include "storage/lru_cache.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace storage {
+@@ -137,7 +137,7 @@ class LRUStorageTest : public ::testing::Test {
+ 
+   static std::string GetTemporaryFilePath() {
+     // This name should be unique to each test.
+-    return FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir),
++    return FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir),
+                               "LRUStorageTest_test.db");
+   }
+ 
+@@ -245,7 +245,7 @@ TEST_F(LRUStorageTest, Merge) {
+ 
+   {
+     // Need to mock clock because old entries are removed on Open.  The maximum
+-    // timestmap set below is 50, so set the current time to 100.
++    // timestamp set below is 50, so set the current time to 100.
+     ScopedClockMock clock(100, 0);
+ 
+     LRUStorage::CreateStorageFile(file1.c_str(), 4, 8, kSeed);
+@@ -288,7 +288,7 @@ TEST_F(LRUStorageTest, Merge) {
+   // same FP
+   {
+     // Need to mock clock because old entries are removed on Open.  The maximum
+-    // timestmap set below is 50, so set the current time to 100.
++    // timestamp set below is 50, so set the current time to 100.
+     ScopedClockMock clock(100, 0);
+ 
+     LRUStorage::CreateStorageFile(file1.c_str(), 4, 8, kSeed);
+diff --git storage/registry_test.cc storage/registry_test.cc
+index 4e14d9616..a4c3d11ca 100644
+--- storage/registry_test.cc
++++ storage/registry_test.cc
+@@ -31,16 +31,16 @@
+ 
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/system_util.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace storage {
+ 
+ TEST(RegistryTest, TinyStorageTest) {
+-  SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++  SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+ 
+   {
+     uint64 value = 20;
+diff --git storage/storage_interface.h storage/storage_interface.h
+index c691a733d..3b6524adf 100644
+--- storage/storage_interface.h
++++ storage/storage_interface.h
+@@ -56,15 +56,15 @@ class StorageInterface {
+ 
+   // Looks up key and returns the value.
+   // If key is not found, returns false.
+-  // It is not guranteed that the data is synced to the disk.
++  // It is not guaranteed that the data is synced to the disk.
+   virtual bool Lookup(const std::string &key, std::string *value) const = 0;
+ 
+   // Inserts key and value.
+-  // It is not guranteed that the data is synced to the disk.
++  // It is not guaranteed that the data is synced to the disk.
+   virtual bool Insert(const std::string &key, const std::string &value) = 0;
+ 
+   // Erases the key-value pair specified by |key|.
+-  // It is not guranteed that the data is synced to the disk
++  // It is not guaranteed that the data is synced to the disk
+   virtual bool Erase(const std::string &key) = 0;
+ 
+   // clears internal keys and values
+diff --git storage/tiny_storage.h storage/tiny_storage.h
+index 6bbcdb8c0..3a9c1c7b7 100644
+--- storage/tiny_storage.h
++++ storage/tiny_storage.h
+@@ -42,7 +42,7 @@ namespace storage {
+ // We will replace it with faster and more robust implementation.
+ class TinyStorage {
+  public:
+-  // Returns an implementatoin of StorageInterface.
++  // Returns an implementation of StorageInterface.
+   // Caller must take ownership of the returned object.
+   // Returns NULL if fails.
+   static StorageInterface *New();
+diff --git storage/tiny_storage_test.cc storage/tiny_storage_test.cc
+index e8f5a3a32..755ecca00 100644
+--- storage/tiny_storage_test.cc
++++ storage/tiny_storage_test.cc
+@@ -37,11 +37,11 @@
+ #include <vector>
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/port.h"
+ #include "storage/storage_interface.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ #include "absl/strings/str_format.h"
+ 
+ namespace mozc {
+@@ -80,7 +80,7 @@ class TinyStorageTest : public testing::Test {
+ 
+   static std::string GetTemporaryFilePath() {
+     // This name should be unique to each test.
+-    return FileUtil::JoinPath(mozc::GetFlag(FLAGS_test_tmpdir),
++    return FileUtil::JoinPath(absl::GetFlag(FLAGS_test_tmpdir),
+                               "TinyStorageTest_test.db");
+   }
+ 
+diff --git testing/BUILD testing/BUILD
+index b840b33c0..2aed40512 100644
+--- testing/BUILD
++++ testing/BUILD
+@@ -77,7 +77,7 @@ cc_library_mozc(
+     deps = [
+         ":gunit",
+         "//base",
+-        "//base:flags",
++        "@com_google_absl//absl/flags:flag",
+     ] + select_mozc(
+         client = [
+             "//base:init_mozc",
+@@ -154,7 +154,7 @@ cc_library_mozc(
+             "//base",
+             "//base:logging",
+             "//base:file_util",
+-            "//base:flags",
++            "@com_google_absl//absl/flags:flag",
+             "//base:util",
+         ],
+         default = ["//testing/base/public:gunit_for_library_testonly"],
+@@ -173,11 +173,11 @@ cc_library_mozc(
+         ":googletest",
+         "//base",
+         "//base:file_util",
+-        "//base:flags",
+         "//base:logging",
+         "//base:port",
+         "//base:system_util",
+         "//base:util",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings",
+     ],
+ )
+diff --git testing/base/internal/googletest.cc testing/base/internal/googletest.cc
+index a3610a2f4..e64ce2448 100644
+--- testing/base/internal/googletest.cc
++++ testing/base/internal/googletest.cc
+@@ -40,17 +40,18 @@
+ #include <string>
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/util.h"
++#include "absl/flags/declare.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, test_srcdir, "",
++ABSL_FLAG(std::string, test_srcdir, "",
+           "A directory that contains the input data files for a test.");
+ 
+-MOZC_FLAG(string, test_tmpdir, "",
++ABSL_FLAG(std::string, test_tmpdir, "",
+           "Directory for all temporary testing files.");
+ 
+-MOZC_DECLARE_FLAG(string, program_invocation_name);
++ABSL_DECLARE_FLAG(string, program_invocation_name);
+ 
+ namespace mozc {
+ namespace {
+@@ -95,7 +96,7 @@ string GetTestTmpdir() {
+ // directory information. E.g like "/spam/eggs/foo_unittest".
+ string GetProgramPath() {
+   const string& program_invocation_name =
+-      mozc::GetFlag(FLAGS_program_invocation_name);
++      absl::GetFlag(FLAGS_program_invocation_name);
+   if (program_invocation_name.empty() || program_invocation_name[0] == '/') {
+     return program_invocation_name;
+   }
+@@ -144,11 +145,11 @@ string GetTestTmpdir() {
+ }  // namespace
+ 
+ void InitTestFlags() {
+-  if (mozc::GetFlag(FLAGS_test_srcdir).empty()) {
+-    mozc::SetFlag(&FLAGS_test_srcdir, GetTestSrcdir());
++  if (absl::GetFlag(FLAGS_test_srcdir).empty()) {
++    absl::SetFlag(&FLAGS_test_srcdir, GetTestSrcdir());
+   }
+-  if (mozc::GetFlag(FLAGS_test_tmpdir).empty()) {
+-    mozc::SetFlag(&FLAGS_test_tmpdir, GetTestTmpdir());
++  if (absl::GetFlag(FLAGS_test_tmpdir).empty()) {
++    absl::SetFlag(&FLAGS_test_tmpdir, GetTestTmpdir());
+   }
+ }
+ 
+diff --git testing/base/internal/gtest_main.cc testing/base/internal/gtest_main.cc
+index b6666ff0d..b753339b3 100644
+--- testing/base/internal/gtest_main.cc
++++ testing/base/internal/gtest_main.cc
+@@ -28,10 +28,10 @@
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
++#include "absl/flags/flag.h"
+ 
+ int main(int argc, char **argv) {
+   // TODO(yukawa, team): Implement b/2805528 so that you can specify any option
+diff --git testing/base/public/googletest.h testing/base/public/googletest.h
+index ed1fa238d..2fa5513aa 100644
+--- testing/base/public/googletest.h
++++ testing/base/public/googletest.h
+@@ -30,7 +30,8 @@
+ #ifndef MOZC_TESTING_BASE_PUBLIC_GOOGLETEST_H_
+ #define MOZC_TESTING_BASE_PUBLIC_GOOGLETEST_H_
+ 
+-#include "base/flags.h"
++#include "absl/flags/declare.h"
++#include "absl/flags/flag.h"
+ 
+ // gunit doesn't expose test_srcdir and test_tmpdir on mobile platforms like
+ // Android.
+@@ -38,13 +39,13 @@
+ // --test_srcdir is the path to a directory that contains the input data files
+ // for a test, so that each entry in the 'data' section of the BUILD rule for
+ // this test specifies a path relative to FLAGS_test_srcdir.
+-MOZC_DECLARE_FLAG(string, test_srcdir);
++ABSL_DECLARE_FLAG(std::string, test_srcdir);
+ 
+ // --test_tmpdir is a temporary directory that you can write to from inside a
+ // test.  Files you write will eventually be cleaned up but you can see them at
+ // ~/local/tmp in the immediate aftermath of the test.  These files are
+ // stored on local disk, not on the networked filer.
+-MOZC_DECLARE_FLAG(string, test_tmpdir);
++ABSL_DECLARE_FLAG(std::string, test_tmpdir);
+ 
+ namespace mozc {
+ // Initialize FLAGS_test_srcdir and FLAGS_test_tmpdir.
+diff --git testing/base/public/mozctest.cc testing/base/public/mozctest.cc
+index 6e30fc48f..25f42c379 100644
+--- testing/base/public/mozctest.cc
++++ testing/base/public/mozctest.cc
+@@ -30,18 +30,18 @@
+ #include "testing/base/public/mozctest.h"
+ 
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/system_util.h"
+ #include "base/util.h"
+ #include "testing/base/public/googletest.h"
++#include "absl/flags/flag.h"
+ #include "absl/strings/string_view.h"
+ 
+ namespace mozc {
+ namespace testing {
+ 
+ std::string GetSourcePath(const std::vector<absl::string_view> &components) {
+-  const std::string test_srcdir = mozc::GetFlag(FLAGS_test_srcdir);
++  const std::string test_srcdir = absl::GetFlag(FLAGS_test_srcdir);
+   std::vector<absl::string_view> abs_components = { test_srcdir };
+ 
+   const char *workspace = std::getenv("TEST_WORKSPACE");
+@@ -83,7 +83,7 @@ std::vector<std::string> GetSourceFilesInDirOrDie(
+ 
+ ScopedTmpUserProfileDirectory::ScopedTmpUserProfileDirectory()
+     : original_dir_(SystemUtil::GetUserProfileDirectory()) {
+-  SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++  SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+ }
+ 
+ ScopedTmpUserProfileDirectory::~ScopedTmpUserProfileDirectory() {
+diff --git tools/build_defs/qt.bzl tools/build_defs/qt.bzl
+index 0a1ee34e8..14e676b47 100644
+--- tools/build_defs/qt.bzl
++++ tools/build_defs/qt.bzl
+@@ -117,7 +117,7 @@ def macos_qt_application_mozc(name, bundle_name, deps):
+         app_icons = ["//data/images/mac:product_icon.icns"],
+         bundle_id = MACOS_BUNDLE_ID_PREFIX + ".Tool." + bundle_name,
+         bundle_name = bundle_name,
+-        infoplists = ["//gui:gen_mozc_tool_info_plist"],
++        infoplists = ["//gui:mozc_tool_info_plist"],
+         minimum_os_version = MACOS_MIN_OS_VER,
+         resources = ["//data/images/mac:candidate_window_logo.tiff"],
+         visibility = ["//:__subpackages__"],
+diff --git tools/cc_target_os/BUILD tools/cc_target_os/BUILD
+index 6a6ac82d2..ee11dd19b 100644
+--- tools/cc_target_os/BUILD
++++ tools/cc_target_os/BUILD
+@@ -104,3 +104,10 @@ config_setting(
+         "define": "TARGET=wasm",
+     },
+ )
++
++config_setting(
++    name = "windows",
++    values = {
++        "define": "TARGET=windows",
++    },
++)
+diff --git unix/emacs/BUILD unix/emacs/BUILD
+index f73fd970a..bc1224a48 100644
+--- unix/emacs/BUILD
++++ unix/emacs/BUILD
+@@ -48,7 +48,6 @@ cc_binary_mozc(
+     deps = [
+         ":mozc_emacs_helper_lib",
+         "//base",
+-        "//base:flags",
+         "//base:init_mozc",
+         "//base:logging",
+         "//base:util",
+@@ -57,6 +56,7 @@ cc_binary_mozc(
+         "//config:config_handler",
+         "//ipc",
+         "//protocol:commands_proto",
++        "@com_google_absl//absl/flags:flag",
+         "@com_google_absl//absl/strings:str_format",
+     ],
+ )
+diff --git unix/emacs/mozc_emacs_helper.cc unix/emacs/mozc_emacs_helper.cc
+index 562b23221..3416547da 100644
+--- unix/emacs/mozc_emacs_helper.cc
++++ unix/emacs/mozc_emacs_helper.cc
+@@ -30,7 +30,6 @@
+ #include <cstdio>
+ #include <iostream>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/util.h"
+@@ -40,9 +39,10 @@
+ #include "protocol/commands.pb.h"
+ #include "unix/emacs/client_pool.h"
+ #include "unix/emacs/mozc_emacs_helper_lib.h"
++#include "absl/flags/flag.h"
+ #include "absl/strings/str_format.h"
+ 
+-MOZC_FLAG(bool, suppress_stderr, false, "Discards all the output to stderr.");
++ABSL_FLAG(bool, suppress_stderr, false, "Discards all the output to stderr.");
+ 
+ namespace {
+ 
+@@ -125,7 +125,7 @@ void ProcessLoop() {
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+-  if (mozc::GetFlag(FLAGS_suppress_stderr)) {
++  if (absl::GetFlag(FLAGS_suppress_stderr)) {
+ #ifdef OS_WIN
+     const char path[] = "NUL";
+ #else
+diff --git unix/emacs/mozc_emacs_helper_lib.h unix/emacs/mozc_emacs_helper_lib.h
+index 22ecffb08..775e6eb2d 100644
+--- unix/emacs/mozc_emacs_helper_lib.h
++++ unix/emacs/mozc_emacs_helper_lib.h
+@@ -110,7 +110,7 @@ void ErrorExit(const std::string &error, const std::string &message);
+ // Removes unused usage information from output protocol buffers.
+ // Usage data may contain line breaks, which have not been supported yet for IPC
+ // in S-expression. Only single line S-expressions are supported so far.
+-// This function retuns true if usage data is removed.
++// This function returns true if usage data is removed.
+ bool RemoveUsageData(mozc::commands::Output *output);
+ 
+ }  // namespace emacs
+diff --git unix/ibus/BUILD unix/ibus/BUILD
+index ea7d08346..62d6f84c3 100644
+--- unix/ibus/BUILD
++++ unix/ibus/BUILD
+@@ -229,8 +229,8 @@ cc_binary_mozc(
+         ":ibus_mozc_lib",
+         ":ibus_mozc_metadata",
+         "//base",
+-        "//base:flags",
+         "//base:init_mozc",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+diff --git unix/ibus/key_translator_test.cc unix/ibus/key_translator_test.cc
+index a39d51e57..0664abc0b 100644
+--- unix/ibus/key_translator_test.cc
++++ unix/ibus/key_translator_test.cc
+@@ -216,7 +216,7 @@ TEST_F(KeyTranslatorTest, TranslateSingleModifierMasks) {
+   // keyboard are not assigned Shift-0 character. So that, we expect the client
+   // send keycode='0'(\x30) with shift modifier, but currently only send
+   // keycode='0'. There are few difficulties because the mapping of Shift-0 are
+-  // controled xkb in X11, but the way to get the mapping is unclear.
++  // controlled xkb in X11, but the way to get the mapping is unclear.
+ 
+   // ALT modifier
+   // M-F1
+@@ -507,7 +507,7 @@ TEST_F(KeyTranslatorTest, MultipleShiftKeysTest) {
+   IsContained(commands::KeyEvent::SHIFT, out.modifier_keys());
+ }
+ 
+-TEST_F(KeyTranslatorTest, TranslateUnknow) {
++TEST_F(KeyTranslatorTest, TranslateUnknown) {
+   commands::KeyEvent out;
+   EXPECT_FALSE(translator_->Translate(IBUS_VoidSymbol, 0, 0,
+                                       config::Config::ROMAN, true, &out));
+diff --git unix/ibus/main.cc unix/ibus/main.cc
+index b7852cbb4..6813d131a 100644
+--- unix/ibus/main.cc
++++ unix/ibus/main.cc
+@@ -27,20 +27,21 @@
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
++#include "unix/ibus/main.h"
++
+ #include <cstddef>
+ #include <cstdio>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/logging.h"
+ #include "base/version.h"
+ #include "unix/ibus/ibus_config.h"
+-#include "unix/ibus/main.h"
+ #include "unix/ibus/mozc_engine.h"
+ #include "unix/ibus/path_util.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(bool, ibus, false, "The engine is started by ibus-daemon");
+-MOZC_FLAG(bool, xml, false, "Output xml data for the engine.");
++ABSL_FLAG(bool, ibus, false, "The engine is started by ibus-daemon");
++ABSL_FLAG(bool, xml, false, "Output xml data for the engine.");
+ 
+ namespace {
+ 
+@@ -119,13 +120,13 @@ void OutputXml() {
+ 
+ int main(gint argc, gchar **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+-  if (mozc::GetFlag(FLAGS_xml)) {
++  if (absl::GetFlag(FLAGS_xml)) {
+     OutputXml();
+     return 0;
+   }
+ 
+   ibus_init();
+-  InitIBusComponent(mozc::GetFlag(FLAGS_ibus));
++  InitIBusComponent(absl::GetFlag(FLAGS_ibus));
+ #ifndef MOZC_NO_LOGGING
+   EnableVerboseLog();
+ #endif  // MOZC_NO_LOGGING
+diff --git unix/ibus/main_stub.cc unix/ibus/main_stub.cc
+index 48bb490da..29214a801 100644
+--- unix/ibus/main_stub.cc
++++ unix/ibus/main_stub.cc
+@@ -29,11 +29,11 @@
+ 
+ #include <iostream>
+ 
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "unix/ibus/ibus_config.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(bool, xml, false, "Output xml data for the engine.");
++ABSL_FLAG(bool, xml, false, "Output xml data for the engine.");
+ 
+ namespace {
+ void OutputXml() {
+@@ -44,7 +44,7 @@ void OutputXml() {
+ 
+ int main(int argc, char **argv) {
+   mozc::InitMozc(argv[0], &argc, &argv);
+-  if (mozc::GetFlag(FLAGS_xml)) {
++  if (absl::GetFlag(FLAGS_xml)) {
+     OutputXml();
+     return 0;
+   }
+diff --git unix/ibus/mozc_engine.cc unix/ibus/mozc_engine.cc
+index be82541b2..8db7fd8c7 100644
+--- unix/ibus/mozc_engine.cc
++++ unix/ibus/mozc_engine.cc
+@@ -40,7 +40,6 @@
+ #include "base/clock.h"
+ #include "base/const.h"
+ #include "base/file_util.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/singleton.h"
+ #include "base/system_util.h"
+@@ -58,6 +57,7 @@
+ #include "unix/ibus/preedit_handler.h"
+ #include "unix/ibus/property_handler.h"
+ #include "unix/ibus/surrounding_text_util.h"
++#include "absl/flags/flag.h"
+ 
+ #ifdef ENABLE_GTK_RENDERER
+ #include "renderer/renderer_client.h"
+@@ -69,7 +69,7 @@
+ #endif  // MOZC_ENABLE_X11_SELECTION_MONITOR
+ 
+ #ifdef ENABLE_GTK_RENDERER
+-MOZC_FLAG(bool, use_mozc_renderer, true,
++ABSL_FLAG(bool, use_mozc_renderer, true,
+           "The engine tries to use mozc_renderer if available.");
+ #endif  // ENABLE_GTK_RENDERER
+ 
+@@ -221,7 +221,7 @@ std::unique_ptr<client::ClientInterface> CreateAndConfigureClient() {
+ #ifdef ENABLE_GTK_RENDERER
+ CandidateWindowHandlerInterface *createGtkCandidateWindowHandler(
+     ::mozc::renderer::RendererClient *renderer_client) {
+-  if (!mozc::GetFlag(FLAGS_use_mozc_renderer)) {
++  if (!absl::GetFlag(FLAGS_use_mozc_renderer)) {
+     return nullptr;
+   }
+   if (GetEnv("XDG_SESSION_TYPE") == "wayland") {
+diff --git usage_stats/BUILD usage_stats/BUILD
+index 4f1ce5116..ffc592f0c 100644
+--- usage_stats/BUILD
++++ usage_stats/BUILD
+@@ -86,7 +86,6 @@ cc_test_mozc(
+     deps = [
+         ":usage_stats",
+         ":usage_stats_proto",
+-        "//base:flags",
+         "//base:port",
+         "//base:system_util",
+         "//config:stats_config_util",
+@@ -94,6 +93,7 @@ cc_test_mozc(
+         "//storage:registry",
+         "//storage:storage_interaface",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+@@ -123,12 +123,12 @@ cc_test_mozc(
+         ":usage_stats_testing_util",
+         ":usage_stats_uploader",
+         "//base",
+-        "//base:flags",
+         "//base:port",
+         "//base:system_util",
+         "//base:version",
+         "//storage:registry",
+         "//testing:gunit_main",
++        "@com_google_absl//absl/flags:flag",
+     ],
+ )
+ 
+diff --git usage_stats/usage_stats.h usage_stats/usage_stats.h
+index 8b71d785a..0729d43f2 100644
+--- usage_stats/usage_stats.h
++++ usage_stats/usage_stats.h
+@@ -80,7 +80,7 @@ class UsageStats {
+   // Synchronizes (writes) usage data into disk. Returns false on failure.
+   static bool Sync();
+ 
+-  // Clears existing data exept for Integer and Boolean stats.
++  // Clears existing data except for Integer and Boolean stats.
+   static void ClearStats();
+ 
+   // Clears all data.
+diff --git usage_stats/usage_stats_test.cc usage_stats/usage_stats_test.cc
+index 4debfd226..f8d0fea70 100644
+--- usage_stats/usage_stats_test.cc
++++ usage_stats/usage_stats_test.cc
+@@ -32,7 +32,6 @@
+ #include <map>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/port.h"
+ #include "base/system_util.h"
+ #include "config/stats_config_util.h"
+@@ -42,6 +41,7 @@
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
+ #include "usage_stats/usage_stats.pb.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace usage_stats {
+@@ -49,7 +49,7 @@ namespace usage_stats {
+ class UsageStatsTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     EXPECT_TRUE(storage::Registry::Clear());
+     mozc::config::StatsConfigUtil::SetHandler(&stats_config_util_);
+   }
+diff --git usage_stats/usage_stats_uploader_test.cc usage_stats/usage_stats_uploader_test.cc
+index 9586135c5..fe376c631 100644
+--- usage_stats/usage_stats_uploader_test.cc
++++ usage_stats/usage_stats_uploader_test.cc
+@@ -35,7 +35,6 @@
+ #include <utility>
+ #include <vector>
+ 
+-#include "base/flags.h"
+ #include "base/port.h"
+ #include "base/system_util.h"
+ #include "base/version.h"
+@@ -43,6 +42,7 @@
+ #include "testing/base/public/googletest.h"
+ #include "testing/base/public/gunit.h"
+ #include "usage_stats/usage_stats.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace usage_stats {
+@@ -63,7 +63,7 @@ void SetUpMetaData(uint32 last_upload_time) {
+ class UsageStatsUploaderTest : public ::testing::Test {
+  protected:
+   void SetUp() override {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     EXPECT_TRUE(storage::Registry::Clear());
+   }
+ 
+diff --git win32/base/accessible_object_info.h win32/base/accessible_object_info.h
+index ade941773..52e69ff85 100644
+--- win32/base/accessible_object_info.h
++++ win32/base/accessible_object_info.h
+@@ -40,10 +40,10 @@ namespace win32 {
+ struct AccessibleObjectInfo {
+   AccessibleObjectInfo();
+ 
+-  string role;  // utf8
++  std::string role;  // utf8
+   bool is_builtin_role;
+-  string name;   // utf8
+-  string value;  // utf8
++  std::string name;   // utf8
++  std::string value;  // utf8
+ };
+ 
+ }  // namespace win32
+diff --git win32/base/browser_info.cc win32/base/browser_info.cc
+index 1bccec4e2..4fb1bb0bf 100644
+--- win32/base/browser_info.cc
++++ win32/base/browser_info.cc
+@@ -113,26 +113,26 @@ bool BrowserInfo::IsInIncognitoMode(
+     return false;
+   }
+ 
+-  const char *sufix_ja = nullptr;
+-  const char *sufix_en = nullptr;
++  const char *suffix_ja = nullptr;
++  const char *suffix_en = nullptr;
+   switch (GetBrowerType()) {
+     case kBrowserTypeChrome:
+-      sufix_ja = "(シークレット モード)";
+-      sufix_en = "(Incognito)";
++      suffix_ja = "(シークレット モード)";
++      suffix_en = "(Incognito)";
+       break;
+     case kBrowserTypeFirefox:
+-      sufix_ja = " (プライベートブラウジング)";
+-      sufix_en = "(Private Browsing)";
++      suffix_ja = " (プライベートブラウジング)";
++      suffix_en = "(Private Browsing)";
+       break;
+     case kBrowserTypeIE:
+-      sufix_ja = "[InPrivate]";
+-      sufix_en = "[InPrivate]";
++      suffix_ja = "[InPrivate]";
++      suffix_en = "[InPrivate]";
+       break;
+   }
+-  if (sufix_ja != nullptr && Util::EndsWith(root_window_name, sufix_ja)) {
++  if (suffix_ja != nullptr && Util::EndsWith(root_window_name, suffix_ja)) {
+     return true;
+   }
+-  if (sufix_en != nullptr && Util::EndsWith(root_window_name, sufix_en)) {
++  if (suffix_en != nullptr && Util::EndsWith(root_window_name, suffix_en)) {
+     return true;
+   }
+   return false;
+diff --git win32/base/focus_hierarchy_observer.h win32/base/focus_hierarchy_observer.h
+index faa5173a0..beb3e438c 100644
+--- win32/base/focus_hierarchy_observer.h
++++ win32/base/focus_hierarchy_observer.h
+@@ -46,8 +46,8 @@ class FocusHierarchyObserver {
+   struct WindowInfo {
+     WindowInfo();
+     HWND window_handle;
+-    string title;       // utf8
+-    string class_name;  // utf8
++    std::string title;       // utf8
++    std::string class_name;  // utf8
+     DWORD process_id;
+   };
+ 
+@@ -57,7 +57,7 @@ class FocusHierarchyObserver {
+   virtual bool IsAbailable() const = 0;
+   virtual std::vector<AccessibleObjectInfo> GetUIHierarchy() const = 0;
+   virtual std::vector<WindowInfo> GetWindowHierarchy() const = 0;
+-  virtual string GetRootWindowName() const = 0;
++  virtual std::string GetRootWindowName() const = 0;
+ 
+   static FocusHierarchyObserver *Create();
+   static void OnDllProcessAttach(HINSTANCE module_handle, bool static_loading);
+diff --git win32/base/input_dll.h win32/base/input_dll.h
+index 4cbaf28e4..4c7204bed 100644
+--- win32/base/input_dll.h
++++ win32/base/input_dll.h
+@@ -32,7 +32,7 @@
+ 
+ #include <windows.h>
+ 
+-// Structures and flags bellow have not been included header files in Windows
++// Structures and flags below have not been included header files in Windows
+ // SDK.  You can see the original source of this information at the following
+ // page.
+ // - http://msdn.microsoft.com/en-us/library/bb847907.aspx
+@@ -183,7 +183,7 @@ extern "C" __declspec(dllimport) BOOL WINAPI
+ //     FALSE: An unspecified error occurred.
+ //   Observational Facts:
+ //     This API seems to be designed to modify per user settings, like HKCU,
+-//     so that the current user can modify it with his/her privileges.  In
++//     so that the current user can modify it with their privileges.  In
+ //     oother words, no administrative privilege is required.
+ //     SetDefaultLayoutOrTipUserReg might be a phantom, which only exists in
+ //     MSDN Library.
+diff --git win32/base/keyevent_handler.cc win32/base/keyevent_handler.cc
+index a627b386f..8913706a9 100644
+--- win32/base/keyevent_handler.cc
++++ win32/base/keyevent_handler.cc
+@@ -521,7 +521,7 @@ bool ConvertToKeyEventMain(const VirtualKey &virtual_key, BYTE scan_code,
+   //    VK_A         -> 'a'
+   //    VK_A + SHIFT -> '('
+   // Unfortunately, the current Mozc protocol cannot handle these cases because
+-  // there is serious ambiguity betwen 'Key' and 'Character' in Mozc key
++  // there is serious ambiguity between 'Key' and 'Character' in Mozc key
+   // bindings.
+   const bool is_vk_alpha =
+       ('A' <= virtual_key.virtual_key() && virtual_key.virtual_key() <= 'Z');
+@@ -924,7 +924,7 @@ bool KeyEventHandler::ConvertToKeyEvent(
+     const InputState &ime_state, const KeyboardStatus &keyboard_status,
+     Win32KeyboardInterface *keyboard, mozc::commands::KeyEvent *key) {
+   // Since Mozc protocol requires tricky conditions for modifiers, using set
+-  // container makes the the main part of key event conversion simple rather
++  // container makes the main part of key event conversion simple rather
+   // than using vector-like container.
+   std::set<KeyEvent::ModifierKey> modifiers;
+   const bool result = ConvertToKeyEventMain(
+diff --git win32/base/keyevent_handler_test.cc win32/base/keyevent_handler_test.cc
+index e3e326522..86d779c59 100644
+--- win32/base/keyevent_handler_test.cc
++++ win32/base/keyevent_handler_test.cc
+@@ -27,6 +27,8 @@
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
++#include "win32/base/keyevent_handler.h"
++
+ // clang-format off
+ #include <windows.h>
+ #include <ime.h>
+@@ -36,7 +38,6 @@
+ #include <memory>
+ #include <string>
+ 
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/system_util.h"
+ #include "base/version.h"
+@@ -48,7 +49,7 @@
+ #include "testing/base/public/gunit.h"
+ #include "win32/base/input_state.h"
+ #include "win32/base/keyboard.h"
+-#include "win32/base/keyevent_handler.h"
++#include "absl/flags/flag.h"
+ 
+ namespace mozc {
+ namespace win32 {
+@@ -245,7 +246,7 @@ class KeyEventHandlerTest : public testing::Test {
+   KeyEventHandlerTest() {}
+   virtual ~KeyEventHandlerTest() {}
+   virtual void SetUp() {
+-    SystemUtil::SetUserProfileDirectory(mozc::GetFlag(FLAGS_test_tmpdir));
++    SystemUtil::SetUserProfileDirectory(absl::GetFlag(FLAGS_test_tmpdir));
+     mozc::config::ConfigHandler::GetDefaultConfig(&default_config_);
+     mozc::config::ConfigHandler::SetConfig(default_config_);
+   }
+diff --git win32/base/string_util.h win32/base/string_util.h
+index cbedd8c50..49d640e4f 100644
+--- win32/base/string_util.h
++++ win32/base/string_util.h
+@@ -58,7 +58,7 @@ class StringUtil {
+ 
+   // Returns a UTF8 string converted from the result of KeyToReading.
+   // This function is mainly for unittest.
+-  static string KeyToReadingA(absl::string_view key);
++  static std::string KeyToReadingA(absl::string_view key);
+ 
+   // Joins all segment strings in |preedit| and returns it.
+   static std::wstring ComposePreeditText(
+diff --git win32/base/surrogate_pair_observer.h win32/base/surrogate_pair_observer.h
+index 911071cc3..702e4932e 100644
+--- win32/base/surrogate_pair_observer.h
++++ win32/base/surrogate_pair_observer.h
+@@ -44,7 +44,7 @@ class SurrogatePairObserver {
+   // Return code which represents the expected action of the IME DLL.
+   enum ClientActionType {
+     // This key event is not a VK_PACKET-related event.
+-    // The the caller must do the default action.
++    // The caller must do the default action.
+     DO_DEFAULT_ACTION = 0,
+     // This key event is a VK_PACKET-related event.
+     // The caller replace the VirtualKey instance with new one which conatins
+diff --git win32/base/uninstall_helper.h win32/base/uninstall_helper.h
+index dda9d7960..3d9ac63e0 100644
+--- win32/base/uninstall_helper.h
++++ win32/base/uninstall_helper.h
+@@ -79,7 +79,7 @@ class UninstallHelper {
+   // settings.  Please beware that this method touches HKCU hive especially
+   // when you call this method from a custom action.  If you call this
+   // function from the deferred custom action which does not use
+-  // impersonation, it is highly recomended to set true for
++  // impersonation, it is highly recommended to set true for
+   // |disable_hkcu_cache| so that HKCU points HKU/.Default as expected.
+   static bool EnsureIMEIsRemovedForCurrentUser(bool disable_hkcu_cache);
+ 
+diff --git win32/broker/ime_switcher.cc win32/broker/ime_switcher.cc
+index 40d4abea4..e8a6218ff 100644
+--- win32/broker/ime_switcher.cc
++++ win32/broker/ime_switcher.cc
+@@ -33,7 +33,6 @@
+ #include <vector>
+ 
+ #include "base/const.h"
+-#include "base/flags.h"
+ #include "base/logging.h"
+ #include "base/process_mutex.h"
+ #include "base/scoped_handle.h"
+@@ -45,8 +44,9 @@
+ #include "win32/base/imm_registrar.h"
+ #include "win32/base/imm_util.h"
+ #include "win32/base/migration_util.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(bool, set_default_do_not_ask_again, false,
++ABSL_FLAG(bool, set_default_do_not_ask_again, false,
+           "Set true if SetDefaultDialog should not be displayed again.");
+ 
+ namespace mozc {
+@@ -144,7 +144,7 @@ int RunSetDefaultWin8() {
+     return kErrorLevelGeneralError;
+   }
+ 
+-  if (mozc::GetFlag(FLAGS_set_default_do_not_ask_again)) {
++  if (absl::GetFlag(FLAGS_set_default_do_not_ask_again)) {
+     if (!ClearCheckDefault()) {
+       // Notify the error to user but never treat this as an error.
+       NotifyFatalMessage("ClearCheckDefault() failed.", __LINE__);
+@@ -183,7 +183,7 @@ int RunSetDefault(int argc, char *argv[]) {
+     return kErrorLevelGeneralError;
+   }
+ 
+-  if (mozc::GetFlag(FLAGS_set_default_do_not_ask_again)) {
++  if (absl::GetFlag(FLAGS_set_default_do_not_ask_again)) {
+     if (!ClearCheckDefault()) {
+       // Notify the error to user but never treat this as an error.
+       NotifyFatalMessage("ClearCheckDefault() failed.", __LINE__);
+diff --git win32/broker/mozc_broker.rc win32/broker/mozc_broker.rc
+index 7f625b4e1..8448fbe59 100644
+Binary files win32/broker/mozc_broker.rc and win32/broker/mozc_broker.rc differ
+diff --git win32/broker/mozc_broker_main.cc win32/broker/mozc_broker_main.cc
+index 954c30042..6abd2343d 100644
+--- win32/broker/mozc_broker_main.cc
++++ win32/broker/mozc_broker_main.cc
+@@ -32,15 +32,15 @@
+ #endif  // OS_WIN
+ 
+ #include "base/crash_report_handler.h"
+-#include "base/flags.h"
+ #include "base/init_mozc.h"
+ #include "base/system_util.h"
+ #ifdef OS_WIN
+ #include "base/winmain.h"
+ #endif  // OS_WIN
+ #include "config/stats_config_util.h"
++#include "absl/flags/flag.h"
+ 
+-MOZC_FLAG(string, mode, "", "mozc_broker mode");
++ABSL_FLAG(std::string, mode, "", "mozc_broker mode");
+ 
+ #ifdef OS_WIN
+ namespace mozc {
+@@ -66,13 +66,13 @@ int main(int argc, char *argv[]) {
+ 
+   int result = 0;
+ #ifdef OS_WIN
+-  if (mozc::GetFlag(FLAGS_mode) == "register_ime") {
++  if (absl::GetFlag(FLAGS_mode) == "register_ime") {
+     result = mozc::win32::RunRegisterIME(argc, argv);
+-  } else if (mozc::GetFlag(FLAGS_mode) == "set_default") {
++  } else if (absl::GetFlag(FLAGS_mode) == "set_default") {
+     result = mozc::win32::RunSetDefault(argc, argv);
+-  } else if (mozc::GetFlag(FLAGS_mode) == "unregister_ime") {
++  } else if (absl::GetFlag(FLAGS_mode) == "unregister_ime") {
+     result = mozc::win32::RunUnregisterIME(argc, argv);
+-  } else if (mozc::GetFlag(FLAGS_mode) == "prelaunch_processes") {
++  } else if (absl::GetFlag(FLAGS_mode) == "prelaunch_processes") {
+     result = mozc::win32::RunPrelaunchProcesses(argc, argv);
+   }
+ #endif  // OS_WIN
+diff --git win32/custom_action/custom_action.h win32/custom_action/custom_action.h
+index b4f461d4f..8633c32d6 100644
+--- win32/custom_action/custom_action.h
++++ win32/custom_action/custom_action.h
+@@ -96,7 +96,7 @@ UINT __stdcall InitialInstallationCommit(MSIHANDLE msi_handle);
+ // RestoreServiceState.
+ // Since they are executed as deferred customs actions and most properties
+ // cannot be accessible from a deferred custom action, it is necessary to store
+-// these data explictly to CustomCationData.
++// these data explicitly to CustomCationData.
+ UINT __stdcall SaveCustomActionData(MSIHANDLE msi_handle);
+ 
+ // Restore the settings of the cache service as it was.
+diff --git win32/custom_action/custom_action.rc win32/custom_action/custom_action.rc
+index a395f6ee2..5f818c8ce 100644
+Binary files win32/custom_action/custom_action.rc and win32/custom_action/custom_action.rc differ
+diff --git win32/ime/GoogleIMEJa.rc win32/ime/GoogleIMEJa.rc
+index fac32bb7c..5cd73c21f 100644
+Binary files win32/ime/GoogleIMEJa.rc and win32/ime/GoogleIMEJa.rc differ
+diff --git win32/ime/ime_candidate_info_test.cc win32/ime/ime_candidate_info_test.cc
+index 32a2d73f1..2b5c11495 100644
+--- win32/ime/ime_candidate_info_test.cc
++++ win32/ime/ime_candidate_info_test.cc
+@@ -104,11 +104,11 @@ const int32 kIDs[kNumCandidates] = {
+     0, 1, 2, 3, 4, 5, 6, 7, -1, -2, -3, -7, -11,
+ };
+ 
+-class ScopedCanidateInfoBuffer {
++class ScopedCandidateInfoBuffer {
+  public:
+-  explicit ScopedCanidateInfoBuffer(size_t size)
++  explicit ScopedCandidateInfoBuffer(size_t size)
+       : header_(static_cast<CANDIDATEINFO *>(Allocate(size))) {}
+-  ~ScopedCanidateInfoBuffer() { ::HeapFree(::GetProcessHeap(), 0, header_); }
++  ~ScopedCandidateInfoBuffer() { ::HeapFree(::GetProcessHeap(), 0, header_); }
+   const CANDIDATEINFO *header() const { return header_; }
+   CANDIDATEINFO *mutable_header() { return header_; }
+   const CANDIDATELIST *GetList(int candidate_list_no) const {
+@@ -133,7 +133,7 @@ class ScopedCanidateInfoBuffer {
+   }
+   CANDIDATEINFO *header_;
+ 
+-  DISALLOW_COPY_AND_ASSIGN(ScopedCanidateInfoBuffer);
++  DISALLOW_COPY_AND_ASSIGN(ScopedCandidateInfoBuffer);
+ };
+ 
+ // TODO(yukawa): Make a common library for this function.
+@@ -529,7 +529,7 @@ TEST(CandidateInfoUtilTest, WriteResultTest) {
+   CandidateInfo info;
+   EXPECT_TRUE(CandidateInfoUtil::Convert(output, &info));
+ 
+-  ScopedCanidateInfoBuffer buffer(info.candidate_info_size);
++  ScopedCandidateInfoBuffer buffer(info.candidate_info_size);
+   CandidateInfoUtil::Write(info, buffer.mutable_header());
+ 
+   EXPECT_CANDIDATEINFO(330, 1, sizeof(CANDIDATEINFO), 0, 0, buffer.header());
+@@ -558,7 +558,7 @@ TEST(CandidateInfoUtilTest, PagingEmulation_Issue4077022) {
+   CandidateInfo info;
+   EXPECT_TRUE(CandidateInfoUtil::Convert(output, &info));
+ 
+-  ScopedCanidateInfoBuffer buffer(info.candidate_info_size);
++  ScopedCandidateInfoBuffer buffer(info.candidate_info_size);
+   CandidateInfoUtil::Write(info, buffer.mutable_header());
+ 
+   EXPECT_CANDIDATEINFO(330, 1, sizeof(CANDIDATEINFO), 0, 0, buffer.header());
+@@ -573,7 +573,7 @@ TEST(CandidateInfoUtilTest, WriteSafeDefaultTest) {
+   CandidateInfo info;
+   CandidateInfoUtil::SetSafeDefault(&info);
+ 
+-  ScopedCanidateInfoBuffer buffer(info.candidate_info_size);
++  ScopedCandidateInfoBuffer buffer(info.candidate_info_size);
+   CandidateInfoUtil::Write(info, buffer.mutable_header());
+ 
+   EXPECT_CANDIDATEINFO(sizeof(CANDIDATEINFO) + sizeof(CANDIDATELIST), 1,
+diff --git win32/ime/ime_composition_string.cc win32/ime/ime_composition_string.cc
+index ed1a22fc7..0bdcf5c9c 100644
+--- win32/ime/ime_composition_string.cc
++++ win32/ime/ime_composition_string.cc
+@@ -116,7 +116,7 @@ bool CompositionString::Update(const mozc::commands::Output &output,
+     // In OOo, we need this message to restore caret status.
+     // We should not send this null-WM_IME_COMPOSITION when
+     // |info.dwResultStrLen != 0|.  Otherwise, the result string will be
+-    // commited twice in wordpad.exe.
++    // committed twice in wordpad.exe.
+     if (info.dwResultStrLen == 0) {
+       messages->push_back(UIMessage(WM_IME_COMPOSITION, 0, 0));
+     }
+diff --git win32/ime/ime_composition_string.h win32/ime/ime_composition_string.h
+index 746eca7a2..50daeec00 100644
+--- win32/ime/ime_composition_string.h
++++ win32/ime/ime_composition_string.h
+@@ -99,9 +99,9 @@ struct CompositionString {
+   FRIEND_TEST(ImeCompositionStringTest,
+               EndCompositionWhenCompositionBecomesEmpty);
+   FRIEND_TEST(ImeCompositionStringTest,
+-              EndCompositionWhenCompositionIsCommited);
++              EndCompositionWhenCompositionIsCommitted);
+   FRIEND_TEST(ImeCompositionStringTest,
+-              EndCompositionWhenCompositionIsCommitedWithPreedit);
++              EndCompositionWhenCompositionIsCommittedWithPreedit);
+   FRIEND_TEST(ImeCompositionStringTest, SpaceKeyWhenIMEIsTurnedOn_Issue3200585);
+   FRIEND_TEST(ImeCompositionStringTest, Suggest);
+   FRIEND_TEST(ImeCompositionStringTest, Predict);
+diff --git win32/ime/ime_composition_string_test.cc win32/ime/ime_composition_string_test.cc
+index 68762a37a..0d3cf4e16 100644
+--- win32/ime/ime_composition_string_test.cc
++++ win32/ime/ime_composition_string_test.cc
+@@ -555,9 +555,9 @@ TEST(ImeCompositionStringTest, EndCompositionWhenCompositionBecomesEmpty) {
+   EXPECT_EQ(0, compstr.info.dwResultStrLen);
+ }
+ 
+-TEST(ImeCompositionStringTest, EndCompositionWhenCompositionIsCommited) {
++TEST(ImeCompositionStringTest, EndCompositionWhenCompositionIsCommitted) {
+   // WM_IME_COMPOSITION should be sent up to once.
+-  // Otherwise, the result string will be commited twice in wordpad.exe.
++  // Otherwise, the result string will be committed twice in wordpad.exe.
+ 
+   CompositionString compstr;
+   EXPECT_TRUE(compstr.Initialize());
+@@ -666,9 +666,9 @@ TEST(ImeCompositionStringTest, SpaceKeyWhenIMEIsTurnedOn_Issue3200585) {
+ }
+ 
+ TEST(ImeCompositionStringTest,
+-     EndCompositionWhenCompositionIsCommitedWithPreedit) {
++     EndCompositionWhenCompositionIsCommittedWithPreedit) {
+   // WM_IME_COMPOSITION should be sent up to once.
+-  // Otherwise, the result string will be commited twice in wordpad.exe.
++  // Otherwise, the result string will be committed twice in wordpad.exe.
+ 
+   CompositionString compstr;
+   EXPECT_TRUE(compstr.Initialize());
+diff --git win32/ime/ime_core.cc win32/ime/ime_core.cc
+index e16785268..4cd9cb8c5 100644
+--- win32/ime/ime_core.cc
++++ win32/ime/ime_core.cc
+@@ -626,7 +626,7 @@ bool ImeCore::UpdateContextMain(HIMC himc, const InputState &next_state,
+ 
+   if (generate_message) {
+     // In order to minimize the risk of application compatibility problem,
+-    // we might want to send these messages in the the same order to MS-IME.
++    // we might want to send these messages in the same order to MS-IME.
+     // See b/3488848 for details.
+     std::vector<UIMessage> sorted_messages;
+     SortIMEMessages(composition_messages, candidate_messages, previous_open,
+diff --git win32/ime/ime_core.h win32/ime/ime_core.h
+index 6c998ada7..7be02c79f 100644
+--- win32/ime/ime_core.h
++++ win32/ime/ime_core.h
+@@ -217,7 +217,7 @@ class ImeCore {
+ 
+   // Returns the target string in UTF8 for the reconversion invoked by IME.
+   // Returns an empty string if the target strin is not available.
+-  static string GetTextForReconversionFromIME(HIMC himc);
++  static std::string GetTextForReconversionFromIME(HIMC himc);
+ 
+   FRIEND_TEST(ImeCoreTest, TemporalConversionModeMessageOrderTest);
+   FRIEND_TEST(ImeCoreTest, CandidateMessageOrderTest);
+diff --git win32/ime/ime_language_bar.cc win32/ime/ime_language_bar.cc
+index 8a4ca264d..ba5334cbe 100644
+--- win32/ime/ime_language_bar.cc
++++ win32/ime/ime_language_bar.cc
+@@ -47,7 +47,7 @@ using ATL::CComQIPtr;
+ namespace {
+ // The GUID of the help menu in the system language bar.
+ // TODO(mazda): Confirm this GUID is valid permanently for the system help menu
+-// since the GUID was programatically obtained.
++// since the GUID was programmatically obtained.
+ // It is confirmed that the GUID is valid on Windows XP SP2 and Windows Vista.
+ // {ED9D5450-EBE6-4255-8289-F8A31E687228}
+ const GUID kSystemLangBarHelpMenu = {
+diff --git win32/ime/ime_language_bar_menu.cc win32/ime/ime_language_bar_menu.cc
+index ee1c3ad02..7e2ad5c23 100644
+--- win32/ime/ime_language_bar_menu.cc
++++ win32/ime/ime_language_bar_menu.cc
+@@ -139,9 +139,9 @@ HICON LoadIconFromResource(HINSTANCE instance, UINT icon_id_for_non_theme,
+ 
+ // Retrieves the bitmap handle loaded by using an icon ID.
+ // Returns true if the specified icons is available as bitmaps.
+-// Caller can set nullptr for |color| and/or |mask| to represent not to recieve
++// Caller can set nullptr for |color| and/or |mask| to represent not to receive
+ // the specified handle even if it exists.  Caller should releases any returned
+-// bitmap handle and this function releases any handle which is not recieved
++// bitmap handle and this function releases any handle which is not received
+ // by the caller.
+ bool LoadIconAsBitmap(HINSTANCE instance, UINT icon_id_for_non_theme,
+                       UINT icon_id_for_theme, HBITMAP* color, HBITMAP* mask) {
+@@ -260,7 +260,7 @@ STDAPI ImeLangBarMenu::GetInfo(TF_LANGBARITEMINFO* item_info) {
+ }
+ 
+ // Implements the ITfLangBarItem::GetStatus() function.
+-// This fucntion is called by Windows to retrieve the current status of this
++// This function is called by Windows to retrieve the current status of this
+ // button menu.
+ STDAPI ImeLangBarMenu::GetStatus(DWORD* status) {
+   *status = status_;
+@@ -271,7 +271,7 @@ STDAPI ImeLangBarMenu::GetStatus(DWORD* status) {
+ // This function is called by Windows to notify the display status of this
+ // button menu has been updated.
+ STDAPI ImeLangBarMenu::Show(BOOL show) {
+-  // Just return becasue this button is always shown, i.e. we do not have to
++  // Just return because this button is always shown, i.e. we do not have to
+   // manage the display state of this button menu.
+   return E_NOTIMPL;
+ }
+@@ -295,14 +295,14 @@ STDAPI ImeLangBarMenu::OnClick(TfLBIClick click, POINT point,
+ }
+ 
+ // Implements the ITfLangBarItemButton::GetText() function.
+-// This function is called by Windows to retrive the text label of this
++// This function is called by Windows to retrieve the text label of this
+ // button menu.
+ STDAPI ImeLangBarMenu::GetText(BSTR* text) {
+   *text = ::SysAllocString(&item_info_.szDescription[0]);
+   return (*text ? S_OK : E_OUTOFMEMORY);
+ }
+ 
+-// Implements the ITfSource::AdviseSink() funtion.
++// Implements the ITfSource::AdviseSink() function.
+ STDAPI ImeLangBarMenu::AdviseSink(REFIID interface_id, IUnknown* unknown,
+                                   DWORD* cookie) {
+   // Return if the caller tries to start advising any events except the
+diff --git win32/ime/ime_ui_visibility_tracker_test.cc win32/ime/ime_ui_visibility_tracker_test.cc
+index 7be77ae70..08be7fd0e 100644
+--- win32/ime/ime_ui_visibility_tracker_test.cc
++++ win32/ime/ime_ui_visibility_tracker_test.cc
+@@ -124,7 +124,7 @@ TEST(ImeUIVisibilityTrackerTest,
+ }
+ 
+ // When a user changes the input method by the LangBar, WM_IME_SETCONTEXT will
+-// not be sent.  Even in this case, the candiate window can be visible,
++// not be sent.  Even in this case, the candidate window can be visible,
+ // without any focus change, which finally invokes ImeSetActiveContext.
+ TEST(ImeUIVisibilityTrackerTest,
+      CandidateWindowCanBeShownWhenImeIsChangedByLangBar) {
+diff --git win32/ime/ime_ui_window.cc win32/ime/ime_ui_window.cc
+index b4506aa27..ba37b8e7e 100644
+--- win32/ime/ime_ui_window.cc
++++ win32/ime/ime_ui_window.cc
+@@ -82,7 +82,7 @@ using WTL::CRect;
+ using ::mozc::renderer::win32::Win32RendererClient;
+ using ::std::unique_ptr;
+ 
+-// True if the the DLL received DLL_PROCESS_DETACH notification.
++// True if the DLL received DLL_PROCESS_DETACH notification.
+ volatile bool g_module_unloaded = false;
+ 
+ // As filed in b/3088049 or b/4271156, the IME module (e.g. GIMEJa.ime) is
+@@ -979,7 +979,7 @@ class DefaultUIWindow {
+ //   [N] kMessageReceiverMessageName / SELECT_CANDIDATE
+ //                      any other message(s)
+ //
+-//   In this case, messages from [1] to [3] can be removed and and start
++//   In this case, messages from [1] to [3] can be removed and start
+ //   handling the message [4] as if it the handler just received it.
+ //
+ //
+@@ -992,7 +992,7 @@ class DefaultUIWindow {
+ //   [N] kMessageReceiverMessageName / HIGHLIGHT_CANDIDATE
+ //                      any other message(s)
+ //
+-//   In this case, messages from [1] to [2] can be removed and and start
++//   In this case, messages from [1] to [2] can be removed and start
+ //   handling the message [4] as if it the handler just received it.
+ //
+ //
+diff --git win32/tip/tip_candidate_list_test.cc win32/tip/tip_candidate_list_test.cc
+index 689a502b7..2cd3c60ed 100644
+--- win32/tip/tip_candidate_list_test.cc
++++ win32/tip/tip_candidate_list_test.cc
+@@ -108,14 +108,14 @@ std::wstring ToWStr(const CComBSTR &bstr) {
+ 
+ AssertionResult ExpectCandidateString(ULONG expected_index,
+                                       const std::wstring &expected_text,
+-                                      CComPtr<ITfCandidateString> candiate) {
+-  if (candiate == nullptr) {
++                                      CComPtr<ITfCandidateString> candidate) {
++  if (candidate == nullptr) {
+     return AssertionFailure() << "|actual| should be non-null";
+   }
+   HRESULT hr = S_OK;
+   {
+     ULONG index = 0;
+-    hr = candiate->GetIndex(&index);
++    hr = candidate->GetIndex(&index);
+     if (FAILED(hr)) {
+       return AssertionFailure() << "ITfCandidateString::GetIndex failed."
+                                 << " hr = " << hr;
+@@ -127,7 +127,7 @@ AssertionResult ExpectCandidateString(ULONG expected_index,
+   }
+   {
+     CComBSTR str;
+-    hr = candiate->GetString(&str);
++    hr = candidate->GetString(&str);
+     if (FAILED(hr)) {
+       return AssertionFailure() << "ITfCandidateString::GetString failed."
+                                 << " hr = " << hr;
+@@ -144,7 +144,7 @@ AssertionResult ExpectCandidateString(ULONG expected_index,
+ #define EXPECT_CANDIDATE_STR(expected_index, expected_str, actual) \
+   EXPECT_PRED3(ExpectCandidateString, expected_index, expected_str, actual)
+ 
+-TEST(TipCandidateListTest, EmptyCandiate) {
++TEST(TipCandidateListTest, EmptyCandidate) {
+   MockCallbackResult result;
+ 
+   std::vector<std::wstring> empty;
+@@ -177,7 +177,7 @@ TEST(TipCandidateListTest, EmptyCandiate) {
+   EXPECT_FALSE(result.on_finalize_called());
+ }
+ 
+-TEST(TipCandidateListTest, NonEmptyCandiates) {
++TEST(TipCandidateListTest, NonEmptyCandidates) {
+   MockCallbackResult result;
+ 
+   std::vector<std::wstring> source;
+diff --git win32/tip/tip_edit_session_impl.cc win32/tip/tip_edit_session_impl.cc
+index 6ad73ed71..e8fcee526 100644
+--- win32/tip/tip_edit_session_impl.cc
++++ win32/tip/tip_edit_session_impl.cc
+@@ -154,7 +154,7 @@ CComPtr<ITfComposition> CreateComposition(TipTextService *text_service,
+ //      interpreted as the "committed text".
+ //   4. Update the caret position explicitly. Note that some applications
+ //      such as WPF's TextBox do not update the caret position automatically
+-//      when an composition is commited.
++//      when an composition is committed.
+ // See also b/8406545 and b/9747361.
+ CComPtr<ITfComposition> CommitText(TipTextService *text_service,
+                                    ITfContext *context,
+diff --git win32/tip/tip_lang_bar_menu.cc win32/tip/tip_lang_bar_menu.cc
+index 0edc32198..2c715660f 100644
+--- win32/tip/tip_lang_bar_menu.cc
++++ win32/tip/tip_lang_bar_menu.cc
+@@ -138,9 +138,9 @@ HICON LoadIconFromResource(HINSTANCE instance, UINT icon_id_for_non_theme,
+ 
+ // Retrieves the bitmap handle loaded by using an icon ID.
+ // Returns true if the specified icons is available as bitmaps.
+-// Caller can set nullptr for |color| and/or |mask| to represent not to recieve
++// Caller can set nullptr for |color| and/or |mask| to represent not to receive
+ // the specified handle even if it exists.  Caller should releases any returned
+-// bitmap handle and this function releases any handle which is not recieved
++// bitmap handle and this function releases any handle which is not received
+ // by the caller.
+ bool LoadIconAsBitmap(HINSTANCE instance, UINT icon_id_for_non_theme,
+                       UINT icon_id_for_theme, HBITMAP *color, HBITMAP *mask) {
+@@ -267,7 +267,7 @@ STDMETHODIMP TipLangBarButton::GetInfo(TF_LANGBARITEMINFO *item_info) {
+ }
+ 
+ // Implements the ITfLangBarItem::GetStatus() function.
+-// This fucntion is called by Windows to retrieve the current status of this
++// This function is called by Windows to retrieve the current status of this
+ // button menu.
+ STDMETHODIMP TipLangBarButton::GetStatus(DWORD *status) {
+   *status = status_;
+@@ -278,7 +278,7 @@ STDMETHODIMP TipLangBarButton::GetStatus(DWORD *status) {
+ // This function is called by Windows to notify the display status of this
+ // button menu has been updated.
+ STDMETHODIMP TipLangBarButton::Show(BOOL show) {
+-  // Just return becasue this button is always shown, i.e. we do not have to
++  // Just return because this button is always shown, i.e. we do not have to
+   // manage the display state of this button menu.
+   return E_NOTIMPL;
+ }
+@@ -371,14 +371,14 @@ STDMETHODIMP TipLangBarButton::OnClick(TfLBIClick click, POINT point,
+ }
+ 
+ // Implements the ITfLangBarItemButton::GetText() function.
+-// This function is called by Windows to retrive the text label of this
++// This function is called by Windows to retrieve the text label of this
+ // button menu.
+ STDMETHODIMP TipLangBarButton::GetText(BSTR *text) {
+   *text = ::SysAllocString(&item_info_.szDescription[0]);
+   return (*text ? S_OK : E_OUTOFMEMORY);
+ }
+ 
+-// Implements the ITfSource::AdviseSink() funtion.
++// Implements the ITfSource::AdviseSink() function.
+ STDMETHODIMP TipLangBarButton::AdviseSink(REFIID interface_id,
+                                           IUnknown *unknown, DWORD *cookie) {
+   // Return if the caller tries to start advising any events except the
+diff --git win32/tip/tip_reconvert_function.cc win32/tip/tip_reconvert_function.cc
+index 77d408a9c..6f0231153 100644
+--- win32/tip/tip_reconvert_function.cc
++++ win32/tip/tip_reconvert_function.cc
+@@ -134,7 +134,7 @@ class ReconvertFunctionImpl : public ITfFnReconversion {
+   // The ITfFnReconversion interface method.
+   virtual HRESULT STDMETHODCALLTYPE QueryRange(ITfRange *range,
+                                                ITfRange **new_range,
+-                                               BOOL *convertable) {
++                                               BOOL *convertible) {
+     if (range == nullptr) {
+       return E_INVALIDARG;
+     }
+@@ -142,10 +142,10 @@ class ReconvertFunctionImpl : public ITfFnReconversion {
+       return E_INVALIDARG;
+     }
+     BOOL dummy_bool = FALSE;
+-    if (convertable == nullptr) {
+-      convertable = &dummy_bool;
++    if (convertible == nullptr) {
++      convertible = &dummy_bool;
+     }
+-    *convertable = FALSE;
++    *convertible = FALSE;
+     *new_range = nullptr;
+ 
+     CComPtr<ITfContext> context;
+@@ -160,7 +160,7 @@ class ReconvertFunctionImpl : public ITfFnReconversion {
+ 
+     if (info.in_composition) {
+       // on-going composition is found.
+-      *convertable = FALSE;
++      *convertible = FALSE;
+       *new_range = nullptr;
+       return S_OK;
+     }
+@@ -168,7 +168,7 @@ class ReconvertFunctionImpl : public ITfFnReconversion {
+     if (info.selected_text.find(static_cast<wchar_t>(TS_CHAR_EMBEDDED)) !=
+         std::wstring::npos) {
+       // embedded object is found.
+-      *convertable = FALSE;
++      *convertible = FALSE;
+       *new_range = nullptr;
+       return S_OK;
+     }
+@@ -176,7 +176,7 @@ class ReconvertFunctionImpl : public ITfFnReconversion {
+     if (FAILED(range->Clone(new_range))) {
+       return E_FAIL;
+     }
+-    *convertable = TRUE;
++    *convertible = TRUE;
+     return S_OK;
+   }
+ 
+diff --git win32/tip/tip_resource.rc win32/tip/tip_resource.rc
+index d9b24ea7e..640277e0d 100644
+Binary files win32/tip/tip_resource.rc and win32/tip/tip_resource.rc differ
+diff --git win32/tip/tip_surrounding_text.cc win32/tip/tip_surrounding_text.cc
+index d42c065c0..ed5f9235d 100644
+--- win32/tip/tip_surrounding_text.cc
++++ win32/tip/tip_surrounding_text.cc
+@@ -148,14 +148,14 @@ class SurroudingTextUpdater : public ITfEditSession {
+     const TF_HALTCOND halt_cond = {nullptr, TF_ANCHOR_START, TF_HF_OBJECT};
+ 
+     {
+-      CComPtr<ITfRange> preceeding_range;
+-      LONG preceeding_range_shifted = 0;
+-      if (SUCCEEDED(selected_range->Clone(&preceeding_range)) &&
+-          SUCCEEDED(preceeding_range->Collapse(edit_cookie, TF_ANCHOR_START)) &&
+-          SUCCEEDED(preceeding_range->ShiftStart(
+-              edit_cookie, -kMaxSurroundingLength, &preceeding_range_shifted,
++      CComPtr<ITfRange> preceding_range;
++      LONG preceding_range_shifted = 0;
++      if (SUCCEEDED(selected_range->Clone(&preceding_range)) &&
++          SUCCEEDED(preceding_range->Collapse(edit_cookie, TF_ANCHOR_START)) &&
++          SUCCEEDED(preceding_range->ShiftStart(
++              edit_cookie, -kMaxSurroundingLength, &preceding_range_shifted,
+               &halt_cond))) {
+-        result = TipRangeUtil::GetText(preceeding_range, edit_cookie,
++        result = TipRangeUtil::GetText(preceding_range, edit_cookie,
+                                        &result_.preceding_text);
+         result_.has_preceding_text = SUCCEEDED(result);
+       }
+@@ -241,11 +241,11 @@ class PrecedingTextDeleter : public ITfEditSession {
+ 
+     const TF_HALTCOND halt_cond = {nullptr, TF_ANCHOR_START, 0};
+ 
+-    CComPtr<ITfRange> preceeding_range;
+-    if (FAILED(selected_range->Clone(&preceeding_range))) {
++    CComPtr<ITfRange> preceding_range;
++    if (FAILED(selected_range->Clone(&preceding_range))) {
+       return E_FAIL;
+     }
+-    if (FAILED(preceeding_range->Collapse(edit_cookie, TF_ANCHOR_START))) {
++    if (FAILED(preceding_range->Collapse(edit_cookie, TF_ANCHOR_START))) {
+       return E_FAIL;
+     }
+ 
+@@ -256,14 +256,14 @@ class PrecedingTextDeleter : public ITfEditSession {
+     }
+     const LONG initial_offset_utf16 =
+         -static_cast<LONG>(num_characters_in_ucs4_) * 2;
+-    LONG preceeding_range_shifted = 0;
+-    if (FAILED(preceeding_range->ShiftStart(edit_cookie, initial_offset_utf16,
+-                                            &preceeding_range_shifted,
++    LONG preceding_range_shifted = 0;
++    if (FAILED(preceding_range->ShiftStart(edit_cookie, initial_offset_utf16,
++                                            &preceding_range_shifted,
+                                             &halt_cond))) {
+       return E_FAIL;
+     }
+     std::wstring total_string;
+-    if (FAILED(TipRangeUtil::GetText(preceeding_range, edit_cookie,
++    if (FAILED(TipRangeUtil::GetText(preceding_range, edit_cookie,
+                                      &total_string))) {
+       return E_FAIL;
+     }
+@@ -278,15 +278,15 @@ class PrecedingTextDeleter : public ITfEditSession {
+     }
+ 
+     const LONG final_offset = total_string.size() - len_in_utf16;
+-    if (FAILED(preceeding_range->ShiftStart(edit_cookie, final_offset,
+-                                            &preceeding_range_shifted,
++    if (FAILED(preceding_range->ShiftStart(edit_cookie, final_offset,
++                                            &preceding_range_shifted,
+                                             &halt_cond))) {
+       return E_FAIL;
+     }
+-    if (final_offset != preceeding_range_shifted) {
++    if (final_offset != preceding_range_shifted) {
+       return E_FAIL;
+     }
+-    if (FAILED(preceeding_range->SetText(edit_cookie, 0, L"", 0))) {
++    if (FAILED(preceding_range->SetText(edit_cookie, 0, L"", 0))) {
+       return E_FAIL;
+     }
+ 
+diff --git win32/tip/tip_surrounding_text.h win32/tip/tip_surrounding_text.h
+index 2c11604ed..86cd131bb 100644
+--- win32/tip/tip_surrounding_text.h
++++ win32/tip/tip_surrounding_text.h
+@@ -86,7 +86,7 @@ class TipSurroundingText {
+                                             TipSurroundingTextInfo *info,
+                                             bool *need_async_reconversion);
+ 
+-  // Returns true when succeeds to delete preceeding text from the beginning of
++  // Returns true when succeeds to delete preceding text from the beginning of
+   // the selected range.
+   // Caveats: |num_characters_to_be_deleted_in_ucs4| is not the number of
+   //     elements in UTF16. Beware of surrogate pairs.
+diff --git win32/tip/tip_text_service.cc win32/tip/tip_text_service.cc
+index eea0b3fe1..8bccab402 100644
+--- win32/tip/tip_text_service.cc
++++ win32/tip/tip_text_service.cc
+@@ -88,7 +88,7 @@ using ATL::CComQIPtr;
+ // Represents the module handle of this module.
+ volatile HMODULE g_module = nullptr;
+ 
+-// True if the the DLL received DLL_PROCESS_DETACH notification.
++// True if the DLL received DLL_PROCESS_DETACH notification.
+ volatile bool g_module_unloaded = false;
+ 
+ // Thread Local Storage (TLS) index to specify the current UI thread is
+@@ -877,7 +877,7 @@ class TipTextServiceImpl : public ITfTextInputProcessorEx,
+   virtual HRESULT STDMETHODCALLTYPE OnSetThreadFocus() {
+     EnsureKanaLockUnlocked();
+ 
+-    // A temporary workaround for b/24793812.  When previous atempt to
++    // A temporary workaround for b/24793812.  When previous attempt to
+     // establish conection failed, retry again as if this was the first attempt.
+     // TODO(yukawa): We should give up if this fails a number of times.
+     if (WinUtil::IsProcessSandboxed()) {
+diff --git win32/tip/tip_ui_element_immersive.cc win32/tip/tip_ui_element_immersive.cc
+index 336991bbf..9a2e4ab00 100644
+--- win32/tip/tip_ui_element_immersive.cc
++++ win32/tip/tip_ui_element_immersive.cc
+@@ -108,7 +108,7 @@ const wchar_t kImmersiveUIWindowClassName[] = L"Mozc Immersive UI Window";
+ // Represents the module handle of this module.
+ volatile HMODULE g_module = nullptr;
+ 
+-// True if the the DLL received DLL_PROCESS_DETACH notification.
++// True if the DLL received DLL_PROCESS_DETACH notification.
+ volatile bool g_module_unloaded = false;
+ 
+ // Thread Local Storage (TLS) index to specify the current UI thread is
+diff --git win32/tip/tip_ui_handler_immersive.cc win32/tip/tip_ui_handler_immersive.cc
+index f96a01138..4bdeed54e 100644
+--- win32/tip/tip_ui_handler_immersive.cc
++++ win32/tip/tip_ui_handler_immersive.cc
+@@ -69,7 +69,7 @@ typedef ::mozc::commands::Preedit_Segment::Annotation Annotation;
+ // Represents the module handle of this module.
+ volatile HMODULE g_module = nullptr;
+ 
+-// True if the the DLL received DLL_PROCESS_DETACH notification.
++// True if the DLL received DLL_PROCESS_DETACH notification.
+ volatile bool g_module_unloaded = false;
+ 
+ // Thread Local Storage (TLS) index to specify the current UI thread is
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_base.gyp
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_base.gyp:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_base.gyp  Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-base_base.gyp,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- base/base.gyp.orig 2017-11-02 13:32:45.000000000 +0000
++++ base/base.gyp
+@@ -141,7 +141,7 @@
+             },
+           },
+         }],
+-        ['target_platform=="Linux" and server_dir!=""', {
++        ['(target_platform=="Linux" or target_platform=="NetBSD") and server_dir!=""', {
+           'defines': [
+             'MOZC_SERVER_DIRECTORY="<(server_dir)"',
+           ],
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_clock.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_clock.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_clock.cc  Wed Feb 17 15:29:51 2021
@@ -0,0 +1,24 @@
+$NetBSD: patch-base_clock.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- base/clock.cc.orig 2021-02-15 03:48:53.000000000 +0000
++++ base/clock.cc
+@@ -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_WASM)
++#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM) || defined(OS_NETBSD)
+     return 1000000uLL;
+ #else  // platforms (OS_WIN, __APPLE__, OS_LINUX, ...)
+ #error "Not supported platform"
+@@ -133,7 +133,7 @@ class ClockImpl : public ClockInterface 
+     return static_cast<uint64>(timestamp.QuadPart);
+ #elif defined(__APPLE__)
+     return static_cast<uint64>(mach_absolute_time());
+-#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);
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_cpu__stats.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_cpu__stats.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_cpu__stats.cc     Wed Feb 17 15:29:51 2021
@@ -0,0 +1,48 @@
+$NetBSD: patch-base_cpu__stats.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- base/cpu_stats.cc.orig     2021-02-15 03:48:53.000000000 +0000
++++ base/cpu_stats.cc
+@@ -122,13 +122,13 @@ float CPUStats::GetSystemCPULoad() {
+ 
+ #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)
+   // 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_WASM
++#endif  // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
+ 
+   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_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_WASM
++#endif  // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
+ 
+   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  // __APPLE__
+ 
+-#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_WASM || OS_NETBSD
+ }
+ }  // namespace mozc
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_logging.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_logging.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_logging.cc        Wed Feb 17 15:29:51 2021
@@ -0,0 +1,25 @@
+$NetBSD: patch-base_logging.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+--- base/logging.cc.orig       2021-02-17 12:18:42.000000000 +0000
++++ base/logging.cc
+@@ -53,6 +53,10 @@
+ #include <sstream>
+ #include <string>
+ 
++#if defined(OS_NETBSD)
++#include <lwp.h>
++#endif
++
+ #ifdef OS_ANDROID
+ #include "base/const.h"
+ #endif  // OS_ANDROID
+@@ -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(), " ",
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_mutex.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_mutex.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_mutex.cc  Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-base_mutex.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- base/mutex.cc.orig 2021-02-15 03:48:53.000000000 +0000
++++ base/mutex.cc
+@@ -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(__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)
+   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_password__manager.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_password__manager.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_password__manager.cc      Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-base_password__manager.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- base/password_manager.cc.orig      2021-02-15 03:48:53.000000000 +0000
++++ base/password_manager.cc
+@@ -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_WASM)
++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_WASM) || defined(OS_NETBSD)
+ typedef PlainPasswordManager DefaultPasswordManager;
+ #endif  // OS_LINUX || OS_ANDROID || OS_WASM
+ 
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_port.h
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_port.h:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_port.h    Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-base_port.h,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+--- base/port.h.orig   2021-02-15 05:04:33.000000000 +0000
++++ base/port.h
+@@ -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."
+ #endif  // !MOZC_OS_DEFINED
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_process.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_process.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_process.cc        Wed Feb 17 15:29:51 2021
@@ -0,0 +1,73 @@
+$NetBSD: patch-base_process.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- base/process.cc.orig       2021-02-15 03:48:53.000000000 +0000
++++ base/process.cc
+@@ -46,12 +46,12 @@
+ #include "base/mac_process.h"
+ #endif  // __APPLE__
+ 
+-#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
++#endif  // OS_LINUX || OS_ANDROID || OS_NETBSD
+ 
+ #include <cstdlib>
+ #include <memory>
+@@ -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)
+-  static const char kBrowserCommand[] = "/usr/bin/xdg-open";
++#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
++#endif  // OS_LINUX || OS_ANDROID || OS_NETBSD
+ 
+ #ifdef __APPLE__
+   return MacProcess::OpenBrowserForMac(url);
+@@ -185,7 +185,7 @@ bool Process::SpawnProcess(const std::st
+   }
+ #endif
+ 
+-#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;
+@@ -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
++#endif  // OS_LINUX || OS_ANDROID || OS_NETBSD
+   pid_t tmp_pid = 0;
+ 
+   // Spawn new process.
+@@ -383,7 +383,7 @@ bool Process::LaunchErrorMessageDialog(c
+   }
+ #endif  // OS_WIN
+ 
+-#if defined(OS_LINUX) || defined(OS_ANDROID)
++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NETBSD)
+   const char kMozcTool[] = "mozc_tool";
+   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
++#endif  // OS_LINUX || OS_ANDROID || OS_NETBSD
+ 
+   return true;
+ }
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_run__level.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_run__level.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_run__level.cc     Wed Feb 17 15:29:51 2021
@@ -0,0 +1,19 @@
+$NetBSD: patch-base_run__level.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- 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  // __APPLE__
+ 
+-#if defined(OS_LINUX) || defined(OS_ANDROID)
++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NETBSD)
+ #include <sys/types.h>
+ #include <unistd.h>
+-#endif  // OS_LINUX || OS_ANDROID
++#endif  // OS_LINUX || OS_ANDROID || OS_NETBSD
+ 
+ #include "base/const.h"
+ #include "base/logging.h"
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_system__util.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_system__util.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_system__util.cc   Wed Feb 17 15:29:51 2021
@@ -0,0 +1,87 @@
+$NetBSD: patch-base_system__util.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+--- base/system_util.cc.orig   2021-02-15 05:04:33.000000000 +0000
++++ base/system_util.cc
+@@ -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__
+ 
+-#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
+@@ -499,12 +499,12 @@ std::string SystemUtil::GetUserNameAsStr
+   return ppw->pw_name;
+ #endif  // OS_ANDROID
+ 
+-#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));
+   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
+ 
+ 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 "";
+   }
+   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 std::string ret = "NetBSD";
++  return ret;
++#else   // !OS_WIN && !__APPLE__ && !OS_LINUX && !OS_NETBSD
+   const string ret = "Unknown";
+   return ret;
+-#endif  // OS_WIN, __APPLE__, OS_LINUX
++#endif  // OS_WIN, __APPLE__, OS_LINUX, OS_NETBSD
+ }
+ 
+ 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.
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_thread.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_thread.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-base_thread.cc Wed Feb 17 15:29:51 2021
@@ -0,0 +1,20 @@
+$NetBSD: patch-base_thread.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* tweak for NetBSD pthread_setname_np(3)
+
+--- base/thread.cc.orig        2021-02-15 03:48:53.000000000 +0000
++++ base/thread.cc
+@@ -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_WASM | __APPLE__)
++#elif defined(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)
+   }
+ }
+ 
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-build__mozc.py
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-build__mozc.py:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-build__mozc.py Wed Feb 17 15:29:51 2021
@@ -0,0 +1,73 @@
+$NetBSD: patch-build__mozc.py,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- build_mozc.py.orig 2021-02-15 03:48:53.000000000 +0000
++++ build_mozc.py
+@@ -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
+@@ -96,6 +97,7 @@ def GetBuildShortBaseName(target_platfor
+       'Windows': 'out_win',
+       'Mac': 'out_mac',
+       'Linux': 'out_linux',
++      'NetBSD': 'out_bsd',
+       'iOS': 'out_ios',
+   }
+ 
+@@ -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():
++    default_target = 'NetBSD'
+   elif IsWindows():
+     default_target = 'Windows'
+   elif IsMac():
+@@ -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')
++  elif target_platform == 'NetBSD':
++    targets = [SRC_DIR + '/server/server.gyp:mozc_server',
++               SRC_DIR + '/renderer/renderer.gyp:mozc_renderer',
++               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')
+   elif target_platform == 'Mac':
+     targets = [SRC_DIR + '/mac/mac.gyp:codesign_DiskImage']
+   elif target_platform == 'Windows':
+@@ -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':
++  elif (target_platform == 'Linux' or
++       target_platform == 'NetBSD'):
+     gyp_options.extend(['-D', 'use_qt=YES'])
+     gyp_options.extend(['-D', 'qt_dir='])
+ 
+@@ -482,7 +493,8 @@ def GypMain(options, unused_args):
+   if IsWindows():
+     gyp_options.extend(['-G', 'msvs_version=2017'])
+ 
+-  if (target_platform == 'Linux' and
++  if ((target_platform == 'Linux' or
++       target_platform == 'NetBSD') and
+       '%s/unix/ibus/ibus.gyp' % SRC_DIR in gyp_file_names):
+     gyp_options.extend(['-D', 'use_libibus=1'])
+ 
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-build__tools_mozc__version.py
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-build__tools_mozc__version.py:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-build__tools_mozc__version.py  Wed Feb 17 15:29:51 2021
@@ -0,0 +1,14 @@
+$NetBSD: patch-build__tools_mozc__version.py,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- build_tools/mozc_version.py.orig   2021-02-15 03:48:53.000000000 +0000
++++ build_tools/mozc_version.py
+@@ -69,6 +69,7 @@ TARGET_PLATFORM_TO_DIGIT = {
+     'iOS': '6',
+     'iOS_sim': '6',
+     'Wasm': '7',
++    'NetBSD': '8',
+ }
+ 
+ VERSION_PROPERTIES = [
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-build__tools_util.py
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-build__tools_util.py:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-build__tools_util.py   Wed Feb 17 15:29:51 2021
@@ -0,0 +1,18 @@
+$NetBSD: patch-build__tools_util.py,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- build_tools/util.py.orig   2016-05-15 08:11:10.000000000 +0000
++++ build_tools/util.py
+@@ -59,6 +59,11 @@ def IsLinux():
+   return os.name == 'posix' and os.uname()[0] == 'Linux'
+ 
+ 
++def IsNetBSD():
++  """Returns true if the platform is NetBSD."""
++  return os.name == 'posix' and os.uname()[0] == 'NetBSD'
++
++
+ def GetNumberOfProcessors():
+   """Returns the number of CPU cores available.
+ 
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-client_client.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-client_client.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-client_client.cc       Wed Feb 17 15:29:51 2021
@@ -0,0 +1,24 @@
+$NetBSD: patch-client_client.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- client/client.cc.orig      2021-02-15 03:48:53.000000000 +0000
++++ client/client.cc
+@@ -867,7 +867,7 @@ bool Client::LaunchTool(const std::strin
+     return false;
+   }
+ 
+-#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 += " ";
+@@ -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
++#endif  // OS_WIN || OS_LINUX || OS_ANDROID || OS_NETBSD
+ 
+   // TODO(taku): move MacProcess inside SpawnMozcProcess.
+   // TODO(taku): support extra_arg.
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-config.bzl
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-config.bzl:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-config.bzl     Wed Feb 17 15:29:51 2021
@@ -0,0 +1,19 @@
+$NetBSD: patch-config.bzl,v 1.1 2021/02/17 15:29:51 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"
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-config_stats__config__util__test.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-config_stats__config__util__test.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-config_stats__config__util__test.cc    Wed Feb 17 15:29:51 2021
@@ -0,0 +1,20 @@
+$NetBSD: patch-config_stats__config__util__test.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- config/stats_config_util_test.cc.orig      2021-02-15 03:48:53.000000000 +0000
++++ config/stats_config_util_test.cc
+@@ -685,11 +685,11 @@ TEST(StatsConfigUtilTestAndroid, Default
+ }
+ #endif  // OS_ANDROID
+ 
+-#if defined(OS_LINUX)
++#if defined(OS_LINUX) || defined(OS_NETBSD)
+ TEST(StatsConfigUtilTestLinux, DefaultValueTest) {
+   EXPECT_FALSE(StatsConfigUtil::IsEnabled());
+ }
+-#endif  // OS_LINUX
++#endif  // OS_LINUX || OS_NETBSD
+ 
+ #else  // !GOOGLE_JAPANESE_INPUT_BUILD
+ TEST(StatsConfigUtilTestNonOfficialBuild, DefaultValueTest) {
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_config__dialog_config__dialog.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_config__dialog_config__dialog.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_config__dialog_config__dialog.cc   Wed Feb 17 15:29:51 2021
@@ -0,0 +1,50 @@
+$NetBSD: patch-gui_config__dialog_config__dialog.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- gui/config_dialog/config_dialog.cc.orig    2021-02-15 03:48:53.000000000 +0000
++++ gui/config_dialog/config_dialog.cc
+@@ -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)
+   miscDefaultIMEWidget->setVisible(false);
+   miscAdministrationWidget->setVisible(false);
+   miscStartupWidget->setVisible(false);
+-#endif  // OS_LINUX
++#endif  // OS_LINUX || OS_NETBSD
+ 
+ #ifdef MOZC_NO_LOGGING
+   // disable logging options
+   miscLoggingWidget->setVisible(false);
+ 
+-#if defined(OS_LINUX)
++#if defined(OS_LINUX) || defined(OS_NETBSD)
+   // The last "misc" tab has no valid configs on Linux
+   const int kMiscTabIndex = 6;
+   configDialogTabWidget->removeTab(kMiscTabIndex);
+-#endif  // OS_LINUX
++#endif  // OS_LINUX || OS_NETBSD
+ #endif  // MOZC_NO_LOGGING
+ 
+   suggestionsSizeSpinBox->setRange(1, 9);
+@@ -280,7 +280,7 @@ ConfigDialog::ConfigDialog()
+   dictionaryPreloadingAndUACLabel->setVisible(false);
+ #endif  // OS_WIN
+ 
+-#ifdef OS_LINUX
++#if defined(OS_LINUX) || defined(OS_NETBSD)
+   // On Linux, disable all fields for UsageStats
+   usageStatsLabel->setEnabled(false);
+   usageStatsLabel->setVisible(false);
+@@ -290,7 +290,7 @@ ConfigDialog::ConfigDialog()
+   usageStatsMessage->setVisible(false);
+   usageStatsCheckBox->setEnabled(false);
+   usageStatsCheckBox->setVisible(false);
+-#endif  // OS_LINUX
++#endif  // OS_LINUX || OS_NETBSD
+ 
+   GuiUtil::ReplaceWidgetLabels(this);
+ 
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_config__dialog_keybinding__editor.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_config__dialog_keybinding__editor.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_config__dialog_keybinding__editor.cc       Wed Feb 17 15:29:51 2021
@@ -0,0 +1,24 @@
+$NetBSD: patch-gui_config__dialog_keybinding__editor.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- gui/config_dialog/keybinding_editor.cc.orig        2021-02-15 03:48:53.000000000 +0000
++++ gui/config_dialog/keybinding_editor.cc
+@@ -381,7 +381,7 @@ KeyBindingFilter::KeyState KeyBindingFil
+       return Encode(result);
+     }
+   }
+-#elif OS_LINUX
++#elif defined(OS_LINUX) || defined(OS_NETBSD)
+   // The XKB defines three types of logical key code: "xkb::Hiragana",
+   // "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);
+-#if defined(OS_LINUX)
++#if defined(OS_LINUX) || defined(OS_NETBSD)
+   // Workaround for the issue https://github.com/google/mozc/issues/9
+   // Seems that even after clicking the button for the keybinding dialog,
+   // the edit is not raised. This might be a bug of setFocusProxy.
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_dictionary__tool_dictionary__tool.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_dictionary__tool_dictionary__tool.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_dictionary__tool_dictionary__tool.cc       Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-gui_dictionary__tool_dictionary__tool.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- gui/dictionary_tool/dictionary_tool.cc.orig        2014-05-21 10:51:22.000000000 +0000
++++ gui/dictionary_tool/dictionary_tool.cc
+@@ -347,7 +347,7 @@ DictionaryTool::DictionaryTool(QWidget *
+ #endif  // !ENABLE_CLOUD_SYNC
+ 
+   // main window
+-#ifndef OS_LINUX
++#if !defined(OS_LINUX) && !defined(OS_NETBSD)
+   // For some reason setCentralWidget crashes the dictionary_tool on Linux
+   // TODO(taku): investigate the cause of the crashes
+   setCentralWidget(splitter_);
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__libraries.gypi
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__libraries.gypi:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__libraries.gypi Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-gui_qt__libraries.gypi,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- gui/qt_libraries.gypi.orig 2017-11-02 13:32:47.000000000 +0000
++++ gui/qt_libraries.gypi
+@@ -98,7 +98,7 @@
+         '$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
+       ]
+     }],
+-    ['target_platform=="Linux"', {
++    ['target_platform=="Linux" or target_platform=="NetBSD"', {
+       'cflags': ['<!@(pkg-config --cflags Qt5Widgets Qt5Gui Qt5Core)'],
+       'libraries': ['<!@(pkg-config --libs Qt5Widgets Qt5Gui Qt5Core)'],
+     }],
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__moc.gypi
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__moc.gypi:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__moc.gypi       Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-gui_qt__moc.gypi,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- gui/qt_moc.gypi.orig       2017-11-02 13:32:47.000000000 +0000
++++ gui/qt_moc.gypi
+@@ -33,7 +33,7 @@
+ 
+   'variables': {
+     'conditions': [
+-      ['target_platform=="Linux"', {
++      ['target_platform=="Linux" or target_platform=="NetBSD"', {
+         'moc_path': '<!(pkg-config --variable=host_bins Qt5Core)/moc',
+       }, 'qt_dir', {
+         'moc_path': '<(qt_dir)/bin/moc<(EXECUTABLE_SUFFIX)',
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__rcc.gypi
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__rcc.gypi:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__rcc.gypi       Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-gui_qt__rcc.gypi,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- gui/qt_rcc.gypi.orig       2017-11-02 13:32:47.000000000 +0000
++++ gui/qt_rcc.gypi
+@@ -33,7 +33,7 @@
+ 
+   'variables': {
+     'conditions': [
+-      ['target_platform=="Linux"', {
++      ['target_platform=="Linux" or target_platform=="NetBSD"', {
+         'rcc_path': '<!(pkg-config --variable=host_bins Qt5Core)/rcc',
+       }, 'qt_dir', {
+         'rcc_path': '<(qt_dir)/bin/rcc<(EXECUTABLE_SUFFIX)',
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__uic.gypi
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__uic.gypi:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_qt__uic.gypi       Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-gui_qt__uic.gypi,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- gui/qt_uic.gypi.orig       2017-11-02 13:32:47.000000000 +0000
++++ gui/qt_uic.gypi
+@@ -33,7 +33,7 @@
+ 
+   'variables': {
+     'conditions': [
+-      ['target_platform=="Linux"', {
++      ['target_platform=="Linux" or target_platform=="NetBSD"', {
+         'uic_path': '<!(pkg-config --variable=host_bins Qt5Core)/uic',
+       }, 'qt_dir', {
+         'uic_path': '<(qt_dir)/bin/uic<(EXECUTABLE_SUFFIX)',
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_word__register__dialog_word__register__dialog.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_word__register__dialog_word__register__dialog.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gui_word__register__dialog_word__register__dialog.cc   Wed Feb 17 15:29:51 2021
@@ -0,0 +1,19 @@
+$NetBSD: patch-gui_word__register__dialog_word__register__dialog.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+* Fix from https://github.com/google/mozc/issues/460
+
+--- 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
+@@ -97,9 +97,9 @@ QString GetEnv(const char *envname) {
+   }
+   return QLatin1String("");
+ #endif  // OS_WIN
+-#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 QLatin1String("");
+ }
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gyp_common.gypi
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gyp_common.gypi:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gyp_common.gypi        Wed Feb 17 15:29:51 2021
@@ -0,0 +1,67 @@
+$NetBSD: patch-gyp_common.gypi,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- gyp/common.gypi.orig       2021-02-15 05:04:33.000000000 +0000
++++ gyp/common.gypi
+@@ -93,6 +93,13 @@
+       '-fstack-protector',
+       '--param=ssp-buffer-size=4',
+     ],
++    # netbsd_cflags will be used for NetBSD.
++    'netbsd_cflags': [
++      '<@(gcc_cflags)',
++      '-fPIC',
++      '-D_NETBSD_SOURCE',
++      '-fno-exceptions',
++    ],
+     # 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': 'gcc',
++        'compiler_host_version_int': 409,  # GCC 4.9 or higher
++      }],
+     ],
+   },
+   'target_defaults': {
+@@ -318,6 +331,24 @@
+           }],
+         ],
+       }],
++      ['OS=="netbsd"', {
++        'defines': [
++          'OS_NETBSD',
++        ],
++        'cflags': [
++          '<@(netbsd_cflags)',
++          '-fPIC',
++          '-fno-exceptions',
++        ],
++        'cflags_cc': [
++          # We use deprecated <hash_map> and <hash_set> instead of upcoming
++          # <unordered_map> and <unordered_set>.
++          '-Wno-deprecated',
++        ],
++        'ldflags': [
++          '-pthread',
++        ],
++      }],
+       ['OS=="mac"', {
+         'defines': [
+           '__APPLE__',
+@@ -410,7 +441,7 @@
+     ],
+   },
+   'conditions': [
+-    ['target_platform=="Linux"', {
++    ['target_platform=="Linux" or target_platform=="NetBSD"', {
+       'make_global_settings': [
+         ['AR', '<!(which ar)'],
+         ['CC', '<!(which clang)'],
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gyp_directories.gypi
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gyp_directories.gypi:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-gyp_directories.gypi   Wed Feb 17 15:29:51 2021
@@ -0,0 +1,13 @@
+$NetBSD: patch-gyp_directories.gypi,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+--- gyp/directories.gypi.orig  2021-02-15 05:04:33.000000000 +0000
++++ gyp/directories.gypi
+@@ -43,7 +43,7 @@
+ 
+     # server_dir represents the directory where mozc_server is
+     # installed. This option is only for Linux.
+-    'server_dir%': '/usr/lib/mozc',
++    'server_dir%': '@PREFIX@/libexec',
+ 
+     # Represents the directory where the source code of protobuf is
+     # extracted. This value is ignored when 'use_libprotobuf' is 1.
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_ipc__path__manager.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_ipc__path__manager.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_ipc__path__manager.cc      Wed Feb 17 15:29:51 2021
@@ -0,0 +1,42 @@
+$NetBSD: patch-ipc_ipc__path__manager.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- ipc/ipc_path_manager.cc.orig       2021-02-15 03:48:53.000000000 +0000
++++ ipc/ipc_path_manager.cc
+@@ -53,6 +53,11 @@
+ #endif  // __APPLE__
+ #endif  // OS_WIN
+ 
++#if defined(OS_NETBSD)
++#include <sys/param.h>
++#include <sys/sysctl.h>
++#endif
++
+ #include <cstdlib>
+ #include <map>
+ #ifdef OS_WIN
+@@ -425,6 +430,23 @@ bool IPCPathManager::IsValidServer(uint3
+     return true;
+   }
+ 
++#if defined(OS_NETBSD)
++  int name[] = { CTL_KERN, KERN_PROC_ARGS, static_cast<int>(pid) };
++  size_t data_len = 0;
++  if (sysctl(name, arraysize(name), NULL,
++             &data_len, NULL, 0) < 0) {
++    LOG(ERROR) << "sysctl KERN_PROC_ARGS failed";
++    return false;
++  }
++
++  server_path_.resize(data_len);
++  if (sysctl(name, arraysize(name), &server_path_[0],
++             &data_len, NULL, 0) < 0) {
++    LOG(ERROR) << "sysctl KERN_PROC_ARGS failed";
++    return false;
++  }
++#endif // OS_NETBSD
++
+ #ifdef OS_LINUX
+   if ((server_path + " (deleted)") == server_path_) {
+     LOG(WARNING) << server_path << " on disk is modified";
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_ipc__path__manager__test.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_ipc__path__manager__test.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_ipc__path__manager__test.cc        Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-ipc_ipc__path__manager__test.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- ipc/ipc_path_manager_test.cc.orig  2013-07-17 02:37:50.000000000 +0000
++++ ipc/ipc_path_manager_test.cc
+@@ -103,7 +103,7 @@ TEST_F(IPCPathManagerTest, IPCPathManage
+   EXPECT_FALSE(manager->GetServerProductVersion().empty());
+   EXPECT_GT(manager->GetServerProcessId(), 0);
+   EXPECT_EQ(t.path(), path);
+-#ifdef OS_LINUX
++#if defined(OS_LINUX) || defined(OS_NETBSD)
+   // On Linux, |path| should be abstract (see man unix(7) for details.)
+   ASSERT_FALSE(path.empty());
+   EXPECT_EQ('\0', path[0]);
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_named__event.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_named__event.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_named__event.cc    Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-ipc_named__event.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* sem_open(..., 0) is not supported for NetBSD at least.
+
+--- ipc/named_event.cc.orig    2021-02-15 03:48:53.000000000 +0000
++++ ipc/named_event.cc
+@@ -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) {
+     LOG(ERROR) << "sem_open failed: " << ::strerror(errno);
+   }
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_unix__ipc.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_unix__ipc.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-ipc_unix__ipc.cc       Wed Feb 17 15:29:51 2021
@@ -0,0 +1,55 @@
+$NetBSD: patch-ipc_unix__ipc.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- 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_WASM don't reach here.
+-#if defined(OS_LINUX)
++#if defined(OS_LINUX) || defined(OS_NETBSD)
+ 
+ #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.
+-#ifndef __arm__
++#if !defined(__arm__) && !defined(OS_NETBSD)
+   struct ucred peer_cred;
+   int peer_cred_len = sizeof(peer_cred);
+   if (getsockopt(socket, SOL_SOCKET, SO_PEERCRED,
+@@ -141,7 +141,23 @@ bool IsPeerValid(int socket, pid_t *pid)
+   }
+ 
+   *pid = peer_cred.pid;
+-#endif  // __arm__
++#endif  // __arm__ || OS_NETBSD
++
++#if defined(OS_NETBSD)
++  struct unpcbid peer_cred;
++  int peer_cred_len = sizeof(peer_cred);
++  if (getsockopt(socket, 0, LOCAL_PEEREID,
++                 reinterpret_cast<void *>(&peer_cred),
++                 reinterpret_cast<socklen_t *>(&peer_cred_len)) < 0) {
++    LOG(ERROR) << "cannot get peer credential. Not a Unix socket?";
++    return false;
++  }
++
++  if (peer_cred.unp_euid!= ::geteuid()) {
++    LOG(WARNING) << "uid mismatch." << peer_cred.unp_euid << "!=" << ::geteuid();
++    return false;
++  }
++#endif
+ 
+   return true;
+ }
+@@ -468,4 +484,4 @@ void IPCServer::Terminate() { server_thr
+ 
+ }  // namespace mozc
+ 
+-#endif  // OS_LINUX
++#endif  // OS_LINUX || OS_NETBSD
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-renderer_renderer.gyp
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-renderer_renderer.gyp:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-renderer_renderer.gyp  Wed Feb 17 15:29:51 2021
@@ -0,0 +1,24 @@
+$NetBSD: patch-renderer_renderer.gyp,v 1.1 2021/02/17 15:29:51 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.
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-session_session.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-session_session.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-session_session.cc     Wed Feb 17 15:29:51 2021
@@ -0,0 +1,36 @@
+$NetBSD: patch-session_session.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- session/session.cc.orig    2021-02-15 03:48:53.000000000 +0000
++++ session/session.cc
+@@ -230,9 +230,9 @@ void Session::InitContext(ImeContext *co
+   context->SetConfig(&context->GetConfig());
+ 
+ #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_ANDROID || OS_IOS || OS_LINUX || OS_WASM
++#endif  // OS_ANDROID || OS_IOS || OS_LINUX || OS_WASM || OS_NETBSD
+ }
+ 
+ void Session::PushUndoContext() {
+@@ -964,14 +964,14 @@ void Session::UpdatePreferences(commands
+   }
+ 
+ #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_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_ANDROID || OS_IOS || OS_LINUX || OS_WASM
++#endif  // OS_ANDROID || OS_IOS || OS_LINUX || OS_WASM || OS_NETBSD
+ }
+ 
+ bool Session::IMEOn(commands::Command *command) {
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-session_session__test.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-session_session__test.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-session_session__test.cc       Wed Feb 17 15:29:51 2021
@@ -0,0 +1,71 @@
+$NetBSD: patch-session_session__test.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* NetBSD support
+
+--- session/session_test.cc.orig       2021-02-15 03:48:53.000000000 +0000
++++ session/session_test.cc
+@@ -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_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_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_WASM
++#endif  // defined(OS_LINUX) || defined(OS_ANDROID) || OS_WASM || defined(OS_NETBSD)
+ 
+   command.Clear();
+   session->ConvertCancel(&command);
+@@ -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_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
+@@ -2159,13 +2159,13 @@ TEST_F(SessionTest, OutputAllCandidateWo
+     //   "aiueo"  (t13n), "AIUEO" (t13n), "Aieuo" (t13n),
+     //   "アイウエオ" (t13n) ]
+     EXPECT_EQ(9, output.all_candidate_words().candidates_size());
+-#else   // OS_LINUX || OS_ANDROID || OS_WASM
++#else   // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
+     // [ "あいうえお", "アイウエオ", "アイウエオ" (t13n), "あいうえお" (t13n),
+     //   "aiueo" (t13n), "AIUEO" (t13n), "Aieuo" (t13n),
+     //   "aiueo"  (t13n), "AIUEO" (t13n), "Aieuo" (t13n),
+     //   "アイウエオ" (t13n) ]
+     EXPECT_EQ(11, output.all_candidate_words().candidates_size());
+-#endif  // OS_LINUX || OS_ANDROID || OS_WASM
++#endif  // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
+   }
+ 
+   command.Clear();
+@@ -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_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
+@@ -2187,13 +2187,13 @@ TEST_F(SessionTest, OutputAllCandidateWo
+     //   "aiueo"  (t13n), "AIUEO" (t13n), "Aieuo" (t13n),
+     //   "アイウエオ" (t13n) ]
+     EXPECT_EQ(9, output.all_candidate_words().candidates_size());
+-#else   // OS_LINUX || OS_ANDROID || OS_WASM
++#else   // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
+     // [ "あいうえお", "アイウエオ",
+     //   "aiueo" (t13n), "AIUEO" (t13n), "Aieuo" (t13n),
+     //   "aiueo"  (t13n), "AIUEO" (t13n), "Aieuo" (t13n),
+     //   "アイウエオ" (t13n) ]
+     EXPECT_EQ(11, output.all_candidate_words().candidates_size());
+-#endif  // OS_LINUX || OS_ANDROID || OS_WASM
++#endif  // OS_LINUX || OS_ANDROID || OS_WASM || OS_NETBSD
+   }
+ }
+ 
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-third__party_abseil-cpp_absl_base_config.h
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-third__party_abseil-cpp_absl_base_config.h:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-third__party_abseil-cpp_absl_base_config.h     Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-third__party_abseil-cpp_absl_base_config.h,v 1.1 2021/02/17 15:29:51 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
+ 
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-third__party_protobuf_post__process__dist.sh
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-third__party_protobuf_post__process__dist.sh:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-third__party_protobuf_post__process__dist.sh   Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-third__party_protobuf_post__process__dist.sh,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* appease pkglint
+
+--- third_party/protobuf/post_process_dist.sh.orig     2017-11-02 13:35:43.000000000 +0000
++++ third_party/protobuf/post_process_dist.sh
+@@ -15,7 +15,7 @@
+ #    non-testdata .txt files are converted to Windows-style line endings.
+ # 5) Cleans up after itself.
+ 
+-if [ "$1" == "" ]; then
++if [ "$1" = "" ]; then
+   echo "USAGE:  $0 DISTFILE" >&2
+   exit 1
+ fi
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-unix_ibus_ibus.gyp
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-unix_ibus_ibus.gyp:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-unix_ibus_ibus.gyp     Wed Feb 17 15:29:51 2021
@@ -0,0 +1,17 @@
+$NetBSD: patch-unix_ibus_ibus.gyp,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* use ${PREFIX} paths
+
+--- unix/ibus/ibus.gyp.orig    2017-11-02 13:32:47.000000000 +0000
++++ unix/ibus/ibus.gyp
+@@ -31,8 +31,8 @@
+   'variables': {
+     'relative_dir': 'unix/ibus',
+     'gen_out_dir': '<(SHARED_INTERMEDIATE_DIR)/<(relative_dir)',
+-    'ibus_mozc_icon_path%': '/usr/share/ibus-mozc/product_icon.png',
+-    'ibus_mozc_path%': '/usr/lib/ibus-mozc/ibus-engine-mozc',
++    'ibus_mozc_icon_path%': '@PREFIX@/share/ibus-mozc/product_icon.png',
++    'ibus_mozc_path%': '@PREFIX@/libexec/ibus-engine-mozc',
+     # enable_x11_selection_monitor represents if ibus_mozc uses X11 selection
+     # monitor or not.
+     'enable_x11_selection_monitor%': 1,
Index: pkgsrc/inputmethod/fcitx5-mozc/patches/patch-unix_ibus_path__util.cc
diff -u /dev/null pkgsrc/inputmethod/fcitx5-mozc/patches/patch-unix_ibus_path__util.cc:1.1
--- /dev/null   Wed Feb 17 15:29:52 2021
+++ pkgsrc/inputmethod/fcitx5-mozc/patches/patch-unix_ibus_path__util.cc        Wed Feb 17 15:29:51 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-unix_ibus_path__util.cc,v 1.1 2021/02/17 15:29:51 ryoon Exp $
+
+* use ${PREFIX} path
+
+--- unix/ibus/path_util.cc.orig        2017-11-02 13:32:47.000000000 +0000
++++ unix/ibus/path_util.cc
+@@ -30,7 +30,7 @@
+ #include "unix/ibus/path_util.h"
+ 
+ namespace {
+-const char kInstalledDirectory[] = "/usr/share/ibus-mozc";
++const char kInstalledDirectory[] = "@PREFIX@/share/ibus-mozc";
+ }
+ 
+ namespace mozc {



Home | Main Index | Thread Index | Old Index