aboutsummaryrefslogtreecommitdiff
path: root/japanese/mozc-server
diff options
context:
space:
mode:
authorDaichi GOTO <daichi@FreeBSD.org>2010-09-05 02:08:49 +0000
committerDaichi GOTO <daichi@FreeBSD.org>2010-09-05 02:08:49 +0000
commit110eef605f02469d5fd0a4ea7c3e12f01e0ce603 (patch)
tree0f39d2d27d39022ab2b18befd1d065a872998bc6 /japanese/mozc-server
parent12c1d27aee4fb6d8d85ec4515fff3550516dd4b0 (diff)
downloadports-110eef605f02469d5fd0a4ea7c3e12f01e0ce603.tar.gz
ports-110eef605f02469d5fd0a4ea7c3e12f01e0ce603.zip
Notes
Diffstat (limited to 'japanese/mozc-server')
-rw-r--r--japanese/mozc-server/Makefile1
-rw-r--r--japanese/mozc-server/files/patch-ipc_unix_ipc.cc38
-rw-r--r--japanese/mozc-server/files/patch-server_mozc_server.cc48
3 files changed, 86 insertions, 1 deletions
diff --git a/japanese/mozc-server/Makefile b/japanese/mozc-server/Makefile
index df02aa5a96a2..e516f8a99eb9 100644
--- a/japanese/mozc-server/Makefile
+++ b/japanese/mozc-server/Makefile
@@ -7,6 +7,7 @@
PORTNAME= mozc-server
PORTVERSION= 0.12.434.102
+PORTREVISION= 1
CATEGORIES= japanese
MASTER_SITES= http://people.freebsd.org/~daichi/distfiles/
DISTNAME= mozc-${PORTVERSION}
diff --git a/japanese/mozc-server/files/patch-ipc_unix_ipc.cc b/japanese/mozc-server/files/patch-ipc_unix_ipc.cc
index ea575d28240d..7c173cb839ee 100644
--- a/japanese/mozc-server/files/patch-ipc_unix_ipc.cc
+++ b/japanese/mozc-server/files/patch-ipc_unix_ipc.cc
@@ -1,5 +1,5 @@
--- ipc/unix_ipc.cc.org 2010-09-03 11:29:17.747782268 +0900
-+++ ipc/unix_ipc.cc 2010-09-03 11:30:16.703030211 +0900
++++ ipc/unix_ipc.cc 2010-09-05 10:10:24.194440985 +0900
@@ -41,7 +41,7 @@
#include <sys/time.h>
#include <sys/types.h>
@@ -27,3 +27,39 @@
// 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.
+@@ -306,7 +306,7 @@
+ 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(__FreeBSD__) || defined(OS_MACOSX)
+ address.sun_len = SUN_LEN(&address);
+ const size_t sun_len = sizeof(address);
+ #else
+@@ -412,21 +412,21 @@
+ SO_REUSEADDR,
+ reinterpret_cast<char *>(&on),
+ sizeof(on));
+-#ifdef OS_MACOSX
++#if defined(__FreeBSD__) || defined(OS_MACOSX)
+ 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);
+- }
+ 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);
+ return;
+ }
++ if (!IsAbstractSocket(server_address_)) {
++ // Linux does not use files for IPC.
++ ::chmod(server_address_.c_str(), 0600);
++ }
+
+ if (::listen(socket_, num_connections) < 0) {
+ LOG(FATAL) << "listen() 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
new file mode 100644
index 000000000000..5562bd9b1367
--- /dev/null
+++ b/japanese/mozc-server/files/patch-server_mozc_server.cc
@@ -0,0 +1,48 @@
+--- server/mozc_server.cc.org 2010-09-05 10:11:21.205396567 +0900
++++ server/mozc_server.cc 2010-09-05 10:36:15.099047296 +0900
+@@ -29,6 +29,8 @@
+
+ #ifdef OS_WINDOWS
+ #include <windows.h>
++#else
++#include <signal.h>
+ #endif
+
+ #include "base/base.h"
+@@ -46,6 +48,23 @@
+ mozc::SessionServer *g_session_server = NULL;
+ }
+
++#ifndef OS_WINDOWS
++static void sig_func(int num)
++{
++ VLOG(1) << "signal " << num << " recieved.";
++ switch (num) {
++ case SIGINT:
++ case SIGHUP:
++ case SIGTERM:
++ if (g_session_server)
++ g_session_server->Terminate();
++ break;
++ default:
++ break;
++ }
++}
++#endif
++
+ namespace mozc {
+ namespace {
+
+@@ -122,6 +141,12 @@
+ return -1;
+ }
+
++#ifndef OS_WINDOWS
++ ::signal(SIGINT, sig_func);
++ ::signal(SIGHUP, sig_func);
++ ::signal(SIGTERM, sig_func);
++#endif
++
+ // Create a new thread.
+ // We can't call Loop() as Loop() doesn't make a thread.
+ // We have to make a thread here so that ShutdownSessionCallback()