Update kfreebsd patch
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@debian.org>
Nobuhiro Iwamatsu
12 years ago
214 | 214 | struct timespec timestamp; |
215 | 215 | if (-1 == clock_gettime(CLOCK_REALTIME, ×tamp)) { |
216 | 216 | return 0; |
217 | diff --git a/base/thread.h b/base/thread.h | |
218 | index 681c3f6..e1d9ecf 100755 | |
219 | --- a/base/thread.h | |
220 | +++ b/base/thread.h | |
221 | @@ -58,10 +58,10 @@ | |
222 | #endif // OS_WINDOWS | |
223 | ||
224 | // Use GCC's keyword on Linux. | |
225 | -#ifdef OS_LINUX | |
226 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
227 | #define TLS_KEYWORD __thread | |
228 | #define HAVE_TLS 1 | |
229 | -#endif // OS_LINUX | |
230 | +#endif // OS_LINUX || OS_GNU_KFREEBSD || OS_FREEBSD | |
231 | ||
232 | ||
233 | // OSX doesn't support Thread Local Storage. | |
217 | 234 | diff --git a/base/util.cc b/base/util.cc |
218 | 235 | index 41f30e7..ecaaba5 100755 |
219 | 236 | --- a/base/util.cc |
288 | 305 | const size_t page_size = sysconf(_SC_PAGESIZE); |
289 | 306 | #else |
290 | 307 | diff --git a/build_mozc.py b/build_mozc.py |
291 | index d9afab8..57542c7 100755 | |
308 | index d9afab8..f3a856d 100755 | |
292 | 309 | --- a/build_mozc.py |
293 | 310 | +++ b/build_mozc.py |
294 | 311 | @@ -72,6 +72,14 @@ def IsLinux(): |
369 | 386 | command_line.extend(['-D', 'pkg_config_command=%s' % GetPkgConfigCommand()]) |
370 | 387 | else: |
371 | 388 | command_line.extend(['-D', 'pkg_config_command=']) |
372 | @@ -661,6 +675,41 @@ def BuildOnLinux(options, targets, unused_original_directory_name): | |
389 | @@ -661,6 +675,42 @@ def BuildOnLinux(options, targets, unused_original_directory_name): | |
373 | 390 | |
374 | 391 | RunOrDie([make_command] + build_args + target_names) |
375 | 392 | |
377 | 394 | + """Build the targets on *BSD.""" |
378 | 395 | + target_names = [] |
379 | 396 | + for target in targets: |
380 | + (unused_gyp_file_name, target_name) = ParseTarget(target) | |
397 | + (unused_gyp_file_name, target_name) = ( | |
398 | + CanonicalTargetToGypFileAndTargetName(target)) | |
381 | 399 | + target_names.append(target_name) |
382 | 400 | + |
383 | 401 | + if os.uname()[0] == 'FreeBSD' : |
411 | 429 | |
412 | 430 | def CheckFileOrDie(file_name): |
413 | 431 | """Check the file exists or dies if not.""" |
414 | @@ -776,6 +825,8 @@ def BuildMain(options, targets, original_directory_name): | |
432 | @@ -776,6 +826,8 @@ def BuildMain(options, targets, original_directory_name): | |
415 | 433 | BuildOnMac(options, targets, original_directory_name) |
416 | 434 | elif IsLinux(): |
417 | 435 | BuildOnLinux(options, targets, original_directory_name) |
420 | 438 | elif IsWindows(): |
421 | 439 | BuildOnWindows(options, targets, original_directory_name) |
422 | 440 | else: |
423 | @@ -899,7 +950,7 @@ def CleanBuildFilesAndDirectories(options, unused_args): | |
441 | @@ -899,7 +951,7 @@ def CleanBuildFilesAndDirectories(options, unused_args): | |
424 | 442 | elif IsMac(): |
425 | 443 | directory_names.extend(glob.glob(os.path.join(gyp_directory_name, |
426 | 444 | '*.xcodeproj'))) |
429 | 447 | file_names.extend(glob.glob(os.path.join(gyp_directory_name, |
430 | 448 | '*.target.mk'))) |
431 | 449 | file_names.extend(glob.glob(os.path.join(gyp_directory_name, |
432 | @@ -918,6 +969,10 @@ def CleanBuildFilesAndDirectories(options, unused_args): | |
450 | @@ -918,6 +970,10 @@ def CleanBuildFilesAndDirectories(options, unused_args): | |
433 | 451 | file_names.append('Makefile') |
434 | 452 | elif IsWindows(): |
435 | 453 | file_names.append('third_party/breakpad/breakpad.gyp') |
440 | 458 | # Remove files. |
441 | 459 | for file_name in file_names: |
442 | 460 | RemoveFile(file_name) |
443 | @@ -944,6 +999,42 @@ def ShowHelpAndExit(): | |
461 | @@ -944,7 +1000,6 @@ def ShowHelpAndExit(): | |
444 | 462 | print 'See also the comment in the script for typical usage.' |
445 | 463 | sys.exit(1) |
446 | 464 | |
447 | +def BuildOnBSD(options, targets): | |
448 | + """Build the targets on *BSD.""" | |
449 | + target_names = [] | |
450 | + for target in targets: | |
451 | + (unused_gyp_file_name, target_name) = ParseTarget(target) | |
452 | + target_names.append(target_name) | |
453 | + | |
454 | + if os.uname()[0] == 'FreeBSD' : | |
455 | + make_command = os.getenv('BUILD_COMMAND', 'gmake') | |
456 | + else: | |
457 | + make_command = os.getenv('BUILD_COMMAND', 'make') | |
458 | + | |
459 | + # flags for building in Chrome OS chroot environment | |
460 | + envvars = [ | |
461 | + 'CFLAGS', | |
462 | + 'CXXFLAGS', | |
463 | + 'CXX', | |
464 | + 'CC', | |
465 | + 'AR', | |
466 | + 'AS', | |
467 | + 'RANLIB', | |
468 | + 'LD', | |
469 | + ] | |
470 | + for envvar in envvars: | |
471 | + if envvar in os.environ: | |
472 | + os.environ[envvar] = os.getenv(envvar) | |
473 | + | |
474 | + # set output directory | |
475 | + os.environ['builddir_name'] = 'out_bsd' | |
476 | + | |
477 | + build_args = ['-j%s' % options.jobs, 'BUILDTYPE=%s' % options.configuration] | |
478 | + if options.build_base: | |
479 | + build_args.append('builddir_name=%s' % options.build_base) | |
480 | + | |
481 | + RunOrDie([make_command] + build_args + target_names) | |
482 | + | |
483 | ||
465 | - | |
484 | 466 | def main(): |
485 | 467 | if len(sys.argv) < 2: |
468 | ShowHelpAndExit() | |
486 | 469 | diff --git a/build_tools/mozc_version.py b/build_tools/mozc_version.py |
487 | 470 | index 04d644b..b3ed870 100755 |
488 | 471 | --- a/build_tools/mozc_version.py |
512 | 495 | if last_digit: |
513 | 496 | return revision[0:-1] + last_digit |
514 | 497 | |
498 | diff --git a/config/stats_config_util.cc b/config/stats_config_util.cc | |
499 | index f6f8be6..a424fa9 100755 | |
500 | --- a/config/stats_config_util.cc | |
501 | +++ b/config/stats_config_util.cc | |
502 | @@ -218,7 +218,7 @@ bool MacStatsConfigUtilImpl::SetEnabled(bool val) { | |
503 | #endif // MACOSX | |
504 | ||
505 | ||
506 | -#ifdef OS_LINUX | |
507 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
508 | class LinuxStatsConfigUtilImpl : public StatsConfigUtilInterface { | |
509 | // TODO(toshiyuki): implement this | |
510 | public: | |
511 | diff --git a/config/stats_config_util_test.cc b/config/stats_config_util_test.cc | |
512 | index 8babb47..30e68bc 100755 | |
513 | --- a/config/stats_config_util_test.cc | |
514 | +++ b/config/stats_config_util_test.cc | |
515 | @@ -756,7 +756,7 @@ TEST_F(StatsConfigUtilTestWin, IsEnabledForRunLevelLow) { | |
516 | #else // CHANNEL_DEV | |
517 | #endif // CHANNEL_DEV | |
518 | ||
519 | -#ifdef OS_LINUX | |
520 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
521 | TEST(StatsConfigUtilTestLinux, DefaultValueTest) { | |
522 | EXPECT_FALSE(mozc::StatsConfigUtil::IsEnabled()); | |
523 | } | |
515 | 524 | diff --git a/gui/base/locale_util.cc b/gui/base/locale_util.cc |
516 | 525 | index 827fd28..52c881b 100755 |
517 | 526 | --- a/gui/base/locale_util.cc |
762 | 771 | if ((server_path + " (deleted)") == server_path_) { |
763 | 772 | LOG(WARNING) << server_path << " on disk is modified"; |
764 | 773 | // If a user updates the server binary on disk during the server is running, |
774 | diff --git a/ipc/ipc_path_manager_test.cc b/ipc/ipc_path_manager_test.cc | |
775 | index a645563..0f79c70 100755 | |
776 | --- a/ipc/ipc_path_manager_test.cc | |
777 | +++ b/ipc/ipc_path_manager_test.cc | |
778 | @@ -92,7 +92,7 @@ TEST(IPCPathManagerTest, IPCPathManagerTest) { | |
779 | EXPECT_FALSE(manager->GetServerProductVersion().empty()); | |
780 | EXPECT_GT(manager->GetServerProcessId(), 0); | |
781 | EXPECT_EQ(t.path(), path); | |
782 | -#ifdef OS_LINUX | |
783 | +#if defined(OS_LINUX) | |
784 | // On Linux, |path| should be abstract (see man unix(7) for details.) | |
785 | ASSERT_FALSE(path.empty()); | |
786 | EXPECT_EQ('\0', path[0]); | |
765 | 787 | diff --git a/ipc/unix_ipc.cc b/ipc/unix_ipc.cc |
766 | index 3085320..3f94332 100755 | |
788 | index 3085320..37ff133 100755 | |
767 | 789 | --- a/ipc/unix_ipc.cc |
768 | 790 | +++ b/ipc/unix_ipc.cc |
769 | 791 | @@ -28,7 +28,8 @@ |
794 | 816 | // If the OS is MAC, we should validate the peer by using LOCAL_PEERCRED. |
795 | 817 | struct xucred peer_cred; |
796 | 818 | socklen_t peer_cred_len = sizeof(struct xucred); |
819 | @@ -146,7 +147,7 @@ bool IsPeerValid(int socket, pid_t *pid) { | |
820 | *pid = 0; | |
821 | #endif | |
822 | ||
823 | -#ifdef OS_LINUX | |
824 | +#if defined(OS_LINUX) | |
825 | // On ARM Linux, we do nothing and just return true since the platform | |
826 | // sometimes doesn't support the getsockopt(sock, SOL_SOCKET, SO_PEERCRED) | |
827 | // system call. | |
797 | 828 | @@ -185,7 +186,7 @@ bool SendMessage(int socket, |
798 | 829 | return false; |
799 | 830 | } |
845 | 876 | 'includes' : [ |
846 | 877 | '../gyp/install_build_tool.gypi', |
847 | 878 | ], |
879 | diff --git a/session/session_converter_interface.h b/session/session_converter_interface.h | |
880 | index 7f27398..da6c9cf 100755 | |
881 | --- a/session/session_converter_interface.h | |
882 | +++ b/session/session_converter_interface.h | |
883 | @@ -56,7 +56,7 @@ struct OperationPreferences { | |
884 | bool use_cascading_window; | |
885 | string candidate_shortcuts; | |
886 | OperationPreferences() { | |
887 | -#ifdef OS_LINUX | |
888 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
889 | // TODO(komatsu): Move this logic to the client code. | |
890 | use_cascading_window = false; | |
891 | #else | |
892 | diff --git a/session/session_test.cc b/session/session_test.cc | |
893 | index 4433081..4cdf7e9 100755 | |
894 | --- a/session/session_test.cc | |
895 | +++ b/session/session_test.cc | |
896 | @@ -2081,7 +2081,7 @@ TEST_F(SessionTest, OutputAllCandidateWords) { | |
897 | ||
898 | EXPECT_EQ(0, output.all_candidate_words().focused_index()); | |
899 | EXPECT_EQ(commands::CONVERSION, output.all_candidate_words().category()); | |
900 | -#ifdef OS_LINUX | |
901 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) | |
902 | // Cascading window is not supported on Linux, so the size of | |
903 | // candidate words is different from other platform. | |
904 | // TODO(komatsu): Modify the client for Linux to explicitly change | |
905 | @@ -2109,7 +2109,7 @@ TEST_F(SessionTest, OutputAllCandidateWords) { | |
906 | ||
907 | EXPECT_EQ(1, output.all_candidate_words().focused_index()); | |
908 | EXPECT_EQ(commands::CONVERSION, output.all_candidate_words().category()); | |
909 | -#ifdef OS_LINUX | |
910 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) | |
911 | // Cascading window is not supported on Linux, so the size of | |
912 | // candidate words is different from other platform. | |
913 | // TODO(komatsu): Modify the client for Linux to explicitly change | |
848 | 914 | diff --git a/testing/testing.gyp b/testing/testing.gyp |
849 | 915 | index 58d1cf3..34a59d6 100755 |
850 | 916 | --- a/testing/testing.gyp |