Gaucheのインストール

計算機プログラムの構造と解釈

計算機プログラムの構造と解釈

今更という話もあるかも知れないけど、「計算機プログラムの構造と解釈」、いわゆるSICPを読んでみることにする。

ということでGaucheのインストールした時のメモ。
参考はhttp://kayui.blog38.fc2.com/blog-entry-45.html辺り。

OSはWindowsVistaで、Cygwin, Meadowはインストール済の状態からのインストール。

Cygwin

Cygwinにはsetupからmake, g++ 等をインストール

Gauche

  1. http://www.swiss.ai.mit.edu/~jaffer/SLIB.htmlからslib-3b1-1.exeをダウンロード
  2. 展開したファイルをc:\cygwin\usr\shareにインストール
  3. 本家(http://practical-scheme.net/gauche/download-j.html)からGauche-0.8.13.tgzをダウンロード

コンパイル済Windouwsバイナリ(Gauche-mingw-0.8.13.zip)ってのもあったのでコレで良いかも

  1. とりあえず /usr/local/src に展開
% gzcat Gauche-0.8.13.tgz | tar xf -
% cd Gauche-0.8.13
% ./configure --enable-multibyte=utf-8 --with-slib=/usr/share/slib --with-iconv=/usr/lib
  1. iconv.hが無いと言われたので--with-iconv=/usr/include に変更
% make distclean
% ./configure --enable-multibyte=utf-8 --with-slib=/usr/share/slib --with-iconv=/usr/include

と思ったらやっぱり怒られたのでよく見ると
iconvnls.h
というライブラリだったのでcygwinでlibiconvをインストールし再度configure

% ./configure --enable-multibyte=utf-8 --with-slib=/usr/share/slib --with-iconv=/usr
% make
% make install

cygwin上でgoshと叩いて起動することを確認
環境変数PATHにC:\cygwin\binを追加

Meadow

.emacsに以下を追加

;; gosh
;; Gaucheのデフォルトエンコーディングに合わせます。
;; Gaucheのデフォルトエンコーディングがeuc-jpの時はutf-8をeuc-jpに
;; してください。
(setq process-coding-system-alist
(cons '("gosh" utf-8 . utf-8) process-coding-system-alist))
(setq gosh-program-name "C:/cygwin/usr/local/bin/gosh -i")
(autoload 'scheme-mode "cmuscheme" "Major mode for Scheme." t)
(autoload 'run-scheme "cmuscheme" "Run an inferior Scheme process." t)
(defun scheme-other-window ()
"Run scheme on other window"
(interactive)
(switch-to-buffer-other-window
(get-buffer-create "*scheme*"))
(run-scheme gosh-program-name))
(define-key global-map
"\C-cS" 'scheme-other-window)

;; 直前/直後の括弧に対応する括弧を光らせます。
(show-paren-mode)

;; 以下はインデントの定義です。
(put 'and-let* 'scheme-indent-function 1)
(put 'begin0 'scheme-indent-function 0)
(put 'call-with-client-socket 'scheme-indent-function 1)
(put 'call-with-input-conversion 'scheme-indent-function 1)
(put 'call-with-input-file 'scheme-indent-function 1)
(put 'call-with-input-process 'scheme-indent-function 1)
(put 'call-with-input-string 'scheme-indent-function 1)
(put 'call-with-iterator 'scheme-indent-function 1)
(put 'call-with-output-conversion 'scheme-indent-function 1)
(put 'call-with-output-file 'scheme-indent-function 1)
(put 'call-with-output-string 'scheme-indent-function 0)
(put 'call-with-temporary-file 'scheme-indent-function 1)
(put 'call-with-values 'scheme-indent-function 1)
(put 'dolist 'scheme-indent-function 1)
(put 'dotimes 'scheme-indent-function 1)
(put 'if-match 'scheme-indent-function 2)
(put 'let*-values 'scheme-indent-function 1)
(put 'let-args 'scheme-indent-function 2)
(put 'let-keywords* 'scheme-indent-function 2)
(put 'let-match 'scheme-indent-function 2)
(put 'let-optionals* 'scheme-indent-function 2)
(put 'let-syntax 'scheme-indent-function 1)
(put 'let-values 'scheme-indent-function 1)
(put 'let/cc 'scheme-indent-function 1)
(put 'let1 'scheme-indent-function 2)
(put 'letrec-syntax 'scheme-indent-function 1)
(put 'make 'scheme-indent-function 1)
(put 'multiple-value-bind 'scheme-indent-function 2)
(put 'match 'scheme-indent-function 1)
(put 'parameterize 'scheme-indent-function 1)
(put 'parse-options 'scheme-indent-function 1)
(put 'receive 'scheme-indent-function 2)
(put 'rxmatch-case 'scheme-indent-function 1)
(put 'rxmatch-cond 'scheme-indent-function 0)
(put 'rxmatch-if  'scheme-indent-function 2)
(put 'rxmatch-let 'scheme-indent-function 2)
(put 'syntax-rules 'scheme-indent-function 1)
(put 'unless 'scheme-indent-function 1)
(put 'until 'scheme-indent-function 1)
(put 'when 'scheme-indent-function 1)
(put 'while 'scheme-indent-function 1)
(put 'with-builder 'scheme-indent-function 1)
(put 'with-error-handler 'scheme-indent-function 0)
(put 'with-error-to-port 'scheme-indent-function 1)
(put 'with-input-conversion 'scheme-indent-function 1)
(put 'with-input-from-port 'scheme-indent-function 1)
(put 'with-input-from-process 'scheme-indent-function 1)
(put 'with-input-from-string 'scheme-indent-function 1)
(put 'with-iterator 'scheme-indent-function 1)
(put 'with-module 'scheme-indent-function 1)
(put 'with-output-conversion 'scheme-indent-function 1)
(put 'with-output-to-port 'scheme-indent-function 1)
(put 'with-output-to-process 'scheme-indent-function 1)
(put 'with-output-to-string 'scheme-indent-function 1)
(put 'with-port-locking 'scheme-indent-function 1)
(put 'with-string-io 'scheme-indent-function 1)
(put 'with-time-counter 'scheme-indent-function 1)
(put 'with-signal-handlers 'scheme-indent-function 1)
(put 'with-locking-mutex 'scheme-indent-function 1)
(put 'guard 'scheme-indent-function 1)

で動作確認して完了。