サーバ構築メモ書き-11

あまりにもmt-search.cgiが遅いので、全文検索を高速化したい、と。とりあえずmecabをrpmで入れる。

某所より持ってきて、x86_64/UTF-8で動かすことにあわせて適当に修正したもの。mecab-0.97とmecab-ipadic-2.7.0-20070801で。

# cat mecab.spec%define name mecab%define version 0.97%define release 1.e# cat mecab.spec
%define name mecab
%define version 0.97
%define release 1.el5

Summary: Yet Another Part-of-Speech and Morphological
Name: %{name}
Version: %{version}
Release: %{release}
Source0: http://downloads.sourceforge.net/mecab/%{name}-%{version}.tar.gz
License: GPL/LGPL/BSD
Group: Applications/Other
URL: http://mecab.sourceforge.net/

BuildRoot: %{_tmppath}/%{name}-%{version}-root

#Vendor: Project Vine
#Distribution: Vine Linux

BuildRequires: perl, gcc-c++

%description
MeCab is Yet Another Part-of-Speech and Morphological, developed
as the unit project of Graduate School of Informatics, Kyoto 
University and NTT Communication Science Laboratories. It is designed 
basically general and independent of language, dictionary, and corpus.
It uses Conditional Random Fields (CRF) for parameter estimation, 
which is more efficient than Hidden Markov Model, which is used in
ChaSen. MeCab works normally faster than ChaSen, Juman, and KAKASI.

%package devel
Summary: Header files and libraries for developing apps which use MeCab
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
Header files and libraries for developing apps which use MeCab

%prep
rm -rf $RPM_BUILD_ROOT
%setup -q

%build
%configure --enable-utf8-only
%__make

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=${RPM_BUILD_ROOT} install

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc README AUTHORS COPYING ChangeLog INSTALL NEWS GPL LGPL BSD doc/*.html
%{_libdir}/*.so.*
%{_libexecdir}/mecab
%{_bindir}/*
%{_mandir}/man?/*
%{_sysconfdir}/*

%files devel
%defattr(-,root,root)
%{_libdir}/*.so
%{_libdir}/*.a
%{_libdir}/*.la
%{_includedir}/*

%changelog
* Sun Oct 5 2008 Y.Ohkouchi <cmf@ohtanz.com> 0.95-el5.1
- rebuild for CentOS5

* Sat Mar 24 2007 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.95-0vl1
- upstream release
- drop Patch0 (merged into upstream source)
- add Patch1: mecab-0.95-bufferoverflow.patch
  (for details, see [mecab-usres 258])

* Fri Mar 2 2007 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.94-0vl1
- upstream release
- change Source0 and URL
- add Patch0: mecab-0.94-cpp-template.patch

* Wed Sep 7 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.93-0vl2
- upstream release
- changed License from LGPL to GPL/LGPL/BSD (upstream change)
- add LGPL, GPL, BSD to %%doc

* Sat Sep 2 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.91-0vl3
- changed devel Group to Development/Libraries
- added %post and %postun section

* Mon May 1 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.91-0vl2
- upstream release

* Sun Apr 9 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.90-0vl3
- change Group: Applications/Other

* Fri Mar 31 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.90-0vl2
- upstream release
- divide dictionary into another package (mecab-ipadic)
- change description
- fix Source: URL
- add BuildRequires: perl, gcc-c++

* Sun Jun 26 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 0.81-0vl2
- initial build for VineSeedPlus
# cat mecab-ipadic.spec%define name mecab-ipadic%define ver 2.7.0%define date 20070801%define release 1.el5Summary: IPA dictionary for # cat mecab-ipadic.spec
%define name mecab-ipadic
%define ver 2.7.0
%define date 20070801
%define release 1.el5

Summary: IPA dictionary for MeCab
Summary(ja): MeCab用のIPA辞書
Name: %{name}
Version: %{ver}.%{date}
Release: %{release}
Source0: http://downloads.sourceforge.net/mecab/%{name}-%{ver}-%{date}.tar.gz
License: distributable
Group: Applications/Other
URL: http://mecab.sourceforge.net/

BuildRoot: %{_tmppath}/%{name}-%{version}-root

#Vendor: Project Vine
#Distribution: Vine Linux

BuildRequires: mecab >= 0.97
Requires: mecab >= 0.97

%description
IPA dictionary for MeCab

%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n %{name}-%{ver}-%{date}

%build
%configure --with-charset=utf8
%__make

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=${RPM_BUILD_ROOT} install

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
/usr/lib64/mecab/dic/ipadic

%changelog
* Sun Oct 5 2008 Y.Ohkouchi <cmf@ohtanz.com> 2.7.0.20060707-el5.2
- rebuild for CentOS5

* Sat Mar 24 2007 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 2.7.0.20060707-0vl2.2
- rebuild with mecab-0.95-0vl1

* Sat Mar 3 2007 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 2.7.0.20060707-0vl2.1
- rebuild with mecab-0.94-0vl1
- change Source0 and URL

* Wed Sep 7 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 2.7.0.20060707-0vl2
- upstream release

* Sun Apr 9 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 2.7.0.20060408-0vl2
- upstream release
- change Group: Applications/Other

* Fri Mar 31 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 2.7.0.20051110-0vl2
- rebuild on VineSeed

* Fri Mar 31 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 2.7.0.20051110-0vl1
- initial build for Vine Linux 3.2

/etc/mecabrcを編集。

# cat /etc/mecabrc 
;
; Configuration file of MeCab
;
; $Id: mecabrc.in,v 1.3 2006/05/29 15:36:08 taku-ku Exp $;
;
;dicdir =  /usr/lib/mecab/dic/ipadic
dicdir =  /usr/lib64/mecab/dic/ipadic

; userdic = /home/foo/bar/user.dic

; output-format-type = wakati
; input-buffer-size = 8192

; node-format = %m\n
; bos-format = %S\n
; eos-format = EOS\n

後でtextsearch_jaを突っ込むために、mecab-develもインストールしておこう。

タイトルとURLをコピーしました