[Groonga-commit] groonga/groonga at bd3cc74 [master] windows: use MeCab 0.996

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Jan 10 19:46:05 JST 2016


Kouhei Sutou	2016-01-10 19:46:05 +0900 (Sun, 10 Jan 2016)

  New Revision: bd3cc74b1529d6bb3bef366eb232c67abb04e798
  https://github.com/groonga/groonga/commit/bd3cc74b1529d6bb3bef366eb232c67abb04e798

  Message:
    windows: use MeCab 0.996
    
    It may be broken.

  Added files:
    packages/windows/patches/mecab-0.996.diff
  Modified files:
    packages/windows/Makefile.am
    packages/windows/Rakefile

  Modified: packages/windows/Makefile.am (+11 -0)
===================================================================
--- packages/windows/Makefile.am    2016-01-10 18:28:43 +0900 (b0cee6f)
+++ packages/windows/Makefile.am    2016-01-10 19:46:05 +0900 (43f6e05)
@@ -136,3 +136,14 @@ source: $(SOURCE)
 
 $(SOURCE):
 	ln -s $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz ../
+
+diff-mecab:
+	(							\
+	  cd tmp/mecab;						\
+	  diff -u mecab-$(MECAB_VERSION){.orig,}/configure.in;	\
+	  diff -u mecab-$(MECAB_VERSION){.orig,}/src/common.h;	\
+	  diff -u mecab-$(MECAB_VERSION){.orig,}/src/mmap.h;	\
+	  diff -u mecab-$(MECAB_VERSION){.orig,}/src/utils.cpp;	\
+	  diff -u mecab-$(MECAB_VERSION){.orig,}/src/winmain.h;	\
+	  :							\
+	) > patches/mecab-$(MECAB_VERSION).diff

  Modified: packages/windows/Rakefile (+3 -5)
===================================================================
--- packages/windows/Rakefile    2016-01-10 18:28:43 +0900 (2be9819)
+++ packages/windows/Rakefile    2016-01-10 19:46:05 +0900 (f8b5711)
@@ -38,8 +38,7 @@ bin_dir = binary_dir + "bin"
 
 patches_dir = (base_dir + "patches").expand_path
 mecab_patches = [
-  "mecab-0.98-not-use-locale-on-mingw.diff",
-  "mecab-0.98-add-missing-dll-export.diff",
+  "mecab-0.996.diff",
 ]
 nginx_patches = [
 ]
@@ -47,7 +46,6 @@ if groonga_win32_x86_p
   host = "i686-w64-mingw32"
 else
   host = "x86_64-w64-mingw32"
-  mecab_patches << "mecab-0.98-mingw-w64.diff"
 end
 
 def download(url, download_dir)
@@ -203,10 +201,10 @@ namespace :build do
     tmp_dir = Pathname.new("tmp/mecab")
     rm_rf(tmp_dir)
     mkdir_p(tmp_dir)
-    mecab_version = "0.98"
+    mecab_version = "0.996"
     mecab_base = "mecab-#{mecab_version}"
     mecab_tar_gz = "#{mecab_base}.tar.gz"
-    mecab_tar_gz_url = "http://mecab.googlecode.com/files/#{mecab_tar_gz}"
+    mecab_tar_gz_url = "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE"
     mecab_tar_gz = download(mecab_tar_gz_url, download_dir)
     Dir.chdir(tmp_dir) do
       sh("tar", "xzf", mecab_tar_gz.to_s) or exit(false)

  Added: packages/windows/patches/mecab-0.996.diff (+113 -0) 100644
===================================================================
--- /dev/null
+++ packages/windows/patches/mecab-0.996.diff    2016-01-10 19:46:05 +0900 (cf3f166)
@@ -0,0 +1,113 @@
+--- mecab-0.996.orig/configure.in	2013-02-15 17:07:36.000000000 +0900
++++ mecab-0.996/configure.in	2016-01-10 19:34:10.491438159 +0900
+@@ -37,7 +37,7 @@
+ AC_C_BIGENDIAN
+ AC_CHECK_HEADERS(string.h stdlib.h unistd.h fcntl.h stdint.h \
+ 		sys/stat.h sys/mman.h sys/times.h sys/types.h dirent.h \
+-	        ctype.h sys/types.h io.h windows.h pthread.h)
++	        ctype.h sys/types.h io.h windows.h)
+ AC_TYPE_OFF_T
+ AC_TYPE_SIZE_T
+ AC_CHECK_SIZEOF(char)
+@@ -51,8 +51,15 @@
+ 
+ AC_FUNC_MMAP
+ AC_CHECK_LIB(stdc++, main, MECAB_LIBS="-lstdc++")
+-AC_CHECK_LIB(pthread,pthread_create)
+-AC_CHECK_LIB(pthread,pthread_join)
++case "$host_os" in
++ mingw*)
++  ;;
++ *)
++  AC_CHECK_HEADERS(pthread.h)
++  AC_CHECK_LIB(pthread,pthread_create)
++  AC_CHECK_LIB(pthread,pthread_join)
++  ;;
++esac
+ AC_CHECK_FUNCS(getenv)
+ AC_CHECK_FUNCS(opendir)
+ AC_LANG(C++)
+@@ -107,7 +114,7 @@
+ dnl
+ dnl check C++ features
+ dnl
+-AC_DEFUN(CHECK_CXX_STL, [
++AC_DEFUN([CHECK_CXX_STL], [
+   AC_MSG_CHECKING(if ${CXX-c++} supports stl <$1> (required))
+   AC_TRY_COMPILE(
+ 	[
+@@ -253,6 +260,10 @@
+ ])
+ AC_MSG_RESULT([$ac_template])
+ 
++case "$host_os" in
++ mingw*)
++  ;;
++ *)
+ AC_MSG_CHECKING([if ${CXX-c++} supports GCC native atomic operations (optional)])
+ AC_TRY_COMPILE(
+ [
+@@ -271,6 +282,8 @@
+ if test "$enable_gcc_atomic_ops" = "yes"; then
+ AC_DEFINE([HAVE_GCC_ATOMIC_OPS])
+ fi
++  ;;
++esac
+ 
+ AC_MSG_CHECKING([if ${CXX-c++} supports OSX native atomic operations (optional)])
+ AC_TRY_COMPILE(
+@@ -301,8 +314,8 @@
+ case "$host_os" in
+  mingw* | os2*)
+   MECAB_DEFAULT_RC='c:\\\\Program Files\\\\mecab\\\\etc\\\\mecabrc'
+-  CFLAGS="$CFLAGS -municode -DUNICODE -D_UNICODE"
+-  CXXFLAGS="$CXXFLAGS -municode -DUNICODE -D_UNICODE"
++  # CFLAGS="$CFLAGS -municode -DUNICODE -D_UNICODE"
++  # CXXFLAGS="$CXXFLAGS -municode -DUNICODE -D_UNICODE"
+   ;;
+  *)
+   MECAB_DEFAULT_RC="$sysconfdir/mecabrc"
+--- mecab-0.996.orig/src/common.h	2012-09-30 01:44:27.000000000 +0900
++++ mecab-0.996/src/common.h	2016-01-10 19:00:35.450155112 +0900
+@@ -81,7 +81,7 @@
+ #define EXIT_SUCCESS 0
+ #endif
+ 
+-#if defined(_WIN32) && !defined(__CYGWIN__)
++#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__GNUC__)
+ #define WPATH(path) (MeCab::Utf8ToWide(path).c_str())
+ #else
+ #define WPATH(path) (path)
+--- mecab-0.996.orig/src/mmap.h	2013-02-17 17:12:30.000000000 +0900
++++ mecab-0.996/src/mmap.h	2016-01-10 19:02:02.237113907 +0900
+@@ -104,7 +104,7 @@
+       CHECK_FALSE(false) << "unknown open mode:" << filename;
+     }
+ 
+-    hFile = ::CreateFileW(WPATH(filename), mode1, FILE_SHARE_READ, 0,
++    hFile = ::CreateFileA(WPATH(filename), mode1, FILE_SHARE_READ, 0,
+                           OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+     CHECK_FALSE(hFile != INVALID_HANDLE_VALUE)
+         << "CreateFile() failed: " << filename;
+--- mecab-0.996.orig/src/utils.cpp	2013-01-22 14:33:25.000000000 +0900
++++ mecab-0.996/src/utils.cpp	2016-01-10 19:21:35.411703050 +0900
+@@ -359,7 +359,7 @@
+       _wsplitpath(v.get(), drive.get(), dir.get(), NULL, NULL);
+       const std::wstring path =
+           std::wstring(drive.get()) + std::wstring(dir.get()) + L"mecabrc";
+-      if (::GetFileAttributesW(path.c_str()) != -1) {
++      if (::GetFileAttributesW(path.c_str()) != static_cast<DWORD>(-1)) {
+         rcfile = WideToUtf8(path);
+       }
+     }
+--- mecab-0.996.orig/src/winmain.h	2012-10-28 13:07:01.000000000 +0900
++++ mecab-0.996/src/winmain.h	2016-01-10 19:28:42.726930459 +0900
+@@ -2,7 +2,7 @@
+ //
+ //  Copyright(C) 2001-2011 Taku Kudo <taku �� chasen.org>
+ //  Copyright(C) 2004-2006 Nippon Telegraph and Telephone Corporation
+-#if defined(_WIN32) || defined(__CYGWIN__)
++#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(__GNUC__)
+ 
+ #include <windows.h>
+ #include <string>
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index