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