mozc
追記:sed関係を修正した。d:id:kszk-beta:20100520:1274325364
とりあえずビルドしてみた。
LinuxBuildInstructionsに書いてあるソフトウェアのほかにtextproc/gsedも必要。
s/sed/gsed/は面倒そうだったので、手抜きしてsymlinkと$PATHで対処した。要修正。
ビルド手順
cd ~/ mkdir bin.FIXME ln -s `which gsed` bin.FIXME/sed svn co http://src.chromium.org/svn/trunk/tools/depot_tools set path = ($HOME/bin.FIXME $path $HOME/depot_tools) mkdir mozc cd mozc/ gclient config http://mozc.googlecode.com/svn/trunk/src gclient sync patch < $HOME/freebsd-mozc.diff cd src/ python build_mozc.py gyp python build_mozc.py build_tools -c Release python build_mozc.py build -c Release unix/unix.gyp:ibus_mozc
freebsd-mozc.diff
中田真秀氏およびid:m-ichii氏のパッチを一部使わせて頂いた。多謝。
diff -ru src.orig/base/iconv.cc src/base/iconv.cc --- src.orig/base/iconv.cc 2010-05-18 07:09:08.000000000 +0900 +++ src/base/iconv.cc 2010-05-18 13:49:16.000000000 +0900 @@ -52,7 +52,7 @@ size_t olen_org = olen; iconv(ic, 0, &ilen, 0, &olen); // reset iconv state while (ilen != 0) { - if (iconv(ic, reinterpret_cast<char **>(&ibuf), &ilen, &obuf, &olen) + if (iconv(ic, (const char **)(&ibuf), &ilen, &obuf, &olen) == static_cast<size_t>(-1)) { return; } diff -ru src.orig/base/mutex.h src/base/mutex.h --- src.orig/base/mutex.h 2010-05-18 07:09:08.000000000 +0900 +++ src/base/mutex.h 2010-05-18 13:49:16.000000000 +0900 @@ -87,7 +87,7 @@ #endif #ifdef OS_LINUX -#define PTHREAD_MUTEX_RECURSIVE_VALUE PTHREAD_MUTEX_RECURSIVE_NP +#define PTHREAD_MUTEX_RECURSIVE_VALUE PTHREAD_MUTEX_RECURSIVE #endif pthread_mutexattr_t attr; diff -ru src.orig/build_mozc.py src/build_mozc.py --- src.orig/build_mozc.py 2010-05-18 07:09:08.000000000 +0900 +++ src/build_mozc.py 2010-05-18 13:49:16.000000000 +0900 @@ -66,7 +66,7 @@ def IsLinux(): """Returns true if the platform is Linux.""" - return os.name == 'posix' and os.uname()[0] == 'Linux' + return os.name == 'posix' and os.uname()[0] == 'FreeBSD' def GetGeneratorName(): @@ -372,7 +372,7 @@ (unused_gyp_file_name, target_name) = ParseTarget(target) target_names.append(target_name) - make_command = os.getenv('BUILD_COMMAND', 'make') + make_command = os.getenv('BUILD_COMMAND', 'gmake') # flags for building in Chrome OS chroot environment envvars = [ 'CFLAGS', diff -ru src.orig/gyp/common.gypi src/gyp/common.gypi --- src.orig/gyp/common.gypi 2010-05-18 07:08:15.000000000 +0900 +++ src/gyp/common.gypi 2010-05-18 13:49:16.000000000 +0900 @@ -416,6 +416,8 @@ '-lssl', '-lz', ], + 'include_dirs': [ '/usr/local/include' ], + 'ldflags': [ '-L/usr/local/lib' ], }], ['OS=="mac"', { 'defines': [ diff -ru src.orig/ipc/unix_ipc.cc src/ipc/unix_ipc.cc --- src.orig/ipc/unix_ipc.cc 2010-05-18 07:09:08.000000000 +0900 +++ src/ipc/unix_ipc.cc 2010-05-18 13:49:16.000000000 +0900 @@ -41,7 +41,7 @@ #include <sys/time.h> #include <sys/types.h> #include <sys/un.h> -#ifdef OS_MACOSX +#if defined(OS_MACOSX) || defined(__FreeBSD__) #include <sys/ucred.h> #endif #include <sys/wait.h> @@ -124,7 +124,7 @@ bool IsPeerValid(int socket, pid_t *pid) { *pid = 0; -#ifdef OS_MACOSX +#if defined(OS_MACOSX) || defined(__FreeBSD__) // If the OS is MAC, we should validate the peer by using LOCAL_PEERCRED. struct xucred peer_cred; socklen_t peer_cred_len = sizeof(struct xucred); @@ -146,7 +146,7 @@ *pid = 0; #endif -#ifdef OS_LINUX +#if defined(OS_LINUX) && !defined(__FreeBSD__) // On ARM Linux, we do nothing and just return true since the platform (at // least the qemu emulator) doesn't support the getsockopt(sock, SOL_SOCKET, // SO_PEERCRED) system call. diff -ru src.orig/unix/ibus/ibus.gyp src/unix/ibus/ibus.gyp --- src.orig/unix/ibus/ibus.gyp 2010-05-18 07:08:14.000000000 +0900 +++ src/unix/ibus/ibus.gyp 2010-05-18 13:49:16.000000000 +0900 @@ -51,11 +51,11 @@ '../../usage_stats/usage_stats.gyp:usage_stats', ], 'ibus_include_dirs': [ - '<(sysroot)/usr/include/dbus-1.0', - '<(sysroot)/usr/include/glib-2.0', - '<(sysroot)/usr/include/ibus-1.0', - '<(sysroot)/usr/lib/dbus-1.0/include', - '<(sysroot)/usr/lib/glib-2.0/include' + '<(sysroot)/usr/local/include/dbus-1.0', + '<(sysroot)/usr/local/include/glib-2.0', + '<(sysroot)/usr/local/include/ibus-1.0', + '<(sysroot)/usr/local/include/dbus-1.0/include', + '<(sysroot)/usr/local/include/glib-2.0/include' ], 'ibus_libraries': [ '-lcurl',
使い方
setenv GTK_IM_MODULE ibus setenv XMODIFIERS @im=ibus setenv QT_IM_MODULE ibus ibus-daemon & cd mozc/src/out/Release/ ./ibus_mozc &
IBusに登録する方法はググれば見つかるので略。