Skip to content

Instantly share code, notes, and snippets.

@jhorology
Last active October 2, 2023 11:29
Show Gist options
  • Save jhorology/dd04cdf3b22e6c1aef98808f18130aee to your computer and use it in GitHub Desktop.
Save jhorology/dd04cdf3b22e6c1aef98808f18130aee to your computer and use it in GitHub Desktop.
Install and update script for mozc on macos

install and update script for mozc.

added usefull features:

  • support UT Dictionary
  • build mozc_emacs_helper

Prerequisites

brew install bazel pyenv
pyenv install 3.9.x
cd ~/Documents/Sources
git clone https://github.com/google/mozc.git -b master --single-branch --recursive
git clone https://github.com/utuhiro78/merge-ut-dictionaries.git

Todo

create a homebrew script in the future.

#!/bin/bash -e
UT_DICT_DIR=~/Documents/Sources/merge-ut-dictionaries
MOZC_DIR=~/Documents/Sources/mozc

# update UT Dictionary

cd $UT_DICT_DIR
git reset --hard HEAD
git clean -dfx
git pull

cd src

# build with full options
alt_cannadic="true" \
            edict="true" \
            jawiki="true" \
            neologd="true" \
            personal_names="true" \
            place_names="true" \
            skk_jisyo="true" \
            sudachidict="true" \
            sh make.sh


# update source
cd $MOZC_DIR
git reset --hard HEAD
git clean -dfx
git pull --recurse-submodules

# python
pyenv local 3.9.18
python3 -m venv .venv
source .venv/bin/activate
pip3 install requests

cd src

# cleanup
bazel clean --expunge
rm -rf "/private/var/tmp/_bazel_$(whoami)"

# update deps
python3 build_tools/update_deps.py

# build Qt
python3 build_tools/build_qt.py --release --confirm_license

# merge UT dictonary
cat "$UT_DICT_DIR/src/mozcdic-ut.txt" >> data/dictionary_oss/dictionary00.txt

# build mozc
MOZC_QT_PATH="$(pwd)/third_party/qt" \
            bazel build package //unix/emacs:mozc_emacs_helper //unix/emacs:mozc.el --config oss_macos -c opt

# install
cp -f bazel-bin/unix/emacs/mozc_emacs_helper ~/.local/bin
sudo installer -pkg bazel-bin/mac/Mozc.pkg -target /

# cleanup
bazel clean --expunge
rm -rf "/private/var/tmp/_bazel_$(whoami)"
cd $MOZC_DIR
git reset --hard HEAD
git clean -dfx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment