Next: Defining systems with defsystem, Previous: Top, Up: Top
This chapter describes how to use asdf to compile and load ready-made Lisp programs and libraries.
Some Lisp implementations (such as SBCL and OpenMCL) come with asdf included already, so you don't need to download it separately. Consult your Lisp system's documentation. If you need to download asdf and install it by hand, the canonical source is the cCLan CVS repository at http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/cclan/asdf/.
The single file asdf.lisp is all you need to use asdf normally. Once you load it in a running Lisp, you're ready to use asdf. For maximum convenience you might want to have asdf loaded whenever you start your Lisp implementation, for example by loading it from the startup script or dumping a custom core – check your Lisp implementation's manual for details.
The variable asdf:*central-registry*
is a list of “system
directory designators”1. A system directory designator is a form which
will be evaluated whenever a system is to be found, and must evaluate
to a directory to look in. You might want to set or augment
*central-registry*
in your Lisp init file, for example:
(setf asdf:*central-registry* (list* '*default-pathname-defaults* #p"/home/me/cl/systems/" #p"/usr/share/common-lisp/systems/" asdf:*central-registry*))
To compile and load a system, you need to ensure that a symbolic link to its
system definition is in one of the directories in
*central-registry*
2.
For example, if #p"/home/me/cl/systems/"
(note the trailing
slash) is a member of *central-registry*
, you would set up a
system foo that is stored in a directory
/home/me/src/foo/ for loading with asdf with the following
commands at the shell (this has to be done only once):
$ cd /home/me/cl/systems/ $ ln -s ~/src/foo/foo.asd .
The system foo is loaded (and compiled, if necessary) by evaluating the following form in your Lisp implementation:
(asdf:operate 'asdf:load-op 'foo)
That's all you need to know to use asdf to load systems written by others. The rest of this manual deals with writing system definitions for Lisp software you write yourself.
[1] When we say “directory” here, we mean “designator for a pathname with a supplied DIRECTORY component”.
[2] It is possible to customize the
system definition file search. That's considered advanced use, and
covered later: search forward for
*system-definition-search-functions*
. See Defining systems with defsystem.