How to add a local project to asdf configured by q

2020-02-17 11:05发布

问题:

I want to add a local project to the known projects by asdf, but due to the fact that asdf was installed and configured by quicklisp and the *central-registry* points to "#P/home/user/quicklisp/quicklisp/", which contains .lisp files. I do not know how to do it as the manual explains that a symbolic link into the directory would do it, but I do not want to mess around inside quicklisp. (It does work as a hotfix, though!)

Therefore:How to add a local project to asdf (NOT QUICKLISP) which was installed and configured by quicklisp?

回答1:

If you use Quicklisp you can use the dedicated directory ~/quicklisp/local-projects/ which is scanned before the others directories. To use it, just put your project or a symbolic link.

(quickproject:make-project "~/quicklisp/local-projects/my-new-website/"
  :depends-on '(restas parenscrit cl-who))

(quickproject:make-project "~/src/lisp/my-cool-gui/"
  :depends-on '(qt))

$ ln -s ~/src/lisp/my-cool-gui ~/quicklisp/local-projects/my-cool-gui  

However, if you really want to configure ASDF do as explained in the documentation .

For example you can put this:

(:directory "~/src/lisp/my-project-XYZ/")

in your ~/.config/common-lisp/source-registry.conf.d/my-asdf.conf to add a directory, or

(:tree "~/src/lisp/")

if you want all the subdirectories to be scanned.



回答2:

As asdf:*central-registry* is not just one path, it is list of pathnames. You can simply do: (push "/path-to-your-project/" asdf:*central-registry*). If you use SBCL, you can add this line to ~/.sbclrc.



回答3:

The ASDF manual has in Section 3:

Since ASDF 2, the preferred way to configure where ASDF finds your systems is the source-registry facility, fully described in its own chapter of this manual. See Controlling where ASDF searches for systems.

Item 7 in Controlling where ASDF searches for systems is

The source registry will be configured from system configuration directory /etc/common-lisp/source-registry.conf.d/ if it exists.

This location is available in Debian and is what I use. By default, Debian puts the sources of downloaded CL libraries in /usr/share/common-lisp/source. However, I don't know (though I have tried to find out) how this location is made known to ASDF. So, you can add files with pathnames to this location, to make those pathnames known to ASDF. I've added a file, /etc/common-lisp/source-registry.conf.d/04-local.conf, containing

(:tree #p"/usr/local/share/common-lisp/source/")

and now i can put sources of locally downloaded CL libraries in /usr/local/share/common-lisp/source/ and they will be visible to ASDL. The :tree syntax is described in Configuring ASDF to find your systems.

asdf:*central-registry* is now depreciated. See Subsection 3.2: Configuring ASDF to find your systems — old style.



回答4:

Put

(push "~/your/local/lisp/projects/folder/" ql:*local-project-directories*)

in your .sbclrc and you can quickload your projects without symlinks or moving folders.

I know you asked about asdf, but I don't think you want to mess around with asdf, when you're actually using quicklisp.