aboutsummaryrefslogtreecommitdiff
path: root/japanese/mozc-server
diff options
context:
space:
mode:
authorDaichi GOTO <daichi@FreeBSD.org>2013-04-23 03:11:57 +0000
committerDaichi GOTO <daichi@FreeBSD.org>2013-04-23 03:11:57 +0000
commitff03793c3a186f34e8a300205a68fdb2fba661a8 (patch)
tree94aade71945bcb73450783497e665b3eb6e13b25 /japanese/mozc-server
parent152e63448ab2e38780fff79a4343dd713165b3f2 (diff)
downloadports-ff03793c3a186f34e8a300205a68fdb2fba661a8.tar.gz
ports-ff03793c3a186f34e8a300205a68fdb2fba661a8.zip
Notes
Diffstat (limited to 'japanese/mozc-server')
-rw-r--r--japanese/mozc-server/Makefile63
-rw-r--r--japanese/mozc-server/distinfo8
-rw-r--r--japanese/mozc-server/files/patch-base_base.gyp10
-rw-r--r--japanese/mozc-server/files/patch-base_iconv.cc4
-rw-r--r--japanese/mozc-server/files/patch-base_mutex.cc4
-rw-r--r--japanese/mozc-server/files/patch-base_mutex.h14
-rw-r--r--japanese/mozc-server/files/patch-base_process.cc6
-rw-r--r--japanese/mozc-server/files/patch-build_tools_util.py4
-rw-r--r--japanese/mozc-server/files/patch-gui_about_dialog_about_dialog.cc6
-rw-r--r--japanese/mozc-server/files/patch-gyp_common.gypi15
-rw-r--r--japanese/mozc-server/files/patch-handwriting_zinnia_handwriting.cc10
-rw-r--r--japanese/mozc-server/files/patch-ipc_ipc_path_manager.cc8
-rw-r--r--japanese/mozc-server/files/patch-ipc_unix_ipc.cc78
-rw-r--r--japanese/mozc-server/files/patch-server_mozc_server.cc12
-rw-r--r--japanese/mozc-server/files/patch-third_party_gyp_pylib_gyp_common.py17
-rw-r--r--japanese/mozc-server/files/patch-third_party_gyp_pylib_gyp_generator_make.py6
-rw-r--r--japanese/mozc-server/files/patch-unix_ibus_gen_mozc_xml.py20
-rw-r--r--japanese/mozc-server/files/patch-unix_ibus_mozc_engine.cc6
-rw-r--r--japanese/mozc-server/files/patch-unix_ibus_path_util.cc4
19 files changed, 159 insertions, 136 deletions
diff --git a/japanese/mozc-server/Makefile b/japanese/mozc-server/Makefile
index 2435d14ce7a3..c0c460ce44ed 100644
--- a/japanese/mozc-server/Makefile
+++ b/japanese/mozc-server/Makefile
@@ -6,8 +6,8 @@
#
PORTNAME= mozc
-PORTVERSION= 1.6.1187.102
-PORTREVISION= 3
+PORTVERSION= 1.10.1390.102
+PORTREVISION= 0
CATEGORIES= japanese
MASTER_SITES= ${MASTER_SITE_GOOGLE_CODE}
PKGNAMEPREFIX?= ja-
@@ -16,10 +16,7 @@ PKGNAMESUFFIX?= -server
MAINTAINER= daichi@FreeBSD.org
COMMENT?= Mozc server for IBus and others
-LIB_DEPENDS= curl.6:${PORTSDIR}/ftp/curl \
- gtest.0:${PORTSDIR}/devel/googletest \
- protobuf:${PORTSDIR}/devel/protobuf \
- zinnia.0:${PORTSDIR}/japanese/zinnia
+LIB_DEPENDS= protobuf:${PORTSDIR}/devel/protobuf
RUN_DEPENDS= xdg-open:${PORTSDIR}/devel/xdg-utils
USE_BZIP2= yes
@@ -29,22 +26,16 @@ USE_PYTHON= yes
USE_OPENSSL= yes
USE_PKGCONFIG= build
-BROKEN= fails to build
-
MAKE_JOBS_SAFE= yes
BUILD_MOZC_LIST?= mozc_server
-.if ${BUILD_MOZC_LIST:Mmozc_server} == "mozc_server"
-USE_GNOME+= glib20 gtk20
-.elif ${BUILD_MOZC_LIST:Mmozc_tool} == "mozc_tool"
-USE_QT4+= gui dbus qmake_build moc_build uic_build rcc_build
-.elif ${BUILD_MOZC_LIST:Mibus_mozc} == "ibus_mozc"
-USE_GNOME+= glib20 gtk20 pygtk2
-.elif ${BUILD_MOZC_LIST:Mfcitx_mozc} == "fcitx_mozc"
-USE_GNOME+= glib20 gtk20
-.elif ${BUILD_MOZC_LIST:Mmozc_el} == "mozc_el"
-USE_EMACS= yes
+GYP_OPTIONS=
+.if ${BUILD_MOZC_LIST:Mmozc_server} == "mozc_server" || \
+ ${BUILD_MOZC_LIST:Mibus_mozc} == "ibus_mozc" || \
+ ${BUILD_MOZC_LIST:Mfcitx_mozc} == "fcitx_mozc" || \
+ ${BUILD_MOZC_LIST:Mmozc_el} == "mozc_el"
+GYP_OPTIONS= --noqt
.endif
.include <bsd.port.pre.mk>
@@ -57,12 +48,6 @@ BROKEN= Does not compile on FreeBSD 7.X
BROKEN= Does not compile: segfault
.endif
-.if defined(WITH_DEBUG_CODE)
-BUILD_MODE= Debug
-.else
-BUILD_MODE= Release
-.endif
-
LOCALBASE_REPLACE_FILES= \
gyp/common.gypi \
unix/ibus/gen_mozc_xml.py \
@@ -80,13 +65,11 @@ SSL_REINPLACE_STR+= -e "s,%%${V}%%,${${V}:S/\\/\\\\/g:S/"/\"/g:S/\$/\\$/g:S/,/\,
.endfor
LOCALBASE_PTN= ${LOCALBASE:S/\\/\\\\/g:S/"/\"/g:S/\$/\\$/g:S/,/\,/g}
-GYP_DEFINES="use_libprotobuf=1"
-
+BUILD_MODE= Release
BUILD_CMD= ${SETENV} ${MAKE_ENV} ${GMAKE}
BUILD_MOZC_CMD= cd ${BUILD_WRKSRC} && \
${SETENV} BUILD_COMMAND="${WRKSRC}/mozcmake" \
PYTHONPATH=${WRKSRC}/third_party/gyp/local/lib/python${PYTHON_VER}/site-packages \
- GYP_DEFINES=${GYP_DEFINES} \
${PYTHON_CMD} build_mozc.py
BUILD_GYP_CMD= cd ${WRKSRC}/third_party/gyp && ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYSETUP}
@@ -96,6 +79,8 @@ post-patch:
${LOCALBASE_REPLACE_FILES}
cd ${WRKSRC} && \
${REINPLACE_CMD} ${SSL_REINPLACE_STR} base/base.gyp
+ ${MKDIR} -p ${WRKSRC}/mozc_build_tools/linux
+ ${LN} -sf ${LOCALBASE}/bin/protoc ${WRKSRC}/mozc_build_tools/linux/
.if ${BUILD_MOZC_LIST:Mfcitx_mozc} == "fcitx_mozc"
cd ${WRKSRC} && \
${REINPLACE_CMD} 's,/po/mo},%po}mo,g' \
@@ -111,12 +96,16 @@ pre-build:
${BUILD_GYP_CMD} ${PYDISTUTILS_CONFIGURE_TARGET} ${PYDISTUTILS_CONFIGUREARGS}
${BUILD_GYP_CMD} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS}
${BUILD_GYP_CMD} ${PYDISTUTILS_INSTALL_TARGET} --prefix=${WRKSRC}/third_party/gyp/local
- ${BUILD_MOZC_CMD} gyp --gypdir=${WRKSRC}/third_party/gyp/local/bin \
- --server_dir="${PREFIX}/bin" --channel_dev=0
+ ${BUILD_MOZC_CMD} gyp \
+ --gypdir=${WRKSRC}/third_party/gyp/local/bin \
+ --server_dir="${PREFIX}/bin" --channel_dev=0 \
+ ${GYP_OPTIONS}
${BUILD_MOZC_CMD} build_tools -c ${BUILD_MODE}
# mozc_server
.if ${BUILD_MOZC_LIST:Mmozc_server} == "mozc_server"
+BUILD_DEPENDS+= glib:${PORTSDIR}/devel/glib20 \
+ gtk:${PORTSDIR}/x11-toolkits/gtk20
PLIST_FILES+= bin/mozc_server
do-build-mozc_server:
@@ -131,6 +120,9 @@ do-install-mozc_server:
# mozc_tool
.if ${BUILD_MOZC_LIST:Mmozc_tool} == "mozc_tool"
+LIB_DEPENDS+= zinnia.0:${PORTSDIR}/japanese/zinnia
+BUILD_DEPENDS+= gtk:${PORTSDIR}/x11-toolkits/gtk20
+USE_QT4+= corelib gui
RUN_DEPENDS+= ${LOCALBASE}/share/tegaki/models/zinnia/handwriting-ja.model:${PORTSDIR}/japanese/tegaki-zinnia-japanese
PLIST_FILES+= bin/mozc_tool \
@@ -158,7 +150,8 @@ do-install-mozc_tool:
# ibus_mozc
.if ${BUILD_MOZC_LIST:Mibus_mozc} == "ibus_mozc"
LIB_DEPENDS+= ibus-1.0.401:${PORTSDIR}/textproc/ibus \
- xcb-xfixes.0:${PORTSDIR}/x11/libxcb
+ xcb-xfixes.0:${PORTSDIR}/x11/libxcb \
+ zinnia.0:${PORTSDIR}/japanese/zinnia
RUN_DEPENDS+= mozc_server:${PORTSDIR}/japanese/mozc-server \
mozc_tool:${PORTSDIR}/japanese/mozc-tool \
mozc_server_start:${PORTSDIR}/japanese/mozc-additions \
@@ -204,10 +197,12 @@ do-install-ibus_mozc:
# fcitx_mozc
.if ${BUILD_MOZC_LIST:Mfcitx_mozc} == "fcitx_mozc"
PATCH_SITES= http://fcitx.googlecode.com/files/
-PATCHFILES= fcitx-mozc-${PORTVERSION}.1.patch
+PATCHFILES= fcitx-mozc-${PORTVERSION}.2.patch
PATCH_DIST_STRIP=-p2
-LIB_DEPENDS+= fcitx-config.4:${PORTSDIR}/chinese/fcitx
+LIB_DEPENDS+= fcitx-config.4:${PORTSDIR}/chinese/fcitx \
+ zinnia.0:${PORTSDIR}/japanese/zinnia
+BUILD_DEPENDS+= glib:${PORTSDIR}/devel/glib20
RUN_DEPENDS+= mozc_server:${PORTSDIR}/japanese/mozc-server \
mozc_tool:${PORTSDIR}/japanese/mozc-tool \
mozc_server_start:${PORTSDIR}/japanese/mozc-additions
@@ -267,7 +262,11 @@ do-install-fcitx_mozc:
# mozc_el
.if ${BUILD_MOZC_LIST:Mmozc_el} == "mozc_el"
+USE_EMACS= yes
CATEGORIES+= editors elisp
+LIB_DEPENDS+= zinnia.0:${PORTSDIR}/japanese/zinnia
+BUILD_DEPENDS+= glib:${PORTSDIR}/devel/glib20 \
+ gtk:${PORTSDIR}/x11-toolkits/gtk20
RUN_DEPENDS+= mozc_server:${PORTSDIR}/japanese/mozc-server \
mozc_server_start:${PORTSDIR}/japanese/mozc-additions
diff --git a/japanese/mozc-server/distinfo b/japanese/mozc-server/distinfo
index 4d72d25c1e4b..e6b740b469f4 100644
--- a/japanese/mozc-server/distinfo
+++ b/japanese/mozc-server/distinfo
@@ -1,4 +1,4 @@
-SHA256 (mozc-1.6.1187.102.tar.bz2) = 2a9b54275400c768e14156e7654e9b9a4ca27353573627607c70d221c0e2db65
-SIZE (mozc-1.6.1187.102.tar.bz2) = 54828375
-SHA256 (fcitx-mozc-1.6.1187.102.1.patch) = 1c7549481516ed747c0ea289ebd3317c85be98fd0c4448433c48d21c270e6e75
-SIZE (fcitx-mozc-1.6.1187.102.1.patch) = 96920
+SHA256 (mozc-1.10.1390.102.tar.bz2) = 72a8ed6657daa1c03b1efe50c262a69be2ab66d45747a47df6e54996b6d5ee39
+SIZE(mozc-1.10.1390.102.tar.bz2) = 57879881
+SHA256 (fcitx-mozc-1.10.1390.102.2.patch) = 8702225049052ace5c4fa60998606cc7e08bc86966054f6f61b293277cffdcea
+SIZE (fcitx-mozc-1.10.1390.102.2.patch) = 130658
diff --git a/japanese/mozc-server/files/patch-base_base.gyp b/japanese/mozc-server/files/patch-base_base.gyp
index 31e967d22139..5b85404f4a72 100644
--- a/japanese/mozc-server/files/patch-base_base.gyp
+++ b/japanese/mozc-server/files/patch-base_base.gyp
@@ -1,8 +1,8 @@
---- base/base.gyp.orig 2012-09-07 10:21:29.099021913 +0900
-+++ base/base.gyp 2012-09-12 12:53:34.737234489 +0900
-@@ -262,20 +262,20 @@
- }],
- ['OS=="linux" and target_platform!="Android"', {
+--- base/base.gyp.orig 2013-04-21 03:48:45.178270244 +0900
++++ base/base.gyp 2013-04-21 04:16:38.943269499 +0900
+@@ -265,20 +265,20 @@
+ ['OS=="linux" and target_platform!="Android" and '
+ 'not (target_platform=="NaCl" and _toolset=="target")', {
'cflags': [
- '<!@(<(pkg_config_command) --cflags-only-other openssl)',
+ '%%OPENSSL_CFLAGS%%',
diff --git a/japanese/mozc-server/files/patch-base_iconv.cc b/japanese/mozc-server/files/patch-base_iconv.cc
index 75427d395572..4fb4d60f6688 100644
--- a/japanese/mozc-server/files/patch-base_iconv.cc
+++ b/japanese/mozc-server/files/patch-base_iconv.cc
@@ -1,5 +1,5 @@
---- base/iconv.cc.orig 2012-09-07 10:21:29.102021368 +0900
-+++ base/iconv.cc 2012-09-07 10:38:00.914022679 +0900
+--- base/iconv.cc.orig 2013-04-21 03:48:45.174270168 +0900
++++ base/iconv.cc 2013-04-21 04:16:39.946269033 +0900
@@ -53,7 +53,11 @@
size_t olen_org = olen;
iconv(ic, 0, &ilen, 0, &olen); // reset iconv state
diff --git a/japanese/mozc-server/files/patch-base_mutex.cc b/japanese/mozc-server/files/patch-base_mutex.cc
index b7db6d4cf773..a11517f467a9 100644
--- a/japanese/mozc-server/files/patch-base_mutex.cc
+++ b/japanese/mozc-server/files/patch-base_mutex.cc
@@ -1,5 +1,5 @@
---- base/mutex.cc.orig 2012-09-07 10:21:29.105022147 +0900
-+++ base/mutex.cc 2012-09-07 11:37:36.899021514 +0900
+--- base/mutex.cc.orig 2013-04-21 03:48:45.170269862 +0900
++++ base/mutex.cc 2013-04-21 04:16:39.083269637 +0900
@@ -296,7 +296,7 @@
// PTHREAD_MUTEX_RECURSIVE_NP but Mac OS X 10.5 does not
pthread_mutexattr_t attr;
diff --git a/japanese/mozc-server/files/patch-base_mutex.h b/japanese/mozc-server/files/patch-base_mutex.h
deleted file mode 100644
index cc608c86499d..000000000000
--- a/japanese/mozc-server/files/patch-base_mutex.h
+++ /dev/null
@@ -1,14 +0,0 @@
---- base/mutex.h.orig 2012-09-07 11:34:00.553021416 +0900
-+++ base/mutex.h 2012-09-07 11:36:19.333021260 +0900
-@@ -56,6 +56,11 @@
- #define MOZC_RW_MUTEX_PTR_ARRAYSIZE 10
- #endif
-
-+#if defined(__FreeBSD__)
-+#define PTHREAD_MUTEX_RECURSIVE_VALUE PTHREAD_MUTEX_RECURSIVE
-+#define PTHREAD_MUTEX_RECURSIVE_VALUE PTHREAD_MUTEX_RECURSIVE_NP
-+#endif
-+
- class LOCKABLE Mutex {
- public:
- Mutex();
diff --git a/japanese/mozc-server/files/patch-base_process.cc b/japanese/mozc-server/files/patch-base_process.cc
index d8dc9029a184..5990af6eb29d 100644
--- a/japanese/mozc-server/files/patch-base_process.cc
+++ b/japanese/mozc-server/files/patch-base_process.cc
@@ -1,6 +1,6 @@
---- base/process.cc.orig 2012-09-07 10:21:29.100021069 +0900
-+++ base/process.cc 2012-09-07 10:38:01.060021966 +0900
-@@ -120,13 +120,18 @@
+--- base/process.cc.orig 2013-04-21 03:48:45.176269982 +0900
++++ base/process.cc 2013-04-21 04:16:40.382269441 +0900
+@@ -121,13 +121,18 @@
return ShellExecuteInSystemDir(L"open", wurl.c_str(), NULL, SW_SHOW);
#endif
diff --git a/japanese/mozc-server/files/patch-build_tools_util.py b/japanese/mozc-server/files/patch-build_tools_util.py
index 0e77fc5b409b..6826911ebe10 100644
--- a/japanese/mozc-server/files/patch-build_tools_util.py
+++ b/japanese/mozc-server/files/patch-build_tools_util.py
@@ -1,5 +1,5 @@
---- build_tools/util.py.orig 2012-09-07 10:21:29.190021513 +0900
-+++ build_tools/util.py 2012-09-07 10:30:26.180021509 +0900
+--- build_tools/util.py.orig 2013-04-21 03:48:52.147271754 +0900
++++ build_tools/util.py 2013-04-21 04:07:17.415269142 +0900
@@ -54,7 +54,7 @@
def IsLinux():
diff --git a/japanese/mozc-server/files/patch-gui_about_dialog_about_dialog.cc b/japanese/mozc-server/files/patch-gui_about_dialog_about_dialog.cc
index 682d0e81f52c..18b83b3ec86f 100644
--- a/japanese/mozc-server/files/patch-gui_about_dialog_about_dialog.cc
+++ b/japanese/mozc-server/files/patch-gui_about_dialog_about_dialog.cc
@@ -1,6 +1,6 @@
---- gui/about_dialog/about_dialog.cc.orig 2012-09-07 10:21:29.218021887 +0900
-+++ gui/about_dialog/about_dialog.cc 2012-01-29 13:49:18.542805000 +0900
-@@ -119,7 +119,11 @@
+--- gui/about_dialog/about_dialog.cc.orig 2013-04-21 03:48:45.446269666 +0900
++++ gui/about_dialog/about_dialog.cc 2013-04-21 04:15:03.065269472 +0900
+@@ -121,7 +121,11 @@
SetLabelText(label_terms);
SetLabelText(label_credits);
diff --git a/japanese/mozc-server/files/patch-gyp_common.gypi b/japanese/mozc-server/files/patch-gyp_common.gypi
index 807aceeff0a5..946877e4b7b1 100644
--- a/japanese/mozc-server/files/patch-gyp_common.gypi
+++ b/japanese/mozc-server/files/patch-gyp_common.gypi
@@ -1,5 +1,5 @@
---- gyp/common.gypi.orig 2012-09-07 10:21:29.209021370 +0900
-+++ gyp/common.gypi 2012-09-07 10:30:44.919021522 +0900
+--- gyp/common.gypi.orig 2013-04-21 03:48:45.395416165 +0900
++++ gyp/common.gypi 2013-04-21 08:31:10.191270448 +0900
@@ -58,7 +58,7 @@
# warning_cflags will be shared with Mac and Linux.
'warning_cflags': [
@@ -9,7 +9,16 @@
'-Wno-char-subscripts',
'-Wno-sign-compare',
'-Wno-deprecated-declarations',
-@@ -752,6 +752,12 @@
+@@ -194,7 +194,7 @@
+ # - http://code.google.com/p/protobuf/issues/detail?id=128
+ # - http://code.google.com/p/protobuf/issues/detail?id=370
+ # for the background information.
+- 'use_libprotobuf%': 0,
++ 'use_libprotobuf%': 1,
+
+ # use_libzinnia represents if zinnia library is used or not.
+ # This option is only for Linux.
+@@ -735,6 +735,12 @@
# <unordered_map> and <unordered_set>.
'-Wno-deprecated',
],
diff --git a/japanese/mozc-server/files/patch-handwriting_zinnia_handwriting.cc b/japanese/mozc-server/files/patch-handwriting_zinnia_handwriting.cc
index 0646ae24ebe0..6d92dc1837ff 100644
--- a/japanese/mozc-server/files/patch-handwriting_zinnia_handwriting.cc
+++ b/japanese/mozc-server/files/patch-handwriting_zinnia_handwriting.cc
@@ -1,8 +1,8 @@
---- handwriting/zinnia_handwriting.cc.orig 2012-09-07 10:21:29.209021370 +0900
-+++ handwriting/zinnia_handwriting.cc 2012-09-07 10:38:01.976021756 +0900
-@@ -50,10 +50,16 @@
+--- handwriting/zinnia_handwriting.cc.orig 2013-04-21 03:48:52.166271231 +0900
++++ handwriting/zinnia_handwriting.cc 2013-04-21 04:20:14.073270179 +0900
+@@ -49,10 +49,16 @@
const char kModelFile[] = "handwriting-light-ja.model";
- return Util::JoinPath(MacUtil::GetResourcesDirectory(), kModelFile);
+ return FileUtil::JoinPath(MacUtil::GetResourcesDirectory(), kModelFile);
#elif defined(USE_LIBZINNIA)
+#if defined(__FreeBSD__)
+ const char kModelFile[] =
@@ -16,4 +16,4 @@
+#endif
#else
const char kModelFile[] = "handwriting-ja.model";
- return Util::JoinPath(Util::GetServerDirectory(), kModelFile);
+ return FileUtil::JoinPath(SystemUtil::GetServerDirectory(), kModelFile);
diff --git a/japanese/mozc-server/files/patch-ipc_ipc_path_manager.cc b/japanese/mozc-server/files/patch-ipc_ipc_path_manager.cc
index 3bb7ecad19e2..542f221f0eb0 100644
--- a/japanese/mozc-server/files/patch-ipc_ipc_path_manager.cc
+++ b/japanese/mozc-server/files/patch-ipc_ipc_path_manager.cc
@@ -1,8 +1,8 @@
---- ipc/ipc_path_manager.cc.orig 2012-09-07 10:21:32.692021977 +0900
-+++ ipc/ipc_path_manager.cc 2012-05-01 12:46:21.263693000 +0900
-@@ -284,7 +284,7 @@
+--- ipc/ipc_path_manager.cc.orig 2013-04-21 03:48:45.259273192 +0900
++++ ipc/ipc_path_manager.cc 2013-04-21 04:20:12.800269260 +0900
+@@ -276,7 +276,7 @@
*ipc_name = kIPCPrefix;
- #endif // OS_WINDOWS
+ #endif // OS_WIN
-#ifdef OS_LINUX
+#if defined(OS_LINUX) && !defined(__FreeBSD__)
diff --git a/japanese/mozc-server/files/patch-ipc_unix_ipc.cc b/japanese/mozc-server/files/patch-ipc_unix_ipc.cc
index f4c3876fac03..81be7b6270c0 100644
--- a/japanese/mozc-server/files/patch-ipc_unix_ipc.cc
+++ b/japanese/mozc-server/files/patch-ipc_unix_ipc.cc
@@ -1,56 +1,80 @@
---- ipc/unix_ipc.cc.orig 2012-09-07 10:21:32.692021977 +0900
-+++ ipc/unix_ipc.cc 2012-09-07 10:38:01.136021395 +0900
-@@ -41,7 +41,7 @@
+--- ipc/unix_ipc.cc.orig 2013-04-21 03:48:45.257269513 +0900
++++ ipc/unix_ipc.cc 2013-04-21 08:33:27.207272333 +0900
+@@ -41,6 +41,9 @@
#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/ucred.h>
++#endif
#include <sys/wait.h>
-@@ -125,7 +125,7 @@
+ #include <unistd.h>
+
+@@ -123,6 +126,29 @@
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);
-@@ -147,7 +147,7 @@
- *pid = 0;
- #endif
-
--#ifdef OS_LINUX
++ // 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);
++ if (::getsockopt(socket, 0, LOCAL_PEERCRED,
++ &peer_cred, &peer_cred_len) < 0) {
++ LOG(ERROR) << "cannot get peer credential. NOT a Unix socket?";
++ return false;
++ }
++ if (peer_cred.cr_version != XUCRED_VERSION) {
++ LOG(WARNING) << "credential version mismatch.";
++ return false;
++ }
++ if (peer_cred.cr_uid != ::geteuid()) {
++ LOG(WARNING) << "uid mismatch." << peer_cred.cr_uid << "!=" << ::geteuid();
++ return false;
++ }
++
++ // MacOS doesn't have cr_pid;
++ *pid = 0;
++#endif
++
+#if defined(OS_LINUX) && !defined(__FreeBSD__)
// On ARM Linux, we do nothing and just return true since the platform
// sometimes doesn't support the getsockopt(sock, SOL_SOCKET, SO_PEERCRED)
// system call.
-@@ -310,7 +310,7 @@
+@@ -144,6 +170,7 @@
+
+ *pid = peer_cred.pid;
+ #endif // __arm__
++#endif
+
+ return true;
+ }
+@@ -278,7 +305,12 @@
address.sun_family = AF_UNIX;
::memcpy(address.sun_path, server_address.data(), server_address_length);
address.sun_path[server_address_length] = '\0';
--#ifdef OS_MACOSX
+#if defined(OS_MACOSX) || defined(__FreeBSD__)
- address.sun_len = SUN_LEN(&address);
- const size_t sun_len = sizeof(address);
- #else
-@@ -435,21 +435,21 @@
++ address.sun_len = SUN_LEN(&address);
++ const size_t sun_len = sizeof(address);
++#else
+ const size_t sun_len = sizeof(address.sun_family) + server_address_length;
++#endif
+ pid_t pid = 0;
+ if (::connect(socket_,
+ reinterpret_cast<const sockaddr*>(&address),
+@@ -398,16 +430,21 @@
SO_REUSEADDR,
reinterpret_cast<char *>(&on),
sizeof(on));
--#ifdef OS_MACOSX
+#if defined(OS_MACOSX) || defined(__FreeBSD__)
- addr.sun_len = SUN_LEN(&addr);
- const size_t sun_len = sizeof(addr);
- #else
++ addr.sun_len = SUN_LEN(&addr);
++ const size_t sun_len = sizeof(addr);
++#else
const size_t sun_len = sizeof(addr.sun_family) + server_address_.size();
- #endif
- if (!IsAbstractSocket(server_address_)) {
- // Linux does not use files for IPC.
- ::chmod(server_address_.c_str(), 0600);
- }
++#endif
if (::bind(socket_, reinterpret_cast<sockaddr *>(&addr), sun_len) != 0) {
// The UNIX domain socket file (server_address_) already exists?
LOG(FATAL) << "bind() failed: " << strerror(errno);
diff --git a/japanese/mozc-server/files/patch-server_mozc_server.cc b/japanese/mozc-server/files/patch-server_mozc_server.cc
index c9b414b0b7c2..543604f7df33 100644
--- a/japanese/mozc-server/files/patch-server_mozc_server.cc
+++ b/japanese/mozc-server/files/patch-server_mozc_server.cc
@@ -1,15 +1,15 @@
---- server/mozc_server.cc.orig 2012-09-07 10:21:29.170020927 +0900
-+++ server/mozc_server.cc 2012-09-07 10:30:28.034021395 +0900
+--- server/mozc_server.cc.orig 2013-04-21 03:48:44.841269792 +0900
++++ server/mozc_server.cc 2013-04-21 04:14:37.821269328 +0900
@@ -32,6 +32,9 @@
- #ifdef OS_WINDOWS
+ #ifdef OS_WIN
#include <windows.h>
#endif
+#ifdef __FreeBSD__
+#include <signal.h>
+#endif
- #include "base/base.h"
- #include "base/crash_report_util.h"
+ #include <cstddef>
+ #include <string>
@@ -51,6 +54,23 @@
mozc::SessionServer *g_session_server = NULL;
}
@@ -44,6 +44,6 @@
+ ::signal(SIGTERM, sig_func);
+#endif
+
- #if defined(OS_WINDOWS)
+ #if defined(OS_WIN)
// On Windows, ShutdownSessionCallback is not called intentionally in order
// to avoid crashes oritinates from it. See b/2696087.
diff --git a/japanese/mozc-server/files/patch-third_party_gyp_pylib_gyp_common.py b/japanese/mozc-server/files/patch-third_party_gyp_pylib_gyp_common.py
index ce000e8b7175..a26890f1e33a 100644
--- a/japanese/mozc-server/files/patch-third_party_gyp_pylib_gyp_common.py
+++ b/japanese/mozc-server/files/patch-third_party_gyp_pylib_gyp_common.py
@@ -1,17 +1,14 @@
---- third_party/gyp/pylib/gyp/common.py.orig 2012-09-07 10:21:29.147021135 +0900
-+++ third_party/gyp/pylib/gyp/common.py 2012-09-17 17:14:43.781601968 +0900
-@@ -362,9 +362,11 @@
+--- third_party/gyp/pylib/gyp/common.py.orig 2013-04-21 03:48:44.556270889 +0900
++++ third_party/gyp/pylib/gyp/common.py 2013-04-21 04:16:32.525269583 +0900
+@@ -382,6 +382,11 @@
+ 'cygwin': 'win',
'win32': 'win',
'darwin': 'mac',
- 'sunos5': 'solaris',
-- 'freebsd7': 'freebsd',
-- 'freebsd8': 'freebsd',
-- 'freebsd9': 'freebsd',
+ 'freebsd7': 'linux',
+ 'freebsd8': 'linux',
+ 'freebsd9': 'linux',
+ 'freebsd10': 'linux',
-+ 'freebsd11': 'linux',
++ 'freebsd11': 'linux'
}
- flavor = flavors.get(sys.platform, 'linux')
- return params.get('flavor', flavor)
+
+ if 'flavor' in params:
diff --git a/japanese/mozc-server/files/patch-third_party_gyp_pylib_gyp_generator_make.py b/japanese/mozc-server/files/patch-third_party_gyp_pylib_gyp_generator_make.py
index ba7c1672b12f..62427e26104b 100644
--- a/japanese/mozc-server/files/patch-third_party_gyp_pylib_gyp_generator_make.py
+++ b/japanese/mozc-server/files/patch-third_party_gyp_pylib_gyp_generator_make.py
@@ -1,6 +1,6 @@
---- third_party/gyp/pylib/gyp/generator/make.py.orig 2012-09-07 10:21:29.146021648 +0900
-+++ third_party/gyp/pylib/gyp/generator/make.py 2012-09-17 17:15:20.613807429 +0900
-@@ -1963,6 +1963,9 @@
+--- third_party/gyp/pylib/gyp/generator/make.py.orig 2013-04-21 03:48:44.552270209 +0900
++++ third_party/gyp/pylib/gyp/generator/make.py 2013-04-21 04:16:32.828269137 +0900
+@@ -1956,6 +1956,9 @@
srcdir_prefix = '$(srcdir)/'
flock_command= 'flock'
diff --git a/japanese/mozc-server/files/patch-unix_ibus_gen_mozc_xml.py b/japanese/mozc-server/files/patch-unix_ibus_gen_mozc_xml.py
index 6850aa6d5d66..4919e6da85a2 100644
--- a/japanese/mozc-server/files/patch-unix_ibus_gen_mozc_xml.py
+++ b/japanese/mozc-server/files/patch-unix_ibus_gen_mozc_xml.py
@@ -1,17 +1,18 @@
---- unix/ibus/gen_mozc_xml.py.orig 2012-09-07 10:21:29.111022215 +0900
-+++ unix/ibus/gen_mozc_xml.py 2012-09-07 10:30:26.421021738 +0900
-@@ -40,6 +40,7 @@
- import optparse
+--- unix/ibus/gen_mozc_xml.py.orig 2013-04-21 03:48:44.433270458 +0900
++++ unix/ibus/gen_mozc_xml.py 2013-04-21 04:12:50.384269164 +0900
+@@ -41,6 +41,7 @@
import os
+ import subprocess
import sys
+import os
# Information to generate <component> part of mozc.xml. %s will be replaced with
# a product name, 'Mozc' or 'Google Japanese Input'.
-@@ -65,6 +66,24 @@
- 'rank': '80',
+@@ -75,6 +76,32 @@
+ 'symbol': '&#x3042;',
}
++# Override for FreeBSD
+if os.uname()[0] == 'FreeBSD':
+ IBUS_COMPONENT_PROPS = {
+ 'name': 'com.google.IBus.Mozc',
@@ -29,6 +30,13 @@
+ 'icon': '@@LOCALBASE@@/share/ibus-mozc/icons/product_logo.png',
+ 'rank': '0',
+ }
++ IBUS_1_5_ENGINE_COMMON_PROPS = {
++ 'description': '%s (Japanese Input Method)',
++ 'language': 'ja',
++ 'icon': '@@LOCALBASE@@/share/ibus-mozc/icons/product_logo.png',
++ 'rank': '80',
++ 'symbol': '&#x3042;',
++ }
+
# A dictionary from --platform to engines that are used in the platform. The
# information is used to generate <engines> part of mozc.xml.
diff --git a/japanese/mozc-server/files/patch-unix_ibus_mozc_engine.cc b/japanese/mozc-server/files/patch-unix_ibus_mozc_engine.cc
index 777eebb2b93b..3851a2841320 100644
--- a/japanese/mozc-server/files/patch-unix_ibus_mozc_engine.cc
+++ b/japanese/mozc-server/files/patch-unix_ibus_mozc_engine.cc
@@ -1,6 +1,6 @@
---- unix/ibus/mozc_engine.cc.orig 2012-09-07 10:21:29.111022215 +0900
-+++ unix/ibus/mozc_engine.cc 2012-09-07 10:30:26.452021649 +0900
-@@ -756,7 +756,7 @@
+--- unix/ibus/mozc_engine.cc.orig 2013-04-21 03:48:44.433270458 +0900
++++ unix/ibus/mozc_engine.cc 2013-04-21 04:12:50.609270610 +0900
+@@ -758,7 +758,7 @@
// on size_t, not uint32.
string selection_text;
const uint32 selection_start = min(cursor_pos, anchor_pos);
diff --git a/japanese/mozc-server/files/patch-unix_ibus_path_util.cc b/japanese/mozc-server/files/patch-unix_ibus_path_util.cc
index 43270812acd6..d488733b794b 100644
--- a/japanese/mozc-server/files/patch-unix_ibus_path_util.cc
+++ b/japanese/mozc-server/files/patch-unix_ibus_path_util.cc
@@ -1,5 +1,5 @@
---- unix/ibus/path_util.cc.orig 2012-09-07 10:21:29.112021454 +0900
-+++ unix/ibus/path_util.cc 2012-01-29 13:49:15.994806000 +0900
+--- unix/ibus/path_util.cc.orig 2013-04-21 03:48:44.435272531 +0900
++++ unix/ibus/path_util.cc 2013-04-21 04:12:51.235269303 +0900
@@ -30,14 +30,22 @@
#include "unix/ibus/path_util.h"