macOS Sierra をクリーンインストールしたので mozc_emacs_helper を使えるようにした。google日本語入力と連携できるようにビルドできるという以下のサイトの Tips を参考にしたが、ちょっと解りにくかったので備忘録として整理しておく。
準備
Xcodeが必要と言うことだけどコマンドラインツールのみで大丈夫だった。
ninja が要るらしいので homebrew でインストールしておく。
mozc をダウンロードする
作業ディレクトリはどこでもいいが、僕は基本的にdesktopで作業することが多い。
cd desktop
git clone https://github.com/google/mozc.git -b master --single-branch --recursive
Mac の google日本語入力と連携させるためにソースを修正
以下のファイルを作ってパッチをかけてもいいが、簡単なのでぼくは直接修正した。
diff --git a/src/build_mozc.py b/src/build_mozc.py
index a56aaaf..d419f49 100644
--- a/src/build_mozc.py
+++ b/src/build_mozc.py
@@ -167,6 +167,8 @@ 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 == 'Mac':
+ gyp_file_names.extend(glob.glob('%s/unix/emacs/*.gyp' % SRC_DIR))
elif options.target_platform == 'Linux':
gyp_file_names.extend(glob.glob('%s/unix/*/*.gyp' % SRC_DIR))
# Add ibus.gyp if ibus version is >=1.4.1.
diff --git a/src/mac/mac.gyp b/src/mac/mac.gyp
index 76b540d..2ee4006 100644
--- a/src/mac/mac.gyp
+++ b/src/mac/mac.gyp
@@ -586,7 +586,6 @@
['branding=="GoogleJapaneseInput"', {
'dependencies': [
'DevConfirmPane',
- 'codesign_client',
],
}],
],
コンパイル
cd mozc/src
GYP_DEFINES="mac_sdk=10.12 mac_deployment_target=10.12" python build_mozc.py gyp --noqt --branding=GoogleJapaneseInput
$ python build_mozc.py build -c Release unix/emacs/emacs.gyp:mozc_emacs_helper
動作確認
以下のように表示されれば成功!