0 | |
Description: Support kFreeBSD
|
1 | |
Forwarded: None
|
2 | |
Author: Nobuhiri Iwamatsu <iwamatsu@debian.org>
|
3 | |
Bug-Debian: No
|
4 | |
Last-Update: 2013-01-07
|
5 | |
|
6 | |
diff --git a/base/base.gyp b/base/base.gyp
|
7 | |
index e2773bc..2f64dd8 100755
|
8 | |
--- a/base/base.gyp
|
9 | |
+++ b/base/base.gyp
|
10 | |
@@ -98,7 +98,7 @@
|
11 | |
# shared among *host* binaries and *target* binaries. This means that
|
12 | |
# you should implement *host* binaries by using limited libraries
|
13 | |
# which are also available on NDK.
|
14 | |
- ['OS=="linux" and target_platform!="Android" and '
|
15 | |
+ ['OS=="gnu-kfreebsd" or (OS=="linux" and target_platform!="Android") and '
|
16 | |
'not (target_platform=="NaCl" and _toolset=="target")', {
|
17 | |
'defines': [
|
18 | |
'HAVE_LIBRT=1',
|
19 | |
@@ -260,7 +260,7 @@
|
20 | |
],
|
21 | |
}
|
22 | |
}],
|
23 | |
- ['OS=="linux" and target_platform!="Android"', {
|
24 | |
+ ['OS=="gnu-kfreebsd" or (OS=="linux" and target_platform!="Android")', {
|
25 | |
'cflags': [
|
26 | |
'<!@(<(pkg_config_command) --cflags-only-other openssl)',
|
27 | |
],
|
28 | |
diff --git a/base/cpu_stats.cc b/base/cpu_stats.cc
|
29 | |
index 19617bb..27f168d 100755
|
30 | |
--- a/base/cpu_stats.cc
|
31 | |
+++ b/base/cpu_stats.cc
|
32 | |
@@ -123,7 +123,7 @@ float CPUStats::GetSystemCPULoad() {
|
33 | |
|
34 | |
#endif // OS_MACOSX
|
35 | |
|
36 | |
-#ifdef OS_LINUX
|
37 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
38 | |
// NOT IMPLEMENTED
|
39 | |
// TODO(taku): implement Linux version
|
40 | |
// can take the info from /proc/stats
|
41 | |
@@ -178,7 +178,7 @@ float CPUStats::GetCurrentProcessCPULoad() {
|
42 | |
TimeValueTToInt64(task_times_info.system_time);
|
43 | |
#endif // OS_MACOSX
|
44 | |
|
45 | |
-#ifdef OS_LINUX
|
46 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
47 | |
// not implemented
|
48 | |
const uint64 total_times = 0;
|
49 | |
const uint64 cpu_times = 0;
|
50 | |
@@ -210,7 +210,7 @@ size_t CPUStats::GetNumberOfProcessors() const {
|
51 | |
return static_cast<size_t>(basic_info.avail_cpus);
|
52 | |
#endif // OS_MACOSX
|
53 | |
|
54 | |
-#ifdef OS_LINUX
|
55 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
56 | |
// Not implemented
|
57 | |
return 1;
|
58 | |
#endif // OS_LINUX
|
59 | |
diff --git a/base/iconv.cc b/base/iconv.cc
|
60 | |
index 089124d..f3fd74c 100755
|
61 | |
--- a/base/iconv.cc
|
62 | |
+++ b/base/iconv.cc
|
63 | |
@@ -53,7 +53,11 @@ bool IconvHelper(iconv_t ic, const string &input, string *output) {
|
64 | |
size_t olen_org = olen;
|
65 | |
iconv(ic, 0, &ilen, 0, &olen); // reset iconv state
|
66 | |
while (ilen != 0) {
|
67 | |
+#ifdef OS_FREEBSD
|
68 | |
+ if (iconv(ic, (const char **)(&ibuf), &ilen, &obuf, &olen)
|
69 | |
+#else
|
70 | |
if (iconv(ic, reinterpret_cast<char **>(&ibuf), &ilen, &obuf, &olen)
|
71 | |
+#endif
|
72 | |
== static_cast<size_t>(-1)) {
|
73 | |
return false;
|
74 | |
}
|
75 | |
diff --git a/base/logging.cc b/base/logging.cc
|
76 | |
index fcebb22..29d0e98 100755
|
77 | |
--- a/base/logging.cc
|
78 | |
+++ b/base/logging.cc
|
79 | |
@@ -106,12 +106,7 @@ string Logging::GetLogMessageHeader() {
|
80 | |
char buf[512];
|
81 | |
snprintf(buf, sizeof(buf),
|
82 | |
"%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d %u "
|
83 | |
-#if !defined(OS_LINUX) || defined(__native_client__)
|
84 | |
-// = OS_WINDOWS or OS_MACOSX or __native_client__
|
85 | |
- "%u",
|
86 | |
-#else
|
87 | |
"%lu",
|
88 | |
-#endif
|
89 | |
1900 + tm_time.tm_year,
|
90 | |
1 + tm_time.tm_mon,
|
91 | |
tm_time.tm_mday,
|
92 | |
diff --git a/base/mutex.cc b/base/mutex.cc
|
93 | |
index 4e34ec9..7379378 100755
|
94 | |
--- a/base/mutex.cc
|
95 | |
+++ b/base/mutex.cc
|
96 | |
@@ -61,7 +61,8 @@ namespace mozc {
|
97 | |
|
98 | |
// Wrapper for Windows InterlockedCompareExchange
|
99 | |
namespace {
|
100 | |
-#ifdef OS_LINUX
|
101 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
102 | |
+// TODO(taku):
|
103 | |
// Linux doesn't provide InterlockedCompareExchange-like function.
|
104 | |
inline int InterlockedCompareExchange(volatile int *target,
|
105 | |
int new_value,
|
106 | |
@@ -298,7 +299,7 @@ Mutex::Mutex() {
|
107 | |
pthread_mutexattr_init(&attr);
|
108 | |
#if defined(OS_MACOSX)
|
109 | |
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
110 | |
-#elif defined(OS_LINUX)
|
111 | |
+#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
112 | |
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
|
113 | |
#else
|
114 | |
#error "This platform is not supported."
|
115 | |
diff --git a/base/password_manager.cc b/base/password_manager.cc
|
116 | |
index b597d81..f960955 100755
|
117 | |
--- a/base/password_manager.cc
|
118 | |
+++ b/base/password_manager.cc
|
119 | |
@@ -366,7 +366,7 @@ class DeprecatedMacPasswordManager : public PasswordManagerInterface {
|
120 | |
// this module to other Linux distro, you might want to implement
|
121 | |
// a new password manager which adopts some secure mechanism such
|
122 | |
// like gnome-keyring.
|
123 | |
-#if defined OS_LINUX
|
124 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
125 | |
typedef PlainPasswordManager DefaultPasswordManager;
|
126 | |
#endif
|
127 | |
|
128 | |
diff --git a/base/process.cc b/base/process.cc
|
129 | |
index 4e5dd2e..b18aa22 100755
|
130 | |
--- a/base/process.cc
|
131 | |
+++ b/base/process.cc
|
132 | |
@@ -50,7 +50,7 @@
|
133 | |
#include "base/mac_process.h"
|
134 | |
#endif // OS_MACOSX
|
135 | |
|
136 | |
-#ifdef OS_LINUX
|
137 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
138 | |
#include <fcntl.h>
|
139 | |
#include <signal.h>
|
140 | |
#include <spawn.h> // for posix_spawn().
|
141 | |
@@ -120,7 +120,7 @@ bool Process::OpenBrowser(const string &url) {
|
142 | |
return ShellExecuteInSystemDir(L"open", wurl.c_str(), NULL, SW_SHOW);
|
143 | |
#endif
|
144 | |
|
145 | |
-#ifdef OS_LINUX
|
146 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
147 | |
static const char kBrowserCommand[] = "/usr/bin/xdg-open";
|
148 | |
// xdg-open which uses kfmclient or gnome-open internally works both on KDE
|
149 | |
// and GNOME environments.
|
150 | |
@@ -204,7 +204,7 @@ bool Process::SpawnProcess(const string &path,
|
151 | |
}
|
152 | |
#endif
|
153 | |
|
154 | |
-#ifdef OS_LINUX
|
155 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
156 | |
// Do not call posix_spawn() for obviously bad path.
|
157 | |
if (!S_ISREG(statbuf.st_mode)) {
|
158 | |
LOG(ERROR) << "Not a regular file: " << path;
|
159 | |
@@ -398,7 +398,7 @@ bool Process::LaunchErrorMessageDialog(const string &error_type) {
|
160 | |
}
|
161 | |
#endif // OS_WINDOWS
|
162 | |
|
163 | |
-#ifdef OS_LINUX
|
164 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
165 | |
const char kMozcTool[] = "mozc_tool";
|
166 | |
const string arg = "--mode=error_message_dialog --error_type=" + error_type;
|
167 | |
size_t pid = 0;
|
168 | |
diff --git a/base/run_level.cc b/base/run_level.cc
|
169 | |
index 15081c2..af68530 100755
|
170 | |
--- a/base/run_level.cc
|
171 | |
+++ b/base/run_level.cc
|
172 | |
@@ -34,7 +34,7 @@
|
173 | |
#include <aclapi.h>
|
174 | |
#endif // OS_WINDOWS
|
175 | |
|
176 | |
-#ifdef OS_LINUX
|
177 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
178 | |
#include <unistd.h>
|
179 | |
#include <sys/types.h>
|
180 | |
#endif // OS_LINUX
|
181 | |
diff --git a/base/thread.h b/base/thread.h
|
182 | |
index 165e909..ec5aa43 100755
|
183 | |
--- a/base/thread.h
|
184 | |
+++ b/base/thread.h
|
185 | |
@@ -55,7 +55,8 @@
|
186 | |
|
187 | |
// Andorid NDK and NaCl don't support TLS.
|
188 | |
#if defined(OS_LINUX) && !defined(OS_ANDROID) && \
|
189 | |
- !defined(__native_client__) && (defined(__GNUC__) || defined(__clang__))
|
190 | |
+ !defined(__native_client__) && (defined(__GNUC__) || defined(__clang__)) || \
|
191 | |
+ defined(OS_GNU_KFREEBSD)
|
192 | |
// GCC and Clang support TLS.
|
193 | |
#define TLS_KEYWORD __thread
|
194 | |
#define HAVE_TLS 1
|
195 | |
diff --git a/base/util.cc b/base/util.cc
|
196 | |
index 8788e10..e55919c 100755
|
197 | |
--- a/base/util.cc
|
198 | |
+++ b/base/util.cc
|
199 | |
@@ -891,7 +891,7 @@ class ClockImpl : public Util::ClockInterface {
|
200 | |
mach_timebase_info(&timebase_info);
|
201 | |
return static_cast<uint64>(
|
202 | |
1.0e9 * timebase_info.denom / timebase_info.numer);
|
203 | |
-#elif defined(OS_LINUX)
|
204 | |
+#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
205 | |
#if defined(HAVE_LIBRT)
|
206 | |
return 1000000000uLL;
|
207 | |
#else
|
208 | |
@@ -911,7 +911,7 @@ class ClockImpl : public Util::ClockInterface {
|
209 | |
return static_cast<uint64>(timestamp.QuadPart);
|
210 | |
#elif defined(OS_MACOSX)
|
211 | |
return static_cast<uint64>(mach_absolute_time());
|
212 | |
-#elif defined(OS_LINUX)
|
213 | |
+#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
214 | |
#if defined(HAVE_LIBRT)
|
215 | |
struct timespec timestamp;
|
216 | |
if (-1 == clock_gettime(CLOCK_REALTIME, ×tamp)) {
|
217 | |
@@ -1869,7 +1869,7 @@ string Util::GetServerDirectory() {
|
218 | |
return MacUtil::GetServerDirectory();
|
219 | |
#endif // OS_MACOSX
|
220 | |
|
221 | |
-#ifdef OS_LINUX
|
222 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
223 | |
return kMozcServerDirectory;
|
224 | |
#endif // OS_LINUX
|
225 | |
}
|
226 | |
@@ -2000,7 +2000,7 @@ bool GetCurrentSessionId(DWORD *session_id) {
|
227 | |
#endif // OS_WINDOWS
|
228 | |
|
229 | |
string Util::GetDesktopNameAsString() {
|
230 | |
-#ifdef OS_LINUX
|
231 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
232 | |
const char *display = getenv("DISPLAY");
|
233 | |
if (display == NULL) {
|
234 | |
return "";
|
235 | |
@@ -2514,7 +2514,7 @@ bool Util::IsPlatformSupported() {
|
236 | |
#if defined(OS_MACOSX)
|
237 | |
// TODO(yukawa): support Mac.
|
238 | |
return true;
|
239 | |
-#elif defined(OS_LINUX)
|
240 | |
+#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
241 | |
// TODO(yukawa): support Linux.
|
242 | |
return true;
|
243 | |
#elif defined(OS_WINDOWS)
|
244 | |
@@ -2873,6 +2873,9 @@ string Util::GetOSVersionString() {
|
245 | |
#elif defined(OS_LINUX)
|
246 | |
const string ret = "Linux";
|
247 | |
return ret;
|
248 | |
+#elif defined(OS_GNU_KFREEBSD)
|
249 | |
+ const string ret = "GNU/kFreeBSD";
|
250 | |
+ return ret;
|
251 | |
#else
|
252 | |
const string ret = "Unknown";
|
253 | |
return ret;
|
254 | |
@@ -2910,7 +2913,7 @@ uint64 Util::GetTotalPhysicalMemory() {
|
255 | |
return 0;
|
256 | |
}
|
257 | |
return total_memory;
|
258 | |
-#elif defined(OS_LINUX)
|
259 | |
+#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
260 | |
#if defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES)
|
261 | |
const long page_size = sysconf(_SC_PAGESIZE);
|
262 | |
const long number_of_phyisical_pages = sysconf(_SC_PHYS_PAGES);
|
263 | |
diff --git a/base/util_test.cc b/base/util_test.cc
|
264 | |
index 6d5d1c3..6a9b239 100755
|
265 | |
--- a/base/util_test.cc
|
266 | |
+++ b/base/util_test.cc
|
267 | |
@@ -2210,7 +2210,7 @@ TEST(UtilTest, MacMaybeMLockTest) {
|
268 | |
TEST(UtilTest, LinuxMaybeMLockTest) {
|
269 | |
size_t data_len = 32;
|
270 | |
void *addr = malloc(data_len);
|
271 | |
-#ifdef OS_LINUX
|
272 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
273 | |
#if defined(OS_ANDROID) || defined(__native_client__)
|
274 | |
EXPECT_EQ(-1, Util::MaybeMLock(addr, data_len));
|
275 | |
EXPECT_EQ(-1, Util::MaybeMUnlock(addr, data_len));
|
276 | |
diff --git a/build_mozc.py b/build_mozc.py
|
277 | |
index 8742994..a119309 100755
|
278 | |
--- a/build_mozc.py
|
279 | |
+++ b/build_mozc.py
|
280 | |
@@ -82,6 +82,14 @@ def GetMozcVersion():
|
281 | |
# TODO(matsuzakit): Caching might be better.
|
282 | |
return mozc_version.MozcVersion('%s/mozc_version.txt' % SRC_DIR)
|
283 | |
|
284 | |
+def IsFreeBSD():
|
285 | |
+ """Returns true if the platform is FreeBSD."""
|
286 | |
+ return os.name == 'posix' and os.uname()[0] == 'FreeBSD'
|
287 | |
+
|
288 | |
+def IsGNUkFreeBSD():
|
289 | |
+ """Returns true if the platform is GNU/kFreeBSD."""
|
290 | |
+ os.environ['GYP_DEFINES'] = 'OS=="GNU/kFreeBSD"'
|
291 | |
+ return os.name == 'posix' and os.uname()[0] == 'GNU/kFreeBSD'
|
292 | |
|
293 | |
def GetBuildBaseName(options, target_platform):
|
294 | |
"""Returns the build base directory.
|
295 | |
@@ -109,7 +117,7 @@ def GetBuildBaseName(options, target_platform):
|
296 | |
build_base = 'out_win'
|
297 | |
elif target_platform == 'Mac':
|
298 | |
build_base = 'out_mac'
|
299 | |
- elif target_platform == 'Linux' or target_platform == 'ChromeOS':
|
300 | |
+ elif target_platform == 'Linux' or target_platform == 'ChromeOS' or target_platform == 'GNU/kFreeBSD':
|
301 | |
build_base = 'out_linux'
|
302 | |
elif target_platform == 'Android':
|
303 | |
build_base = 'out_android'
|
304 | |
@@ -208,7 +216,7 @@ def GetGypFileNames(options):
|
305 | |
if IsWindows():
|
306 | |
gyp_file_names.extend(glob.glob('%s/win32/*/*.gyp' % SRC_DIR))
|
307 | |
gyp_file_names.extend(glob.glob('third_party/breakpad/*.gyp'))
|
308 | |
- elif IsLinux():
|
309 | |
+ elif IsLinux() or IsGNUkFreeBSD():
|
310 | |
gyp_file_names.extend(glob.glob('%s/unix/*/*.gyp' % SRC_DIR))
|
311 | |
# Add ibus.gyp if ibus version is >=1.4.1.
|
312 | |
if not PkgExists('ibus-1.0 >= 1.4.1'):
|
313 | |
@@ -274,6 +282,7 @@ def AddCommonOptions(parser):
|
314 | |
help='Specifies the base directory of the built binaries.')
|
315 | |
parser.add_option('--language', dest='language', default='japanese',
|
316 | |
help='Specify the target language to build.')
|
317 | |
+ parser.add_option('--os', dest='os', default='linux')
|
318 | |
return parser
|
319 | |
|
320 | |
|
321 | |
@@ -288,6 +297,10 @@ def AddTargetPlatformOption(parser):
|
322 | |
default_target = 'Windows'
|
323 | |
elif IsMac():
|
324 | |
default_target = 'Mac'
|
325 | |
+ elif IsFreeBSD():
|
326 | |
+ default_target = 'FreeBSD'
|
327 | |
+ elif IsGNUkFreeBSD():
|
328 | |
+ default_target = 'GNU/kFreeBSD'
|
329 | |
parser.add_option('--target_platform', dest='target_platform',
|
330 | |
default=default_target,
|
331 | |
help=('Linux environment can build for Linux, Android and '
|
332 | |
@@ -481,7 +494,7 @@ def ParseBuildOptions(args=None, values=None):
|
333 | |
"""Parses command line options for the build command."""
|
334 | |
parser = optparse.OptionParser(usage='Usage: %prog build [options]')
|
335 | |
AddCommonOptions(parser)
|
336 | |
- if IsLinux():
|
337 | |
+ if IsLinux() or IsGNUkFreeBSD():
|
338 | |
default_build_concurrency = GetNumberOfProcessors() * 2
|
339 | |
parser.add_option('--jobs', '-j', dest='jobs',
|
340 | |
default=('%d' % default_build_concurrency),
|
341 | |
@@ -501,7 +514,7 @@ def ParseRunTestsOptions(args=None, values=None):
|
342 | |
parser = optparse.OptionParser(
|
343 | |
usage='Usage: %prog runtests [options] [test_targets] [-- build options]')
|
344 | |
AddCommonOptions(parser)
|
345 | |
- if IsLinux():
|
346 | |
+ if IsLinux() or IsGNUkFreeBSD():
|
347 | |
default_build_concurrency = GetNumberOfProcessors() * 2
|
348 | |
parser.add_option('--jobs', '-j', dest='jobs',
|
349 | |
default=('%d' % default_build_concurrency),
|
350 | |
@@ -634,6 +647,8 @@ def GypMain(options, unused_args):
|
351 | |
command_line.extend(['-D', 'wix_dir=%s' % options.wix_dir])
|
352 | |
else:
|
353 | |
command_line.extend(['-D', 'use_wix=NO'])
|
354 | |
+ if options.os:
|
355 | |
+ command_line.extend(['-D', 'OS=%s' % options.os])
|
356 | |
|
357 | |
command_line.extend(['-D', 'android_arch_abi=%s' % options.android_arch_abi])
|
358 | |
command_line.extend(['-D', 'android_application_id=%s' %
|
359 | |
@@ -669,7 +684,7 @@ def GypMain(options, unused_args):
|
360 | |
|
361 | |
def SetCommandLineForFeature(option_name, windows=False, mac=False,
|
362 | |
linux=False, chromeos=False, android=False,
|
363 | |
- nacl=False):
|
364 | |
+ nacl=False, freebsd=False, gnu_kfreebsd=False):
|
365 | |
"""Updates an option like '--enable_foober' and add a -D argument for gyp.
|
366 | |
|
367 | |
This function ensures an option like '--enable_foober' exists and it has a
|
368 | |
@@ -693,6 +708,10 @@ def GypMain(options, unused_args):
|
369 | |
option on Android platform.
|
370 | |
nacl: A boolean which replesents the default value of the target
|
371 | |
option on NaCl.
|
372 | |
+ freebsd: A boolean which replesents the default value of the target
|
373 | |
+ option on FreeBSD platform.
|
374 | |
+ gnu_fkreebsd: A boolean which replesents the default value of the target
|
375 | |
+ option on GNU/kFreeBSD platform.
|
376 | |
|
377 | |
Raises:
|
378 | |
ValueError: An error occurred when 'option_name' is empty.
|
379 | |
@@ -706,6 +725,7 @@ def GypMain(options, unused_args):
|
380 | |
'Linux': linux,
|
381 | |
'ChromeOS': chromeos,
|
382 | |
'Android': android,
|
383 | |
+ 'GNU/kFreeBSD': gnu_kfreebsd,
|
384 | |
'NaCl': nacl}[options.target_platform]
|
385 | |
enable_option_name = 'enable_%s' % option_name
|
386 | |
enabled = options.ensure_value(enable_option_name, default_enabled)
|
387 | |
@@ -769,7 +789,7 @@ def GypMain(options, unused_args):
|
388 | |
else:
|
389 | |
command_line.extend(['-D', 'use_zinnia=NO'])
|
390 | |
|
391 | |
- if IsLinux():
|
392 | |
+ if IsLinux() or IsGNUkFreeBSD():
|
393 | |
if '%s/unix/ibus/ibus.gyp' % SRC_DIR in gyp_file_names:
|
394 | |
command_line.extend(['-D', 'use_libibus=1'])
|
395 | |
|
396 | |
@@ -790,7 +810,7 @@ def GypMain(options, unused_args):
|
397 | |
# command for pkg-config. Here we catch the environment variable
|
398 | |
# and use the specified command instead of actual pkg-config
|
399 | |
# command.
|
400 | |
- if IsLinux():
|
401 | |
+ if IsLinux() or IsFreeBSD() or IsGNUkFreeBSD():
|
402 | |
command_line.extend(['-D', 'pkg_config_command=%s' % GetPkgConfigCommand()])
|
403 | |
else:
|
404 | |
command_line.extend(['-D', 'pkg_config_command='])
|
405 | |
@@ -927,6 +947,44 @@ def BuildOnMac(options, targets, original_directory_name):
|
406 | |
'-parallelizeTargets',
|
407 | |
'BUILD_WITH_GYP=1'])
|
408 | |
|
409 | |
+def BuildOnBSD(options, targets, unused_original_directory_name):
|
410 | |
+ """Build the targets on *BSD."""
|
411 | |
+ target_names = []
|
412 | |
+ for target in targets:
|
413 | |
+ (unused_gyp_file_name, target_name) = (
|
414 | |
+ CanonicalTargetToGypFileAndTargetName(target))
|
415 | |
+ target_names.append(target_name)
|
416 | |
+
|
417 | |
+ if os.uname()[0] == 'FreeBSD' :
|
418 | |
+ make_command = os.getenv('BUILD_COMMAND', 'gmake')
|
419 | |
+ else:
|
420 | |
+ make_command = os.getenv('BUILD_COMMAND', 'make')
|
421 | |
+ # flags for building in Chrome OS chroot environment
|
422 | |
+ envvars = [
|
423 | |
+ 'CFLAGS',
|
424 | |
+ 'CXXFLAGS',
|
425 | |
+ 'CXX',
|
426 | |
+ 'CC',
|
427 | |
+ 'AR',
|
428 | |
+ 'AS',
|
429 | |
+ 'RANLIB',
|
430 | |
+ 'LD',
|
431 | |
+ ]
|
432 | |
+ for envvar in envvars:
|
433 | |
+ if envvar in os.environ:
|
434 | |
+ os.environ[envvar] = os.getenv(envvar)
|
435 | |
+
|
436 | |
+ # set output directory
|
437 | |
+ os.environ['builddir_name'] = 'out_bsd'
|
438 | |
+
|
439 | |
+ build_args = ['-j%s' % options.jobs,
|
440 | |
+ 'MAKE_JOBS=%s' % options.jobs,
|
441 | |
+ 'BUILDTYPE=%s' % options.configuration]
|
442 | |
+ build_args.append('builddir_name=%s' %
|
443 | |
+ GetBuildBaseName(options,
|
444 | |
+ GetMozcVersion().GetTargetPlatform()))
|
445 | |
+
|
446 | |
+ RunOrDie([make_command] + build_args + target_names)
|
447 | |
|
448 | |
def LocateMSBuildDir():
|
449 | |
"""Locate the directory where msbuild.exe exists.
|
450 | |
@@ -1079,6 +1137,8 @@ def BuildMain(options, targets, original_directory_name):
|
451 | |
BuildOnMac(options, targets, original_directory_name)
|
452 | |
elif IsLinux():
|
453 | |
BuildOnLinux(options, targets, original_directory_name)
|
454 | |
+ elif IsFreeBSD() or IsGNUkFreeBSD():
|
455 | |
+ BuildOnBSD(options, targets, original_directory_name)
|
456 | |
elif IsWindows():
|
457 | |
BuildOnWindows(options, targets, original_directory_name)
|
458 | |
else:
|
459 | |
@@ -1350,7 +1410,7 @@ def CleanBuildFilesAndDirectories(options, unused_args):
|
460 | |
elif IsMac():
|
461 | |
directory_names.extend(glob.glob(os.path.join(gyp_directory_name,
|
462 | |
'*.xcodeproj')))
|
463 | |
- elif IsLinux():
|
464 | |
+ elif IsLinux() or IsFreeBSD() or IsGNUkFreeBSD():
|
465 | |
file_names.extend(glob.glob(os.path.join(gyp_directory_name,
|
466 | |
'*.target.mk')))
|
467 | |
file_names.extend(glob.glob(os.path.join(gyp_directory_name,
|
468 | |
@@ -1377,6 +1437,10 @@ def CleanBuildFilesAndDirectories(options, unused_args):
|
469 | |
file_names.append('Makefile')
|
470 | |
elif IsWindows():
|
471 | |
file_names.append('third_party/breakpad/breakpad.gyp')
|
472 | |
+ directory_names.append('out_win')
|
473 | |
+ elif IsFreeBSD() or IsGNUkFreeBSD():
|
474 | |
+ file_names.append('Makefile')
|
475 | |
+ directory_names.append('out_bsd')
|
476 | |
# Remove files.
|
477 | |
for file_name in file_names:
|
478 | |
RemoveFile(file_name)
|
479 | |
@@ -1403,7 +1467,6 @@ def ShowHelpAndExit():
|
480 | |
print 'See also the comment in the script for typical usage.'
|
481 | |
sys.exit(1)
|
482 | |
|
483 | |
-
|
484 | |
def main():
|
485 | |
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')
|
486 | |
logging.getLogger().addFilter(ColoredLoggingFilter())
|
487 | |
diff --git a/build_tools/mozc_version.py b/build_tools/mozc_version.py
|
488 | |
index 9bebbc4..bdb823c 100755
|
489 | |
--- a/build_tools/mozc_version.py
|
490 | |
+++ b/build_tools/mozc_version.py
|
491 | |
@@ -57,6 +57,13 @@ import os
|
492 | |
import re
|
493 | |
import sys
|
494 | |
|
495 | |
+def IsFreeBSD():
|
496 | |
+ """Returns true if the platform is FreeBSD."""
|
497 | |
+ return os.name == 'posix' and os.uname()[0] == 'FreeBSD'
|
498 | |
+
|
499 | |
+def IsGNUkFreeBSD():
|
500 | |
+ """Returns true if the platform is GNU/kFreeBSD."""
|
501 | |
+ return os.name == 'posix' and os.uname()[0] == 'GNU/kFreeBSD'
|
502 | |
|
503 | |
TARGET_PLATFORM_TO_DIGIT = {
|
504 | |
'Windows': '0',
|
505 | |
@@ -65,6 +72,8 @@ TARGET_PLATFORM_TO_DIGIT = {
|
506 | |
'ChromeOS': '2',
|
507 | |
'Android': '3',
|
508 | |
'NaCl': '4',
|
509 | |
+ 'FreeBSD': '5',
|
510 | |
+ 'GNU/kFreeBSD': '6',
|
511 | |
}
|
512 | |
|
513 | |
VERSION_PROPERTIES = [
|
514 | |
diff --git a/chrome/skk/skk.gyp b/chrome/skk/skk.gyp
|
515 | |
index 3b82e84..ec69cc1 100755
|
516 | |
--- a/chrome/skk/skk.gyp
|
517 | |
+++ b/chrome/skk/skk.gyp
|
518 | |
@@ -42,7 +42,7 @@
|
519 | |
'configuration_nacl_i686': '<(CONFIGURATION_NAME)_NaCl_i686',
|
520 | |
'configuration_nacl_x86_64': '<(CONFIGURATION_NAME)_NaCl_x86-64',
|
521 | |
'conditions': [
|
522 | |
- ['OS=="linux"', {
|
523 | |
+ ['OS=="linux" or OS=="gnu-kfreebsd"', {
|
524 | |
# We need to copy binaries for NaCl i686 and x86-64 into a single skk
|
525 | |
# directory across configurations. The following variables must be
|
526 | |
# the same as <(PRODUCT_DIR) for each configuration.
|
527 | |
diff --git a/client/client.cc b/client/client.cc
|
528 | |
index 5c7f718..7db07b5 100755
|
529 | |
--- a/client/client.cc
|
530 | |
+++ b/client/client.cc
|
531 | |
@@ -934,7 +934,7 @@ bool Client::LaunchTool(const string &mode, const string &extra_arg) {
|
532 | |
return false;
|
533 | |
}
|
534 | |
|
535 | |
-#if defined(OS_WINDOWS) || defined(OS_LINUX)
|
536 | |
+#if defined(OS_WINDOWS) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
537 | |
string arg = "--mode=" + mode;
|
538 | |
if (!extra_arg.empty()) {
|
539 | |
arg += " ";
|
540 | |
diff --git a/config/stats_config_util_test.cc b/config/stats_config_util_test.cc
|
541 | |
index 48a4eba..e373b25 100755
|
542 | |
--- a/config/stats_config_util_test.cc
|
543 | |
+++ b/config/stats_config_util_test.cc
|
544 | |
@@ -708,13 +708,13 @@ TEST(StatsConfigUtilTestAndroid, DefaultValueTest) {
|
545 | |
}
|
546 | |
#endif // OS_ANDROID
|
547 | |
|
548 | |
-#ifdef OS_LINUX
|
549 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
550 | |
#ifndef OS_ANDROID
|
551 | |
TEST(StatsConfigUtilTestLinux, DefaultValueTest) {
|
552 | |
EXPECT_FALSE(StatsConfigUtil::IsEnabled());
|
553 | |
}
|
554 | |
#endif // OS_ANDROID
|
555 | |
-#endif // OS_LINUX
|
556 | |
+#endif // #if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
557 | |
|
558 | |
#else // !GOOGLE_JAPANESE_INPUT_BUILD
|
559 | |
TEST(StatsConfigUtilTestNonOfficialBuild, DefaultValueTest) {
|
560 | |
diff --git a/gui/base/locale_util.cc b/gui/base/locale_util.cc
|
561 | |
index 3bc8e98..6c1ccb3 100755
|
562 | |
--- a/gui/base/locale_util.cc
|
563 | |
+++ b/gui/base/locale_util.cc
|
564 | |
@@ -206,7 +206,7 @@ TranslationDataImpl::TranslationDataImpl()
|
565 | |
qApp->installEventFilter(&window_title_modifier_);
|
566 | |
#endif // MOZC_SHOW_BUILD_NUMBER_ON_TITLE
|
567 | |
|
568 | |
-#ifdef OS_LINUX
|
569 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
570 | |
// Use system default messages.
|
571 | |
// Even if the locale is not English nor Japanese, load translation
|
572 | |
// file to translate common messages like "OK" and "Cancel".
|
573 | |
diff --git a/gui/config_dialog/config_dialog.cc b/gui/config_dialog/config_dialog.cc
|
574 | |
index 61ee405..453a672 100755
|
575 | |
--- a/gui/config_dialog/config_dialog.cc
|
576 | |
+++ b/gui/config_dialog/config_dialog.cc
|
577 | |
@@ -83,7 +83,7 @@ ConfigDialog::ConfigDialog()
|
578 | |
miscAdministrationWidget->setVisible(false);
|
579 | |
#endif // OS_MACOSX
|
580 | |
|
581 | |
-#if defined(OS_LINUX)
|
582 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
583 | |
miscDefaultIMEWidget->setVisible(false);
|
584 | |
miscAdministrationWidget->setVisible(false);
|
585 | |
miscStartupWidget->setVisible(false);
|
586 | |
@@ -93,7 +93,7 @@ ConfigDialog::ConfigDialog()
|
587 | |
// disable logging options
|
588 | |
miscLoggingWidget->setVisible(false);
|
589 | |
|
590 | |
-#if defined(OS_LINUX)
|
591 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
592 | |
// The last "misc" tab has no valid configs on Linux
|
593 | |
const int kMiscTabIndex = 6;
|
594 | |
configDialogTabWidget->removeTab(kMiscTabIndex);
|
595 | |
@@ -322,7 +322,7 @@ ConfigDialog::ConfigDialog()
|
596 | |
dictionaryPreloadingAndUACLabel->setVisible(false);
|
597 | |
#endif // OS_WINDOWS
|
598 | |
|
599 | |
-#ifdef OS_LINUX
|
600 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
601 | |
// On Linux, disable all fields for UsageStats
|
602 | |
usageStatsLabel->setEnabled(false);
|
603 | |
usageStatsLabel->setVisible(false);
|
604 | |
@@ -438,7 +438,7 @@ bool ConfigDialog::Update() {
|
605 | |
}
|
606 | |
|
607 | |
|
608 | |
-#if defined(OS_WINDOWS) || defined(OS_LINUX)
|
609 | |
+#if defined(OS_WINDOWS) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
610 | |
if (initial_preedit_method_ !=
|
611 | |
static_cast<int>(config.preedit_method()) ||
|
612 | |
initial_use_keyboard_to_change_preedit_method_ !=
|
613 | |
diff --git a/gui/config_dialog/keybinding_editor.cc b/gui/config_dialog/keybinding_editor.cc
|
614 | |
index 0644079..7d7728a 100755
|
615 | |
--- a/gui/config_dialog/keybinding_editor.cc
|
616 | |
+++ b/gui/config_dialog/keybinding_editor.cc
|
617 | |
@@ -33,7 +33,7 @@
|
618 | |
#include <windows.h>
|
619 | |
#include <imm.h>
|
620 | |
#include <ime.h>
|
621 | |
-#elif OS_LINUX
|
622 | |
+#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
623 | |
#define XK_MISCELLANY
|
624 | |
#include <X11/keysymdef.h>
|
625 | |
#endif
|
626 | |
@@ -121,7 +121,7 @@ const WinVirtualKeyEntry kWinVirtualKeyModifierNonRequiredTable[] = {
|
627 | |
{ VK_DBE_DBCSCHAR, "Hankaku/Zenkaku" }, // Zenkaku/hankaku
|
628 | |
// { VK_KANJI, "Kanji" }, // Do not support Kanji
|
629 | |
};
|
630 | |
-#elif OS_LINUX
|
631 | |
+#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
632 | |
struct LinuxVirtualKeyEntry {
|
633 | |
uint16 virtual_key;
|
634 | |
const char *mozc_key_name;
|
635 | |
@@ -390,7 +390,7 @@ KeyBindingFilter::KeyState KeyBindingFilter::AddKey(
|
636 | |
return Encode(result);
|
637 | |
}
|
638 | |
}
|
639 | |
-#elif OS_LINUX
|
640 | |
+#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
641 | |
const uint16 virtual_key = key_event.nativeVirtualKey();
|
642 | |
|
643 | |
// The XKB defines three types of logical key code: "xkb::Hiragana",
|
644 | |
@@ -500,7 +500,7 @@ bool KeyBindingFilter::eventFilter(QObject *obj, QEvent *event) {
|
645 | |
KeyBindingEditor::KeyBindingEditor(QWidget *parent, QWidget *trigger_parent)
|
646 | |
: QDialog(parent), trigger_parent_(trigger_parent) {
|
647 | |
setupUi(this);
|
648 | |
-#ifdef OS_LINUX
|
649 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
650 | |
// Workaround for the issue http://code.google.com/p/mozc/issues/detail?id=9
|
651 | |
// Seems that even after clicking the button for the keybinding dialog,
|
652 | |
// the edit is not raised. This might be a bug of setFocusProxy.
|
653 | |
diff --git a/gui/config_dialog/keymap_editor.cc b/gui/config_dialog/keymap_editor.cc
|
654 | |
index 6d33630..6285618 100755
|
655 | |
--- a/gui/config_dialog/keymap_editor.cc
|
656 | |
+++ b/gui/config_dialog/keymap_editor.cc
|
657 | |
@@ -447,7 +447,7 @@ bool KeyMapEditorDialog::Update() {
|
658 | |
*keymap_table += invisible_keymap_table_;
|
659 | |
|
660 | |
if (new_ime_switch_keymap != ime_switch_keymap_) {
|
661 | |
-#if defined(OS_WINDOWS) || defined(OS_LINUX)
|
662 | |
+#if defined(OS_WINDOWS) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
663 | |
QMessageBox::information(
|
664 | |
this,
|
665 | |
tr("Mozc settings"),
|
666 | |
diff --git a/gui/dictionary_tool/dictionary_tool.cc b/gui/dictionary_tool/dictionary_tool.cc
|
667 | |
index f9846e1..2b0199d 100755
|
668 | |
--- a/gui/dictionary_tool/dictionary_tool.cc
|
669 | |
+++ b/gui/dictionary_tool/dictionary_tool.cc
|
670 | |
@@ -339,7 +339,7 @@ DictionaryTool::DictionaryTool(QWidget *parent)
|
671 | |
}
|
672 | |
|
673 | |
// main window
|
674 | |
-#ifndef OS_LINUX
|
675 | |
+#if !defined(OS_LINUX) && !defined(OS_GNU_KFREEBSD) && !defined(OS_FREEBSD)
|
676 | |
// For some reason setCentralWidget crashes the dictionary_tool on Linux
|
677 | |
// TODO(taku): investigate the cause of the crashes
|
678 | |
setCentralWidget(splitter_);
|
679 | |
diff --git a/gui/gui.gyp b/gui/gui.gyp
|
680 | |
index 8f2f3c0..5e0f08b 100755
|
681 | |
--- a/gui/gui.gyp
|
682 | |
+++ b/gui/gui.gyp
|
683 | |
@@ -387,7 +387,7 @@
|
684 | |
'../session/session_base.gyp:session_protocol',
|
685 | |
],
|
686 | |
}],
|
687 | |
- ['use_libzinnia==1 and OS=="linux"', {
|
688 | |
+ ['use_libzinnia==1 and (OS=="linux" or OS=="gnu-kfreebsd")', {
|
689 | |
'defines': [
|
690 | |
'USE_LIBZINNIA',
|
691 | |
],
|
692 | |
diff --git a/gui/qt_libraries.gypi b/gui/qt_libraries.gypi
|
693 | |
index 4c4894f..d9ec5a0 100755
|
694 | |
--- a/gui/qt_libraries.gypi
|
695 | |
+++ b/gui/qt_libraries.gypi
|
696 | |
@@ -84,7 +84,7 @@
|
697 | |
'$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
|
698 | |
]
|
699 | |
}],
|
700 | |
- ['OS=="linux"', {
|
701 | |
+ ['OS=="linux" or OS=="gnu-kfreebsd"', {
|
702 | |
'conditions': [
|
703 | |
['qt_dir', {
|
704 | |
'libraries': [
|
705 | |
diff --git a/gui/word_register_dialog/word_register_dialog.cc b/gui/word_register_dialog/word_register_dialog.cc
|
706 | |
index 1830653..7f08de3 100755
|
707 | |
--- a/gui/word_register_dialog/word_register_dialog.cc
|
708 | |
+++ b/gui/word_register_dialog/word_register_dialog.cc
|
709 | |
@@ -81,7 +81,7 @@ QString GetEnv(const char *envname) {
|
710 | |
}
|
711 | |
return "";
|
712 | |
#endif // OS_WINDOWS
|
713 | |
-#if defined(OS_MACOSX) || defined(OS_LINUX)
|
714 | |
+#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
715 | |
return ::getenv(envname);
|
716 | |
#endif // OS_MACOSX or OS_LINUX
|
717 | |
// TODO(team): Support other platforms.
|
718 | |
diff --git a/gui/zinnia.gyp b/gui/zinnia.gyp
|
719 | |
index 3209843..e76f55a 100755
|
720 | |
--- a/gui/zinnia.gyp
|
721 | |
+++ b/gui/zinnia.gyp
|
722 | |
@@ -48,7 +48,7 @@
|
723 | |
'-Wno-type-limits',
|
724 | |
],
|
725 | |
'conditions': [
|
726 | |
- ['OS=="linux"', {
|
727 | |
+ ['OS=="linux" or OS=="gnu-kfreebsd"', {
|
728 | |
'conditions': [
|
729 | |
['use_libzinnia==1', {
|
730 | |
'link_settings': {
|
731 | |
diff --git a/gyp/common.gypi b/gyp/common.gypi
|
732 | |
index 93e1981..68ef1cf 100755
|
733 | |
--- a/gyp/common.gypi
|
734 | |
+++ b/gyp/common.gypi
|
735 | |
@@ -283,12 +283,12 @@
|
736 | |
# additional suffix except for Japanese so that multiple
|
737 | |
# converter processes can coexist. Note that Mozc on ChromeOS does
|
738 | |
# not use IPC so this kind of special treatment is not required.
|
739 | |
- ['language!="japanese" and target_platform=="Linux"', {
|
740 | |
+ ['language!="japanese" and target_platform=="Linux" or target_platform=="GNU/kFreeBSD"', {
|
741 | |
'defines': [
|
742 | |
'MOZC_LANGUAGE_SUFFIX_FOR_LINUX="_<(language)"',
|
743 | |
],
|
744 | |
}],
|
745 | |
- ['OS=="linux"', {
|
746 | |
+ ['OS=="linux" or OS=="gnu-kfreebsd"', {
|
747 | |
'ldflags': [
|
748 | |
'<@(linux_ldflags)',
|
749 | |
],
|
750 | |
@@ -438,7 +438,7 @@
|
751 | |
},
|
752 | |
},
|
753 | |
'conditions': [
|
754 | |
- ['OS=="linux"', {
|
755 | |
+ ['OS=="linux" or OS=="gnu-kfreebsd"', {
|
756 | |
'cflags': [
|
757 | |
'<@(debug_extra_cflags)',
|
758 | |
],
|
759 | |
@@ -476,7 +476,7 @@
|
760 | |
},
|
761 | |
},
|
762 | |
'conditions': [
|
763 | |
- ['OS=="linux"', {
|
764 | |
+ ['OS=="linux" or OS=="gnu-kfreebsd"', {
|
765 | |
'cflags': [
|
766 | |
'<@(release_extra_cflags)',
|
767 | |
],
|
768 | |
@@ -789,6 +789,16 @@
|
769 | |
}],
|
770 | |
],
|
771 | |
}],
|
772 | |
+ ['OS=="gnu-kfreebsd"', {
|
773 | |
+ 'defines': [
|
774 | |
+ 'OS_GNU_KFREEBSD',
|
775 | |
+ ],
|
776 | |
+ 'cflags': [
|
777 | |
+ '<@(gcc_cflags)',
|
778 | |
+ '-fPIC',
|
779 | |
+ '-fno-exceptions',
|
780 | |
+ ],
|
781 | |
+ }],
|
782 | |
['OS=="mac"', {
|
783 | |
'defines': [
|
784 | |
'OS_MACOSX',
|
785 | |
diff --git a/handwriting/handwriting.gyp b/handwriting/handwriting.gyp
|
786 | |
index 1538d43..b78e773 100755
|
787 | |
--- a/handwriting/handwriting.gyp
|
788 | |
+++ b/handwriting/handwriting.gyp
|
789 | |
@@ -39,7 +39,7 @@
|
790 | |
'../base/base.gyp:base',
|
791 | |
'../gui/zinnia.gyp:zinnia',
|
792 | |
],
|
793 | |
- 'conditions': [['use_libzinnia==1 and OS=="linux"', {
|
794 | |
+ 'conditions': [['use_libzinnia==1 and (OS=="linux" or OS=="gnu-kfreebsd")', {
|
795 | |
'defines': [
|
796 | |
'USE_LIBZINNIA',
|
797 | |
],
|
798 | |
diff --git a/ipc/ipc_path_manager.cc b/ipc/ipc_path_manager.cc
|
799 | |
index 86f4a0c..b000cda 100755
|
800 | |
--- a/ipc/ipc_path_manager.cc
|
801 | |
+++ b/ipc/ipc_path_manager.cc
|
802 | |
@@ -284,7 +284,7 @@ bool IPCPathManager::GetPathName(string *ipc_name) const {
|
803 | |
*ipc_name = kIPCPrefix;
|
804 | |
#endif // OS_WINDOWS
|
805 | |
|
806 | |
-#ifdef OS_LINUX
|
807 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
808 | |
// On Linux, use abstract namespace which is independent of the file system.
|
809 | |
(*ipc_name)[0] = '\0';
|
810 | |
#endif
|
811 | |
@@ -377,7 +377,7 @@ bool IPCPathManager::IsValidServer(uint32 pid,
|
812 | |
}
|
813 | |
#endif
|
814 | |
|
815 | |
-#ifdef OS_LINUX
|
816 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
817 | |
// load from /proc/<pid>/exe
|
818 | |
char proc[128];
|
819 | |
char filename[512];
|
820 | |
@@ -397,7 +397,7 @@ bool IPCPathManager::IsValidServer(uint32 pid,
|
821 | |
return true;
|
822 | |
}
|
823 | |
|
824 | |
-#ifdef OS_LINUX
|
825 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
826 | |
if ((server_path + " (deleted)") == server_path_) {
|
827 | |
LOG(WARNING) << server_path << " on disk is modified";
|
828 | |
// If a user updates the server binary on disk during the server is running,
|
829 | |
diff --git a/ipc/ipc_path_manager_test.cc b/ipc/ipc_path_manager_test.cc
|
830 | |
index 592499c..7c0e9cb 100755
|
831 | |
--- a/ipc/ipc_path_manager_test.cc
|
832 | |
+++ b/ipc/ipc_path_manager_test.cc
|
833 | |
@@ -102,7 +102,7 @@ TEST_F(IPCPathManagerTest, IPCPathManagerTest) {
|
834 | |
EXPECT_FALSE(manager->GetServerProductVersion().empty());
|
835 | |
EXPECT_GT(manager->GetServerProcessId(), 0);
|
836 | |
EXPECT_EQ(t.path(), path);
|
837 | |
-#ifdef OS_LINUX
|
838 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
839 | |
// On Linux, |path| should be abstract (see man unix(7) for details.)
|
840 | |
ASSERT_FALSE(path.empty());
|
841 | |
EXPECT_EQ('\0', path[0]);
|
842 | |
diff --git a/ipc/unix_ipc.cc b/ipc/unix_ipc.cc
|
843 | |
index e4b8c68..3f611a8 100755
|
844 | |
--- a/ipc/unix_ipc.cc
|
845 | |
+++ b/ipc/unix_ipc.cc
|
846 | |
@@ -28,7 +28,7 @@
|
847 | |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
848 | |
|
849 | |
// skip all if non-Linux or Android.
|
850 | |
-#if defined(OS_LINUX) && !defined(OS_ANDROID)
|
851 | |
+#if (defined(OS_LINUX) && !defined(OS_ANDROID)) || defined(OS_GNU_KFREEBSD)
|
852 | |
|
853 | |
#include "ipc/ipc.h"
|
854 | |
|
855 | |
@@ -41,7 +41,7 @@
|
856 | |
#include <sys/time.h>
|
857 | |
#include <sys/types.h>
|
858 | |
#include <sys/un.h>
|
859 | |
-#ifdef OS_MACOSX
|
860 | |
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
|
861 | |
#include <sys/ucred.h>
|
862 | |
#endif
|
863 | |
#include <sys/wait.h>
|
864 | |
@@ -125,7 +125,7 @@ bool IsWriteTimeout(int socket, int timeout) {
|
865 | |
bool IsPeerValid(int socket, pid_t *pid) {
|
866 | |
*pid = 0;
|
867 | |
|
868 | |
-#ifdef OS_MACOSX
|
869 | |
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
|
870 | |
// If the OS is MAC, we should validate the peer by using LOCAL_PEERCRED.
|
871 | |
struct xucred peer_cred;
|
872 | |
socklen_t peer_cred_len = sizeof(struct xucred);
|
873 | |
@@ -147,7 +147,7 @@ bool IsPeerValid(int socket, pid_t *pid) {
|
874 | |
*pid = 0;
|
875 | |
#endif
|
876 | |
|
877 | |
-#ifdef OS_LINUX
|
878 | |
+#if defined(OS_LINUX)
|
879 | |
// On ARM Linux, we do nothing and just return true since the platform
|
880 | |
// sometimes doesn't support the getsockopt(sock, SOL_SOCKET, SO_PEERCRED)
|
881 | |
// system call.
|
882 | |
@@ -186,7 +186,7 @@ bool SendMessage(int socket,
|
883 | |
return false;
|
884 | |
}
|
885 | |
const ssize_t l = ::send(socket, buf, buf_length_left,
|
886 | |
-#ifdef OS_MACOSX
|
887 | |
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
|
888 | |
SO_NOSIGPIPE
|
889 | |
#else
|
890 | |
MSG_NOSIGNAL
|
891 | |
diff --git a/languages/chewing/chewing.gyp b/languages/chewing/chewing.gyp
|
892 | |
index 92354eb..f1c70ab 100755
|
893 | |
--- a/languages/chewing/chewing.gyp
|
894 | |
+++ b/languages/chewing/chewing.gyp
|
895 | |
@@ -55,7 +55,7 @@
|
896 | |
},
|
897 | |
],
|
898 | |
'conditions': [
|
899 | |
- ['OS=="linux"', {
|
900 | |
+ ['OS=="linux" or OS=="gnu-kfreebsd"', {
|
901 | |
'targets': [
|
902 | |
{
|
903 | |
'target_name': 'ibus_mozc_chewing',
|
904 | |
diff --git a/languages/hangul/hangul.gyp b/languages/hangul/hangul.gyp
|
905 | |
index 57a6f53..f8db52b 100755
|
906 | |
--- a/languages/hangul/hangul.gyp
|
907 | |
+++ b/languages/hangul/hangul.gyp
|
908 | |
@@ -59,7 +59,7 @@
|
909 | |
},
|
910 | |
],
|
911 | |
'conditions': [
|
912 | |
- ['OS=="linux"', {
|
913 | |
+ ['OS=="linux" or OS=="gnu-kfreebsd"', {
|
914 | |
'targets': [
|
915 | |
{
|
916 | |
'target_name': 'ibus_mozc_hangul',
|
917 | |
diff --git a/net/net.gyp b/net/net.gyp
|
918 | |
index af01882..3c76edd 100755
|
919 | |
--- a/net/net.gyp
|
920 | |
+++ b/net/net.gyp
|
921 | |
@@ -61,7 +61,7 @@
|
922 | |
},
|
923 | |
},
|
924 | |
}],
|
925 | |
- ['target_platform=="Linux"', {
|
926 | |
+ ['target_platform=="Linux" or OS=="gnu-kfreebsd"', {
|
927 | |
# Enable libcurl
|
928 | |
'cflags': [
|
929 | |
'<!@(<(pkg_config_command) --cflags libcurl)',
|
930 | |
diff --git a/protobuf/genproto.gypi b/protobuf/genproto.gypi
|
931 | |
index a0db8b8..d67f511 100755
|
932 | |
--- a/protobuf/genproto.gypi
|
933 | |
+++ b/protobuf/genproto.gypi
|
934 | |
@@ -34,7 +34,7 @@
|
935 | |
'build_tools_dir%': '../build_tools',
|
936 | |
},
|
937 | |
'conditions': [
|
938 | |
- ['OS!="linux"', {
|
939 | |
+ ['OS!="linux" and OS!="gnu-kfreebsd"', {
|
940 | |
'variables': {
|
941 | |
'protoc_command%': '<(relative_dir)/<(mozc_build_tools_dir)/protoc<(EXECUTABLE_SUFFIX)',
|
942 | |
},
|
943 | |
diff --git a/protobuf/protobuf.gyp b/protobuf/protobuf.gyp
|
944 | |
index 82a2b21..4f35ce5 100755
|
945 | |
--- a/protobuf/protobuf.gyp
|
946 | |
+++ b/protobuf/protobuf.gyp
|
947 | |
@@ -138,7 +138,7 @@
|
948 | |
},
|
949 | |
'conditions': [
|
950 | |
# for gcc and clang
|
951 | |
- ['OS=="linux" or OS=="mac"', {
|
952 | |
+ ['OS=="linux" or OS=="mac" or OS=="gnu-kfreebsd"', {
|
953 | |
'cflags': [
|
954 | |
'-Wno-conversion-null', # coded_stream.cc uses NULL to bool.
|
955 | |
'-Wno-unused-function',
|
956 | |
@@ -159,7 +159,7 @@
|
957 | |
'.',
|
958 | |
],
|
959 | |
'conditions': [
|
960 | |
- ['OS=="linux"', {
|
961 | |
+ ['OS=="linux" or OS=="gnu-kfreebsd"', {
|
962 | |
'conditions': [
|
963 | |
['use_libprotobuf!=1', {
|
964 | |
'cflags': [
|
965 | |
@@ -196,7 +196,7 @@
|
966 | |
},
|
967 | |
'conditions': [
|
968 | |
# use system-installed protoc on Linux
|
969 | |
- ['OS!="linux"', {
|
970 | |
+ ['OS!="linux" and OS!="gnu-kfreebsd"', {
|
971 | |
'includes' : [
|
972 | |
'../gyp/install_build_tool.gypi',
|
973 | |
],
|
974 | |
diff --git a/session/session_converter_interface.h b/session/session_converter_interface.h
|
975 | |
index 2693c90..2a8e016 100755
|
976 | |
--- a/session/session_converter_interface.h
|
977 | |
+++ b/session/session_converter_interface.h
|
978 | |
@@ -68,7 +68,7 @@ struct OperationPreferences {
|
979 | |
bool use_cascading_window;
|
980 | |
string candidate_shortcuts;
|
981 | |
OperationPreferences() {
|
982 | |
-#ifdef OS_LINUX
|
983 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
984 | |
// TODO(komatsu): Move this logic to the client code.
|
985 | |
use_cascading_window = false;
|
986 | |
#else
|
987 | |
diff --git a/session/session_test.cc b/session/session_test.cc
|
988 | |
index 8c58b86..63e92c9 100755
|
989 | |
--- a/session/session_test.cc
|
990 | |
+++ b/session/session_test.cc
|
991 | |
@@ -2417,7 +2417,7 @@ TEST_F(SessionTest, OutputAllCandidateWords) {
|
992 | |
|
993 | |
EXPECT_EQ(0, output.all_candidate_words().focused_index());
|
994 | |
EXPECT_EQ(commands::CONVERSION, output.all_candidate_words().category());
|
995 | |
-#ifdef OS_LINUX
|
996 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
997 | |
// Cascading window is not supported on Linux, so the size of
|
998 | |
// candidate words is different from other platform.
|
999 | |
// TODO(komatsu): Modify the client for Linux to explicitly change
|
1000 | |
@@ -2445,7 +2445,7 @@ TEST_F(SessionTest, OutputAllCandidateWords) {
|
1001 | |
|
1002 | |
EXPECT_EQ(1, output.all_candidate_words().focused_index());
|
1003 | |
EXPECT_EQ(commands::CONVERSION, output.all_candidate_words().category());
|
1004 | |
-#ifdef OS_LINUX
|
1005 | |
+#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
|
1006 | |
// Cascading window is not supported on Linux, so the size of
|
1007 | |
// candidate words is different from other platform.
|
1008 | |
// TODO(komatsu): Modify the client for Linux to explicitly change
|