@peccul is peccu

(love peccu '(emacs lisp cat outdoor bicycle mac linux coffee))

ASDFとQuicklispとRoswellとqlotで利用する(インストールする)パッケージの場所

前の記事でわからない部分をまとめたので、少しずつ調べる。 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

Quicklisp beta FAQ より

項目 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/が該当しそう
  • ASDFの見つけられる場所に置く
    • asdf:*central-registry*にプロジェクトのパスを追加する例が記載されている

Roswell

github.com

lisp/install-quicklisp.lispの111行目 (関数quicklisp-installの定義)にて quicklisp-quickstart:installを呼び、:pathを指定していた。値は(ros:opt "quicklisp")

~/.roswell/local-projectslisp/quicklisp/local-projectsがある。 前者はros install project/repositoryでインストールしたものが入っていて後者がRoswellでインストールされたQuicklisp用のlocal-project?

qlot

github.com

ここまで、ユーザー毎でライブラリが共有されていたので、プロジェクト毎にライブラリを管理するためのツール。

  • 依存するパッケージの情報をqlfileに記載
  • インストールすると quicklisp ディレクトリとqlfile.lockファイルが作成される。

load関連の話

パッケージの場所だけで力尽きたので、loadに関する調査は後ほど。