Shammer's Philosophy

My private adversaria

asdf用初期化ファイル

下記のサイト

 HintsForAsdfAndOpenmcl – Clozure CL

によれば、ASDFにも初期化ファイルがあるようだ。~/.asdf-installにいろいろと書き込めるらしい。このページからリンクされている、ASDFチュートリアルでも説明されている。

 Reference | ASDF-Install Tutorial

このサイトのSpecial variable *LOCATIONS*に書いてある。一応、同じページにもサンプルがあるな。

自分がやりたいのは、ASDFのデフォルト動作では、ライブラリインストール時に/usr/local/asdf-install/siteと/usr/local/asdf-install/site-systemsが指定されてしまうが、それを変えたい。/opt/local/asdf-installにしたい。
その変更例は書いていないが、

;; add a repository for unstable libraries  
(pushnew '(#p"/usr/local/lisp/unstable/site/"  
           #p"/usr/local/lisp/unstable/systems/"  
           "Install as unstable")  
         asdf-install:*locations*  
         :test #'equal)  

という例があった。asdf-install:*locations* の値を変更すればよいのか?
とりあえず、サイトの通りに~/.asdf-install に以下のように追加。

((#p"/opt/local/share/asdf-install/site/"  
  #p"/opt/local/share/asdf-install/site-systems/"  
  "System-wide install")  
 (#p"~/.asdf-install-dir/site/"  
  #p"~/.asdf-install-dir/systems/"  
  "Personal installation")) 

残念ながら、結果はエラー。

$ ccl64
; loading system definition from /opt/local/share/ccl/1.6/tools/asdf-install/asdf-install.asd into #<Package "ASDF0">
; registering #<SYSTEM ASDF-INSTALL> as ASDF-INSTALL
> Error: Car of ((#P"/opt/local/share/asdf-install/site/" #P"/opt/local/share/asdf-install/site-systems" "System-wide install") (#P"/Users/User1/.asdf-install-dir/site/" #P"/Users/User1/.asdf-install-dir/systems/" "Personal instrallation")) is not a function name or lambda-expression.
> While executing: (:INTERNAL CCL::WITH-COMPILATION-UNIT-BODY CCL::LOAD-FROM-STREAM), in process listener(1).
> Type :GO to continue, :POP to abort, :R for a list of available restarts.
> If continued: Skip loading init file.
> Type :? for other options.
1 > 

lambda 式か関数じゃないといけないのか。サイトの例は、asdf-install:*locations*の設定例か?実際にこのシンボルの内容を表示させてみよう。

Welcome to Clozure Common Lisp Version 1.6  (DarwinX8664)!
? asdf-install:*locations*
((#P"/usr/local/asdf-install/site/" #P"/usr/local/asdf-install/site-systems/" "System-wide install") (#P"/Users/User1/.asdf-install-dir/site/" #P"/Users/User1/.asdf-install-dir/systems/" "Personal installation"))

なるほど。このシンボルの指す内容を変更すればよさそうだ。
であれば、以下のように~/.asdf-installの内容を変更すればよいはず。

(setf asdf-install:*locations*
  '((#P"/opt/local/share/asdf-install/site/" 
     #P"/opt/local/share/asdf-install/site-systems/"
     "System-wide install")
    (#P"~/.asdf-install-dir/site/" 
     #P"~/.asdf-install-dir/systems/"
     "Personal installation")))

これで希望通りの動作を得られた!

$ ccl64
; loading system definition from /opt/local/share/ccl/1.6/tools/asdf-install/asdf-install.asd into #<Package "ASDF0">
; registering #<SYSTEM ASDF-INSTALL> as ASDF-INSTALL
;;; ASDF-Install version 0.6.10
Welcome to Clozure Common Lisp Version 1.6  (DarwinX8664)!
? (asdf-install:install 'md5)
Install where?
1) System-wide install: 
   System in /opt/local/share/asdf-install/site-systems
   Files in /opt/local/share/asdf-install/site/ 
2) Personal instrallation: 
   System in /Users/User1/.asdf-install-dir/systems/
   Files in /Users/User1/.asdf-install-dir/site/ 
0) Abort installation.
 --> 0

?