1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SBCL + ASDF3でカレントディレクトリ以下のsystemを読み込む

Last updated at Posted at 2017-02-04

概要

ASDF3でSBCL起動時のディレクトリ(カレントディレクトリ)以下にあるsystemを読み込む際の設定です。

.sbclrcを書き換える

.sbclrc
(require :asdf) ; quicklispの設定が既にある場合はこの行は不要です。
(asdf:initialize-source-registry 
  `(:source-registry (:tree ,*default-pathname-defaults*) :inherit-configuration))

試してみる

./stab/stab.asd
(in-package :cl-user)
(defpackage stab-asd
  (:use :cl :asdf))
(in-package :stab-asd)

(defsystem stab
  :depends-on ()
  :components ((:module "src" 
                :components ((:file "stab")))))
./stab/src/stab.lisp
(defpackage stab
  (:use :cl)
  (:export :foo))
(in-package :stab)
(defun foo () (print "stab loaded"))
(in-package :cl-user)

sbclを.asdファイルがあるより上の階層のディレクトリで起動。

* (asdf:load-system :stab)

T
* (stab:foo)

"stab loaded"
"stab loaded"
*

補足

以前、SBCL + ASDF3 +QuickLispでプロジェクトの作り方
でカレントディレクトリのプロジェクトを見に行く方法を書きましたが、
これはASDF Manualによるとold styleなやり方なんだそうです。

本来は~/.config/common-lisp/source-registry.confに以下のように書けばいいらしいのですが

設定ファイルを利用した設定

~/.config/common-lisp/source-registry.conf
(:source-registry
 (:tree (:home "lisp")) ; ~/lisp/に展開される
 :inherit-configuration)

これはなぜかASDFがsystemを見つけてくれず、うまくいきませんでした。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?