前の記事でわからない部分をまとめたので、少しずつ調べる。 peccu.hatenablog.com (そろそろorg-modeでブログ書きたい)
RoswellとQuicklispが簡単で便利ゆえに中身を気にしていなかった。 背景にある仕組みを理解すればパッケージ周りは多少解決できるのではないだろうか。
結論は、qlot使えば良さそうなことがわかった。
まとめ
ざっくりと拾い上げたので間違っていれば指摘していただけるとありがたいです。
仕組み | 場所 |
---|---|
ASDF | ~/common-lisp , ~/.local/share/common-lisp/source , asdf:*central-registry* |
Quicklisp | ~/quicklisp , ql:*quicklisp-home* |
Roswell | ~/.roswell/local-projects , ~/.roswell/lisp/quicklisp |
qlot | プロジェクトディレクトリ/quicklisp |
ASDF
Another System Definition Facility の略
We recommend you should not use asdf-install anymore, as it is an older similar piece of software that is both unmaintained and obsolete.
asdf-install
は使うなと。Quicklispでインストールするから問題ない。
load path関連について
Make sure software is installed where ASDF can find it. The simplest way is to put all your Lisp code in subdirectories of
~/common-lisp/
(starting with ASDF 3.1.2), or~/.local/share/common-lisp/source/
(for ASDF 2 and later, or if you want to keep source in a hidden directory). For more details, see Configuring ASDF to find your systems.
ASDF Manual: Quick start summary
なるほど ~/common-lisp/
と ~/.local/share/common-lisp/source/
を探していたと。
ただ、どちらも存在しなかったのでQuicklispかRoswellかその両方により設定が上書きされていそう。
If you’re using some tool to install software (e.g. Quicklisp), the authors of that tool should already have configured ASDF.
ASDF Manual: Configuring ASDF to find your systems
同ページに変数に関する記述があった。
In earlier versions of ASDF, the system source registry was configured using a global variable, asdf:central-registry. For more details about this, see the following section, Configuring ASDF to find your systems --- old style. Unless you need to understand this, skip directly to Configuring where ASDF stores object files.
ASDF Manual: Configuring ASDF to find your systems
~/.roswell/lisp/quicklisp/setup.lisp
に下記asdf:*central-registry*
の記載があったので、これが実際に読み込まれるパスの模様。
(unless *load-truename* (error "This file must be LOADed to set up quicklisp.")) (defvar *quicklisp-home* (make-pathname :name nil :type nil :defaults *load-truename*)) (defun qmerge (pathname) "Return PATHNAME merged with the base Quicklisp directory." (merge-pathnames pathname *quicklisp-home*)) (push (qmerge "quicklisp/") asdf:*central-registry*)
利用している環境で試すとここだった。
* ql:*quicklisp-home* #P"/Users/peccu/.roswell/lisp/quicklisp/" * asdf:*central-registry* (#P"/Users/peccu/.roswell/lisp/quicklisp/quicklisp/")
パッケージ作成について
ASDF Manual: Quick start summary
Quick Startに To make your own ASDF system
という項目があった。
- ASDFのパスが通っている場所に
my-system
というディレクトリを作る - システム定義を
my-system.asd
に記述する。(システム名と揃え、全て小文字) (asdf:load-system "my-system")
で読み込め、正しく動くことを確認する
Quicklisp
項目 How is Quicklisp related to ASDF?
より
Quicklispはプロジェクトのアーカイブで、ASDFはそれらのロードとコンパイルでmake
のようなもの。とのこと
Quicklisp has an archive of project files and metadata about project relationships. It can download a project and its dependencies. ASDF is used to actually compile and load the project and its dependencies.
ASDF is a little like make and Quicklisp is a little like a Linux package manager.
項目Can I install somewhere other than ~/quicklisp?
にインストールパスの記載があった。
Quicklispインストール時にパスを指定できるとのこと。
これをRoswellが利用してasdf:*central-registry*
設定に利用していたql:*quicklisp-home*
を変更しているのかも。
(quicklisp-quickstart:install :path ".quicklisp/")
項目Can I load a local project that isn't part of Quicklisp?
にQuicklispに未登録のものをロードする方法の記載があった。
- Quicklispの
local-projects
にプロジェクトのディレクトリを置く- FAQでは
~/quicklisp/local-projects/
が記載されていたので、Roswellでインストールしていれば~/.roswell/lisp/quicklisp/local-projects/
が該当しそう
- FAQでは
- ASDFの見つけられる場所に置く
asdf:*central-registry*
にプロジェクトのパスを追加する例が記載されている
Roswell
lisp/install-quicklisp.lispの111行目 (関数quicklisp-install
の定義)にて
quicklisp-quickstart:install
を呼び、:path
を指定していた。値は(ros:opt "quicklisp")
~/.roswell/
にlocal-projects
とlisp/quicklisp/local-projects
がある。
前者はros install project/repository
でインストールしたものが入っていて後者がRoswellでインストールされたQuicklisp用のlocal-project?
qlot
ここまで、ユーザー毎でライブラリが共有されていたので、プロジェクト毎にライブラリを管理するためのツール。
- 依存するパッケージの情報を
qlfile
に記載 - インストールすると
quicklisp
ディレクトリとqlfile.lock
ファイルが作成される。
load関連の話
パッケージの場所だけで力尽きたので、loadに関する調査は後ほど。