chroot なナニで

gauche やら kahua やらをナニ。
チュートリアルを見つつ、という事でまず gauche 入れるトコからか。

# wget http://prdownloads.sourceforge.net/gauche/Gauche-0.8.12.tgz

で、解凍

# tar zxvf Gauche-0.8.12.tgz

次はビルド

# ./configure --enable-threads=pthreads --enable-multibyte=utf-8 \
  && make && make -s check

げ。gcc が入ってない ...

configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

入れるか。

# apt-get install -fy make gcc autoconf 

でリトライするも以下なエラーが

configure:2150: error: C compiler cannot create executables
See `config.log' for more details.

何が足りんのか。確認してみたら標準ヘッダが無いな。

# apt-get install -fy libc6-dev

はろーわーるどもコンパイルできんのでは話にならんな。これで configure はちゃんと動作したっぽい。テストもパスした模様。

Testing vport ...                                                passed.
Total:  8891 tests,  8891 passed,     0 failed,     0 aborted.
#

で、インストールですか。

# make install

次にチェックをしなさい、とある。

# make install-check
(中略
Testing mt-random ...                                            passed.
Testing digest framework ...                                     passed.
Testing vport ...                                                passed.
#

一応確認

# gosh -V
Gauche scheme interpreter, version 0.8.12 [utf-8,pthreads]
#

これでようやく Step0 に進める訳ですな。

Step0

まず、download を

# wget http://www.kahua.org/download/kahua/Kahua-1.0.7.3.tgz

で解凍して configure ですか。

# tar zxvf Kahua-1.0.7.3.tgz
(ry
# cd Kahua-1.0.7.3
# ./configure --prefix=/usr/local/kahua
(ry
** Required version "0.8.13", but got "0.8.12"
configure: error: You must install Gauche 0.8.13 or later which was built with
                  --enable-threads=pthreads configure option.

#

げ。0.8.13 入れれ、って ...
とりあえず 0.8.13 入れます。手順は略。

# gosh -V
Gauche scheme interpreter, version 0.8.13 [utf-8,pthreads]
#

configure にリトライ。正常終了した模様なんで make install までドキュメントを見ながらなぞっています。あと面倒なんで /etc/profile に PATH 追加。chroot なソレだから使えるソレ。

Step1

ええと一般ユーザで

# su - guest
$ mkdir work
$ cd work
$ kahua-package create site
$ ls
site
$ find site
site
site/app-servers
site/run
site/app
site/static
site/socket
site/database
site/logs
site/etc
site/etc/kahua.conf
site/etc/user.conf
site/plugins
site/tmp
site/templates
$

で、動作確認。

$ kahua-spvr -S ~/work/site/ -H localhost:8088

別の端末にて

$ w3m http://localhost:8088/

表示としては確かに以下

404 Not Found

The requested URL / was not found on this server.

サイトバンドル

上記の ~/work/site をサイトバンドルと呼ぶらしい。

もう少し進めてみる予定ですがどうなるか。

もう少し

アプリのスケルトン生成

$ kahua-package generate bookmarks
Creator Name> Yamane Toshiaki
E-Mail Address> yamanetoshi@gmail.com
$ ls
bookmarks  site
$

これ、いいのかなぁ。site をカレントで実行しなきゃ駄目とか?
って先を読んでみるに、./configure; make; make install しないと駄目っぽい。とりあえず bookmarks ディレクトリに移動して以下

$ cd bookmarks/
$ ./DIST gen
$

これで configure がデキてるんで実行

$ ./configure --prefix=/usr/local/kahua --with-site-bundle=$HOME/work/site
checking for gosh... /usr/local/bin/gosh
checking for kahua-install... /usr/local/kahua//bin/kahua-install
checking for a BSD-compatible install... /usr/bin/install -c
configure: creating ./config.status
config.status: creating Makefile
$

後は make して make check との事。

$ make
sed -e "s@##PROJECT_VERSION##@0.0.0@" bookmarks/version.kahua.in > bookmarks/version.kahua
sed -e "s@##GOSH##@/usr/local/bin/gosh@" -e "s@##PLUGINS##@bookmarks.scm@" \
            -e "s@##KAHUA_WORKING##@/usr/local/kahua//var/kahua@" \
            -e "s@##KAHUA_LIB##@/usr/local/kahua//lib/kahua@" \
            -e "s@##PROJECT_VERSION##@0.0.0@" \
            test/test.scm.in > test/test.scm
sed -e "s@##TEST_DIR##@/home/guest/work/bookmarks@" test/test.conf.in > test/test.conf
test -L checkout || ln -s . checkout
$ make check
rm -f test/test.log
cd test; /usr/local/bin/gosh -I/usr/local/kahua//lib/kahua ./test.scm > test.log
Testing bookmarks ...                                            passed.
$

これで make install せい、とある。

$ make check
rm -f test/test.log
cd test; /usr/local/bin/gosh -I/usr/local/kahua//lib/kahua ./test.scm > test.log
Testing bookmarks ...                                            passed.
guest@debian:~/work/bookmarks$ make install
for f in bookmarks/bookmarks.kahua bookmarks/version.kahua; do \
          /usr/local/kahua//bin/kahua-install -S /home/guest/work/site -t script $f;\
        done
for f in bookmarks/bookmarks.css; do \
          /usr/local/kahua//bin/kahua-install -S /home/guest/work/site -t static --no-overwrite $f;\
        done
for f in bookmarks.scm; do \
          /usr/local/kahua//bin/kahua-install -S /home/guest/work/site -t plugin -r $f plugins/$f;\
        done
for f in page.xml; do \
          /usr/local/kahua//bin/kahua-install -S /home/guest/work/site -t template -r bookmarks/$f templates/$f;\
        done
================================================================================

Please edit app-servers in the Kahua working directory to add
 "bookmarks" entry.

  (bookmarks :arguments () :run-by-default 1)

================================================================================
$

で、上記のナニを ~/work/site/appp-servers に投入して保管。

;; -*-scheme-*-
;; Application Service Configuration alist.
;;
(;;Each entry follow this format:
 ;;(<type> :arguments (<arg> ...) :run-by-default <num>
 ;;        :profile <path-to-profile-base>
 ;;        :default-database-name <path-to-database>)
(bookmarks :arguments () :run-by-default 1)
 )

$ kahua-spvr -S ~/work/site/ -H localhost:8088

して w3mlocalhost:8088 を開いてみると以下

Hello, Kahua!

version

うーん。version はリンクになっててナニしたら以下な表示

bookmarks: version 0.0.0

greeting

とりあえず OK らしい。emacs から云々とゆーのは便利そうなんですが、現状 chroot なナニで云々してるので別途。