要約
Debian に移行した当初は、別に無くてもいいと思い、何もしなかったのだが、いざ調べるときになって、いちいち紙の辞書を調べるのはかなり億劫なものだということがあらためて分かった。そこで電子辞書環境を再度構築することにした。
参考文献
必要なパッケージ
作業内容
辞書データと appendix データのインストール
辞書データ
辞書データは /usr/local/libdata/ebooks 以下にインストールし、appendix データは /usr/local/libdata/ebooks/appendix 以下に、それぞれインストールする。
辞書データにはカタログと辞書データ本体があるので、それを両方ともコピーする。
# <研究社「新英和・和英中辞典」マウント>
# cd /usr/local
# mkdir -p libdata/ebooks/appendix
# cd libdata/ebooks
# mkdir chujiten
# cd chujiten
# cp /mnt/catalogs .
# cp -R /mnt/chujiten .
# cd ..
# <現代用語の基礎知識 2000 CD-ROM 版 マウント>
# mkdir genkiso-2000
# cd genkiso-2000
# cp /mnt/catalogs .
# cp -R /mnt/gn00ep01 .
# cp -R /mnt/gn00ep02 .
# cd ..
# <辞典盤 マウント>
# mkdir jitenban
# cd jitenban
# cp /mnt/catalogs .
# cp -R /mnt/chiezo .
# cp -R /mnt/chujiten .
# cp -R /mnt/iwakoku .
# cp -R /mnt/mypaedia .
# cd ..
# <学研「現代新国語辞典・漢字源」マウント>
# mkdir kokugo_kanji
# cd kokugo_kanji
# cp /mnt/Catalogs .
# cp -R /mnt/KANJIGEN .
# cp -R /mnt/KOKUGO .
appendix データ
appendix データは、ダウンロードした tar アーカイブを /usr/local/libdata/ebooks/appendix 以下にそのまま展開する。
# cd /usr/local/libdata/ebooks/appendix
# tar xvzf chujiten2-2.0.tar.gz
# tar xvzf gendai2000-1.0.tar.gz
# tar xvzf jitenban-2.4.tar.gz
# tar xvzf kanjigen2-2.0.tar.gz
ebnetd サーバーのインストールと設定
eb ライブラリのビルド
eb ライブラリのビルドは以下のとおり。
$ ./configure
$ make
$ su
# make install
# /sbin/ldconfig
ebnetd のビルド
ebnetd のビルドは以下のとおり。
$ ./configure
$ make
$ su
# make install
ebnetd.conf の設定
ebnetd をインストールすると <インストールプレフィックス>/etc/ebnetd.conf.sample ファイルもインストールされる。このファイルを ebnetd.conf としてコピーし、そこに変更を加える。変更内容は以下のとおり。
--- ebnetd.conf.sample 2009-10-09 13:38:33.000000000 +0900
+++ ebnetd.conf 2009-10-09 13:51:11.000000000 +0900
@@ -9,7 +9,7 @@
### Port number `ndtpd' binds.
### (default: ndtp)
-# ndtp-port ndtp
+ndtp-port ndtp
### Port number `ebhttpd' binds.
### (default: http)
@@ -17,22 +17,25 @@
### Owner of the server process.
### (default: none)
-user ndtpuser
+#user ndtpuser
### Group of the server process.
### (default: none)
-group ndtpgrp
+#group ndtpgrp
### How many clients can be connected to the server at the same time.
### (default: 1)
-# max-clients 1
+max-clients 3
### Which hosts can or cannot connect to the server.
### (default: none)
hosts 127.0.0.1
-hosts ::1
-hosts !?
-hosts host.your.domain
+hosts 192.168.0.1
+hosts 192.168.0.2
+hosts 192.168.0.3
+#hosts ::1
+#hosts !?
+#hosts host.your.domain
### Timeout seconds until the server disconnects an idle connection.
### (default: 900)
@@ -61,32 +64,51 @@
### Book entry
###
begin book
- ### Name of the book.
- ### (required)
- name jitenban97
-
- ### Title of the book.
- ### (required)
- title Jitenban 97
-
- ### Path to a top directory of the book.
- ### (required)
- path /cdrom
-
- ### Path to a top directory of the appdendix data of the book.
- ### (default: none)
- appendix-path /usr/local/share/eb/appendix/jitenban97-2.1
-
- ### How many clients can access the book at the same time.
- ### (default: 1)
- max-clients 1
+ name chujiten
+ title Chujiten
+ path /usr/local/libdata/ebooks/chujiten
+ appendix-path /usr/local/libdata/ebooks/appendix/chujiten2-2.0
+ max-clients 3
+ hosts 127.0.0.1
+ hosts 192.168.0.1
+ hosts 192.168.0.2
+ hosts 192.168.0.3
+end
+
+begin book
+ name genkiso-2000
+ title Kiso-Chishiki
+ path /usr/local/libdata/ebooks/genkiso-2000
+ appendix-path /usr/local/libdata/ebooks/appendix/gendai2000-1.0
+ max-clients 3
+ hosts 127.0.0.1
+ hosts 192.168.0.1
+ hosts 192.168.0.2
+ hosts 192.168.0.3
+end
- ### Which hosts can or cannot access to the book.
- ### (default: none)
+begin book
+ name jitenban
+ title Jitenban
+ path /usr/local/libdata/ebooks/jitenban
+ appendix-path /usr/local/libdata/ebooks/appendix/jitenban-2.4
+ max-clients 3
+ hosts 127.0.0.1
+ hosts 192.168.0.1
+ hosts 192.168.0.2
+ hosts 192.168.0.3
+end
+
+begin book
+ name kokugo_kanji
+ title Kokugo_Kanji
+ path /usr/local/libdata/ebooks/kokugo_kanji
+ appendix-path /usr/local/libdata/ebooks/appendix/kanjigen2-2.0
+ max-clients 3
hosts 127.0.0.1
- hosts ::1
- hosts !?
- hosts host.your.domain
+ hosts 192.168.0.1
+ hosts 192.168.0.2
+ hosts 192.168.0.3
end
### Add a book group directive (lines between `begin book' and `end'),
/etc/services の変更
ebnetd で使われるポート番号を /etc/services に追加する。このファイルには、もともと以下の定義がある。
search 2010/tcp ndtp
そこで、これを以下のように変更する。
search 2010/tcp ndtp ebnet
ebnetd の起動環境設定
前回は単独のデーモンとして使えるように、ブート時に使われるスタートアップスクリプトを用意したのだが、今回は inetd 経由で起動するようにする。そこで、ebnetd のソースに含まれる doc/ebnetd.info-1 内の記述に従い、/etc/inetd.conf の最後に以下の行を追加する。
ebnet stream tcp nowait root /usr/local/sbin/ebnetd ebnetd --inetd
それから
inetd を再起動する。
# /etc/init.d/openbsd-inetd restart
ebnetd の動作確認
ebnetd の動作確認は、doc/ebnetd.info-1 内の記述に従い、以下のようにする。
まずサーバーが動くホスト(この場合は自ホスト)に telnet で接続する。
$ telnet localhost ebnet
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
そして
BOOKLIST コマンドをタイプし、
Enter キーを押す。
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
BOOKLIST
辞書とサーバーのインストールと設定が正しければ、利用可能な辞書の一覧が表示される。
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
BOOKLIST
!OK; book names and an empty line follows
chujiten Chujiten
chujiten.app Chujiten
genkiso-2000 Kiso-Chishiki
genkiso-2000.app Kiso-Chishiki
jitenban Jitenban
jitenban.app Jitenban
kokugo_kanji Kokugo_Kanji
kokugo_kanji.app Kokugo_Kanji
終了する時は
QUIT コマンドをタイプし、
Enter キーを押す。
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
BOOKLIST
!OK; book names and an empty line follows
chujiten Chujiten
chujiten.app Chujiten
genkiso-2000 Kiso-Chishiki
genkiso-2000.app Kiso-Chishiki
jitenban Jitenban
jitenban.app Jitenban
kokugo_kanji Kokugo_Kanji
kokugo_kanji.app Kokugo_Kanji
QUIT
Connection closed by foreign host.
$
以上でサーバー側の作業は完了。
ebview のインストール
最初は、従来どおり、以下に示す ebview のパッチを当ててからビルドした。
--- src/preference.c.orig 2005-10-05 09:41:23.000000000 +0900
+++ src/preference.c 2005-10-05 10:11:16.000000000 +0900
@@ -400,7 +400,7 @@ void calculate_font_size(){
PangoFontDescription* desc;
PangoLanguage* lang;
PangoFontMap* fontmap;
-#ifndef __WIN32__
+#if !GTK_CHECK_VERSION(2,8,0) && !defined(__WIN32__)
Display *display;
#endif
PangoContext *context;
@@ -420,6 +420,9 @@ void calculate_font_size(){
desc = pango_font_description_from_string(fontset_normal);
lang = pango_language_from_string("ja");
+#if GTK_CHECK_VERSION(2,8,0)
+ fontmap = pango_cairo_font_map_get_default();
+#else
#ifdef __WIN32__
fontmap = pango_win32_font_map_for_display();
#else
@@ -430,7 +433,8 @@ void calculate_font_size(){
}
fontmap = pango_x_font_map_for_display(display);
-#endif
+#endif /* __WIN32__ */
+#endif /* GTK_CHECK_VERSION(2,8,0) */
if(fontmap == NULL){
LOG(LOG_INFO, "fontmap == NULL");
しかし Debian "lenny" でビルドすると、途中で以下のようなエラーが出る。
調べてみると、これについては
www.nabble.com/Bug-444523 にパッチが掲載されていた。そこで、それを参考に以下の修正を加えた。
--- ebview-0.3.6.org/src/ebview.c 2004-02-22 12:46:29.000000000 +0900
+++ ebview-0.3.6/src/ebview.c 2009-10-09 14:41:39.000000000 +0900
@@ -15,7 +15,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#define GTK_DISABLE_DEPRECATED 1
+//#define GTK_DISABLE_DEPRECATED 1
#define _GLOBAL
#include
これでビルドが完了した。
$ パッチを入れる
$ ./configure
$ make
$ su
# make install
これでクライアント側の準備も完了した。