Codebase list mozc / 21e71ac
Update kfreebsd support patch. Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@debian.org> Nobuhiro Iwamatsu 12 years ago
1 changed file(s) with 152 addition(s) and 146 deletion(s). Raw diff Collapse all Expand all
00 diff --git a/base/cpu_stats.cc b/base/cpu_stats.cc
1 index e915b35..1dcd91c 100755
1 index e915b35..a53141d 100755
22 --- a/base/cpu_stats.cc
33 +++ b/base/cpu_stats.cc
44 @@ -122,7 +122,7 @@ float CPUStats::GetSystemCPULoad() {
66 #endif // OS_MACOSX
77
88 -#ifdef OS_LINUX
9 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
9 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
1010 // NOT IMPLEMENTED
1111 // TODO(taku): implement Linux version
1212 // can take the info from /proc/stats
1515 #endif // OS_MACOSX
1616
1717 -#ifdef OS_LINUX
18 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
18 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
1919 // not implemented
2020 const uint64 total_times = 0;
2121 const uint64 cpu_times = 0;
2424 #endif // OS_MACOSX
2525
2626 -#ifdef OS_LINUX
27 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
27 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
2828 // Not implemented
2929 return 1;
3030 #endif // OS_LINUX
4242 CrashReportHandler::Initialize(false);
4343 }
4444 diff --git a/base/iconv.cc b/base/iconv.cc
45 index ee05938..da0f058 100755
45 index 84c6380..6785171 100755
4646 --- a/base/iconv.cc
4747 +++ b/base/iconv.cc
48 @@ -52,7 +52,11 @@ void IconvHelper(iconv_t ic, const string &input, string *output) {
48 @@ -52,7 +52,11 @@ bool IconvHelper(iconv_t ic, const string &input, string *output) {
4949 size_t olen_org = olen;
5050 iconv(ic, 0, &ilen, 0, &olen); // reset iconv state
5151 while (ilen != 0) {
5555 if (iconv(ic, reinterpret_cast<char **>(&ibuf), &ilen, &obuf, &olen)
5656 +#endif
5757 == static_cast<size_t>(-1)) {
58 return;
58 return false;
5959 }
6060 diff --git a/base/logging.cc b/base/logging.cc
6161 index ffeb703..5d0d104 100755
7171 #else
7272 "%lu",
7373 diff --git a/base/mutex.cc b/base/mutex.cc
74 index 14c110f..55045bd 100755
74 index 14c110f..fbdc00e 100755
7575 --- a/base/mutex.cc
7676 +++ b/base/mutex.cc
7777 @@ -44,7 +44,8 @@ namespace mozc {
7979 // Wrapper for Windows InterlockedCompareExchange
8080 namespace {
8181 -#ifdef OS_LINUX
82 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
82 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
8383 +// TODO(taku):
8484 // Linux doesn't provide InterlockedCompareExchange-like function.
8585 inline int InterlockedCompareExchange(volatile int *target,
105105 pthread_mutexattr_init(&attr);
106106 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_VALUE);
107107 diff --git a/base/password_manager.cc b/base/password_manager.cc
108 index aa8b6b4..d508c5d 100755
108 index aa8b6b4..42718af 100755
109109 --- a/base/password_manager.cc
110110 +++ b/base/password_manager.cc
111111 @@ -363,7 +363,7 @@ class DeprecatedMacPasswordManager : public PasswordManagerInterface {
113113 // a new password manager which adopts some secure mechanism such
114114 // like gnome-keyring.
115115 -#if defined OS_LINUX
116 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
116 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
117117 typedef PlainPasswordManager DefaultPasswordManager;
118118 #endif
119119
120120 diff --git a/base/process.cc b/base/process.cc
121 index 51eae95..aca659c 100755
121 index 51eae95..7f2d89b 100755
122122 --- a/base/process.cc
123123 +++ b/base/process.cc
124124 @@ -51,7 +51,7 @@
126126 #endif // OS_MACOSX
127127
128128 -#ifdef OS_LINUX
129 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
129 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
130130 #include <fcntl.h>
131131 #include <signal.h>
132132 #include <spawn.h> // for posix_spawn().
135135 #endif
136136
137137 -#ifdef OS_LINUX
138 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
138 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
139139 static const char kBrowserCommand[] = "/usr/bin/xdg-open";
140140 // xdg-open which uses kfmclient or gnome-open internally works both on KDE
141141 // and GNOME environments.
144144 #endif
145145
146146 -#ifdef OS_LINUX
147 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
147 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
148148 // Do not call posix_spawn() for obviously bad path.
149149 if (!S_ISREG(statbuf.st_mode)) {
150150 LOG(ERROR) << "Not a regular file: " << path;
153153 #endif // OS_WINDOWS
154154
155155 -#ifdef OS_LINUX
156 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
156 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
157157 const char kMozcTool[] = "mozc_tool";
158158 const string arg = "--mode=error_message_dialog --error_type=" + error_type;
159159 size_t pid = 0;
160160 diff --git a/base/run_level.cc b/base/run_level.cc
161 index 3523b04..777dcad 100755
161 index 8b1fe47..cc4c58a 100755
162162 --- a/base/run_level.cc
163163 +++ b/base/run_level.cc
164164 @@ -38,7 +38,7 @@
166166 #endif
167167
168168 -#ifdef OS_LINUX
169 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
169 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
170170 #include <unistd.h>
171171 #include <sys/types.h>
172172 #endif
173173 diff --git a/base/stopwatch.cc b/base/stopwatch.cc
174 index 04edac3..d9ed9a8 100755
174 index 04edac3..dd5020f 100755
175175 --- a/base/stopwatch.cc
176176 +++ b/base/stopwatch.cc
177177 @@ -39,7 +39,7 @@
179179 #endif // OS_MACOSX
180180
181181 -#if defined(OS_LINUX)
182 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
182 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
183183 #include <sys/time.h>
184184 #endif // OS_LINUX
185185
188188 #endif // OS_MACOSX
189189
190190 -#if defined(OS_LINUX)
191 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
191 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
192192 return 1000000000LL;
193193 #endif // OS_LINUX
194194 }
197197 #endif // OS_MACOSX
198198
199199 -#if defined(OS_LINUX)
200 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
200 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
201201 struct timespec timestamp;
202202 if (-1 == clock_gettime(CLOCK_REALTIME, &timestamp)) {
203203 return 0;
204204 diff --git a/base/thread.h b/base/thread.h
205 index 25417e1..98e2e60 100755
205 index 422e63b..a5f5008 100755
206206 --- a/base/thread.h
207207 +++ b/base/thread.h
208 @@ -58,10 +58,10 @@
209 #endif // OS_WINDOWS
210
211 // Use GCC's keyword on Linux.
212 -#ifdef OS_LINUX
213 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
208 @@ -59,7 +59,8 @@
209
210 // Andorid NDK doesn't support TLS.
211 #if defined(OS_LINUX) && !defined(OS_ANDROID) && \
212 - (defined(__GNUC__) || defined(__clang__))
213 + (defined(__GNUC__) || defined(__clang__)) || \
214 + defined(OS_GNU_KFREEBSD)
215 // GCC and Clang support TLS.
214216 #define TLS_KEYWORD __thread
215217 #define HAVE_TLS 1
216 -#endif // OS_LINUX
217 +#endif // OS_LINUX || OS_GNU_KFREEBSD || OS_FREEBSD
218
219
220 // OSX doesn't support Thread Local Storage.
221218 diff --git a/base/util.cc b/base/util.cc
222 index 24a7258..0ddf669 100755
219 index b0ac451..d5dfedf 100755
223220 --- a/base/util.cc
224221 +++ b/base/util.cc
225 @@ -2636,7 +2636,7 @@ string Util::GetServerDirectory() {
222 @@ -2685,7 +2685,7 @@ string Util::GetServerDirectory() {
226223 return MacUtil::GetServerDirectory();
227224 #endif // OS_MACOSX
228225
229226 -#ifdef OS_LINUX
230 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
231 return "/usr/lib/mozc";
227 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
228 return kMozcServerDirectory;
232229 #endif // OS_LINUX
233230 }
234 @@ -2715,7 +2715,7 @@ string GetObjectNameAsString(HANDLE handle) {
231 @@ -2764,7 +2764,7 @@ string GetObjectNameAsString(HANDLE handle) {
235232 #endif
236233
237234 string Util::GetDesktopNameAsString() {
238235 -#ifdef OS_LINUX
239 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
236 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
240237 const char *display = getenv("DISPLAY");
241238 if (display == NULL) {
242239 return "";
243 @@ -3211,7 +3211,7 @@ bool Util::IsPlatformSupported() {
240 @@ -3266,7 +3266,7 @@ bool Util::IsPlatformSupported() {
244241 #if defined(OS_MACOSX)
245242 // TODO(yukawa): support Mac.
246243 return true;
247244 -#elif defined(OS_LINUX)
248 +#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
245 +#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
249246 // TODO(yukawa): support Linux.
250247 return true;
251248 #elif defined(OS_WINDOWS)
252 @@ -3631,18 +3631,19 @@ string Util::GetOSVersionString() {
253 } else {
254 LOG(WARNING) << "GetVersionEx failed";
255 }
256 - return ret;
257 #elif defined(OS_MACOSX)
258 const string ret = "MacOSX " + MacUtil::GetOSVersionString();
259 // TODO(toshiyuki): get more specific info
260 - return ret;
249 @@ -3694,6 +3694,9 @@ string Util::GetOSVersionString() {
261250 #elif defined(OS_LINUX)
262251 const string ret = "Linux";
263 - return ret;
252 return ret;
264253 +#elif defined(OS_GNU_KFREEBSD)
265254 + const string ret = "GNU/kFreeBSD";
266 +#elif defined(OS_FREEBSD)
267 + const string ret = "FreeBSD";
255 + return ret;
268256 #else
269257 const string ret = "Unknown";
270 - return ret;
271 #endif
272 + return ret;
273 }
274
275 void Util::DisableIME() {
276 @@ -3676,7 +3677,7 @@ uint64 Util::GetTotalPhysicalMemory() {
258 return ret;
259 @@ -3731,7 +3734,7 @@ uint64 Util::GetTotalPhysicalMemory() {
277260 return 0;
278261 }
279262 return total_memory;
280263 -#elif defined(OS_LINUX)
281 +#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
264 +#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
282265 #if defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES)
283266 const long page_size = sysconf(_SC_PAGESIZE);
284267 const long number_of_phyisical_pages = sysconf(_SC_PHYS_PAGES);
285 @@ -3702,7 +3703,7 @@ void Util::PreloadMappedRegion(const void *begin,
268 @@ -3757,7 +3760,7 @@ void Util::PreloadMappedRegion(const void *begin,
286269 ::ZeroMemory(&system_info, sizeof(system_info));
287270 ::GetSystemInfo(&system_info);
288271 const size_t page_size = system_info.dwPageSize;
289272 -#elif defined(OS_MACOSX) || defined(OS_LINUX)
290 +#elif defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
273 +#elif defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
291274 #if defined(_SC_PAGESIZE)
292275 const size_t page_size = sysconf(_SC_PAGESIZE);
293276 #else
294277 diff --git a/build_mozc.py b/build_mozc.py
295 index 63c75e7..bc0f0f3 100755
278 index f8cd143..4471f88 100755
296279 --- a/build_mozc.py
297280 +++ b/build_mozc.py
298281 @@ -72,6 +72,14 @@ def IsLinux():
328311 else:
329312 logging.error('Unsupported platform: %s', os.name)
330313
331 @@ -205,7 +215,7 @@ def GetGypFileNames(options):
314 @@ -204,7 +214,7 @@ def GetGypFileNames(options):
332315 if IsWindows():
333316 gyp_file_names.extend(glob.glob('%s/win32/*/*.gyp' % SRC_DIR))
334317 gyp_file_names.extend(glob.glob('third_party/breakpad/*.gyp'))
337320 gyp_file_names.extend(glob.glob('%s/unix/*/*.gyp' % SRC_DIR))
338321 # Add ibus.gyp if ibus is installed.
339322 # Ubuntu 8.04 (Hardy) does not contain ibus package.
340 @@ -366,6 +376,7 @@ def AddCommonOptions(parser):
341 help='If you want ChromeOS build, specify "ChromeOS"')
323 @@ -375,6 +385,7 @@ def AddCommonOptions(parser):
324 'If you want ChromeOS build, specify "ChromeOS".'))
342325 parser.add_option('--language', dest='language', default='japanese',
343326 help='Specify the target language to build.')
344327 + parser.add_option('--os', dest='os', default='linux')
345328 return parser
346329
347330
348 @@ -485,7 +496,7 @@ def ExpandMetaTarget(meta_target_name, target_platform):
331 @@ -549,7 +560,7 @@ def ExpandMetaTarget(meta_target_name, target_platform):
349332 targets = ['%s/unix/ibus/ibus.gyp:ibus_mozc',
350333 '%s/server/server.gyp:mozc_server',
351334 '%s/gui/gui.gyp:mozc_tool']
354337 targets = ['%s/unix/ibus/ibus.gyp:ibus_mozc',
355338 '%s/server/server.gyp:mozc_server',
356339 '%s/gui/gui.gyp:mozc_tool']
357 @@ -600,6 +611,9 @@ def GypMain(options, unused_args):
340 @@ -662,6 +673,9 @@ def GypMain(options, unused_args):
358341 else:
359342 command_line.extend(['-D', 'use_wix=NO'])
360343
364347 command_line.extend(['-D', 'build_base=%s' % GetBuildBaseName(options)])
365348
366349
367 @@ -658,7 +672,7 @@ def GypMain(options, unused_args):
350 @@ -777,7 +791,7 @@ def GypMain(options, unused_args):
368351 # command for pkg-config. Here we catch the environment variable
369352 # and use the specified command instead of actual pkg-config
370353 # command.
373356 command_line.extend(['-D', 'pkg_config_command=%s' % GetPkgConfigCommand()])
374357 else:
375358 command_line.extend(['-D', 'pkg_config_command='])
376 @@ -763,6 +777,42 @@ def BuildOnLinux(options, targets, unused_original_directory_name):
359 @@ -885,6 +899,42 @@ def BuildOnLinux(options, targets, unused_original_directory_name):
377360
378361 RunOrDie([make_command] + build_args + target_names)
379362
416399
417400 def CheckFileOrDie(file_name):
418401 """Check the file exists or dies if not."""
419 @@ -928,6 +978,8 @@ def BuildMain(options, targets, original_directory_name):
402 @@ -1049,6 +1099,8 @@ def BuildMain(options, targets, original_directory_name):
420403 BuildOnMac(options, targets, original_directory_name)
421404 elif IsLinux():
422405 BuildOnLinux(options, targets, original_directory_name)
425408 elif IsWindows():
426409 BuildOnWindows(options, targets, original_directory_name)
427410 else:
428 @@ -1052,7 +1104,7 @@ def CleanBuildFilesAndDirectories(options, unused_args):
411 @@ -1173,7 +1225,7 @@ def CleanBuildFilesAndDirectories(options, unused_args):
429412 elif IsMac():
430413 directory_names.extend(glob.glob(os.path.join(gyp_directory_name,
431414 '*.xcodeproj')))
434417 file_names.extend(glob.glob(os.path.join(gyp_directory_name,
435418 '*.target.mk')))
436419 file_names.extend(glob.glob(os.path.join(gyp_directory_name,
437 @@ -1072,6 +1124,10 @@ def CleanBuildFilesAndDirectories(options, unused_args):
420 @@ -1193,6 +1245,10 @@ def CleanBuildFilesAndDirectories(options, unused_args):
438421 file_names.append('Makefile')
439422 elif IsWindows():
440423 file_names.append('third_party/breakpad/breakpad.gyp')
445428 # Remove files.
446429 for file_name in file_names:
447430 RemoveFile(file_name)
448 @@ -1098,7 +1154,6 @@ def ShowHelpAndExit():
431 @@ -1219,7 +1275,6 @@ def ShowHelpAndExit():
449432 print 'See also the comment in the script for typical usage.'
450433 sys.exit(1)
451434
496479 # directory across configurations. The following variables must be
497480 # the same as <(PRODUCT_DIR) for each configuration.
498481 diff --git a/config/stats_config_util_test.cc b/config/stats_config_util_test.cc
499 index c13fdeb..de22cee 100755
482 index c13fdeb..11e2d0d 100755
500483 --- a/config/stats_config_util_test.cc
501484 +++ b/config/stats_config_util_test.cc
502485 @@ -690,7 +690,7 @@ TEST_F(StatsConfigUtilTestWin, IsEnabled) {
504487 #endif // CHANNEL_DEV
505488
506489 -#ifdef OS_LINUX
507 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
490 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
508491 TEST(StatsConfigUtilTestLinux, DefaultValueTest) {
509492 EXPECT_FALSE(mozc::StatsConfigUtil::IsEnabled());
510493 }
511494 diff --git a/gui/base/locale_util.cc b/gui/base/locale_util.cc
512 index 8089f8e..4f411a7 100755
495 index 8089f8e..ff9365f 100755
513496 --- a/gui/base/locale_util.cc
514497 +++ b/gui/base/locale_util.cc
515498 @@ -198,7 +198,7 @@ TranslationDataImpl::TranslationDataImpl()
517500 #endif
518501
519502 -#ifdef OS_LINUX
520 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
503 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
521504 // Use system default messages.
522505 // Even if the locale is not English nor Japanese, load translation
523506 // file to translate common messages like "OK" and "Cancel".
524507 diff --git a/gui/config_dialog/config_dialog.cc b/gui/config_dialog/config_dialog.cc
525 index c3dff57..460c94f 100755
508 index 589c0a7..0ae7dc8 100755
526509 --- a/gui/config_dialog/config_dialog.cc
527510 +++ b/gui/config_dialog/config_dialog.cc
528 @@ -73,11 +73,11 @@ ConfigDialog::ConfigDialog()
511 @@ -76,11 +76,11 @@ ConfigDialog::ConfigDialog()
529512 verboseLevelLabel->setVisible(false);
530513 verboseLevelComboBox->setVisible(false);
531514
532515 -#if defined(OS_MACOSX) || defined(OS_LINUX)
533 +#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
516 +#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
534517 // The last "misc" tab has no valid configs on Mac and Linux
535518 const int kMiscTabIndex = 6;
536519 configDialogTabWidget->removeTab(kMiscTabIndex);
537520 -#endif // OS_MACOSX || OS_LINUX
538 +#endif // OS_MACOSX || OS_LINUX || OS_GNU_KFREEBSD || OS_FREEBSD
521 +#endif // OS_MACOSX || OS_LINUX || OS_GNU_KFREEBSD
539522 #endif // NO_LOGGING
540523
541 #if !defined(GOOGLE_JAPANESE_INPUT_BUILD)
542 @@ -273,7 +273,7 @@ ConfigDialog::ConfigDialog()
524 #ifndef ENABLE_CLOUD_SYNC
525 @@ -305,7 +305,7 @@ ConfigDialog::ConfigDialog()
543526 dictionaryPreloadingAndUACLabel->setVisible(false);
544527 #endif // OS_WINDOWS
545528
546529 -#ifdef OS_LINUX
547 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
530 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
548531 // On Linux, disable all fields for UsageStats
549532 usageStatsLabel->setEnabled(false);
550533 usageStatsLabel->setVisible(false);
551 @@ -362,7 +362,7 @@ bool ConfigDialog::Update() {
534 @@ -421,7 +421,7 @@ bool ConfigDialog::Update() {
552535 }
553536
554537
555538 -#if defined(OS_WINDOWS) || defined(OS_LINUX)
556 +#if defined(OS_WINDOWS) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
539 +#if defined(OS_WINDOWS) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
557540 if (initial_preedit_method_ !=
558541 static_cast<int>(config.preedit_method()) ||
559542 initial_use_keyboard_to_change_preedit_method_ !=
560543 diff --git a/gui/config_dialog/keybinding_editor.cc b/gui/config_dialog/keybinding_editor.cc
561 index a28310a..fd3f01e 100755
544 index a28310a..6433a86 100755
562545 --- a/gui/config_dialog/keybinding_editor.cc
563546 +++ b/gui/config_dialog/keybinding_editor.cc
547 @@ -33,7 +33,7 @@
548 #include <windows.h>
549 #include <imm.h>
550 #include <ime.h>
551 -#elif OS_LINUX
552 +#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
553 #define XK_MISCELLANY
554 #include <X11/keysymdef.h>
555 #endif
556 @@ -121,7 +121,7 @@ const WinVirtualKeyEntry kWinVirtualKeyModifierNonRequiredTable[] = {
557 { VK_DBE_DBCSCHAR, "Hankaku/Zenkaku" }, // Zenkaku/hankaku
558 // { VK_KANJI, "Kanji" }, // Do not support Kanji
559 };
560 -#elif OS_LINUX
561 +#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
562 struct LinuxVirtualKeyEntry {
563 uint16 virtual_key;
564 const char *mozc_key_name;
565 @@ -387,7 +387,7 @@ KeyBindingFilter::KeyState KeyBindingFilter::AddKey(
566 return Encode(result);
567 }
568 }
569 -#elif OS_LINUX
570 +#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
571 // Handle JP109's Muhenkan/Henkan/katakana-hiragana and Zenkaku/Hankaku
572 const uint16 virtual_key = key_event.nativeVirtualKey();
573 for (size_t i = 0; i < arraysize(kLinuxVirtualKeyModifierNonRequiredTable);
564574 @@ -472,7 +472,7 @@ bool KeyBindingFilter::eventFilter(QObject *obj, QEvent *event) {
565575 KeyBindingEditor::KeyBindingEditor(QWidget *parent, QWidget *trigger_parent)
566576 : QDialog(parent), trigger_parent_(trigger_parent) {
567577 setupUi(this);
568578 -#ifdef OS_LINUX
569 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
579 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
570580 // Workaround for the issue http://code.google.com/p/mozc/issues/detail?id=9
571581 // Seems that even after clicking the button for the keybinding dialog,
572582 // the edit is not raised. This might be a bug of setFocusProxy.
573583 diff --git a/gui/config_dialog/keymap_editor.cc b/gui/config_dialog/keymap_editor.cc
574 index 33ab590..4f8e217 100755
584 index 853aca7..41cec81 100755
575585 --- a/gui/config_dialog/keymap_editor.cc
576586 +++ b/gui/config_dialog/keymap_editor.cc
577587 @@ -447,7 +447,7 @@ bool KeyMapEditorDialog::Update() {
579589
580590 if (new_ime_switch_keymap != ime_switch_keymap_) {
581591 -#if defined(OS_WINDOWS) || defined(OS_LINUX)
582 +#if defined(OS_WINDOWS) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
592 +#if defined(OS_WINDOWS) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
583593 QMessageBox::information(
584594 this,
585595 tr("Mozc settings"),
586596 diff --git a/gui/dictionary_tool/dictionary_tool.cc b/gui/dictionary_tool/dictionary_tool.cc
587 index 2f60969..ac3bee8 100755
597 index 0b0cce2..87b8e4e 100755
588598 --- a/gui/dictionary_tool/dictionary_tool.cc
589599 +++ b/gui/dictionary_tool/dictionary_tool.cc
590 @@ -317,7 +317,7 @@ DictionaryTool::DictionaryTool(QWidget *parent)
600 @@ -325,7 +325,7 @@ DictionaryTool::DictionaryTool(QWidget *parent)
591601 }
592602
593603 // main window
597607 // TODO(taku): investigate the cause of the crashes
598608 setCentralWidget(splitter_);
599609 diff --git a/gui/gui.gyp b/gui/gui.gyp
600 index 038d204..e5efe44 100755
610 index d69c07a..b649475 100755
601611 --- a/gui/gui.gyp
602612 +++ b/gui/gui.gyp
603 @@ -378,7 +378,7 @@
604 'includes': [
605 'qt_libraries.gypi',
606 ],
607 - 'conditions': [['use_libzinnia==1 and OS=="linux"', {
608 + 'conditions': [['use_libzinnia==1 and (OS=="linux" or OS=="gnu-kfreebsd")', {
609 'defines': [
610 'USE_LIBZINNIA',
611 ],
613 @@ -384,7 +384,7 @@
614 '../languages/japanese/japanese.gyp:language_dependent_spec_japanese',
615 ],
616 }],
617 - ['use_libzinnia==1 and OS=="linux"', {
618 + ['use_libzinnia==1 and (OS=="linux" or OS=="gnu-kfreebsd"', {
619 'defines': [
620 'USE_LIBZINNIA',
621 ],
612622 diff --git a/gui/qt_libraries.gypi b/gui/qt_libraries.gypi
613623 index ba5bf3e..4f90f7d 100755
614624 --- a/gui/qt_libraries.gypi
636646 ['use_libzinnia==1', {
637647 'link_settings': {
638648 diff --git a/gyp/common.gypi b/gyp/common.gypi
639 index 3d70455..8e37814 100755
649 index 48cb042..c8c9fd3 100755
640650 --- a/gyp/common.gypi
641651 +++ b/gyp/common.gypi
642 @@ -261,7 +261,7 @@
652 @@ -282,7 +282,7 @@
643653 },
644654 },
645655 'conditions': [
648658 'cflags': [
649659 '<@(debug_extra_cflags)',
650660 ],
651 @@ -317,7 +317,7 @@
661 @@ -338,7 +338,7 @@
652662 },
653663 },
654664 'conditions': [
657667 'cflags': [
658668 '<@(release_extra_cflags)',
659669 ],
660 @@ -588,6 +588,51 @@
670 @@ -613,6 +613,51 @@
661671 }],
662672 ],
663673 }],
709719 ['OS=="mac"', {
710720 'defines': [
711721 'OS_MACOSX',
712 @@ -642,7 +687,7 @@
722 @@ -667,7 +712,7 @@
713723 # Linux gyp (into scons) doesn't like target_conditions?
714724 # TODO(team): track down why 'target_conditions' doesn't work
715725 # on Linux gyp into scons like it does on Mac gyp into xcodeproj.
719729 '-fprofile-arcs' ],
720730 'link_settings': { 'libraries': [ '-lgcov' ] },
721731 diff --git a/handwriting/handwriting.gyp b/handwriting/handwriting.gyp
722 index 1009837..422cdf8 100755
732 index a077b99..d72ec7b 100755
723733 --- a/handwriting/handwriting.gyp
724734 +++ b/handwriting/handwriting.gyp
725735 @@ -39,7 +39,7 @@
732742 'USE_LIBZINNIA',
733743 ],
734744 diff --git a/ipc/ipc_path_manager.cc b/ipc/ipc_path_manager.cc
735 index a5a62fb..bcdaf81 100755
745 index 8efa613..6df3ed5 100755
736746 --- a/ipc/ipc_path_manager.cc
737747 +++ b/ipc/ipc_path_manager.cc
748 @@ -79,7 +79,7 @@ string GetIPCKeyFileName(const string &name) {
749 #endif
750
751 basename.append(name);
752 -#ifdef OS_LINUX
753 +#ifdef OS_LINUX || defined(OS_GNU_KFREEBSD)
754 // TODO(nona): Support multi platform
755 const language::LanguageDependentSpecInterface *lang_spec =
756 language::GlobalLanguageSpec::GetLanguageDependentSpec();
738757 @@ -274,7 +274,7 @@ bool IPCPathManager::GetPathName(string *ipc_name) {
739758 *ipc_name = kIPCPrefix;
740759 #endif // OS_WINDOWS
741760
742761 -#ifdef OS_LINUX
743 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
762 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
744763 // On Linux, use abstract namespace which is independent of the file system.
745764 (*ipc_name)[0] = '\0';
746765 #endif
749768 #endif
750769
751770 -#ifdef OS_LINUX
752 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
771 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
753772 // load from /proc/<pid>/exe
754773 char proc[128];
755774 char filename[512];
758777 }
759778
760779 -#ifdef OS_LINUX
761 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
780 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
762781 if ((server_path + " (deleted)") == server_path_) {
763782 LOG(WARNING) << server_path << " on disk is modified";
764783 // If a user updates the server binary on disk during the server is running,
765784 diff --git a/ipc/ipc_path_manager_test.cc b/ipc/ipc_path_manager_test.cc
766 index f0b5fcc..4abb655 100755
785 index f0b5fcc..604cd33 100755
767786 --- a/ipc/ipc_path_manager_test.cc
768787 +++ b/ipc/ipc_path_manager_test.cc
769788 @@ -108,7 +108,7 @@ TEST_F(IPCPathManagerTest, IPCPathManagerTest) {
771790 EXPECT_GT(manager->GetServerProcessId(), 0);
772791 EXPECT_EQ(t.path(), path);
773792 -#ifdef OS_LINUX
774 +#if defined(OS_LINUX)
793 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
775794 // On Linux, |path| should be abstract (see man unix(7) for details.)
776795 ASSERT_FALSE(path.empty());
777796 EXPECT_EQ('\0', path[0]);
778797 diff --git a/ipc/unix_ipc.cc b/ipc/unix_ipc.cc
779 index acdc334..213e762 100755
798 index acdc334..e39cf33 100755
780799 --- a/ipc/unix_ipc.cc
781800 +++ b/ipc/unix_ipc.cc
782801 @@ -28,7 +28,8 @@
812831 #endif
813832
814833 -#ifdef OS_LINUX
815 +#if defined(OS_LINUX)
834 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
816835 // On ARM Linux, we do nothing and just return true since the platform
817836 // sometimes doesn't support the getsockopt(sock, SOL_SOCKET, SO_PEERCRED)
818837 // system call.
833852 +#endif // defined(OS_LINUX) || defined(OS_MACOSX) ||
834853 + // defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD)
835854 diff --git a/languages/chewing/chewing.gyp b/languages/chewing/chewing.gyp
836 index 18fa842..0160ad6 100755
855 index 094478a..d099c6e 100755
837856 --- a/languages/chewing/chewing.gyp
838857 +++ b/languages/chewing/chewing.gyp
839858 @@ -61,7 +61,7 @@
846865 {
847866 'target_name': 'ibus_mozc_chewing_metadata',
848867 diff --git a/languages/hangul/hangul.gyp b/languages/hangul/hangul.gyp
849 index 6a7a9e4..084cc4c 100755
868 index 7fd29c9..593bd5f 100755
850869 --- a/languages/hangul/hangul.gyp
851870 +++ b/languages/hangul/hangul.gyp
852 @@ -59,7 +59,7 @@
871 @@ -58,7 +58,7 @@
853872 },
854873 ],
855874 'conditions': [
872891 #else
873892 #error "Unsupported platform. Windows, Mac OS X, and GNU/Linux are supported."
874893 diff --git a/protobuf/genproto.gypi b/protobuf/genproto.gypi
875 index d197312..e26f517 100755
894 index a0db8b8..d67f511 100755
876895 --- a/protobuf/genproto.gypi
877896 +++ b/protobuf/genproto.gypi
878 @@ -39,7 +39,7 @@
879 '<(protobuf_dir)/protobuf.gyp:install_protoc',
880 ],
881 }],
897 @@ -34,7 +34,7 @@
898 'build_tools_dir%': '../build_tools',
899 },
900 'conditions': [
882901 - ['OS!="linux"', {
883902 + ['OS!="linux" and OS!="gnu-kfreebsd"', {
884903 'variables': {
885904 'protoc_command%': '<(relative_dir)/<(mozc_build_tools_dir)/protoc<(EXECUTABLE_SUFFIX)',
886905 },
887906 diff --git a/protobuf/protobuf.gyp b/protobuf/protobuf.gyp
888 index 17de9f5..31a4fcf 100755
907 index bc936db..93f19dd 100755
889908 --- a/protobuf/protobuf.gyp
890909 +++ b/protobuf/protobuf.gyp
891910 @@ -116,7 +116,7 @@
907926 '../gyp/install_build_tool.gypi',
908927 ],
909928 diff --git a/session/session_converter_interface.h b/session/session_converter_interface.h
910 index f410edd..0b63f47 100755
929 index a52347e..e831186 100755
911930 --- a/session/session_converter_interface.h
912931 +++ b/session/session_converter_interface.h
913932 @@ -56,7 +56,7 @@ struct OperationPreferences {
915934 string candidate_shortcuts;
916935 OperationPreferences() {
917936 -#ifdef OS_LINUX
918 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD)
937 +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD)
919938 // TODO(komatsu): Move this logic to the client code.
920939 use_cascading_window = false;
921940 #else
922941 diff --git a/session/session_test.cc b/session/session_test.cc
923 index 195e4ba..e5da4fd 100755
942 index 1a53d4a..ab581cd 100755
924943 --- a/session/session_test.cc
925944 +++ b/session/session_test.cc
926 @@ -2089,7 +2089,7 @@ TEST_F(SessionTest, OutputAllCandidateWords) {
945 @@ -2253,7 +2253,7 @@ TEST_F(SessionTest, OutputAllCandidateWords) {
927946
928947 EXPECT_EQ(0, output.all_candidate_words().focused_index());
929948 EXPECT_EQ(commands::CONVERSION, output.all_candidate_words().category());
932951 // Cascading window is not supported on Linux, so the size of
933952 // candidate words is different from other platform.
934953 // TODO(komatsu): Modify the client for Linux to explicitly change
935 @@ -2117,7 +2117,7 @@ TEST_F(SessionTest, OutputAllCandidateWords) {
954 @@ -2281,7 +2281,7 @@ TEST_F(SessionTest, OutputAllCandidateWords) {
936955
937956 EXPECT_EQ(1, output.all_candidate_words().focused_index());
938957 EXPECT_EQ(commands::CONVERSION, output.all_candidate_words().category());
941960 // Cascading window is not supported on Linux, so the size of
942961 // candidate words is different from other platform.
943962 // TODO(komatsu): Modify the client for Linux to explicitly change
944 diff --git a/testing/testing.gyp b/testing/testing.gyp
945 index f43dd30..9593e5e 100755
946 --- a/testing/testing.gyp
947 +++ b/testing/testing.gyp
948 @@ -53,7 +53,7 @@
949 '../base/base.gyp:base',
950 ],
951 'conditions': [
952 - ['OS!="linux"', {
953 + ['OS!="linux" and OS!="gnu-kfreebsd"', {
954 'dependencies': [
955 'testing',
956 ],