My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
LinuxBuildInstructions  
How to build Mozc on Linux
Updated Jul 5, 2014 by yukawa@google.com

System Requirements

Currently, only Ubuntu 12.04 is tested to build Mozc.

Software Requirements

Building on Linux requires the following software.

  • gcc/g++
  • Python
  • IBus (-libus-1.0)
  • GLib (-glib-2.0, -lgobject-2.0)
  • GTK+
  • Zinnia
  • Subversion
  • Qt4
  • XCB XFixes

On Ubuntu 12.04, you can install the dependencies by:

% sudo apt-get install g++ python libibus-1.0-dev libdbus-1-dev libglib2.0-dev subversion libqt4-dev libzinnia-dev tegaki-zinnia-japanese libgtk2.0-dev libxcb-xfixes0-dev

Get the Code

First, you'll need to download the depot_tools, add depot_tools to your PATH:

% cd ~/
% git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
% export PATH="$PATH":`pwd`/depot_tools

Then, download the Mozc code from its SVN repository with the gclient command:

% mkdir -p ~/src/mozc
% cd ~/src/mozc
% gclient config http://mozc.googlecode.com/svn/trunk/src
% gclient sync

This will also download source code of other programs such as Protocol Buffers.

(hint) Get the specific version

If you want to check out specific version of Mozc code, specify --revision option for gclient sync. For instance, you can check out Mozc r192 as follows:

% # Check out specific version of Mozc (Check out r192 in this example)
% mkdir -p ~/src/mozc
% cd ~/src/mozc
% gclient config http://mozc.googlecode.com/svn/trunk/src
% gclient sync --revision=192

(hint) Update to the latest revision

Execute the following command to update to the latest revision.

% gclient sync

Updating the tree sometimes causes a mysterious build error. Try "build_mozc.py clean" if it occurs.

Compilation

First, you'll need to generate Makefiles using a tool called GYP, which is automatically downloaded by "gclient sync":

% cd ~/src/mozc/src
% python build_mozc.py gyp

Then, build ibus-mozc, mozc_server and mozc_tool executables.

% 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

Compilation Options

To do a parallel build, add -jX where X is the number of jobs run at once. To do a debug build, replace Release with Debug. This produces binaries with debug information included.

Customize installation paths

If want to customize the installation locations, use GYP_DEFINES environment variable. Currently following variables are supported.

  • ibus_mozc_path: ibus-mozc executable path
  • ibus_mozc_icon_path: ibus-mozc icon path
  • document_dir: Directory path where Mozc's license file is placed
  • zinnia_model_file: Zinnia's model data path
(For historical reasons, the installation directory for mozc_server, mozc_tool, and mozc_renderer is configured with --server_dir gyp option)

% 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
% python build_mozc.py build -c Release unix/ibus/ibus.gyp:ibus_mozc server/server.gyp:mozc_server gui/gui.gyp:mozc_tool renderer/renderer.gyp:mozc_renderer

Executables

Executables are written in ~/src/mozc/src/out_linux/Release for Release builds, and ~/src/mozc/src/out_linux/Debug for Debug builds. For instance, you'll have ~/src/mozc/src/out_linux/Release/ibus_mozc once the ibus-mozc is built successfully in the Release mode.

  • out_linux/Release/mozc_server - conversion engine
  • out_linux/Release/mozc_renderer - UI renderer for candidate window
  • out_linux/Release/mozc_tool - GUI tool for user preferences
  • out_linux/Release/ibus_mozc - IBus client

Run unit tests

To run unit tests, execute the following command.

% python build_mozc.py runtests -c Release

You can simply replace Release with Debug to run unit tests with debug build binaries,

Clean up the Tree

To clean up the tree, execute the following. This will remove executables and intermediate files like object files, generated source files, Makefiles, etc.

% python build_mozc.py clean

Debian Packages

To create Debian packages, please refer the rules file of the official package.

% apt-get source mozc-server
% ls (mozc_dir)/debian/rules
Powered by Google Project Hosting