読者です 読者をやめる 読者になる 読者になる

Mac(SnowLeopard)にcmigemo入れたメモ

migemoちゃん入れたのでメモ。

参考URL
http://d.hatena.ne.jp/tbrook/20110328/1301301033http://d.hatena.ne.jp/samurai20000/20100907/1283791433


$ cd ~/src/$ wget http://cmigemo.googlecode.com/files/cmigemo-default-src-20110227.zip$ unzip cmigemo-default-src-20110227.zip$ cd cmigemo-default-src$ sudo make osx

んで参考URLと同じようにエラーが出るので
同じように、 src/wordbuf.c へ


#include 

を追加して

$ sudo make osxmake osxmake -f compile/Make_osx.mak
cc -dynamiclib -install_name libmigemo.1.dylib -o libmigemo.1.1.0.dylib ./build/object/charset.o ./build/object/filename.o ./build/object/migemo.o ./build/object/mnode.o ./build/object/romaji.o ./build/object/rxgen.o ./build/object/wordbuf.o ./build/object/wordlist.o
rm -f libmigemo.1.dylib libmigemo.dylib
ln -s libmigemo.1.1.0.dylib libmigemo.1.dylib
ln -s libmigemo.1.1.0.dylib libmigemo.dylib
cc -o build/cmigemo ./build/object/main.o -L. -L./build/ -lmigemo

$ sudo make -osx-dict
make: Nothing to be done for `default'.

もうやってるよ。って怒られちゃった。。。

$ cd dict
$ sudo make utf-8
curl -O http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.L.gz
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100 1733k  100 1733k    0     0  2851k      0 --:--:-- --:--:-- --:--:-- 3209k
gzip -d SKK-JISYO.L.gz
perl ../tools/skk2migemo.pl < SKK-JISYO.L > dict.tmp
perl ../tools/optimize-dict.pl < dict.tmp > base-dict
rm -f dict.tmp
nkf -x -s < base-dict > migemo-dict
mkdir -p utf-8.d
iconv -t utf-8 -f cp932 < migemo-dict > utf-8.d/migemo-dict
iconv -t utf-8 -f cp932 < zen2han.dat > utf-8.d/zen2han.dat
iconv -t utf-8 -f cp932 < han2zen.dat > utf-8.d/han2zen.dat
iconv -t utf-8 -f cp932 < hira2kata.dat > utf-8.d/hira2kata.dat
iconv -t utf-8 -f cp932 < roma2hira.dat > utf-8.d/roma2hira.dat

$ cd ..
$ udo make osx-install

make -f compile/Make_osx.mak
make -f compile/Make_osx.mak dictionary
cd dict && make osx
mkdir -p euc-jp.d
nkf -x -e < migemo-dict > euc-jp.d/migemo-dict
nkf -x -e < zen2han.dat > euc-jp.d/zen2han.dat
nkf -x -e < han2zen.dat > euc-jp.d/han2zen.dat
nkf -x -e < hira2kata.dat > euc-jp.d/hira2kata.dat
nkf -x -e < roma2hira.dat > euc-jp.d/roma2hira.dat
make -f compile/Make_osx.mak install
mkdir -p /usr/local/bin
mkdir -p /usr/local/lib
mkdir -p /usr/local/include
mkdir -p /usr/local/doc/migemo
mkdir -p /usr/local/share/migemo
mkdir -p /usr/local/share/migemo/cp932
mkdir -p /usr/local/share/migemo/euc-jp
mkdir -p /usr/local/share/migemo/utf-8
/usr/bin/install -c -m 644 dict/migemo-dict /usr/local/share/migemo/cp932
/usr/bin/install -c -m 644 dict/han2zen.dat /usr/local/share/migemo/cp932
/usr/bin/install -c -m 644 dict/hira2kata.dat /usr/local/share/migemo/cp932
/usr/bin/install -c -m 644 dict/roma2hira.dat /usr/local/share/migemo/cp932
/usr/bin/install -c -m 644 dict/zen2han.dat /usr/local/share/migemo/cp932
if [ -d dict/euc-jp.d ]; then
/usr/bin/install -c -m 644 dict/euc-jp.d/migemo-dict /usr/local/share/migemo/euc-jp;
/usr/bin/install -c -m 644 dict/euc-jp.d/han2zen.dat /usr/local/share/migemo/euc-jp;
/usr/bin/install -c -m 644 dict/euc-jp.d/hira2kata.dat /usr/local/share/migemo/euc-jp;
/usr/bin/install -c -m 644 dict/euc-jp.d/roma2hira.dat /usr/local/share/migemo/euc-jp;
/usr/bin/install -c -m 644 dict/euc-jp.d/zen2han.dat /usr/local/share/migemo/euc-jp;
fi
if [ -d dict/utf-8.d ]; then
/usr/bin/install -c -m 644 dict/utf-8.d/migemo-dict /usr/local/share/migemo/utf-8;
/usr/bin/install -c -m 644 dict/utf-8.d/han2zen.dat /usr/local/share/migemo/utf-8;
/usr/bin/install -c -m 644 dict/utf-8.d/hira2kata.dat /usr/local/share/migemo/utf-8;
/usr/bin/install -c -m 644 dict/utf-8.d/roma2hira.dat /usr/local/share/migemo/utf-8;
/usr/bin/install -c -m 644 dict/utf-8.d/zen2han.dat /usr/local/share/migemo/utf-8;
fi
/usr/bin/install -c -m 755 libmigemo.1.1.0.dylib /usr/local/lib
rm -f /usr/local/lib/libmigemo.1.dylib /usr/local/lib/libmigemo.dylib
ln -s libmigemo.1.1.0.dylib /usr/local/lib/libmigemo.1.dylib
ln -s libmigemo.1.1.0.dylib /usr/local/lib/libmigemo.dylib
/usr/bin/install -c -m 644 ./src/migemo.h /usr/local/include
/usr/bin/install -c -m 644 doc/README_j.txt /usr/local/doc/migemo
/usr/bin/install -c -m 755 ./build/cmigemo /usr/local/bin

んで入ったので

$ cmigemo --help
cmigemo - C/Migemo Library 1.3 Driver

USAGE: cmigemo [OPTIONS]

OPTIONS:

  • d --dict     Use a file for dictionary.
  • s --subdict     Sub dictionary files. (MAX 8 times)
  • q --quiet        Show no message except results.
  • v --vim        Use vim style regexp.
  • e --emacs        Use emacs style regexp.
  • n --nonewline    Don't use newline match.
  • w --word     Expand a and soon exit.
  • h --help        Show this message

使えますよと。 migemo.el ファイルはgitから落としてきたものを使いました。

$ git clone git://gist.github.com/457761.git
Cloning into 457761...
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), 6.10 KiB, done.

$ ls 457761
migemo.el

という感じ。Windowよりはるかに楽ちんでよかった。