Skip to content

Latest commit

 

History

History
130 lines (93 loc) · 4.67 KB

build_mozc_in_docker.md

File metadata and controls

130 lines (93 loc) · 4.67 KB

How to build Mozc in Docker

Introduction

Docker containers are available to build Mozc binaries for Android, NaCl, and Linux desktop.

System Requirements

Currently, only Ubuntu 14.04 is tested to host the Docker container to build Mozc. See official document to set up Docker for Ubuntu 14.04.

Set up Ubuntu 14.04 Docker container

mkdir ubuntu14.04 && cd ubuntu14.04
curl -O https://raw.githubusercontent.com/google/mozc/master/src/docker/ubuntu14.04/Dockerfile
sudo docker build --rm -t $USER/mozc_ubuntu14.04 .
sudo docker run --interactive --tty --rm $USER/mozc_ubuntu14.04

Set up Fedora 21 Docker container

Fedora 21 container is also provided just for your reference.

mkdir fedora21 && cd fedora21
curl -O https://raw.githubusercontent.com/google/mozc/master/src/docker/fedora21/Dockerfile
sudo docker build --rm -t $USER/mozc_fedora21 .
sudo docker run --interactive --tty --rm $USER/mozc_fedora21

Hint

Don't forget to rebuild Docker container when Dockerfile is updated.

Update the source tree

If Dockerfile is not updated but GitHub Mozc repository is updated, you can fetch the latest source code as follows.

cd ../
gclient sync
cd src/

Build in the container

Before explaining detailed build configurations and options, let's walk through the simplest cases to see how it looks like.

Build Mozc for Android:

python build_mozc.py gyp --target_platform=Android
python build_mozc.py build -c Debug android/android.gyp:apk

Build Mozc for NaCl:

python build_mozc.py gyp --target_platform=NaCl --nacl_sdk_root=$NACL_SDK_ROOT
python build_mozc.py build -c Release chrome/nacl/nacl_extension.gyp:nacl_mozc

Build Mozc for Linux Desktop:

python build_mozc.py gyp --target_platform=Linux
python build_mozc.py build -c Release unix/ibus/ibus.gyp:ibus_mozc unix/emacs/emacs.gyp:mozc_emacs_helper server/server.gyp:mozc_server gui/gui.gyp:mozc_tool renderer/renderer.gyp:mozc_renderer

You can also run unittests as follows.

python build_mozc.py runtests -c Debug

Build configurations

In python build_mozc.py gyp step, there are two different styles to customize configurations. One is GYP_DEFINES environment variable and the other is commandline option.

[GYP_DEFINES="..."] python build_mozc.py gyp [options]

GYP_DEFINES

You can specify GYP_DEFINES environment variable to change variables in GYP files, which you can find many directories in Mozc's source tree. common.gypi is an example. Here are examples of GYP variables that you may want to change for Linux desktop build.

  • document_dir: Directory path where Mozc's license file is placed
  • ibus_mozc_path: ibus-mozc executable path
  • ibus_mozc_icon_path: ibus-mozc icon path
  • zinnia_model_file: Zinnia's model data path

Note that you can specify multiple GYP variables as follows.

GYP_DEFINES="ibus_mozc_path=/usr/lib/ibus-mozc/ibus-engine-mozc ibus_mozc_icon_path=/usr/share/ibus-mozc/product_icon.png document_dir=/usr/share/doc/mozc zinnia_model_file=/usr/share/zinnia/model/tomoe/handwriting-ja.model" python build_mozc.py gyp

command line options

You can find many command line options as follows.

python build_mozc.py gyp --help

Here we show some notable options.

--target_platform

You can use --target_platform option to specify the target OS on which Mozc will run. Following options are available.

  • Android
  • NaCl
  • Linux (default)

If you don't specify this option, --target_platform=Linux will be used implicitly.

--noqt (Linux desktop target only)

You can use --noqt option to build Mozc without depending on Qt 4 library.

--server_dir (Linux desktop target only)

You can use --server_dir option to specify the directory name where mozc_server will be installed.

Compile options

In build_mozc.py build step, you can specify build types (Release`` or Debug`) and one or more build targets. Please find each GYP file to see what build targets are defined.

python build_mozc.py build -c {Release, Debug} [gyp_path_1.gyp:gyp_target_name1] [gyp_path_2.gyp:gyp_target_name2] 

Android specific topics

Aplication package name

CAUTION: Currently the application package is fixed (org.mozc.android.inputmethod.japanese). Don't publish the built package. If you want to publish, specify --android_application_id to build_mozc.py gyp command and manually update related files.

zipalign

Android version of Mozc may not run if the APK file is not aligned with zipalign command.