Update patch for kfreebsd
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@debian.org>
Nobuhiro Iwamatsu
13 years ago
2 | 2 | * New upstream release (r52). |
3 | 3 | * Update and add some patches. |
4 | 4 | - Update patch of uim-mozc (r222). |
5 | - Update patch of kfreebsd. | |
5 | 6 | - Drop mozc-el-pseudo-cursor.patch. |
6 | 7 | |
7 | 8 | -- Nobuhiro Iwamatsu <iwamatsu@debian.org> Tue, 15 Mar 2011 01:06:41 +0900 |
0 | From 3b7ac867fe894005bf4ac46341d1dc7114ddf630 Mon Sep 17 00:00:00 2001 | |
1 | From: Nobuhiro Iwamatsu <iwamatsu@debian.org> | |
2 | Date: Sat, 9 Oct 2010 08:15:18 +0900 | |
3 | Subject: [PATCH] Add support kfreebsd | |
4 | ||
5 | Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@debian.org> | |
6 | --- | |
7 | base/const.h | 2 +- | |
8 | base/cpu_stats.cc | 6 +- | |
9 | base/flags.h | 2 +- | |
10 | base/iconv.cc | 4 ++ | |
11 | base/logging.cc | 2 +- | |
12 | base/mutex.cc | 3 +- | |
13 | base/mutex.h | 6 ++- | |
14 | base/password_manager.cc | 2 +- | |
15 | base/process.cc | 8 ++-- | |
16 | base/run_level.cc | 2 +- | |
17 | base/stats_config_util.cc | 2 +- | |
18 | base/stats_config_util_test.cc | 2 +- | |
19 | base/stopwatch.cc | 6 +- | |
20 | base/util.cc | 19 +++++---- | |
21 | build_mozc.py | 64 ++++++++++++++++++++++++++++++-- | |
22 | build_tools/mozc_version.py | 11 +++++ | |
23 | client/session.cc | 2 +- | |
24 | dictionary/dictionary_preloader.cc | 4 +- | |
25 | gui/base/locale_util.cc | 2 +- | |
26 | gui/config_dialog/config_dialog.cc | 8 ++-- | |
27 | gui/config_dialog/keybinding_editor.cc | 2 +- | |
28 | gui/config_dialog/keymap_editor.cc | 4 +- | |
29 | gui/dictionary_tool/dictionary_tool.cc | 2 +- | |
30 | gui/qt_common.gypi | 2 +- | |
31 | gui/qt_libraries.gypi | 2 +- | |
32 | gui/qt_moc.gypi | 2 +- | |
33 | gui/qt_rcc.gypi | 2 +- | |
34 | gui/qt_target_default.gypi | 2 +- | |
35 | gui/qt_uic.gypi | 2 +- | |
36 | gyp/common.gypi | 51 ++++++++++++++++++++++++- | |
37 | ipc/ipc_path_manager.cc | 6 +- | |
38 | ipc/unix_ipc.cc | 12 +++-- | |
39 | protobuf/genproto.gypi | 2 +- | |
40 | protobuf/protobuf.gyp | 4 +- | |
41 | session/session_converter.cc | 2 +- | |
42 | testing/testing.gyp | 2 +- | |
43 | 36 files changed, 190 insertions(+), 66 deletions(-) | |
44 | ||
45 | diff --git a/base/const.h b/base/const.h | |
46 | index a018527..c8b8946 100755 | |
47 | --- a/base/const.h | |
48 | +++ b/base/const.h | |
49 | @@ -109,7 +109,7 @@ const char kEventPathPrefix[] = "GoogleJapaneseInput.event."; | |
50 | #else | |
51 | const char kEventPathPrefix[] = "Mozc.event."; | |
52 | #endif // GOOGLE_JAPANESE_INPUT_BUILD | |
53 | -#else // OS_LINUX | |
54 | +#else // OS_LINUX || OS_GNU_KFREEBSD || OS_FREEBSD | |
55 | const char kMozcServerName[] = "mozc_server"; | |
56 | const char kEventPathPrefix[] = "mozc.event."; | |
57 | const char kMozcTool[] = "mozc_tool"; | |
58 | diff --git a/base/cpu_stats.cc b/base/cpu_stats.cc | |
59 | index 7279ff6..3b785ca 100755 | |
60 | --- a/base/cpu_stats.cc | |
61 | +++ b/base/cpu_stats.cc | |
62 | @@ -122,7 +122,7 @@ float CPUStats::GetSystemCPULoad() { | |
63 | ||
64 | #endif // OS_MACOSX | |
65 | ||
66 | -#ifdef OS_LINUX | |
67 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
68 | // NOT IMPLEMENTED | |
69 | // TODO(taku): implement Linux version | |
70 | // can take the info from /proc/stats | |
71 | @@ -177,7 +177,7 @@ float CPUStats::GetCurrentProcessCPULoad() { | |
72 | TimeValueTToInt64(task_times_info.system_time); | |
73 | #endif // OS_MACOSX | |
74 | ||
75 | -#ifdef OS_LINUX | |
76 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
77 | // not implemented | |
78 | const uint64 total_times = 0; | |
79 | const uint64 cpu_times = 0; | |
80 | @@ -209,7 +209,7 @@ size_t CPUStats::GetNumberOfProcessors() const { | |
81 | return static_cast<size_t>(basic_info.avail_cpus); | |
82 | #endif // OS_MACOSX | |
83 | ||
84 | -#ifdef OS_LINUX | |
85 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
86 | // Not implemented | |
87 | return 1; | |
88 | #endif // OS_LINUX | |
89 | diff --git a/base/flags.h b/base/flags.h | |
90 | index 2767113..81567c4 100755 | |
91 | --- a/base/flags.h | |
92 | +++ b/base/flags.h | |
93 | @@ -76,7 +76,7 @@ namespace { | |
94 | // so that CrashReportHandler() is resovled in link time | |
95 | inline void InstallBreakpad() { | |
96 | #ifdef GOOGLE_JAPANESE_INPUT_BUILD | |
97 | -#ifndef OS_LINUX | |
98 | +#if !defined(OS_LINUX) && !defined(OS_GNU_KFREEBSD) && !defined(OS_FREEBSD) | |
99 | if (StatsConfigUtil::IsEnabled()) { | |
100 | CrashReportHandler::Initialize(false); | |
101 | } | |
102 | diff --git a/base/iconv.cc b/base/iconv.cc | |
103 | index e61031a..3ebd0eb 100755 | |
104 | --- a/base/iconv.cc | |
105 | +++ b/base/iconv.cc | |
106 | @@ -52,7 +52,11 @@ void IconvHelper(iconv_t ic, const string &input, string *output) { | |
107 | size_t olen_org = olen; | |
108 | iconv(ic, 0, &ilen, 0, &olen); // reset iconv state | |
109 | while (ilen != 0) { | |
110 | +#ifdef OS_FREEBSD | |
111 | + if (iconv(ic, (const char **)(&ibuf), &ilen, &obuf, &olen) | |
112 | +#else | |
113 | if (iconv(ic, reinterpret_cast<char **>(&ibuf), &ilen, &obuf, &olen) | |
114 | +#endif | |
115 | == static_cast<size_t>(-1)) { | |
116 | return; | |
117 | } | |
118 | diff --git a/base/logging.cc b/base/logging.cc | |
119 | index 3ba399b..cdba4a2 100755 | |
120 | --- a/base/logging.cc | |
121 | +++ b/base/logging.cc | |
122 | @@ -212,7 +212,7 @@ string Logging::GetLogMessageHeader() { | |
123 | char buf[512]; | |
124 | snprintf(buf, sizeof(buf), | |
125 | "%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d %u " | |
126 | -#ifndef OS_LINUX // = OS_WINDOWS or OS_MACOSX | |
127 | +#if !defined(OS_LINUX) && !defined(OS_GNU_KFREEBSD) && !defined(OS_FREEBSD) // = OS_WINDOWS or OS_MACOSX | |
128 | "%u", | |
129 | #else | |
130 | "%lu", | |
131 | diff --git a/base/mutex.cc b/base/mutex.cc | |
132 | index 36f4dc3..79ed9b3 100755 | |
133 | --- a/base/mutex.cc | |
134 | +++ b/base/mutex.cc | |
135 | @@ -44,7 +44,8 @@ namespace mozc { | |
136 | ||
137 | // Wrapper for Windows InterlockedCompareExchange | |
138 | namespace { | |
139 | -#ifdef OS_LINUX | |
140 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
141 | +// TODO(taku): | |
142 | // Linux doesn't provide InterlockedCompareExchange-like function. | |
143 | inline int InterlockedCompareExchange(volatile int *target, | |
144 | int new_value, | |
145 | diff --git a/base/mutex.h b/base/mutex.h | |
146 | index 6d2d1e4..0f19a80 100755 | |
147 | --- a/base/mutex.h | |
148 | +++ b/base/mutex.h | |
149 | @@ -86,10 +86,14 @@ class Mutex { | |
150 | #define PTHREAD_MUTEX_RECURSIVE_VALUE PTHREAD_MUTEX_RECURSIVE | |
151 | #endif | |
152 | ||
153 | -#ifdef OS_LINUX | |
154 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) | |
155 | #define PTHREAD_MUTEX_RECURSIVE_VALUE PTHREAD_MUTEX_RECURSIVE_NP | |
156 | #endif | |
157 | ||
158 | +#ifdef OS_FREEBSD | |
159 | +#define PTHREAD_MUTEX_RECURSIVE_VALUE PTHREAD_MUTEX_RECURSIVE | |
160 | +#endif | |
161 | + | |
162 | pthread_mutexattr_t attr; | |
163 | pthread_mutexattr_init(&attr); | |
164 | pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_VALUE); | |
165 | diff --git a/base/password_manager.cc b/base/password_manager.cc | |
166 | index ce4cbdb..93f4490 100755 | |
167 | --- a/base/password_manager.cc | |
168 | +++ b/base/password_manager.cc | |
169 | @@ -358,7 +358,7 @@ class MacPasswordManager : public PasswordManagerInterface { | |
170 | // this module to other Linux distro, you might want to implement | |
171 | // a new password manager which adopts some secure mechanism such | |
172 | // like gnome-keyring. | |
173 | -#if defined OS_LINUX | |
174 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
175 | typedef PlainPasswordManager DefaultPasswordManager; | |
176 | #endif | |
177 | ||
178 | diff --git a/base/process.cc b/base/process.cc | |
179 | index 445fa30..f1bf767 100755 | |
180 | --- a/base/process.cc | |
181 | +++ b/base/process.cc | |
182 | @@ -52,7 +52,7 @@ | |
183 | #include "base/mac_process.h" | |
184 | #endif // OS_MACOSX | |
185 | ||
186 | -#ifdef OS_LINUX | |
187 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
188 | #include <fcntl.h> | |
189 | #include <signal.h> | |
190 | #include <spawn.h> // for posix_spawn(). | |
191 | @@ -194,7 +194,7 @@ bool Process::OpenBrowser(const string &url) { | |
192 | return ShellExecuteInSystemDir(L"open", wurl.c_str(), NULL, SW_SHOW); | |
193 | #endif | |
194 | ||
195 | -#ifdef OS_LINUX | |
196 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
197 | static const char kBrowserCommand[] = "/usr/bin/xdg-open"; | |
198 | // xdg-open which uses kfmclient or gnome-open internally works both on KDE | |
199 | // and GNOME environments. | |
200 | @@ -278,7 +278,7 @@ bool Process::SpawnProcess(const string &path, | |
201 | } | |
202 | #endif | |
203 | ||
204 | -#ifdef OS_LINUX | |
205 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
206 | // Do not call posix_spawn() for obviously bad path. | |
207 | if (!S_ISREG(statbuf.st_mode)) { | |
208 | LOG(ERROR) << "Not a regular file: " << path; | |
209 | @@ -574,7 +574,7 @@ bool Process::LaunchErrorMessageDialog(const string &error_type) { | |
210 | } | |
211 | #endif // OS_WINDOWS | |
212 | ||
213 | -#ifdef OS_LINUX | |
214 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
215 | const char kMozcTool[] = "mozc_tool"; | |
216 | const string arg = "--mode=error_message_dialog --error_type=" + error_type; | |
217 | size_t pid = 0; | |
218 | diff --git a/base/run_level.cc b/base/run_level.cc | |
219 | index 87b0f0a..1578ad8 100755 | |
220 | --- a/base/run_level.cc | |
221 | +++ b/base/run_level.cc | |
222 | @@ -38,7 +38,7 @@ | |
223 | #include <windows.h> | |
224 | #endif | |
225 | ||
226 | -#ifdef OS_LINUX | |
227 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
228 | #include <unistd.h> | |
229 | #include <sys/types.h> | |
230 | #endif | |
231 | diff --git a/base/stats_config_util.cc b/base/stats_config_util.cc | |
232 | index d6a15ab..3588905 100755 | |
233 | --- a/base/stats_config_util.cc | |
234 | +++ b/base/stats_config_util.cc | |
235 | @@ -336,7 +336,7 @@ bool MacStatsConfigUtilImpl::SetEnabled(bool val) { | |
236 | } | |
237 | #endif // MACOSX | |
238 | ||
239 | -#ifdef OS_LINUX | |
240 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
241 | class LinuxStatsConfigUtilImpl : public StatsConfigUtilInterface { | |
242 | // TODO(toshiyuki): implement this | |
243 | public: | |
244 | diff --git a/base/stats_config_util_test.cc b/base/stats_config_util_test.cc | |
245 | index 3052d86..fab4aa2 100755 | |
246 | --- a/base/stats_config_util_test.cc | |
247 | +++ b/base/stats_config_util_test.cc | |
248 | @@ -840,7 +840,7 @@ TEST_F(StatsConfigUtilTestWin, | |
249 | } // namespace mozc | |
250 | #endif // OS_WINDOWS | |
251 | ||
252 | -#ifdef OS_LINUX | |
253 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
254 | TEST(StatsConfigUtilTestLinux, DefaultValueTest) { | |
255 | EXPECT_FALSE(mozc::StatsConfigUtil::IsEnabled()); | |
256 | } | |
257 | diff --git a/base/stopwatch.cc b/base/stopwatch.cc | |
258 | index 5224b36..1b512d9 100755 | |
259 | --- a/base/stopwatch.cc | |
260 | +++ b/base/stopwatch.cc | |
261 | @@ -39,7 +39,7 @@ | |
262 | #include <unistd.h> | |
263 | #endif // OS_MACOSX | |
264 | ||
265 | -#if defined(OS_LINUX) | |
266 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
267 | #include <sys/time.h> | |
268 | #endif // OS_LINUX | |
269 | ||
270 | @@ -65,7 +65,7 @@ int64 Stopwatch::GetFrequency() { | |
271 | return static_cast<int64>(1.0e9 * timebase_info.denom / timebase_info.numer); | |
272 | #endif // OS_MACOSX | |
273 | ||
274 | -#if defined(OS_LINUX) | |
275 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
276 | return 1000000000LL; | |
277 | #endif // OS_LINUX | |
278 | } | |
279 | @@ -83,7 +83,7 @@ int64 Stopwatch::GetTimestamp() { | |
280 | return static_cast<int64>(mach_absolute_time()); | |
281 | #endif // OS_MACOSX | |
282 | ||
283 | -#if defined(OS_LINUX) | |
284 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
285 | struct timespec timestamp; | |
286 | if (-1 == clock_gettime(CLOCK_REALTIME, ×tamp)) { | |
287 | return 0; | |
288 | diff --git a/base/util.cc b/base/util.cc | |
289 | index 8dc2f89..fddcfb0 100755 | |
290 | --- a/base/util.cc | |
291 | +++ b/base/util.cc | |
292 | @@ -1629,7 +1629,7 @@ string Util::GetServerDirectory() { | |
293 | return MacUtil::GetServerDirectory(); | |
294 | #endif // OS_MACOSX | |
295 | ||
296 | -#ifdef OS_LINUX | |
297 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
298 | return "/usr/lib/mozc"; | |
299 | #endif // OS_LINUX | |
300 | } | |
301 | @@ -1705,7 +1705,7 @@ string GetObjectNameAsString(HANDLE handle) { | |
302 | #endif | |
303 | ||
304 | string Util::GetDesktopNameAsString() { | |
305 | -#ifdef OS_LINUX | |
306 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
307 | const char *display = getenv("DISPLAY"); | |
308 | if (display == NULL) { | |
309 | return ""; | |
310 | @@ -2152,7 +2152,7 @@ bool Util::IsPlatformSupported() { | |
311 | #if defined(OS_MACOSX) | |
312 | // TODO(yukawa): support Mac. | |
313 | return true; | |
314 | -#elif defined(OS_LINUX) | |
315 | +#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
316 | // TODO(yukawa): support Linux. | |
317 | return true; | |
318 | #elif defined(OS_WINDOWS) | |
319 | @@ -2468,18 +2468,19 @@ string Util::GetOSVersionString() { | |
320 | } else { | |
321 | LOG(WARNING) << "GetVersionEx failed"; | |
322 | } | |
323 | - return ret; | |
324 | #elif defined(OS_MACOSX) | |
325 | const string ret = "MacOSX " + MacUtil::GetOSVersionString(); | |
326 | // TODO(toshiyuki): get more specific info | |
327 | - return ret; | |
328 | #elif defined(OS_LINUX) | |
329 | const string ret = "Linux"; | |
330 | - return ret; | |
331 | +#elif defined(OS_GNU_KFREEBSD) | |
332 | + const string ret = "GNU/kFreeBSD"; | |
333 | +#elif defined(OS_FREEBSD) | |
334 | + const string ret = "FreeBSD"; | |
335 | #else | |
336 | const string ret = "Unknown"; | |
337 | - return ret; | |
338 | #endif | |
339 | + return ret; | |
340 | } | |
341 | ||
342 | void Util::DisableIME() { | |
343 | @@ -2513,7 +2514,7 @@ uint64 Util::GetTotalPhysicalMemory() { | |
344 | return 0; | |
345 | } | |
346 | return total_memory; | |
347 | -#elif defined(OS_LINUX) | |
348 | +#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
349 | #if defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES) | |
350 | const long page_size = sysconf(_SC_PAGESIZE); | |
351 | const long number_of_phyisical_pages = sysconf(_SC_PHYS_PAGES); | |
352 | @@ -2539,7 +2540,7 @@ void Util::PreloadMappedRegion(const void *begin, | |
353 | ::ZeroMemory(&system_info, sizeof(system_info)); | |
354 | ::GetSystemInfo(&system_info); | |
355 | const size_t page_size = system_info.dwPageSize; | |
356 | -#elif defined(OS_MACOSX) || defined(OS_LINUX) | |
357 | +#elif defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
358 | #if defined(_SC_PAGESIZE) | |
359 | const size_t page_size = sysconf(_SC_PAGESIZE); | |
360 | #else | |
361 | diff --git a/build_mozc.py b/build_mozc.py | |
362 | index 0c2991d..786b09d 100755 | |
363 | --- a/build_mozc.py | |
364 | +++ b/build_mozc.py | |
365 | @@ -71,6 +71,14 @@ def IsLinux(): | |
366 | """Returns true if the platform is Linux.""" | |
367 | return os.name == 'posix' and os.uname()[0] == 'Linux' | |
368 | ||
369 | +def IsFreeBSD(): | |
370 | + """Returns true if the platform is FreeBSD.""" | |
371 | + return os.name == 'posix' and os.uname()[0] == 'FreeBSD' | |
372 | + | |
373 | +def IsGNUkFreeBSD(): | |
374 | + """Returns true if the platform is GNU/kFreeBSD.""" | |
375 | + os.environ['GYP_DEFINES'] = 'OS=="GNU/kFreeBSD"' | |
376 | + return os.name == 'posix' and os.uname()[0] == 'GNU/kFreeBSD' | |
377 | ||
378 | # TODO(yukawa): Move this function to util.py (b/2715400) | |
379 | def GetNumberOfProcessors(): | |
380 | @@ -86,7 +94,7 @@ def GetNumberOfProcessors(): | |
381 | commands = ['sysctl', '-n', 'hw.ncpu'] | |
382 | process = subprocess.Popen(commands, stdout=subprocess.PIPE) | |
383 | return int(process.communicate()[0]) | |
384 | - elif IsLinux(): | |
385 | + elif IsLinux() or IsFreeBSD() or IsGNUkFreeBSD(): | |
386 | # Count the number of 'vendor_id' in /proc/cpuinfo, assuming that | |
387 | # each line corresponds to one logical CPU. | |
388 | cpuinfo = open('/proc/cpuinfo', 'r') | |
389 | @@ -183,7 +191,7 @@ def GetGypFileNames(): | |
390 | gyp_file_names.extend(glob.glob('%s/win32/*/*.gyp' % SRC_DIR)) | |
391 | gyp_file_names.extend(glob.glob('third_party/breakpad/*.gyp')) | |
392 | gyp_file_names.append('third_party/mozc/sandbox/sandbox.gyp') | |
393 | - elif IsLinux(): | |
394 | + elif IsLinux() or IsFreeBSD() or IsGNUkFreeBSD(): | |
395 | gyp_file_names.extend(glob.glob('%s/unix/*/*.gyp' % SRC_DIR)) | |
396 | # Add ibus.gyp if ibus is installed. | |
397 | # Ubuntu 8.04 (Hardy) does not contain ibus package. | |
398 | @@ -256,7 +264,7 @@ def CleanBuildFilesAndDirectories(): | |
399 | elif IsMac(): | |
400 | directory_names.extend(glob.glob(os.path.join(gyp_directory_name, | |
401 | '*.xcodeproj'))) | |
402 | - elif IsLinux(): | |
403 | + elif IsLinux() or IsFreeBSD() or IsGNUkFreeBSD(): | |
404 | file_names.extend(glob.glob(os.path.join(gyp_directory_name, | |
405 | '*.target.mk'))) | |
406 | file_names.append('%s/mozc_version.txt' % SRC_DIR) | |
407 | @@ -270,6 +278,10 @@ def CleanBuildFilesAndDirectories(): | |
408 | file_names.append('Makefile') | |
409 | elif IsWindows(): | |
410 | file_names.append('third_party/breakpad/breakpad.gyp') | |
411 | + directory_names.append('out_win') | |
412 | + elif IsFreeBSD() or IsGNUkFreeBSD(): | |
413 | + file_names.append('Makefile') | |
414 | + directory_names.append('out_bsd') | |
415 | # Remove files. | |
416 | for file_name in file_names: | |
417 | RemoveFile(file_name) | |
418 | @@ -351,6 +363,8 @@ def GypMain(deps_file_name): | |
419 | command_line.extend(['-D', 'use_qt=NO']) | |
420 | if options.coverage: | |
421 | command_line.extend(['-D', 'coverage=1']) | |
422 | + if options.os: | |
423 | + command_line.extend(['-D', 'OS=%s' % options.os]) | |
424 | ||
425 | command_line.extend(['-D', 'build_base=%s' % GetBuildBaseName(options)]) | |
426 | ||
427 | @@ -386,6 +400,8 @@ def RunTests(configuration, calculate_coverage): | |
428 | base_path = os.path.join('out_linux', configuration) | |
429 | elif IsWindows(): | |
430 | base_path = os.path.join('out_win', configuration) | |
431 | + elif IsFreeBSD() or IsGNUkFreeBSD(): | |
432 | + base_path = os.path.join('out_bsd', configuration) | |
433 | else: | |
434 | logging.error('Unsupported platform: %s', os.name) | |
435 | return | |
436 | @@ -527,6 +543,7 @@ def ParseGypOptions(): | |
437 | parser.add_option('--build_base', dest='build_base', | |
438 | help='specify the base directory of the built binaries.') | |
439 | ||
440 | + parser.add_option('--os', dest='os', default='linux') | |
441 | (options, unused_args) = parser.parse_args() | |
442 | return options | |
443 | ||
444 | @@ -639,6 +656,7 @@ def BuildOnLinux(options, targets): | |
445 | target_names.append(target_name) | |
446 | ||
447 | make_command = os.getenv('BUILD_COMMAND', 'make') | |
448 | + | |
449 | # flags for building in Chrome OS chroot environment | |
450 | envvars = [ | |
451 | 'CFLAGS', | |
452 | @@ -653,7 +671,7 @@ def BuildOnLinux(options, targets): | |
453 | for envvar in envvars: | |
454 | if envvar in os.environ: | |
455 | os.environ[envvar] = os.getenv(envvar) | |
456 | - | |
457 | + | |
458 | # set output directory | |
459 | os.environ['builddir_name'] = 'out_linux' | |
460 | ||
461 | @@ -663,6 +681,42 @@ def BuildOnLinux(options, targets): | |
462 | ||
463 | RunOrDie([make_command] + build_args + target_names) | |
464 | ||
465 | +def BuildOnBSD(options, targets): | |
466 | + """Build the targets on *BSD.""" | |
467 | + target_names = [] | |
468 | + for target in targets: | |
469 | + (unused_gyp_file_name, target_name) = ParseTarget(target) | |
470 | + target_names.append(target_name) | |
471 | + | |
472 | + if os.uname()[0] == 'FreeBSD' : | |
473 | + make_command = os.getenv('BUILD_COMMAND', 'gmake') | |
474 | + else: | |
475 | + make_command = os.getenv('BUILD_COMMAND', 'make') | |
476 | + | |
477 | + # flags for building in Chrome OS chroot environment | |
478 | + envvars = [ | |
479 | + 'CFLAGS', | |
480 | + 'CXXFLAGS', | |
481 | + 'CXX', | |
482 | + 'CC', | |
483 | + 'AR', | |
484 | + 'AS', | |
485 | + 'RANLIB', | |
486 | + 'LD', | |
487 | + ] | |
488 | + for envvar in envvars: | |
489 | + if envvar in os.environ: | |
490 | + os.environ[envvar] = os.getenv(envvar) | |
491 | + | |
492 | + # set output directory | |
493 | + os.environ['builddir_name'] = 'out_bsd' | |
494 | + | |
495 | + build_args = ['-j%s' % options.jobs, 'BUILDTYPE=%s' % options.configuration] | |
496 | + if options.build_base: | |
497 | + build_args.append('builddir_name=%s' % options.build_base) | |
498 | + | |
499 | + RunOrDie([make_command] + build_args + target_names) | |
500 | + | |
501 | ||
502 | def CheckFileOrDie(file_name): | |
503 | """Check the file exists or dies if not.""" | |
504 | @@ -756,6 +810,8 @@ def BuildMain(original_directory_name): | |
505 | BuildOnMac(options, targets, original_directory_name) | |
506 | elif IsLinux(): | |
507 | BuildOnLinux(options, targets) | |
508 | + elif IsFreeBSD() or IsGNUkFreeBSD(): | |
509 | + BuildOnBSD(options, targets) | |
510 | elif IsWindows(): | |
511 | BuildOnWindows(options, targets, original_directory_name) | |
512 | else: | |
513 | diff --git a/build_tools/mozc_version.py b/build_tools/mozc_version.py | |
514 | index 42af980..700cf53 100755 | |
515 | --- a/build_tools/mozc_version.py | |
516 | +++ b/build_tools/mozc_version.py | |
517 | @@ -57,6 +57,13 @@ def IsLinux(): | |
518 | """Returns true if the platform is Linux.""" | |
519 | return os.name == 'posix' and os.uname()[0] == 'Linux' | |
520 | ||
521 | +def IsFreeBSD(): | |
522 | + """Returns true if the platform is FreeBSD.""" | |
523 | + return os.name == 'posix' and os.uname()[0] == 'FreeBSD' | |
524 | + | |
525 | +def IsGNUkFreeBSD(): | |
526 | + """Returns true if the platform is GNU/kFreeBSD.""" | |
527 | + return os.name == 'posix' and os.uname()[0] == 'GNU/kFreeBSD' | |
528 | ||
529 | def CalculateRevisionForPlatform(revision): | |
530 | """Returns the revision for the current platform.""" | |
531 | @@ -68,6 +75,10 @@ def CalculateRevisionForPlatform(revision): | |
532 | last_digit = '1' | |
533 | elif IsLinux(): | |
534 | last_digit = '2' | |
535 | + elif IsFreeBSD(): | |
536 | + last_digit = '3' | |
537 | + elif IsGNUkFreeBSD(): | |
538 | + last_digit = '4' | |
539 | if last_digit: | |
540 | return revision[0:-1] + last_digit | |
541 | ||
542 | diff --git a/client/session.cc b/client/session.cc | |
543 | index 4557a0a..72c10f6 100755 | |
544 | --- a/client/session.cc | |
545 | +++ b/client/session.cc | |
546 | @@ -847,7 +847,7 @@ bool Session::LaunchTool(const string &mode, const string &extra_arg) { | |
547 | return false; | |
548 | } | |
549 | ||
550 | -#if defined(OS_WINDOWS) || defined(OS_LINUX) | |
551 | +#if defined(OS_WINDOWS) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
552 | string arg = "--mode=" + mode; | |
553 | if (!extra_arg.empty()) { | |
554 | arg += " "; | |
555 | diff --git a/dictionary/dictionary_preloader.cc b/dictionary/dictionary_preloader.cc | |
556 | index c9a7044..b023ffc 100755 | |
557 | --- a/dictionary/dictionary_preloader.cc | |
558 | +++ b/dictionary/dictionary_preloader.cc | |
559 | @@ -89,7 +89,7 @@ bool IsPreloadable(const char *image, size_t size) { | |
560 | return available_memory > preload_size * FLAGS_preload_memory_factor; | |
561 | #endif | |
562 | ||
563 | -#ifdef OS_LINUX | |
564 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
565 | // TOOD(taku): implement Linux version. | |
566 | // Since Linux is installed into heterogeneous environment, | |
567 | // we have to check the amount of available memory. | |
568 | @@ -161,7 +161,7 @@ void DictionaryPreloader::PreloadIfApplicable(const char *image, size_t size) { | |
569 | // GoogleIMEJaCacheService.exe is responsible for keeping the dictionary | |
570 | // on-page (or freeing the memory in low-memory condition). | |
571 | // See http://b/2354549 for details. | |
572 | -#if defined(OS_MACOSX) || defined(OS_LINUX) | |
573 | +#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
574 | if (!IsPreloadable(image, size)) { | |
575 | return; | |
576 | } | |
577 | diff --git a/gui/base/locale_util.cc b/gui/base/locale_util.cc | |
578 | index 2e32f21..a825086 100755 | |
579 | --- a/gui/base/locale_util.cc | |
580 | +++ b/gui/base/locale_util.cc | |
581 | @@ -198,7 +198,7 @@ TranslationDataImpl::TranslationDataImpl() | |
582 | qApp->installEventFilter(&window_title_modifier_); | |
583 | #endif | |
584 | ||
585 | -#ifdef OS_LINUX | |
586 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
587 | // Use system default messages. | |
588 | // Even if the locale is not English nor Japanese, load translation | |
589 | // file to translate common messages like "OK" and "Cancel". | |
590 | diff --git a/gui/config_dialog/config_dialog.cc b/gui/config_dialog/config_dialog.cc | |
591 | index e748393..04e91ae 100755 | |
592 | --- a/gui/config_dialog/config_dialog.cc | |
593 | +++ b/gui/config_dialog/config_dialog.cc | |
594 | @@ -73,11 +73,11 @@ ConfigDialog::ConfigDialog() | |
595 | verboseLevelLabel->setVisible(false); | |
596 | verboseLevelComboBox->setVisible(false); | |
597 | ||
598 | -#if defined(OS_MACOSX) || defined(OS_LINUX) | |
599 | +#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
600 | // The last "misc" tab has no valid configs on Mac and Linux | |
601 | const int kMiscTabIndex = 5; | |
602 | configDialogTabWidget->removeTab(kMiscTabIndex); | |
603 | -#endif // OS_MACOSX || OS_LINUX | |
604 | +#endif // OS_MACOSX || OS_LINUX || OS_GNU_KFREEBSD || OS_FREEBSD) | |
605 | #endif // NO_LOGGING | |
606 | ||
607 | client_->set_restricted(true); // start with restricted mode | |
608 | @@ -258,7 +258,7 @@ ConfigDialog::ConfigDialog() | |
609 | dictionaryPreloadingAndUACLabel->setVisible(false); | |
610 | #endif // OS_WINDOWS | |
611 | ||
612 | -#ifdef OS_LINUX | |
613 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
614 | // On Linux, disable all fields for UsageStats | |
615 | usageStatsLabel->setEnabled(false); | |
616 | usageStatsLabel->setVisible(false); | |
617 | @@ -343,7 +343,7 @@ bool ConfigDialog::Update() { | |
618 | } | |
619 | ||
620 | ||
621 | -#if defined(OS_WINDOWS) || defined(OS_LINUX) | |
622 | +#if defined(OS_WINDOWS) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
623 | if (initial_preedit_method_ != | |
624 | static_cast<int>(config.preedit_method()) || | |
625 | initial_use_keyboard_to_change_preedit_method_ != | |
626 | diff --git a/gui/config_dialog/keybinding_editor.cc b/gui/config_dialog/keybinding_editor.cc | |
627 | index 6749dcb..17d90da 100755 | |
628 | --- a/gui/config_dialog/keybinding_editor.cc | |
629 | +++ b/gui/config_dialog/keybinding_editor.cc | |
630 | @@ -443,7 +443,7 @@ bool KeyBindingFilter::eventFilter(QObject *obj, QEvent *event) { | |
631 | KeyBindingEditor::KeyBindingEditor(QWidget *parent, QWidget *trigger_parent) | |
632 | : QDialog(parent), trigger_parent_(trigger_parent) { | |
633 | setupUi(this); | |
634 | -#ifdef OS_LINUX | |
635 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
636 | // Workaround for the issue http://code.google.com/p/mozc/issues/detail?id=9 | |
637 | // Seems that even after clicking the button for the keybinding dialog, | |
638 | // the edit is not raised. This might be a bug of setFocusProxy. | |
639 | diff --git a/gui/config_dialog/keymap_editor.cc b/gui/config_dialog/keymap_editor.cc | |
640 | index adfe645..ebbe3f2 100755 | |
641 | --- a/gui/config_dialog/keymap_editor.cc | |
642 | +++ b/gui/config_dialog/keymap_editor.cc | |
643 | @@ -93,7 +93,7 @@ class KeyMapValidator { | |
644 | invisible_commands_.insert(kReportBugCommand); | |
645 | // Old command name. | |
646 | invisible_commands_.insert(kEditInsertCommand); | |
647 | -#if defined(OS_MACOSX) || defined(OS_LINUX) | |
648 | +#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
649 | // On Mac/Linux, we cannot customize keybindings for IME ON/OFF | |
650 | // So we do not show them. | |
651 | // TODO(toshiyuki): remove them after implimenting IME ON/OFF for Mac | |
652 | @@ -446,7 +446,7 @@ bool KeyMapEditorDialog::Update() { | |
653 | *keymap_table += invisible_keymap_table_; | |
654 | ||
655 | if (new_ime_switch_keymap != ime_switch_keymap_) { | |
656 | -#if defined(OS_WINDOWS) || defined(OS_LINUX) | |
657 | +#if defined(OS_WINDOWS) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
658 | QMessageBox::information( | |
659 | this, | |
660 | tr("Mozc settings"), | |
661 | diff --git a/gui/dictionary_tool/dictionary_tool.cc b/gui/dictionary_tool/dictionary_tool.cc | |
662 | index 44fe65c..14edad4 100755 | |
663 | --- a/gui/dictionary_tool/dictionary_tool.cc | |
664 | +++ b/gui/dictionary_tool/dictionary_tool.cc | |
665 | @@ -303,7 +303,7 @@ DictionaryTool::DictionaryTool(QWidget *parent) | |
666 | } | |
667 | ||
668 | // main window | |
669 | -#ifndef OS_LINUX | |
670 | +#if !defined(OS_LINUX) && !defined(OS_GNU_KFREEBSD) && !defined(OS_FREEBSD) | |
671 | // For some reason setCentralWidget crashes the dictionary_tool on Linux | |
672 | // TODO(taku): investigate the cause of the crashes | |
673 | setCentralWidget(splitter_); | |
674 | diff --git a/gui/qt_common.gypi b/gui/qt_common.gypi | |
675 | index 66112ed..6d82f54 100755 | |
676 | --- a/gui/qt_common.gypi | |
677 | +++ b/gui/qt_common.gypi | |
678 | @@ -33,7 +33,7 @@ | |
679 | 'variables': { | |
680 | 'qt_basepath': '$(QTDIR)', | |
681 | 'conditions': [ | |
682 | - ['OS=="linux"', { | |
683 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
684 | 'qt_cflags': ' <!@(pkg-config --cflags QtCore QtGui)', | |
685 | },{ # OS!="linux" | |
686 | 'qt_cflags': '<(qt_basepath)/include', | |
687 | diff --git a/gui/qt_libraries.gypi b/gui/qt_libraries.gypi | |
688 | index c1b905a..597daa1 100755 | |
689 | --- a/gui/qt_libraries.gypi | |
690 | +++ b/gui/qt_libraries.gypi | |
691 | @@ -44,7 +44,7 @@ | |
692 | ], | |
693 | }, | |
694 | }], | |
695 | - ['OS=="linux"', { | |
696 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
697 | 'link_settings': { | |
698 | 'libraries': [ | |
699 | ' <!@(pkg-config --libs QtCore QtGui)', | |
700 | diff --git a/gui/qt_moc.gypi b/gui/qt_moc.gypi | |
701 | index f0992a2..bef23fe 100755 | |
702 | --- a/gui/qt_moc.gypi | |
703 | +++ b/gui/qt_moc.gypi | |
704 | @@ -31,7 +31,7 @@ | |
705 | { | |
706 | 'variables': { | |
707 | 'conditions': [ | |
708 | - ['OS=="linux"', { | |
709 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
710 | 'moc_path': '<!(pkg-config --variable=moc_location QtGui)', | |
711 | },{ # OS!="linux" | |
712 | 'moc_path': '<(qt_basepath)/bin/moc<(EXECUTABLE_SUFFIX)', | |
713 | diff --git a/gui/qt_rcc.gypi b/gui/qt_rcc.gypi | |
714 | index 2dd06c6..d163695 100755 | |
715 | --- a/gui/qt_rcc.gypi | |
716 | +++ b/gui/qt_rcc.gypi | |
717 | @@ -31,7 +31,7 @@ | |
718 | { | |
719 | 'variables': { | |
720 | 'conditions': [ | |
721 | - ['OS=="linux"', { | |
722 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
723 | # seems that --variable=rcc_location is not supported | |
724 | 'rcc_path': '<!(pkg-config --variable=exec_prefix QtGui)/bin/rcc', | |
725 | },{ # OS!="linux" | |
726 | diff --git a/gui/qt_target_default.gypi b/gui/qt_target_default.gypi | |
727 | index c168f75..b1aa629 100755 | |
728 | --- a/gui/qt_target_default.gypi | |
729 | +++ b/gui/qt_target_default.gypi | |
730 | @@ -91,7 +91,7 @@ | |
731 | }, | |
732 | }, | |
733 | }], | |
734 | - ['OS=="linux"', { | |
735 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
736 | 'target_defaults': { | |
737 | 'configurations': { | |
738 | 'Common_Base': { | |
739 | diff --git a/gui/qt_uic.gypi b/gui/qt_uic.gypi | |
740 | index cfaa397..1157c0e 100755 | |
741 | --- a/gui/qt_uic.gypi | |
742 | +++ b/gui/qt_uic.gypi | |
743 | @@ -31,7 +31,7 @@ | |
744 | { | |
745 | 'variables': { | |
746 | 'conditions': [ | |
747 | - ['OS=="linux"', { | |
748 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
749 | 'uic_path': '<!(pkg-config --variable=uic_location QtGui)', | |
750 | },{ # OS!="linux" | |
751 | 'uic_path': '<(qt_basepath)/bin/uic<(EXECUTABLE_SUFFIX)', | |
752 | diff --git a/gyp/common.gypi b/gyp/common.gypi | |
753 | index 051284e..8b305ed 100755 | |
754 | --- a/gyp/common.gypi | |
755 | +++ b/gyp/common.gypi | |
756 | @@ -203,7 +203,7 @@ | |
757 | }, | |
758 | }, | |
759 | 'conditions': [ | |
760 | - ['OS=="linux"', { | |
761 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
762 | 'cflags': [ | |
763 | '<@(debug_extra_cflags)', | |
764 | ], | |
765 | @@ -242,7 +242,7 @@ | |
766 | }, | |
767 | }, | |
768 | 'conditions': [ | |
769 | - ['OS=="linux"', { | |
770 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
771 | 'cflags': [ | |
772 | '<@(release_extra_cflags)', | |
773 | ], | |
774 | @@ -455,6 +455,51 @@ | |
775 | }], | |
776 | ], | |
777 | }], | |
778 | + ['OS=="freebsd"', { | |
779 | + 'defines': [ | |
780 | + 'OS_FREEBSD', | |
781 | + ], | |
782 | + 'cflags': [ | |
783 | + '<@(gcc_cflags)', | |
784 | + '-fPIC', | |
785 | + '-fno-exceptions', | |
786 | + ], | |
787 | + 'libraries': [ | |
788 | + '-lcurl', | |
789 | + '-lcrypto', | |
790 | + '-lpthread', | |
791 | + '-lrt', | |
792 | + '-lssl', | |
793 | + '-lz', | |
794 | + '<@(extra_linux_libs)', | |
795 | + ], | |
796 | + 'conditions': [ | |
797 | + ['chromeos==1', { | |
798 | + 'defines': [ | |
799 | + 'OS_CHROMEOS', | |
800 | + ], | |
801 | + }], | |
802 | + ], | |
803 | + }], | |
804 | + ['OS=="gnu-kfreebsd"', { | |
805 | + 'defines': [ | |
806 | + 'OS_GNU_KFREEBSD', | |
807 | + ], | |
808 | + 'cflags': [ | |
809 | + '<@(gcc_cflags)', | |
810 | + '-fPIC', | |
811 | + '-fno-exceptions', | |
812 | + ], | |
813 | + 'libraries': [ | |
814 | + '-lcurl', | |
815 | + '-lcrypto', | |
816 | + '-lpthread', | |
817 | + '-lrt', | |
818 | + '-lssl', | |
819 | + '-lz', | |
820 | + '<@(extra_linux_libs)', | |
821 | + ], | |
822 | + }], | |
823 | ['OS=="mac"', { | |
824 | 'defines': [ | |
825 | 'OS_MACOSX', | |
826 | @@ -509,7 +554,7 @@ | |
827 | # Linux gyp (into scons) doesn't like target_conditions? | |
828 | # TODO(team): track down why 'target_conditions' doesn't work | |
829 | # on Linux gyp into scons like it does on Mac gyp into xcodeproj. | |
830 | - ['OS=="linux"', { | |
831 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
832 | 'cflags': [ '-ftest-coverage', | |
833 | '-fprofile-arcs' ], | |
834 | 'link_settings': { 'libraries': [ '-lgcov' ] }, | |
835 | diff --git a/ipc/ipc_path_manager.cc b/ipc/ipc_path_manager.cc | |
836 | index 392ee0d..60924cb 100755 | |
837 | --- a/ipc/ipc_path_manager.cc | |
838 | +++ b/ipc/ipc_path_manager.cc | |
839 | @@ -265,7 +265,7 @@ bool IPCPathManager::GetPathName(string *ipc_name) { | |
840 | *ipc_name = kIPCPrefix; | |
841 | #endif // OS_WINDOWS | |
842 | ||
843 | -#ifdef OS_LINUX | |
844 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
845 | // On Linux, use abstract namespace which is independent of the file system. | |
846 | (*ipc_name)[0] = '\0'; | |
847 | #endif | |
848 | @@ -358,7 +358,7 @@ bool IPCPathManager::IsValidServer(uint32 pid, | |
849 | } | |
850 | #endif | |
851 | ||
852 | -#ifdef OS_LINUX | |
853 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
854 | // load from /proc/<pid>/exe | |
855 | char proc[128]; | |
856 | char filename[512]; | |
857 | @@ -378,7 +378,7 @@ bool IPCPathManager::IsValidServer(uint32 pid, | |
858 | return true; | |
859 | } | |
860 | ||
861 | -#ifdef OS_LINUX | |
862 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
863 | if ((server_path + " (deleted)") == server_path_) { | |
864 | LOG(WARNING) << server_path << " on disk is modified"; | |
865 | // If a user updates the server binary on disk during the server is running, | |
866 | diff --git a/ipc/unix_ipc.cc b/ipc/unix_ipc.cc | |
867 | index 66eb90c..69373f1 100755 | |
868 | --- a/ipc/unix_ipc.cc | |
869 | +++ b/ipc/unix_ipc.cc | |
870 | @@ -28,7 +28,8 @@ | |
871 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
872 | ||
873 | // skip all if Windows | |
874 | -#ifdef OS_LINUX | |
875 | +#if defined(OS_LINUX) || defined(OS_MACOSX) ||\ | |
876 | + defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD) | |
877 | ||
878 | #include "ipc/ipc.h" | |
879 | ||
880 | @@ -41,7 +42,7 @@ | |
881 | #include <sys/time.h> | |
882 | #include <sys/types.h> | |
883 | #include <sys/un.h> | |
884 | -#ifdef OS_MACOSX | |
885 | +#if defined(OS_MACOSX) || defined(OS_FREEBSD) | |
886 | #include <sys/ucred.h> | |
887 | #endif | |
888 | #include <sys/wait.h> | |
889 | @@ -124,7 +125,7 @@ bool IsWriteTimeout(int socket, int timeout) { | |
890 | bool IsPeerValid(int socket, pid_t *pid) { | |
891 | *pid = 0; | |
892 | ||
893 | -#ifdef OS_MACOSX | |
894 | +#if defined(OS_MACOSX) || defined(OS_FREEBSD) | |
895 | // If the OS is MAC, we should validate the peer by using LOCAL_PEERCRED. | |
896 | struct xucred peer_cred; | |
897 | socklen_t peer_cred_len = sizeof(struct xucred); | |
898 | @@ -179,7 +180,7 @@ bool SendMessage(int socket, | |
899 | return false; | |
900 | } | |
901 | const ssize_t l = ::send(socket, buf, buf_length_left, | |
902 | -#ifdef OS_MACOSX | |
903 | +#if defined(OS_MACOSX) || defined(OS_FREEBSD) | |
904 | SO_NOSIGPIPE | |
905 | #else | |
906 | MSG_NOSIGNAL | |
907 | @@ -518,4 +519,5 @@ void IPCServer::Loop() { | |
908 | ||
909 | }; // namespace mozc | |
910 | ||
911 | -#endif // OS_LINUX | |
912 | +#endif // defined(OS_LINUX) || defined(OS_MACOSX) ||\ | |
913 | + // defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD) | |
914 | diff --git a/protobuf/genproto.gypi b/protobuf/genproto.gypi | |
915 | index b5aba7f..8f209cb 100755 | |
916 | --- a/protobuf/genproto.gypi | |
917 | +++ b/protobuf/genproto.gypi | |
918 | @@ -39,7 +39,7 @@ | |
919 | '<(protobuf_dir)/protobuf.gyp:install_protoc', | |
920 | ], | |
921 | }], | |
922 | - ['OS!="linux"', { | |
923 | + ['OS!="linux" and OS!="gnu-kfreebsd"', { | |
924 | 'variables': { | |
925 | 'protoc_command%': '<(relative_dir)/<(mozc_build_tools_dir)/protoc<(EXECUTABLE_SUFFIX)', | |
926 | }, | |
927 | diff --git a/protobuf/protobuf.gyp b/protobuf/protobuf.gyp | |
928 | index 0b8ca63..449167c 100755 | |
929 | --- a/protobuf/protobuf.gyp | |
930 | +++ b/protobuf/protobuf.gyp | |
931 | @@ -116,7 +116,7 @@ | |
932 | 'target_name': 'protobuf', | |
933 | 'type': 'static_library', | |
934 | 'conditions': [ | |
935 | - ['OS=="linux"', { | |
936 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
937 | 'conditions': [ | |
938 | ['use_libprotobuf==1', { | |
939 | 'link_settings': { | |
940 | @@ -193,7 +193,7 @@ | |
941 | }, | |
942 | 'conditions': [ | |
943 | # use system-installed protoc on Linux | |
944 | - ['OS!="linux"', { | |
945 | + ['OS!="linux" and OS!="gnu-kfreebsd"', { | |
946 | 'includes' : [ | |
947 | '../gyp/install_build_tool.gypi', | |
948 | ], | |
949 | diff --git a/session/session_converter.cc b/session/session_converter.cc | |
950 | index a9a0be3..b23a407 100755 | |
951 | --- a/session/session_converter.cc | |
952 | +++ b/session/session_converter.cc | |
953 | @@ -90,7 +90,7 @@ void SessionConverter::UpdateConfig(const config::Config &config) { | |
954 | } | |
955 | ||
956 | // Cascading Window. | |
957 | -#ifdef OS_LINUX | |
958 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
959 | // TODO(komatsu): Move this logic to the client code. | |
960 | operation_preferences_.use_cascading_window = false; | |
961 | #else | |
962 | diff --git a/testing/testing.gyp b/testing/testing.gyp | |
963 | index 22a659c..1dd505c 100755 | |
964 | --- a/testing/testing.gyp | |
965 | +++ b/testing/testing.gyp | |
966 | @@ -49,7 +49,7 @@ | |
967 | 'base/internal/gtest_main.cc', | |
968 | ], | |
969 | 'conditions': [ | |
970 | - ['OS!="linux"', { | |
971 | + ['OS!="linux" and OS!="gnu-kfreebsd"', { | |
972 | 'dependencies': [ | |
973 | 'testing', | |
974 | ], | |
975 | -- | |
976 | 1.7.2.3 | |
977 |
0 | 0001-Add-support-kfreebsd.patch | |
0 | support-kfreebsd.patch | |
1 | 1 | uim-mozc.patch |
2 | 2 | # mozc-el-pseudo-cursor.patch |
3 | 3 | # mozc-el-not-suggest-in-minibuffer-fixed.patch |
0 | From c962ec1fc61ef5cae36ec2494bf419bd604694c0 Mon Sep 17 00:00:00 2001 | |
1 | From: Nobuhiro Iwamatsu <iwamatsu@debian.org> | |
2 | Date: Sat, 9 Oct 2010 08:15:18 +0900 | |
3 | Subject: [PATCH] Add support kfreebsd | |
4 | ||
5 | Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@debian.org> | |
6 | --- | |
7 | base/const.h | 2 +- | |
8 | base/cpu_stats.cc | 6 +- | |
9 | base/flags.h | 2 +- | |
10 | base/iconv.cc | 4 ++ | |
11 | base/logging.cc | 2 +- | |
12 | base/mutex.cc | 3 +- | |
13 | base/mutex.h | 6 ++- | |
14 | base/password_manager.cc | 2 +- | |
15 | base/process.cc | 8 ++-- | |
16 | base/run_level.cc | 2 +- | |
17 | base/stats_config_util.cc | 2 +- | |
18 | base/stats_config_util_test.cc | 2 +- | |
19 | base/stopwatch.cc | 6 +- | |
20 | base/util.cc | 19 +++++---- | |
21 | build_mozc.py | 66 +++++++++++++++++++++++++++++-- | |
22 | build_tools/mozc_version.py | 11 +++++ | |
23 | client/session.cc | 2 +- | |
24 | dictionary/dictionary_preloader.cc | 4 +- | |
25 | gui/base/locale_util.cc | 2 +- | |
26 | gui/config_dialog/config_dialog.cc | 8 ++-- | |
27 | gui/config_dialog/keybinding_editor.cc | 2 +- | |
28 | gui/config_dialog/keymap_editor.cc | 4 +- | |
29 | gui/dictionary_tool/dictionary_tool.cc | 2 +- | |
30 | gui/qt_common.gypi | 2 +- | |
31 | gui/qt_libraries.gypi | 2 +- | |
32 | gui/qt_moc.gypi | 2 +- | |
33 | gui/qt_rcc.gypi | 2 +- | |
34 | gui/qt_target_default.gypi | 2 +- | |
35 | gui/qt_uic.gypi | 2 +- | |
36 | gyp/common.gypi | 51 +++++++++++++++++++++++- | |
37 | ipc/ipc_path_manager.cc | 6 +- | |
38 | ipc/unix_ipc.cc | 12 +++-- | |
39 | protobuf/genproto.gypi | 2 +- | |
40 | protobuf/protobuf.gyp | 4 +- | |
41 | testing/testing.gyp | 2 +- | |
42 | 35 files changed, 190 insertions(+), 66 deletions(-) | |
43 | ||
44 | diff --git a/base/const.h b/base/const.h | |
45 | index 3d76bc9..16e041b 100755 | |
46 | --- a/base/const.h | |
47 | +++ b/base/const.h | |
48 | @@ -109,7 +109,7 @@ const char kEventPathPrefix[] = "GoogleJapaneseInput.event."; | |
49 | #else | |
50 | const char kEventPathPrefix[] = "Mozc.event."; | |
51 | #endif // GOOGLE_JAPANESE_INPUT_BUILD | |
52 | -#else // OS_LINUX | |
53 | +#else // OS_LINUX || OS_GNU_KFREEBSD || OS_FREEBSD | |
54 | const char kMozcServerName[] = "mozc_server"; | |
55 | const char kEventPathPrefix[] = "mozc.event."; | |
56 | const char kMozcTool[] = "mozc_tool"; | |
57 | diff --git a/base/cpu_stats.cc b/base/cpu_stats.cc | |
58 | index 7279ff6..3b785ca 100755 | |
59 | --- a/base/cpu_stats.cc | |
60 | +++ b/base/cpu_stats.cc | |
61 | @@ -122,7 +122,7 @@ float CPUStats::GetSystemCPULoad() { | |
62 | ||
63 | #endif // OS_MACOSX | |
64 | ||
65 | -#ifdef OS_LINUX | |
66 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
67 | // NOT IMPLEMENTED | |
68 | // TODO(taku): implement Linux version | |
69 | // can take the info from /proc/stats | |
70 | @@ -177,7 +177,7 @@ float CPUStats::GetCurrentProcessCPULoad() { | |
71 | TimeValueTToInt64(task_times_info.system_time); | |
72 | #endif // OS_MACOSX | |
73 | ||
74 | -#ifdef OS_LINUX | |
75 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
76 | // not implemented | |
77 | const uint64 total_times = 0; | |
78 | const uint64 cpu_times = 0; | |
79 | @@ -209,7 +209,7 @@ size_t CPUStats::GetNumberOfProcessors() const { | |
80 | return static_cast<size_t>(basic_info.avail_cpus); | |
81 | #endif // OS_MACOSX | |
82 | ||
83 | -#ifdef OS_LINUX | |
84 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
85 | // Not implemented | |
86 | return 1; | |
87 | #endif // OS_LINUX | |
88 | diff --git a/base/flags.h b/base/flags.h | |
89 | index 2767113..81567c4 100755 | |
90 | --- a/base/flags.h | |
91 | +++ b/base/flags.h | |
92 | @@ -76,7 +76,7 @@ namespace { | |
93 | // so that CrashReportHandler() is resovled in link time | |
94 | inline void InstallBreakpad() { | |
95 | #ifdef GOOGLE_JAPANESE_INPUT_BUILD | |
96 | -#ifndef OS_LINUX | |
97 | +#if !defined(OS_LINUX) && !defined(OS_GNU_KFREEBSD) && !defined(OS_FREEBSD) | |
98 | if (StatsConfigUtil::IsEnabled()) { | |
99 | CrashReportHandler::Initialize(false); | |
100 | } | |
101 | diff --git a/base/iconv.cc b/base/iconv.cc | |
102 | index e61031a..3ebd0eb 100755 | |
103 | --- a/base/iconv.cc | |
104 | +++ b/base/iconv.cc | |
105 | @@ -52,7 +52,11 @@ void IconvHelper(iconv_t ic, const string &input, string *output) { | |
106 | size_t olen_org = olen; | |
107 | iconv(ic, 0, &ilen, 0, &olen); // reset iconv state | |
108 | while (ilen != 0) { | |
109 | +#ifdef OS_FREEBSD | |
110 | + if (iconv(ic, (const char **)(&ibuf), &ilen, &obuf, &olen) | |
111 | +#else | |
112 | if (iconv(ic, reinterpret_cast<char **>(&ibuf), &ilen, &obuf, &olen) | |
113 | +#endif | |
114 | == static_cast<size_t>(-1)) { | |
115 | return; | |
116 | } | |
117 | diff --git a/base/logging.cc b/base/logging.cc | |
118 | index 3ba399b..cdba4a2 100755 | |
119 | --- a/base/logging.cc | |
120 | +++ b/base/logging.cc | |
121 | @@ -212,7 +212,7 @@ string Logging::GetLogMessageHeader() { | |
122 | char buf[512]; | |
123 | snprintf(buf, sizeof(buf), | |
124 | "%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d %u " | |
125 | -#ifndef OS_LINUX // = OS_WINDOWS or OS_MACOSX | |
126 | +#if !defined(OS_LINUX) && !defined(OS_GNU_KFREEBSD) && !defined(OS_FREEBSD) // = OS_WINDOWS or OS_MACOSX | |
127 | "%u", | |
128 | #else | |
129 | "%lu", | |
130 | diff --git a/base/mutex.cc b/base/mutex.cc | |
131 | index 36f4dc3..79ed9b3 100755 | |
132 | --- a/base/mutex.cc | |
133 | +++ b/base/mutex.cc | |
134 | @@ -44,7 +44,8 @@ namespace mozc { | |
135 | ||
136 | // Wrapper for Windows InterlockedCompareExchange | |
137 | namespace { | |
138 | -#ifdef OS_LINUX | |
139 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
140 | +// TODO(taku): | |
141 | // Linux doesn't provide InterlockedCompareExchange-like function. | |
142 | inline int InterlockedCompareExchange(volatile int *target, | |
143 | int new_value, | |
144 | diff --git a/base/mutex.h b/base/mutex.h | |
145 | index 6d2d1e4..0f19a80 100755 | |
146 | --- a/base/mutex.h | |
147 | +++ b/base/mutex.h | |
148 | @@ -86,10 +86,14 @@ class Mutex { | |
149 | #define PTHREAD_MUTEX_RECURSIVE_VALUE PTHREAD_MUTEX_RECURSIVE | |
150 | #endif | |
151 | ||
152 | -#ifdef OS_LINUX | |
153 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) | |
154 | #define PTHREAD_MUTEX_RECURSIVE_VALUE PTHREAD_MUTEX_RECURSIVE_NP | |
155 | #endif | |
156 | ||
157 | +#ifdef OS_FREEBSD | |
158 | +#define PTHREAD_MUTEX_RECURSIVE_VALUE PTHREAD_MUTEX_RECURSIVE | |
159 | +#endif | |
160 | + | |
161 | pthread_mutexattr_t attr; | |
162 | pthread_mutexattr_init(&attr); | |
163 | pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_VALUE); | |
164 | diff --git a/base/password_manager.cc b/base/password_manager.cc | |
165 | index ce4cbdb..93f4490 100755 | |
166 | --- a/base/password_manager.cc | |
167 | +++ b/base/password_manager.cc | |
168 | @@ -358,7 +358,7 @@ class MacPasswordManager : public PasswordManagerInterface { | |
169 | // this module to other Linux distro, you might want to implement | |
170 | // a new password manager which adopts some secure mechanism such | |
171 | // like gnome-keyring. | |
172 | -#if defined OS_LINUX | |
173 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
174 | typedef PlainPasswordManager DefaultPasswordManager; | |
175 | #endif | |
176 | ||
177 | diff --git a/base/process.cc b/base/process.cc | |
178 | index 57fb70e..b9c134d 100755 | |
179 | --- a/base/process.cc | |
180 | +++ b/base/process.cc | |
181 | @@ -52,7 +52,7 @@ | |
182 | #include "base/mac_process.h" | |
183 | #endif // OS_MACOSX | |
184 | ||
185 | -#ifdef OS_LINUX | |
186 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
187 | #include <fcntl.h> | |
188 | #include <signal.h> | |
189 | #include <spawn.h> // for posix_spawn(). | |
190 | @@ -201,7 +201,7 @@ bool Process::OpenBrowser(const string &url) { | |
191 | return ShellExecuteInSystemDir(L"open", wurl.c_str(), NULL, SW_SHOW); | |
192 | #endif | |
193 | ||
194 | -#ifdef OS_LINUX | |
195 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
196 | static const char kBrowserCommand[] = "/usr/bin/xdg-open"; | |
197 | // xdg-open which uses kfmclient or gnome-open internally works both on KDE | |
198 | // and GNOME environments. | |
199 | @@ -285,7 +285,7 @@ bool Process::SpawnProcess(const string &path, | |
200 | } | |
201 | #endif | |
202 | ||
203 | -#ifdef OS_LINUX | |
204 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
205 | // Do not call posix_spawn() for obviously bad path. | |
206 | if (!S_ISREG(statbuf.st_mode)) { | |
207 | LOG(ERROR) << "Not a regular file: " << path; | |
208 | @@ -581,7 +581,7 @@ bool Process::LaunchErrorMessageDialog(const string &error_type) { | |
209 | } | |
210 | #endif // OS_WINDOWS | |
211 | ||
212 | -#ifdef OS_LINUX | |
213 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
214 | const char kMozcTool[] = "mozc_tool"; | |
215 | const string arg = "--mode=error_message_dialog --error_type=" + error_type; | |
216 | size_t pid = 0; | |
217 | diff --git a/base/run_level.cc b/base/run_level.cc | |
218 | index 87b0f0a..1578ad8 100755 | |
219 | --- a/base/run_level.cc | |
220 | +++ b/base/run_level.cc | |
221 | @@ -38,7 +38,7 @@ | |
222 | #include <windows.h> | |
223 | #endif | |
224 | ||
225 | -#ifdef OS_LINUX | |
226 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
227 | #include <unistd.h> | |
228 | #include <sys/types.h> | |
229 | #endif | |
230 | diff --git a/base/stats_config_util.cc b/base/stats_config_util.cc | |
231 | index d6a15ab..3588905 100755 | |
232 | --- a/base/stats_config_util.cc | |
233 | +++ b/base/stats_config_util.cc | |
234 | @@ -336,7 +336,7 @@ bool MacStatsConfigUtilImpl::SetEnabled(bool val) { | |
235 | } | |
236 | #endif // MACOSX | |
237 | ||
238 | -#ifdef OS_LINUX | |
239 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
240 | class LinuxStatsConfigUtilImpl : public StatsConfigUtilInterface { | |
241 | // TODO(toshiyuki): implement this | |
242 | public: | |
243 | diff --git a/base/stats_config_util_test.cc b/base/stats_config_util_test.cc | |
244 | index 3052d86..fab4aa2 100755 | |
245 | --- a/base/stats_config_util_test.cc | |
246 | +++ b/base/stats_config_util_test.cc | |
247 | @@ -840,7 +840,7 @@ TEST_F(StatsConfigUtilTestWin, | |
248 | } // namespace mozc | |
249 | #endif // OS_WINDOWS | |
250 | ||
251 | -#ifdef OS_LINUX | |
252 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
253 | TEST(StatsConfigUtilTestLinux, DefaultValueTest) { | |
254 | EXPECT_FALSE(mozc::StatsConfigUtil::IsEnabled()); | |
255 | } | |
256 | diff --git a/base/stopwatch.cc b/base/stopwatch.cc | |
257 | index 5224b36..1b512d9 100755 | |
258 | --- a/base/stopwatch.cc | |
259 | +++ b/base/stopwatch.cc | |
260 | @@ -39,7 +39,7 @@ | |
261 | #include <unistd.h> | |
262 | #endif // OS_MACOSX | |
263 | ||
264 | -#if defined(OS_LINUX) | |
265 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
266 | #include <sys/time.h> | |
267 | #endif // OS_LINUX | |
268 | ||
269 | @@ -65,7 +65,7 @@ int64 Stopwatch::GetFrequency() { | |
270 | return static_cast<int64>(1.0e9 * timebase_info.denom / timebase_info.numer); | |
271 | #endif // OS_MACOSX | |
272 | ||
273 | -#if defined(OS_LINUX) | |
274 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
275 | return 1000000000LL; | |
276 | #endif // OS_LINUX | |
277 | } | |
278 | @@ -83,7 +83,7 @@ int64 Stopwatch::GetTimestamp() { | |
279 | return static_cast<int64>(mach_absolute_time()); | |
280 | #endif // OS_MACOSX | |
281 | ||
282 | -#if defined(OS_LINUX) | |
283 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
284 | struct timespec timestamp; | |
285 | if (-1 == clock_gettime(CLOCK_REALTIME, ×tamp)) { | |
286 | return 0; | |
287 | diff --git a/base/util.cc b/base/util.cc | |
288 | index 6053277..f3be423 100755 | |
289 | --- a/base/util.cc | |
290 | +++ b/base/util.cc | |
291 | @@ -1724,7 +1724,7 @@ string Util::GetServerDirectory() { | |
292 | return MacUtil::GetServerDirectory(); | |
293 | #endif // OS_MACOSX | |
294 | ||
295 | -#ifdef OS_LINUX | |
296 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
297 | return "/usr/lib/mozc"; | |
298 | #endif // OS_LINUX | |
299 | } | |
300 | @@ -1804,7 +1804,7 @@ string GetObjectNameAsString(HANDLE handle) { | |
301 | #endif | |
302 | ||
303 | string Util::GetDesktopNameAsString() { | |
304 | -#ifdef OS_LINUX | |
305 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
306 | const char *display = getenv("DISPLAY"); | |
307 | if (display == NULL) { | |
308 | return ""; | |
309 | @@ -2248,7 +2248,7 @@ bool Util::IsPlatformSupported() { | |
310 | #if defined(OS_MACOSX) | |
311 | // TODO(yukawa): support Mac. | |
312 | return true; | |
313 | -#elif defined(OS_LINUX) | |
314 | +#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
315 | // TODO(yukawa): support Linux. | |
316 | return true; | |
317 | #elif defined(OS_WINDOWS) | |
318 | @@ -2619,18 +2619,19 @@ string Util::GetOSVersionString() { | |
319 | } else { | |
320 | LOG(WARNING) << "GetVersionEx failed"; | |
321 | } | |
322 | - return ret; | |
323 | #elif defined(OS_MACOSX) | |
324 | const string ret = "MacOSX " + MacUtil::GetOSVersionString(); | |
325 | // TODO(toshiyuki): get more specific info | |
326 | - return ret; | |
327 | #elif defined(OS_LINUX) | |
328 | const string ret = "Linux"; | |
329 | - return ret; | |
330 | +#elif defined(OS_GNU_KFREEBSD) | |
331 | + const string ret = "GNU/kFreeBSD"; | |
332 | +#elif defined(OS_FREEBSD) | |
333 | + const string ret = "FreeBSD"; | |
334 | #else | |
335 | const string ret = "Unknown"; | |
336 | - return ret; | |
337 | #endif | |
338 | + return ret; | |
339 | } | |
340 | ||
341 | void Util::DisableIME() { | |
342 | @@ -2664,7 +2665,7 @@ uint64 Util::GetTotalPhysicalMemory() { | |
343 | return 0; | |
344 | } | |
345 | return total_memory; | |
346 | -#elif defined(OS_LINUX) | |
347 | +#elif defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
348 | #if defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES) | |
349 | const long page_size = sysconf(_SC_PAGESIZE); | |
350 | const long number_of_phyisical_pages = sysconf(_SC_PHYS_PAGES); | |
351 | @@ -2690,7 +2691,7 @@ void Util::PreloadMappedRegion(const void *begin, | |
352 | ::ZeroMemory(&system_info, sizeof(system_info)); | |
353 | ::GetSystemInfo(&system_info); | |
354 | const size_t page_size = system_info.dwPageSize; | |
355 | -#elif defined(OS_MACOSX) || defined(OS_LINUX) | |
356 | +#elif defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
357 | #if defined(_SC_PAGESIZE) | |
358 | const size_t page_size = sysconf(_SC_PAGESIZE); | |
359 | #else | |
360 | diff --git a/build_mozc.py b/build_mozc.py | |
361 | index 3ac32e4..0eb8445 100755 | |
362 | --- a/build_mozc.py | |
363 | +++ b/build_mozc.py | |
364 | @@ -71,6 +71,14 @@ def IsLinux(): | |
365 | """Returns true if the platform is Linux.""" | |
366 | return os.name == 'posix' and os.uname()[0] == 'Linux' | |
367 | ||
368 | +def IsFreeBSD(): | |
369 | + """Returns true if the platform is FreeBSD.""" | |
370 | + return os.name == 'posix' and os.uname()[0] == 'FreeBSD' | |
371 | + | |
372 | +def IsGNUkFreeBSD(): | |
373 | + """Returns true if the platform is GNU/kFreeBSD.""" | |
374 | + os.environ['GYP_DEFINES'] = 'OS=="GNU/kFreeBSD"' | |
375 | + return os.name == 'posix' and os.uname()[0] == 'GNU/kFreeBSD' | |
376 | ||
377 | # TODO(yukawa): Move this function to util.py (b/2715400) | |
378 | def GetNumberOfProcessors(): | |
379 | @@ -86,7 +94,7 @@ def GetNumberOfProcessors(): | |
380 | commands = ['sysctl', '-n', 'hw.ncpu'] | |
381 | process = subprocess.Popen(commands, stdout=subprocess.PIPE) | |
382 | return int(process.communicate()[0]) | |
383 | - elif IsLinux(): | |
384 | + elif IsLinux() or IsFreeBSD() or IsGNUkFreeBSD(): | |
385 | # Count the number of 'vendor_id' in /proc/cpuinfo, assuming that | |
386 | # each line corresponds to one logical CPU. | |
387 | cpuinfo = open('/proc/cpuinfo', 'r') | |
388 | @@ -183,7 +191,7 @@ def GetGypFileNames(): | |
389 | gyp_file_names.extend(glob.glob('%s/win32/*/*.gyp' % SRC_DIR)) | |
390 | gyp_file_names.extend(glob.glob('third_party/breakpad/*.gyp')) | |
391 | gyp_file_names.append('third_party/mozc/sandbox/sandbox.gyp') | |
392 | - elif IsLinux(): | |
393 | + elif IsLinux() or IsFreeBSD() or IsGNUkFreeBSD(): | |
394 | gyp_file_names.extend(glob.glob('%s/unix/*/*.gyp' % SRC_DIR)) | |
395 | # Add ibus.gyp if ibus is installed. | |
396 | # Ubuntu 8.04 (Hardy) does not contain ibus package. | |
397 | @@ -256,7 +264,7 @@ def CleanBuildFilesAndDirectories(): | |
398 | elif IsMac(): | |
399 | directory_names.extend(glob.glob(os.path.join(gyp_directory_name, | |
400 | '*.xcodeproj'))) | |
401 | - elif IsLinux(): | |
402 | + elif IsLinux() or IsFreeBSD() or IsGNUkFreeBSD(): | |
403 | file_names.extend(glob.glob(os.path.join(gyp_directory_name, | |
404 | '*.target.mk'))) | |
405 | file_names.append('%s/mozc_version.txt' % SRC_DIR) | |
406 | @@ -270,6 +278,10 @@ def CleanBuildFilesAndDirectories(): | |
407 | file_names.append('Makefile') | |
408 | elif IsWindows(): | |
409 | file_names.append('third_party/breakpad/breakpad.gyp') | |
410 | + directory_names.append('out_win') | |
411 | + elif IsFreeBSD() or IsGNUkFreeBSD(): | |
412 | + file_names.append('Makefile') | |
413 | + directory_names.append('out_bsd') | |
414 | # Remove files. | |
415 | for file_name in file_names: | |
416 | RemoveFile(file_name) | |
417 | @@ -351,6 +363,8 @@ def GypMain(deps_file_name): | |
418 | command_line.extend(['-D', 'use_qt=NO']) | |
419 | if options.coverage: | |
420 | command_line.extend(['-D', 'coverage=1']) | |
421 | + if options.os: | |
422 | + command_line.extend(['-D', 'OS=%s' % options.os]) | |
423 | ||
424 | command_line.extend(['-D', 'build_base=%s' % GetBuildBaseName(options)]) | |
425 | ||
426 | @@ -393,6 +407,8 @@ def RunTests(configuration, calculate_coverage): | |
427 | base_path = os.path.join('out_linux', configuration) | |
428 | elif IsWindows(): | |
429 | base_path = os.path.join('out_win', configuration) | |
430 | + elif IsFreeBSD() or IsGNUkFreeBSD(): | |
431 | + base_path = os.path.join('out_bsd', configuration) | |
432 | else: | |
433 | logging.error('Unsupported platform: %s', os.name) | |
434 | return | |
435 | @@ -536,13 +552,14 @@ def ParseGypOptions(): | |
436 | parser.add_option('--build_base', dest='build_base', | |
437 | help='specify the base directory of the built binaries.') | |
438 | ||
439 | - | |
440 | # Linux environment can build both for Linux and ChromeOS. | |
441 | # This option enable this script to know which build (Linux or ChromeOS) | |
442 | # should be done. If you want ChromeOS build, specify "ChromeOS". | |
443 | parser.add_option('--target_platform', dest='target_platform', | |
444 | help='if you want ChromeOS build, specify "ChromeOS"') | |
445 | ||
446 | + parser.add_option('--os', dest='os', default='linux') | |
447 | + | |
448 | (options, unused_args) = parser.parse_args() | |
449 | return options | |
450 | ||
451 | @@ -655,6 +672,7 @@ def BuildOnLinux(options, targets): | |
452 | target_names.append(target_name) | |
453 | ||
454 | make_command = os.getenv('BUILD_COMMAND', 'make') | |
455 | + | |
456 | # flags for building in Chrome OS chroot environment | |
457 | envvars = [ | |
458 | 'CFLAGS', | |
459 | @@ -669,7 +687,7 @@ def BuildOnLinux(options, targets): | |
460 | for envvar in envvars: | |
461 | if envvar in os.environ: | |
462 | os.environ[envvar] = os.getenv(envvar) | |
463 | - | |
464 | + | |
465 | # set output directory | |
466 | os.environ['builddir_name'] = 'out_linux' | |
467 | ||
468 | @@ -679,6 +697,42 @@ def BuildOnLinux(options, targets): | |
469 | ||
470 | RunOrDie([make_command] + build_args + target_names) | |
471 | ||
472 | +def BuildOnBSD(options, targets): | |
473 | + """Build the targets on *BSD.""" | |
474 | + target_names = [] | |
475 | + for target in targets: | |
476 | + (unused_gyp_file_name, target_name) = ParseTarget(target) | |
477 | + target_names.append(target_name) | |
478 | + | |
479 | + if os.uname()[0] == 'FreeBSD' : | |
480 | + make_command = os.getenv('BUILD_COMMAND', 'gmake') | |
481 | + else: | |
482 | + make_command = os.getenv('BUILD_COMMAND', 'make') | |
483 | + | |
484 | + # flags for building in Chrome OS chroot environment | |
485 | + envvars = [ | |
486 | + 'CFLAGS', | |
487 | + 'CXXFLAGS', | |
488 | + 'CXX', | |
489 | + 'CC', | |
490 | + 'AR', | |
491 | + 'AS', | |
492 | + 'RANLIB', | |
493 | + 'LD', | |
494 | + ] | |
495 | + for envvar in envvars: | |
496 | + if envvar in os.environ: | |
497 | + os.environ[envvar] = os.getenv(envvar) | |
498 | + | |
499 | + # set output directory | |
500 | + os.environ['builddir_name'] = 'out_bsd' | |
501 | + | |
502 | + build_args = ['-j%s' % options.jobs, 'BUILDTYPE=%s' % options.configuration] | |
503 | + if options.build_base: | |
504 | + build_args.append('builddir_name=%s' % options.build_base) | |
505 | + | |
506 | + RunOrDie([make_command] + build_args + target_names) | |
507 | + | |
508 | ||
509 | def CheckFileOrDie(file_name): | |
510 | """Check the file exists or dies if not.""" | |
511 | @@ -771,6 +825,8 @@ def BuildMain(original_directory_name): | |
512 | BuildOnMac(options, targets, original_directory_name) | |
513 | elif IsLinux(): | |
514 | BuildOnLinux(options, targets) | |
515 | + elif IsFreeBSD() or IsGNUkFreeBSD(): | |
516 | + BuildOnBSD(options, targets) | |
517 | elif IsWindows(): | |
518 | BuildOnWindows(options, targets, original_directory_name) | |
519 | else: | |
520 | diff --git a/build_tools/mozc_version.py b/build_tools/mozc_version.py | |
521 | index 42af980..700cf53 100755 | |
522 | --- a/build_tools/mozc_version.py | |
523 | +++ b/build_tools/mozc_version.py | |
524 | @@ -57,6 +57,13 @@ def IsLinux(): | |
525 | """Returns true if the platform is Linux.""" | |
526 | return os.name == 'posix' and os.uname()[0] == 'Linux' | |
527 | ||
528 | +def IsFreeBSD(): | |
529 | + """Returns true if the platform is FreeBSD.""" | |
530 | + return os.name == 'posix' and os.uname()[0] == 'FreeBSD' | |
531 | + | |
532 | +def IsGNUkFreeBSD(): | |
533 | + """Returns true if the platform is GNU/kFreeBSD.""" | |
534 | + return os.name == 'posix' and os.uname()[0] == 'GNU/kFreeBSD' | |
535 | ||
536 | def CalculateRevisionForPlatform(revision): | |
537 | """Returns the revision for the current platform.""" | |
538 | @@ -68,6 +75,10 @@ def CalculateRevisionForPlatform(revision): | |
539 | last_digit = '1' | |
540 | elif IsLinux(): | |
541 | last_digit = '2' | |
542 | + elif IsFreeBSD(): | |
543 | + last_digit = '3' | |
544 | + elif IsGNUkFreeBSD(): | |
545 | + last_digit = '4' | |
546 | if last_digit: | |
547 | return revision[0:-1] + last_digit | |
548 | ||
549 | diff --git a/client/session.cc b/client/session.cc | |
550 | index 4557a0a..72c10f6 100755 | |
551 | --- a/client/session.cc | |
552 | +++ b/client/session.cc | |
553 | @@ -847,7 +847,7 @@ bool Session::LaunchTool(const string &mode, const string &extra_arg) { | |
554 | return false; | |
555 | } | |
556 | ||
557 | -#if defined(OS_WINDOWS) || defined(OS_LINUX) | |
558 | +#if defined(OS_WINDOWS) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
559 | string arg = "--mode=" + mode; | |
560 | if (!extra_arg.empty()) { | |
561 | arg += " "; | |
562 | diff --git a/dictionary/dictionary_preloader.cc b/dictionary/dictionary_preloader.cc | |
563 | index c9a7044..b023ffc 100755 | |
564 | --- a/dictionary/dictionary_preloader.cc | |
565 | +++ b/dictionary/dictionary_preloader.cc | |
566 | @@ -89,7 +89,7 @@ bool IsPreloadable(const char *image, size_t size) { | |
567 | return available_memory > preload_size * FLAGS_preload_memory_factor; | |
568 | #endif | |
569 | ||
570 | -#ifdef OS_LINUX | |
571 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
572 | // TOOD(taku): implement Linux version. | |
573 | // Since Linux is installed into heterogeneous environment, | |
574 | // we have to check the amount of available memory. | |
575 | @@ -161,7 +161,7 @@ void DictionaryPreloader::PreloadIfApplicable(const char *image, size_t size) { | |
576 | // GoogleIMEJaCacheService.exe is responsible for keeping the dictionary | |
577 | // on-page (or freeing the memory in low-memory condition). | |
578 | // See http://b/2354549 for details. | |
579 | -#if defined(OS_MACOSX) || defined(OS_LINUX) | |
580 | +#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
581 | if (!IsPreloadable(image, size)) { | |
582 | return; | |
583 | } | |
584 | diff --git a/gui/base/locale_util.cc b/gui/base/locale_util.cc | |
585 | index 2e32f21..a825086 100755 | |
586 | --- a/gui/base/locale_util.cc | |
587 | +++ b/gui/base/locale_util.cc | |
588 | @@ -198,7 +198,7 @@ TranslationDataImpl::TranslationDataImpl() | |
589 | qApp->installEventFilter(&window_title_modifier_); | |
590 | #endif | |
591 | ||
592 | -#ifdef OS_LINUX | |
593 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
594 | // Use system default messages. | |
595 | // Even if the locale is not English nor Japanese, load translation | |
596 | // file to translate common messages like "OK" and "Cancel". | |
597 | diff --git a/gui/config_dialog/config_dialog.cc b/gui/config_dialog/config_dialog.cc | |
598 | index bb0f4ee..74e08fd 100755 | |
599 | --- a/gui/config_dialog/config_dialog.cc | |
600 | +++ b/gui/config_dialog/config_dialog.cc | |
601 | @@ -74,11 +74,11 @@ ConfigDialog::ConfigDialog() | |
602 | verboseLevelLabel->setVisible(false); | |
603 | verboseLevelComboBox->setVisible(false); | |
604 | ||
605 | -#if defined(OS_MACOSX) || defined(OS_LINUX) | |
606 | +#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
607 | // The last "misc" tab has no valid configs on Mac and Linux | |
608 | const int kMiscTabIndex = 5; | |
609 | configDialogTabWidget->removeTab(kMiscTabIndex); | |
610 | -#endif // OS_MACOSX || OS_LINUX | |
611 | +#endif // OS_MACOSX || OS_LINUX || OS_GNU_KFREEBSD || OS_FREEBSD) | |
612 | #endif // NO_LOGGING | |
613 | ||
614 | client_->set_restricted(true); // start with restricted mode | |
615 | @@ -261,7 +261,7 @@ ConfigDialog::ConfigDialog() | |
616 | dictionaryPreloadingAndUACLabel->setVisible(false); | |
617 | #endif // OS_WINDOWS | |
618 | ||
619 | -#ifdef OS_LINUX | |
620 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
621 | // On Linux, disable all fields for UsageStats | |
622 | usageStatsLabel->setEnabled(false); | |
623 | usageStatsLabel->setVisible(false); | |
624 | @@ -346,7 +346,7 @@ bool ConfigDialog::Update() { | |
625 | } | |
626 | ||
627 | ||
628 | -#if defined(OS_WINDOWS) || defined(OS_LINUX) | |
629 | +#if defined(OS_WINDOWS) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
630 | if (initial_preedit_method_ != | |
631 | static_cast<int>(config.preedit_method()) || | |
632 | initial_use_keyboard_to_change_preedit_method_ != | |
633 | diff --git a/gui/config_dialog/keybinding_editor.cc b/gui/config_dialog/keybinding_editor.cc | |
634 | index 6749dcb..17d90da 100755 | |
635 | --- a/gui/config_dialog/keybinding_editor.cc | |
636 | +++ b/gui/config_dialog/keybinding_editor.cc | |
637 | @@ -443,7 +443,7 @@ bool KeyBindingFilter::eventFilter(QObject *obj, QEvent *event) { | |
638 | KeyBindingEditor::KeyBindingEditor(QWidget *parent, QWidget *trigger_parent) | |
639 | : QDialog(parent), trigger_parent_(trigger_parent) { | |
640 | setupUi(this); | |
641 | -#ifdef OS_LINUX | |
642 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
643 | // Workaround for the issue http://code.google.com/p/mozc/issues/detail?id=9 | |
644 | // Seems that even after clicking the button for the keybinding dialog, | |
645 | // the edit is not raised. This might be a bug of setFocusProxy. | |
646 | diff --git a/gui/config_dialog/keymap_editor.cc b/gui/config_dialog/keymap_editor.cc | |
647 | index adfe645..ebbe3f2 100755 | |
648 | --- a/gui/config_dialog/keymap_editor.cc | |
649 | +++ b/gui/config_dialog/keymap_editor.cc | |
650 | @@ -93,7 +93,7 @@ class KeyMapValidator { | |
651 | invisible_commands_.insert(kReportBugCommand); | |
652 | // Old command name. | |
653 | invisible_commands_.insert(kEditInsertCommand); | |
654 | -#if defined(OS_MACOSX) || defined(OS_LINUX) | |
655 | +#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
656 | // On Mac/Linux, we cannot customize keybindings for IME ON/OFF | |
657 | // So we do not show them. | |
658 | // TODO(toshiyuki): remove them after implimenting IME ON/OFF for Mac | |
659 | @@ -446,7 +446,7 @@ bool KeyMapEditorDialog::Update() { | |
660 | *keymap_table += invisible_keymap_table_; | |
661 | ||
662 | if (new_ime_switch_keymap != ime_switch_keymap_) { | |
663 | -#if defined(OS_WINDOWS) || defined(OS_LINUX) | |
664 | +#if defined(OS_WINDOWS) || defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
665 | QMessageBox::information( | |
666 | this, | |
667 | tr("Mozc settings"), | |
668 | diff --git a/gui/dictionary_tool/dictionary_tool.cc b/gui/dictionary_tool/dictionary_tool.cc | |
669 | index 44e6b12..a18ca29 100755 | |
670 | --- a/gui/dictionary_tool/dictionary_tool.cc | |
671 | +++ b/gui/dictionary_tool/dictionary_tool.cc | |
672 | @@ -304,7 +304,7 @@ DictionaryTool::DictionaryTool(QWidget *parent) | |
673 | } | |
674 | ||
675 | // main window | |
676 | -#ifndef OS_LINUX | |
677 | +#if !defined(OS_LINUX) && !defined(OS_GNU_KFREEBSD) && !defined(OS_FREEBSD) | |
678 | // For some reason setCentralWidget crashes the dictionary_tool on Linux | |
679 | // TODO(taku): investigate the cause of the crashes | |
680 | setCentralWidget(splitter_); | |
681 | diff --git a/gui/qt_common.gypi b/gui/qt_common.gypi | |
682 | index 66112ed..6d82f54 100755 | |
683 | --- a/gui/qt_common.gypi | |
684 | +++ b/gui/qt_common.gypi | |
685 | @@ -33,7 +33,7 @@ | |
686 | 'variables': { | |
687 | 'qt_basepath': '$(QTDIR)', | |
688 | 'conditions': [ | |
689 | - ['OS=="linux"', { | |
690 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
691 | 'qt_cflags': ' <!@(pkg-config --cflags QtCore QtGui)', | |
692 | },{ # OS!="linux" | |
693 | 'qt_cflags': '<(qt_basepath)/include', | |
694 | diff --git a/gui/qt_libraries.gypi b/gui/qt_libraries.gypi | |
695 | index c1b905a..597daa1 100755 | |
696 | --- a/gui/qt_libraries.gypi | |
697 | +++ b/gui/qt_libraries.gypi | |
698 | @@ -44,7 +44,7 @@ | |
699 | ], | |
700 | }, | |
701 | }], | |
702 | - ['OS=="linux"', { | |
703 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
704 | 'link_settings': { | |
705 | 'libraries': [ | |
706 | ' <!@(pkg-config --libs QtCore QtGui)', | |
707 | diff --git a/gui/qt_moc.gypi b/gui/qt_moc.gypi | |
708 | index f0992a2..bef23fe 100755 | |
709 | --- a/gui/qt_moc.gypi | |
710 | +++ b/gui/qt_moc.gypi | |
711 | @@ -31,7 +31,7 @@ | |
712 | { | |
713 | 'variables': { | |
714 | 'conditions': [ | |
715 | - ['OS=="linux"', { | |
716 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
717 | 'moc_path': '<!(pkg-config --variable=moc_location QtGui)', | |
718 | },{ # OS!="linux" | |
719 | 'moc_path': '<(qt_basepath)/bin/moc<(EXECUTABLE_SUFFIX)', | |
720 | diff --git a/gui/qt_rcc.gypi b/gui/qt_rcc.gypi | |
721 | index 2dd06c6..d163695 100755 | |
722 | --- a/gui/qt_rcc.gypi | |
723 | +++ b/gui/qt_rcc.gypi | |
724 | @@ -31,7 +31,7 @@ | |
725 | { | |
726 | 'variables': { | |
727 | 'conditions': [ | |
728 | - ['OS=="linux"', { | |
729 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
730 | # seems that --variable=rcc_location is not supported | |
731 | 'rcc_path': '<!(pkg-config --variable=exec_prefix QtGui)/bin/rcc', | |
732 | },{ # OS!="linux" | |
733 | diff --git a/gui/qt_target_default.gypi b/gui/qt_target_default.gypi | |
734 | index c168f75..b1aa629 100755 | |
735 | --- a/gui/qt_target_default.gypi | |
736 | +++ b/gui/qt_target_default.gypi | |
737 | @@ -91,7 +91,7 @@ | |
738 | }, | |
739 | }, | |
740 | }], | |
741 | - ['OS=="linux"', { | |
742 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
743 | 'target_defaults': { | |
744 | 'configurations': { | |
745 | 'Common_Base': { | |
746 | diff --git a/gui/qt_uic.gypi b/gui/qt_uic.gypi | |
747 | index cfaa397..1157c0e 100755 | |
748 | --- a/gui/qt_uic.gypi | |
749 | +++ b/gui/qt_uic.gypi | |
750 | @@ -31,7 +31,7 @@ | |
751 | { | |
752 | 'variables': { | |
753 | 'conditions': [ | |
754 | - ['OS=="linux"', { | |
755 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
756 | 'uic_path': '<!(pkg-config --variable=uic_location QtGui)', | |
757 | },{ # OS!="linux" | |
758 | 'uic_path': '<(qt_basepath)/bin/uic<(EXECUTABLE_SUFFIX)', | |
759 | diff --git a/gyp/common.gypi b/gyp/common.gypi | |
760 | index bb8213f..3efd0fd 100755 | |
761 | --- a/gyp/common.gypi | |
762 | +++ b/gyp/common.gypi | |
763 | @@ -202,7 +202,7 @@ | |
764 | }, | |
765 | }, | |
766 | 'conditions': [ | |
767 | - ['OS=="linux"', { | |
768 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
769 | 'cflags': [ | |
770 | '<@(debug_extra_cflags)', | |
771 | ], | |
772 | @@ -241,7 +241,7 @@ | |
773 | }, | |
774 | }, | |
775 | 'conditions': [ | |
776 | - ['OS=="linux"', { | |
777 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
778 | 'cflags': [ | |
779 | '<@(release_extra_cflags)', | |
780 | ], | |
781 | @@ -453,6 +453,51 @@ | |
782 | }], | |
783 | ], | |
784 | }], | |
785 | + ['OS=="freebsd"', { | |
786 | + 'defines': [ | |
787 | + 'OS_FREEBSD', | |
788 | + ], | |
789 | + 'cflags': [ | |
790 | + '<@(gcc_cflags)', | |
791 | + '-fPIC', | |
792 | + '-fno-exceptions', | |
793 | + ], | |
794 | + 'libraries': [ | |
795 | + '-lcurl', | |
796 | + '-lcrypto', | |
797 | + '-lpthread', | |
798 | + '-lrt', | |
799 | + '-lssl', | |
800 | + '-lz', | |
801 | + '<@(extra_linux_libs)', | |
802 | + ], | |
803 | + 'conditions': [ | |
804 | + ['chromeos==1', { | |
805 | + 'defines': [ | |
806 | + 'OS_CHROMEOS', | |
807 | + ], | |
808 | + }], | |
809 | + ], | |
810 | + }], | |
811 | + ['OS=="gnu-kfreebsd"', { | |
812 | + 'defines': [ | |
813 | + 'OS_GNU_KFREEBSD', | |
814 | + ], | |
815 | + 'cflags': [ | |
816 | + '<@(gcc_cflags)', | |
817 | + '-fPIC', | |
818 | + '-fno-exceptions', | |
819 | + ], | |
820 | + 'libraries': [ | |
821 | + '-lcurl', | |
822 | + '-lcrypto', | |
823 | + '-lpthread', | |
824 | + '-lrt', | |
825 | + '-lssl', | |
826 | + '-lz', | |
827 | + '<@(extra_linux_libs)', | |
828 | + ], | |
829 | + }], | |
830 | ['OS=="mac"', { | |
831 | 'defines': [ | |
832 | 'OS_MACOSX', | |
833 | @@ -508,7 +553,7 @@ | |
834 | # Linux gyp (into scons) doesn't like target_conditions? | |
835 | # TODO(team): track down why 'target_conditions' doesn't work | |
836 | # on Linux gyp into scons like it does on Mac gyp into xcodeproj. | |
837 | - ['OS=="linux"', { | |
838 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
839 | 'cflags': [ '-ftest-coverage', | |
840 | '-fprofile-arcs' ], | |
841 | 'link_settings': { 'libraries': [ '-lgcov' ] }, | |
842 | diff --git a/ipc/ipc_path_manager.cc b/ipc/ipc_path_manager.cc | |
843 | index 392ee0d..60924cb 100755 | |
844 | --- a/ipc/ipc_path_manager.cc | |
845 | +++ b/ipc/ipc_path_manager.cc | |
846 | @@ -265,7 +265,7 @@ bool IPCPathManager::GetPathName(string *ipc_name) { | |
847 | *ipc_name = kIPCPrefix; | |
848 | #endif // OS_WINDOWS | |
849 | ||
850 | -#ifdef OS_LINUX | |
851 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
852 | // On Linux, use abstract namespace which is independent of the file system. | |
853 | (*ipc_name)[0] = '\0'; | |
854 | #endif | |
855 | @@ -358,7 +358,7 @@ bool IPCPathManager::IsValidServer(uint32 pid, | |
856 | } | |
857 | #endif | |
858 | ||
859 | -#ifdef OS_LINUX | |
860 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
861 | // load from /proc/<pid>/exe | |
862 | char proc[128]; | |
863 | char filename[512]; | |
864 | @@ -378,7 +378,7 @@ bool IPCPathManager::IsValidServer(uint32 pid, | |
865 | return true; | |
866 | } | |
867 | ||
868 | -#ifdef OS_LINUX | |
869 | +#if defined(OS_LINUX) || defined(OS_GNU_KFREEBSD) || defined(OS_FREEBSD) | |
870 | if ((server_path + " (deleted)") == server_path_) { | |
871 | LOG(WARNING) << server_path << " on disk is modified"; | |
872 | // If a user updates the server binary on disk during the server is running, | |
873 | diff --git a/ipc/unix_ipc.cc b/ipc/unix_ipc.cc | |
874 | index dce1541..158e872 100755 | |
875 | --- a/ipc/unix_ipc.cc | |
876 | +++ b/ipc/unix_ipc.cc | |
877 | @@ -28,7 +28,8 @@ | |
878 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
879 | ||
880 | // skip all if Windows | |
881 | -#ifdef OS_LINUX | |
882 | +#if defined(OS_LINUX) || defined(OS_MACOSX) ||\ | |
883 | + defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD) | |
884 | ||
885 | #include "ipc/ipc.h" | |
886 | ||
887 | @@ -41,7 +42,7 @@ | |
888 | #include <sys/time.h> | |
889 | #include <sys/types.h> | |
890 | #include <sys/un.h> | |
891 | -#ifdef OS_MACOSX | |
892 | +#if defined(OS_MACOSX) || defined(OS_FREEBSD) | |
893 | #include <sys/ucred.h> | |
894 | #endif | |
895 | #include <sys/wait.h> | |
896 | @@ -124,7 +125,7 @@ bool IsWriteTimeout(int socket, int timeout) { | |
897 | bool IsPeerValid(int socket, pid_t *pid) { | |
898 | *pid = 0; | |
899 | ||
900 | -#ifdef OS_MACOSX | |
901 | +#if defined(OS_MACOSX) || defined(OS_FREEBSD) | |
902 | // If the OS is MAC, we should validate the peer by using LOCAL_PEERCRED. | |
903 | struct xucred peer_cred; | |
904 | socklen_t peer_cred_len = sizeof(struct xucred); | |
905 | @@ -185,7 +186,7 @@ bool SendMessage(int socket, | |
906 | return false; | |
907 | } | |
908 | const ssize_t l = ::send(socket, buf, buf_length_left, | |
909 | -#ifdef OS_MACOSX | |
910 | +#if defined(OS_MACOSX) || defined(OS_FREEBSD) | |
911 | SO_NOSIGPIPE | |
912 | #else | |
913 | MSG_NOSIGNAL | |
914 | @@ -524,4 +525,5 @@ void IPCServer::Loop() { | |
915 | ||
916 | }; // namespace mozc | |
917 | ||
918 | -#endif // OS_LINUX | |
919 | +#endif // defined(OS_LINUX) || defined(OS_MACOSX) ||\ | |
920 | + // defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD) | |
921 | diff --git a/protobuf/genproto.gypi b/protobuf/genproto.gypi | |
922 | index b5aba7f..8f209cb 100755 | |
923 | --- a/protobuf/genproto.gypi | |
924 | +++ b/protobuf/genproto.gypi | |
925 | @@ -39,7 +39,7 @@ | |
926 | '<(protobuf_dir)/protobuf.gyp:install_protoc', | |
927 | ], | |
928 | }], | |
929 | - ['OS!="linux"', { | |
930 | + ['OS!="linux" and OS!="gnu-kfreebsd"', { | |
931 | 'variables': { | |
932 | 'protoc_command%': '<(relative_dir)/<(mozc_build_tools_dir)/protoc<(EXECUTABLE_SUFFIX)', | |
933 | }, | |
934 | diff --git a/protobuf/protobuf.gyp b/protobuf/protobuf.gyp | |
935 | index 0b8ca63..449167c 100755 | |
936 | --- a/protobuf/protobuf.gyp | |
937 | +++ b/protobuf/protobuf.gyp | |
938 | @@ -116,7 +116,7 @@ | |
939 | 'target_name': 'protobuf', | |
940 | 'type': 'static_library', | |
941 | 'conditions': [ | |
942 | - ['OS=="linux"', { | |
943 | + ['OS=="linux" or OS=="gnu-kfreebsd"', { | |
944 | 'conditions': [ | |
945 | ['use_libprotobuf==1', { | |
946 | 'link_settings': { | |
947 | @@ -193,7 +193,7 @@ | |
948 | }, | |
949 | 'conditions': [ | |
950 | # use system-installed protoc on Linux | |
951 | - ['OS!="linux"', { | |
952 | + ['OS!="linux" and OS!="gnu-kfreebsd"', { | |
953 | 'includes' : [ | |
954 | '../gyp/install_build_tool.gypi', | |
955 | ], | |
956 | diff --git a/testing/testing.gyp b/testing/testing.gyp | |
957 | index 22a659c..1dd505c 100755 | |
958 | --- a/testing/testing.gyp | |
959 | +++ b/testing/testing.gyp | |
960 | @@ -49,7 +49,7 @@ | |
961 | 'base/internal/gtest_main.cc', | |
962 | ], | |
963 | 'conditions': [ | |
964 | - ['OS!="linux"', { | |
965 | + ['OS!="linux" and OS!="gnu-kfreebsd"', { | |
966 | 'dependencies': [ | |
967 | 'testing', | |
968 | ], | |
969 | -- | |
970 | 1.7.4.1 | |
971 |