|
LinuxBuildInstructions
How to build Mozc on Linux
System RequirementsCurrently, only Ubuntu 12.04 is tested to build Mozc. Software RequirementsBuilding on Linux requires the following software.
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 CodeFirst, 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 versionIf 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 revisionExecute 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. CompilationFirst, 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 OptionsTo 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 pathsIf want to customize the installation locations, use GYP_DEFINES environment variable. Currently following variables are supported.
% 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 ExecutablesExecutables 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.
Run unit testsTo 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 TreeTo 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 PackagesTo create Debian packages, please refer the rules file of the official package. % apt-get source mozc-server % ls (mozc_dir)/debian/rules |