Newer
Older
\input texinfo @c -*- texinfo -*-
@c %**start of header
@setfilename asdf.info
@c We use @&key, etc to escape & from TeX in lambda lists --
@c so we need to define them for info as well.
@macro AallowOtherKeys
&allow-other-keys
@end macro
@macro Aoptional
&optional
@end macro
@macro Arest
&rest
@end macro
@macro Akey
&key
@end macro
@macro Abody
&body
@end macro
@macro defcond
@deftyp CONDITION
@end macro
@c for install-info
@dircategory Software development
@direntry
* asdf: (asdf). Another System Definition Facility (for Common Lisp)
@end direntry
This manual describes ASDF, a system definition facility
for Common Lisp programs and libraries.
You can find the latest version of this manual at
@url{http://common-lisp.net/project/asdf/asdf.html}.
ASDF Copyright @copyright{} 2001-2014 Daniel Barlow and contributors.
This manual Copyright @copyright{} 2001-2014 Daniel Barlow and contributors.
This manual revised @copyright{} 2009-2014 Robert P. Goldman and Francois-Rene Rideau.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@end copying
@titlepage
@title ASDF: Another System Definition Facility
@c The following two commands start the copyright page.
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage
@c Output the table of contents at the beginning.
@contents
@c -------------------
@ifnottex
@node Top, Introduction, (dir), (dir)
@top ASDF: Another System Definition Facility
* Configuring ASDF::
* Using ASDF::
* Defining systems with defsystem::
* The object model of ASDF::
* Controlling where ASDF searches for systems::
* Controlling where ASDF saves compiled files::
* Error handling::
* Miscellaneous additional functionality::
* Getting the latest version::
* FAQ::
Francois-Rene Rideau
committed
* Ongoing Work::
* Bibliography::
* Concept Index::
* Function and Class Index::
* Variable Index:: @c @detailmenu
@c
@detailmenu
--- The Detailed Node Listing ---
Loading ASDF
* Loading a pre-installed ASDF::
* Checking whether ASDF is loaded::
* Upgrading ASDF::
* Loading ASDF from source::
Configuring ASDF
* Configuring ASDF to find your systems::
* Configuring where ASDF stores object files::
Defining systems with defsystem
* The defsystem form::
* A more involved example::
* The defsystem grammar::
* Other code in .asd files::
* The package-system extension::
The object model of ASDF
* Operations::
* Components::
* Functions::
* Predefined operations of ASDF::
* Creating new operations::
* Common attributes of components::
* Pre-defined subclasses of component::
* Creating new component types::
* Pre-defined subclasses of component::
* Creating new component types::
* Where do I report a bug?::
* What has changed between ASDF 1 and ASDF 2?::
* Issues with installing the proper version of ASDF::
* Issues with configuring ASDF::
* Issues with using and extending ASDF to define systems::
* ASDF development FAQs::
``What has changed between ASDF 1, ASDF 2 and ASDF 3?''
* What are ASDF 1 2 3?::
* How do I detect the ASDF version?::
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
* ASDF can portably name files in subdirectories::
* Output translations::
* Source Registry Configuration::
* Usual operations are made easier to the user::
* Many bugs have been fixed::
* ASDF itself is versioned::
* ASDF can be upgraded::
* Decoupled release cycle::
* Pitfalls of the transition to ASDF 2::
Issues with installing the proper version of ASDF
* My Common Lisp implementation comes with an outdated version of ASDF. What to do?::
* I'm a Common Lisp implementation vendor. When and how should I upgrade ASDF?::
Issues with configuring ASDF
* How can I customize where fasl files are stored?::
* How can I wholly disable the compiler output cache?::
Issues with using and extending ASDF to define systems
* How can I cater for unit-testing in my system?::
* How can I cater for documentation generation in my system?::
* How can I maintain non-Lisp (e.g. C) source files?::
* I want to put my module's files at the top level. How do I do this?::
* How do I create a system definition where all the source files have a .cl extension?::
ASDF development FAQs
* How do run the tests interactively in a REPL?::
@end detailmenu
@end menu
@end ifnottex
@c -------------------
@node Introduction, Quick start summary, Top, Top
@comment node-name, next, previous, up
@chapter Introduction
@cindex ASDF-related features
@vindex *features*
@cindex Testing for ASDF
@cindex ASDF versions
@cindex :asdf
@cindex :asdf2
Francois-Rene Rideau
committed
@cindex :asdf3
ASDF is Another System Definition Facility:
a tool for specifying how systems of Common Lisp software
are made up of components (sub-systems and files),
and how to operate on these components in the right order
so that they can be compiled, loaded, tested, etc.
If you are new to ASDF, @pxref{Quick start summary,,the quick start
guide}.
ASDF presents three faces:
one for users of Common Lisp software who want to reuse other people's code,
one for writers of Common Lisp software who want to specify how to build their systems,
and one for implementers of Common Lisp extensions who want to extend
the build system.
For more specifics,
@pxref{Using ASDF,,Loading a system},
to learn how to use ASDF to load a system.
to learn how to define a system of your own.
@xref{The object model of ASDF}, for a description of
Note that
ASDF is @emph{not} a tool for library and system @emph{installation}; it
plays a role like @t{make} or @t{ant}, not like a package manager.
In particular, ASDF should not to be confused with ASDF-Install, which attempts to find and
download ASDF systems for you.
Despite the name, ASDF-Install is not part of ASDF, but a separate piece of software.
ASDF-Install is also unmaintained and obsolete.
We recommend you use Quicklisp
(@uref{http://www.quicklisp.org}) instead,
a Common Lisp package manager which works well and is being actively maintained.
If you want to download software from version control instead of tarballs,
so you may more easily modify it, we recommend clbuild (@uref{http://common-lisp.net/project/clbuild/}).
We recommend @file{~/common-lisp/}
as a place into which to install Common Lisp software;
starting with ASDF 3.1.1, it is included in the default source-registry configuration.
@node Quick start summary, Loading ASDF, Introduction, Top
@chapter Quick start summary
@itemize
@item To load an ASDF system:
@itemize
@item
Load ASDF itself into your Lisp image, either through
@code{(require "asdf")} (if it's supplied by your lisp implementation)
or else through
@code{(load "/path/to/asdf.lisp")}. For more details, @ref{Loading ASDF}.
@item
Make sure ASDF can find system definitions
through proper source-registry configuration.
For more details, @xref{Configuring ASDF to find your systems}.
The simplest way is simply to put all your lisp code in subdirectories of
@file{~/common-lisp/} (starting with ASDF 3.1.1),
or @file{~/.local/share/common-lisp/source/}
(for ASDF 2 and later, or if you want to keep source in a hidden directory).
Such code will automatically be found.
@item
Load a system with @code{(asdf:load-system :system)}. @xref{Using ASDF}.
@end itemize
@item To make your own ASDF system:
@itemize
@item
As above, load and configure ASDF.
@item
Make a new directory for your system, @code{my-system/} in a location
where ASDF can find it (@pxref{Configuring ASDF to find your systems}).
@item
Create an ASDF system definition listing the dependencies of
your system, its components, and their interdependencies,
and put it in @file{my-system.asd}.
This file must have the same name as your system.
@xref{Defining systems with defsystem}.
@item
Use @code{(asdf:load-system :my-system)}
to make sure it's all working properly. @xref{Using ASDF}.
@end itemize
@end itemize
@c FIXME: (1) add a sample project that the user can cut and paste to
@c get started. (2) discuss the option of starting with Quicklisp.
@node Loading ASDF, Configuring ASDF, Quick start summary, Top
@comment node-name, next, previous, up
@chapter Loading ASDF
@menu
* Loading a pre-installed ASDF::
* Checking whether ASDF is loaded::
* Upgrading ASDF::
* Loading ASDF from source::
@node Loading a pre-installed ASDF, Checking whether ASDF is loaded, Loading ASDF, Loading ASDF
@section Loading a pre-installed ASDF
Most recent Lisp implementations include a copy of ASDF 3,
or at least ASDF 2.
You can usually load this copy using Common Lisp's @code{require} function.@footnote{
NB: all implementations except GNU CLISP also accept
@code{(require "ASDF")}, @code{(require 'asdf)} and @code{(require :asdf)}.
For portability's sake, you should use @code{(require "asdf")}.
}
the following implementations provide ASDF 3 this way:
ABCL, Allegro CL, Clozure CL, CMUCL, ECL, GNU CLISP, mkcl, SBCL.
The following implementations only provide ASDF 2:
LispWorks, mocl, XCL.
The following implementation doesn't provide ASDF yet but will in an upcoming release:
SCL.
Francois-Rene Rideau
committed
The following implementations are obsolete, not actively maintained,
and most probably will never bundle ASDF:
Corman CL, GCL, Genera, MCL.
Francois-Rene Rideau
committed
If the implementation you are using doesn't provide ASDF 2 or ASDF 3,
see @pxref{Loading ASDF,,Loading ASDF from source} below.
If that implementation is still actively maintained,
you may also send a bug report to your Lisp vendor and complain
about their failing to provide ASDF.
@node Checking whether ASDF is loaded, Upgrading ASDF, Loading a pre-installed ASDF, Loading ASDF
@section Checking whether ASDF is loaded
To check whether ASDF is properly loaded in your current Lisp image,
you can run this form:
@lisp
(asdf:asdf-version)
@end lisp
If it returns a string,
that is the version of ASDF that is currently installed.
If it raises an error,
then either ASDF is not loaded, or
you are using an old version of ASDF.
You can check whether an old version is loaded
by checking if the ASDF package is present.
The form below will allow you to programmatically determine
whether a recent version is loaded, an old version is loaded,
or none at all:
@lisp
(when (find-package :asdf)
(let ((ver (symbol-value (or (find-symbol (string :*asdf-version*) :asdf)
(find-symbol (string :*asdf-revision*) :asdf)))))
(etypecase ver
(string ver)
Francois-Rene Rideau
committed
(cons (with-output-to-string (s)
(loop for (n . m) on ver do (princ n s) (when m (princ "." s)))))
(null "1.0"))))
If it returns @code{nil} then ASDF is not installed.
Otherwise it should return a string.
If it returns @code{"1.0"}, then it can actually be
any version before 1.77 or so, or some buggy variant of 1.x.
If you are experiencing problems with ASDF,
please try upgrading to the latest released version,
using the method below,
before you contact us and raise an issue.
@node Upgrading ASDF, Loading ASDF from source, Checking whether ASDF is loaded, Loading ASDF
@c FIXME: tighten this up a bit -- there's a lot of stuff here that
@c doesn't matter to almost anyone. Move discussion of updating antique
@c versions of ASDF down, or encapsulate it.
Francois-Rene Rideau
committed
If you want to upgrade to a more recent ASDF version,
you need to install and configure your ASDF just like any other system
(@pxref{Configuring ASDF to find your systems}).
Francois-Rene Rideau
committed
If your implementation provides ASDF 3 or later,
you only need to @code{(require "asdf")}:
ASDF will automatically look whether an updated version of itself is available
amongst the regularly configured systems, before it compiles anything else.
@node Notes about ASDF 1 and ASDF 2, Issues with upgrading ASDF, Upgrading ASDF, Upgrading ASDF
Francois-Rene Rideau
committed
@subsection Notes about ASDF 1 and ASDF 2
Most implementations provide ASDF 3 in their latest release,
and we recommend upgrading your implementation rather than using ASDF 1 or 2.
A few implementations only provide ASDF 2,
that can be overridden by installing a fasl (see below).
A few implementations don't provide ASDF,
but a fasl can be installed to provide it.
GCL so far is still lacking a usable @code{require} interface.
If your implementation has no suitable upgrade available (yet),
or somehow upgrading is not an option,
we assume you're an expert deliberately using a legacy implementation,
and are proficient enough to install this fasl.
Still, the ASDF source repository contains a script
@file{bin/install-asdf-as-module} that can help you do that.
It relies on @file{cl-launch} 4 for command-line invocation,
Francois-Rene Rideau
committed
which may depend on ASDF being checked out in @file{~/cl/asdf/}
if your implementation doesn't even have an ASDF 2;
but if you don't have @file{cl-launch},
you can instead @code{(load "bin/install-asdf-as-module")}
from your implementation's REPL.
Francois-Rene Rideau
committed
Finally, if your implementation only provides ASDF 2,
and you can't or won't upgrade it or override its ASDF module,
you may simply configure ASDF to find a proper upgrade;
however, to avoid issues with a self-upgrade in mid-build,
you @emph{must} make sure to upgrade ASDF immediately
after requiring the builtin ASDF 2:
Francois-Rene Rideau
committed
;; <--- insert programmatic configuration here if needed
(asdf:load-system :asdf)
@end lisp
@node Issues with upgrading ASDF, , Notes about ASDF 1 and ASDF 2, Upgrading ASDF
@subsection Issues with upgrading ASDF
Note that there are some limitations to upgrading ASDF:
@itemize
@item
Previously loaded ASDF extensions become invalid, and will need to be reloaded.
Examples include CFFI-Grovel, hacks used by ironclad, etc.
Francois-Rene Rideau
committed
Since it isn't possible to automatically detect what extensions
need to be invalidated,
ASDF will invalidate @emph{all} previously loaded systems
when it is loaded on top of a forward-incompatible ASDF version.
@footnote{
@vindex *oldest-forward-compatible-asdf-version*
Forward incompatibility can be determined using the variable
@code{asdf/upgrade::*oldest-forward-compatible-asdf-version*},
which is 2.33 at the time of this writing.}
Starting with ASDF 3 (2.27 or later),
this self-upgrade will be automatically attempted as the first step
to any system operation, to avoid any possibility of
Francois-Rene Rideau
committed
a catastrophic attempt to self-upgrade in mid-build.
Francois-Rene Rideau
committed
you should load, configure and upgrade ASDF
as one of the very first things done by your build and startup scripts.
It is safer if you upgrade ASDF and its extensions as a special step
at the very beginning of whatever script you are running,
before you start using ASDF to load anything else.
@item
Francois-Rene Rideau
committed
Until all implementations provide ASDF 3 or later,
it is unsafe to upgrade ASDF as part of loading a system
that depends on a more recent version of ASDF,
since the new one might shadow the old one while the old one is running,
and the running old one will be confused
when extensions are loaded into the new one.
Francois-Rene Rideau
committed
In the meantime, we recommend that your systems should @emph{not} specify
@code{:depends-on (:asdf)}, or @code{:depends-on ((:version :asdf "3.0.1"))},
but instead that they check that a recent enough ASDF is installed,
with such code as:
@example
(unless (or #+asdf2 (asdf:version-satisfies
(asdf:asdf-version) *required-asdf-version*))
(error "FOO requires ASDF ~A or later." *required-asdf-version*))
@end example
Francois-Rene Rideau
committed
Until all implementations provide ASDF 3 or later,
it is unsafe for a system to transitively depend on ASDF
and not directly depend on ASDF;
if any of the system you use either depends-on asdf,
system-depends-on asdf, or transitively does,
you should also do as well.
@end itemize
@node Loading ASDF from source, , Upgrading ASDF, Loading ASDF
@section Loading ASDF from source
If your implementation doesn't include ASDF,
if for some reason the upgrade somehow fails,
does not or cannot apply to your case,
you will have to install the file @file{asdf.lisp}
somewhere and load it with:
@lisp
(load "/path/to/your/installed/asdf.lisp")
@end lisp
The single file @file{asdf.lisp} is all you normally need to use ASDF.
You can extract this file from latest release tarball on the
@url{http://common-lisp.net/project/asdf/,ASDF website}.
If you are daring and willing to report bugs, you can get
the latest and greatest version of ASDF from its git repository.
@xref{Getting the latest version}.
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.
@node Configuring ASDF, Using ASDF, Loading ASDF, Top
@comment node-name, next, previous, up
@chapter Configuring ASDF
For standard use cases, ASDF should work pretty much out of the box.
We recommend you skim the sections on configuring ASDF to find your systems
and choose the method of installing Lisp software that works best for you.
Then skip directly to @xref{Using ASDF}. That will probably be enough.
You are unlikely to have to worry about the way ASDF stores object files,
and resetting the ASDF configuration is usually only needed in corner cases.
* Configuring ASDF to find your systems::
* Configuring where ASDF stores object files::
@node Configuring ASDF to find your systems, Configuring where ASDF stores object files, Configuring ASDF, Configuring ASDF
@section Configuring ASDF to find your systems
In order to compile and load your systems, ASDF must be configured to find
the @file{.asd} files that contain system definitions.
There are a number of different techniques for setting yourself up with
ASDF, starting from easiest to the most complex:
@itemize @bullet
@item
Put all of your systems in subdirectories of
@file{~/.local/share/common-lisp/source/}.
If you install software there, you don't need further configuration.
(NB: @file{~/common-lisp/} is only included in the default configuration
starting with ASDF 3.1.1 or later)
@item
If you're using some tool to install software (e.g. Quicklisp),
the authors of that tool should already have configured ASDF.
@item
If you have more specific desires about how to lay out your software on
disk, the preferred way to configure where ASDF finds your systems is
the @code{source-registry} facility,
fully described in its own chapter of this manual.
@xref{Controlling where ASDF searches for systems}. Here is a quick
recipe for getting started:
The simplest way to add a path to your search path,
say @file{/home/luser/.asd-link-farm/}
is to create the directory
@file{~/.config/common-lisp/source-registry.conf.d/}
and there create a file with any name of your choice,
and with the type @file{conf}@footnote{By requiring the @file{.conf}
extension, and ignoring other files, ASDF allows you to have disabled files,
editor backups, etc. in the same directory with your active
configuration files.
ASDF will also ignore files whose names start with a @file{.} character.
It is customary to start the filename with two digits, to control the
sorting of the @code{conf} files in the source registry directory, and
thus the order in which the directories will be scanned.},
for instance @file{42-asd-link-farm.conf},
containing the line:
@kbd{(:directory "/home/luser/.asd-link-farm/")}
If you want all the subdirectories under @file{/home/luser/lisp/}
to be recursively scanned for @file{.asd} files, instead use:
@kbd{(:tree "/home/luser/lisp/")}
ASDF will automatically read your configuration
the first time you try to find a system.
If necessary, you can reset the source-registry configuration with:
@lisp
(asdf:clear-source-registry)
@end lisp
@item
In earlier versions of ASDF, the system source registry was configured
using a global variable, @code{asdf:*central-registry*}.
For more details about this, see the following section,
@ref{Configuring ASDF to find your systems --- old style}.
Unless you need to understand this,
skip directly to @ref{Configuring where ASDF stores object files}.
@end itemize
Note that your Operating System distribution or your system administrator
may already have configured system-managed libraries for you.
@node Configuring ASDF to find your systems --- old style, Configuring where ASDF stores object files, Configuring ASDF to find your systems, Configuring ASDF
@c FIXME: this section should be moved elsewhere. The novice user
@c should not be burdened with it. [2014/02/27:rpg]
@section Configuring ASDF to find your systems --- old style
The old way to configure ASDF to find your systems is by
@code{push}ing directory pathnames onto the variable
@code{asdf:*central-registry*}.
You must configure this variable between the time you load ASDF
and the time you first try to use it.
Loading and configuring ASDF presumably happen
as part of some initialization script that builds or starts
your Common Lisp software system.
(For instance, some SBCL users used to put it in their @file{~/.sbclrc}.)
Francois-Rene Rideau
committed
The @code{asdf:*central-registry*} is empty by default in ASDF 2 or ASDF 3,
but is still supported for compatibility with ASDF 1.
When used, it takes precedence over the above source-registry.@footnote{
It is possible to further customize
the system definition file search.
That's considered advanced use, and covered later:
search forward for
@code{*system-definition-search-functions*}.
@xref{Defining systems with defsystem}.}
For example, let's say you want ASDF to find the @file{.asd} file
@file{/home/me/src/foo/foo.asd}.
In your lisp initialization file, you could have the following:
(require "asdf")
(push "/home/me/src/foo/" asdf:*central-registry*)
@end lisp
Note the trailing slash: when searching for a system,
ASDF will evaluate each entry of the central registry
and coerce the result to a pathname.@footnote{
ASDF will indeed call @code{eval} on each entry.
It will skip entries that evaluate to @code{nil}.
Strings and pathname objects are self-evaluating,
in which case the @code{eval} step does nothing;
but you may push arbitrary s-expressions onto the central registry.
These s-expressions may be evaluated to compute context-dependent
entries, e.g. things that depend
on the value of shell variables or the identity of the user.
The variable @code{asdf:*central-registry*} is thus a list of
``system directory designators''.
A @dfn{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 (or @code{NIL}).
By ``directory'', we mean
``designator for a pathname with a non-empty DIRECTORY component''.
The trailing directory name separator
is necessary to tell Lisp that you're discussing a directory
rather than a file. If you leave it out, ASDF is likely to look in
@code{/home/me/src/} instead of @code{/home/me/src/foo/} as you
intended, and fail to find your system definition.
Typically there are a lot of @file{.asd} files, and
a common idiom was to put
@emph{symbolic links} to all of one's @file{.asd} files
in a common directory
and push @emph{that} directory (the ``link farm'')
onto
@code{asdf:*central-registry*},
instead of pushing each individual system directory.
ASDF knows to follow @emph{symlinks}
to the actual location of the systems.@footnote{
On Windows, you can use Windows shortcuts instead of POSIX symlinks.
if you try aliases under MacOS, we are curious to hear about your experience.}
For example, if @code{#p"/home/me/cl/systems/"}
is an element of @code{*central-registry*}, you could set up the
system @var{foo} as follows:
@example
$ cd /home/me/cl/systems/
$ ln -s ~/src/foo/foo.asd .
@end example
This old style for configuring ASDF is not recommended for new users,
but it is supported for old users, and for users who want to programmatically
control what directories are added to the ASDF search path.
@node Configuring where ASDF stores object files, , Configuring ASDF to find your systems, Configuring ASDF
@section Configuring where ASDF stores object files
ASDF lets you configure where object files will be stored.
Sensible defaults are provided and
you shouldn't normally have to worry about it.
This allows the same source code repository to be shared
between several versions of several Common Lisp implementations,
between several users using different compilation options,
with users who lack write privileges on shared source directories, etc.
This also keeps source directories from being cluttered
with object/fasl files.
Starting with ASDF 2, the @code{asdf-output-translations} facility
was added to ASDF itself. This facility controls where object files will be stored.
Francois-Rene Rideau
committed
This facility is fully described in a chapter of this manual,
@ref{Controlling where ASDF saves compiled files}.
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
@c FIXME: possibly this should be moved elsewhere. It's redundant here,
@c and makes this section of the manual too long and daunting for the
@c new user. [2014/02/27:rpg]
@c The simplest way to add a translation to your search path,
@c say from @file{/foo/bar/baz/quux/}
@c to @file{/where/i/want/my/fasls/}
@c is to create the directory
@c @file{~/.config/common-lisp/asdf-output-translations.conf.d/}
@c and there create a file with any name of your choice and the type @file{conf},
@c for instance @file{42-bazquux.conf}
@c containing the line:
@c @kbd{("/foo/bar/baz/quux/" "/where/i/want/my/fasls/")}
@c To disable output translations for source under a given directory,
@c say @file{/toto/tata/}
@c you can create a file @file{40-disable-toto.conf}
@c with the line:
@c @kbd{("/toto/tata/")}
@c To wholly disable output translations for all directories,
@c you can create a file @file{00-disable.conf}
@c with the line:
@c @kbd{(t t)}
@c Note that your Operating System distribution or your system administrator
@c may already have configured translations for you.
@c In absence of any configuration, the default is to redirect everything
@c under an implementation-dependent subdirectory of @file{~/.cache/common-lisp/}.
@c @xref{Controlling where ASDF searches for systems}, for full details.
@c The required @file{.conf} extension allows you to have disabled files
@c or editor backups (ending in @file{~}), and works portably
@c (for instance, it is a pain to allow both empty and non-empty extension on CLISP).
@c Excluded are files the name of which start with a @file{.} character.
@c It is customary to start the filename with two digits
@c that specify the order in which the directories will be scanned.
@c ASDF will automatically read your configuration
@c the first time you try to find a system.
@c You can reset the source-registry configuration with:
@c @lisp
@c (asdf:clear-output-translations)
@c @end lisp
@c And you probably should do so before you dump your Lisp image,
@c if the configuration may change
@c between the machine where you save it at the time you save it
@c and the machine you resume it at the time you resume it.
@c (Once again, you should use @code{(asdf:clear-configuration)}
@c before you dump your Lisp image, which includes the above.)
Note that before ASDF 2,
other ASDF add-ons offered the same functionality,
each in subtly different and incompatible ways:
ASDF-Binary-Locations, cl-launch, common-lisp-controller.
ASDF-Binary-Locations is now not needed anymore and should not be used.
Francois-Rene Rideau
committed
cl-launch 3.000 and common-lisp-controller 7.2 have been updated
to delegate object file placement to ASDF.
@node Resetting the ASDF configuration, , Configuring where ASDF stores object files, Configuring ASDF
@c FIXME: this should probably be moved out of the "quickstart" part of
@c the manual. [2014/02/27:rpg]
When you dump and restore an image, or when you tweak your configuration,
you may want to reset the ASDF configuration.
For that you may use the following function:
@defun clear-configuration
undoes any ASDF configuration,
regarding source-registry or output-translations.
@end defun
This function is pushed onto the @code{uiop:*image-dump-hook*} by default,
which means that if you save an image using @code{uiop:dump-image},
or via @code{asdf:image-op} and @code{asdf:program-op},
it will be automatically called to clear your configuration.
If for some reason you prefer to call your implementation's underlying functionality,
be sure to call @code{clear-configuration} manually,
or push it into your implementation's equivalent of @code{uiop:*image-dump-hook*},
e.g. @code{sb-ext:*save-hooks*} on SBCL, or @code{ext:*before-save-initializations*}
on CMUCL and SCL, etc.
@node Using ASDF, Defining systems with defsystem, Configuring ASDF, Top
@chapter Using ASDF
@menu
* Loading a system::
* Other Operations::
* Moving on::
@end menu
@node Loading a system, Other Operations, Using ASDF, Using ASDF
@section Loading a system
The system @var{foo} is loaded (and compiled, if necessary)
by evaluating the following Lisp form:
(asdf:load-system :@var{foo})
On some implementations (namely recent versions of
ABCL, Allegro CL, Clozure CL, CMUCL, ECL, GNU CLISP,
LispWorks, MKCL, SBCL and XCL),
ASDF hooks into the @code{CL:REQUIRE} facility
and you can just use:
@example
(require :@var{foo})
@end example
In older versions of ASDF, you needed to use
@code{(asdf:oos 'asdf:load-op :@var{foo})}.
If your ASDF is too old to provide @code{asdf:load-system} though
Francois-Rene Rideau
committed
we recommend that you upgrade to ASDF 3.
@xref{Loading ASDF,,Loading an otherwise installed ASDF}.
Note the name of a system is specified as a string or a symbol.
If a symbol (including a keyword), its name is taken and lowercased.
The name must be a suitable value for the @code{:name} initarg
to @code{make-pathname} in whatever filesystem the system is to be
found.
The lower-casing-symbols behaviour is unconventional,
but was selected after some consideration.
The type of systems we want to support
either have lowercase as customary case (Unix, Mac, Windows)
or silently convert lowercase to uppercase (lpns).
@c so this makes more sense than attempting to use @code{:case :common},
@c which is reported not to work on some implementations
@node Other Operations, Moving on, Loading a system, Using ASDF
@section Other Operations
@findex load-system
@findex compile-system
@findex test-system
@findex requrie-system
ASDF provides three commands for the most common system operations:
@code{load-system}, @code{compile-system}, and @code{test-system}.
It also provides @code{require-system}, a version of @code{load-system}
that skips trying to update systems that are already loaded.
@c FIXME: We seem to export @findex bundle-system also.
@findex operate
@findex oos
Because ASDF is an extensible system
for defining @emph{operations} on @emph{components},
it also provides a generic function @code{operate}
(which is usually abbreviated by @code{oos}).
You'll use @code{oos} whenever you want to do something beyond
compiling, loading and testing.
Output from ASDF and ASDF extensions are sent
to the CL stream @code{*standard-output*},
so rebinding that stream around calls to @code{asdf:operate}
should redirect all output from ASDF operations.
@c Reminder: before ASDF can operate on a system, however,
@c it must be able to find and load that system's definition.
@c @xref{Configuring ASDF,,Configuring ASDF to find your systems}.
@c FIXME: the following is too complicated for here, especially since
@c :force hasn't been defined yet. Move it. [2014/02/27:rpg]
@findex already-loaded-systems
@findex require-system
@findex load-system
@vindex *load-system-operation*
For advanced users, note that
@code{require-system} calls @code{load-system}
with keyword arguments @code{:force-not (already-loaded-systems)}.
@code{already-loaded-systems} returns a list of the names of loaded systems.
@code{load-system} applies @code{operate} with the operation from
@code{*load-system-operation*}, which by default is @code{load-op},
the system, and any provided keyword arguments.
@section Moving on
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 Common Lisp software you write yourself,
including how to extend ASDF to define new operation and component types.
@node Defining systems with defsystem, The object model of ASDF, Using ASDF, Top
@comment node-name, next, previous, up
@chapter Defining systems with defsystem
This chapter describes how to use asdf to define systems and develop
software.
@menu
* The defsystem form::
* A more involved example::
* The defsystem grammar::
* Other code in .asd files::
Francois-Rene Rideau
committed
* The package-system extension::
@end menu
@node The defsystem form, A more involved example, Defining systems with defsystem, Defining systems with defsystem
@comment node-name, next, previous, up
@section The defsystem form
Systems can be constructed programmatically
by instantiating components using @code{make-instance}.
Most of the time, however, it is much more practical to use
a static @code{defsystem} form.
This section begins with an example of a system definition,
then gives the full grammar of @code{defsystem}.
Let's look at a simple system.
This is a complete file that would
usually be saved as @file{hello-lisp.asd}:
(in-package :asdf)
:description "hello-lisp: a sample Lisp system."
:version "0.2.1"
:author "Joe User <joe@@example.com>"
:licence "Public Domain"
:components ((:file "packages")
(:file "macros" :depends-on ("packages"))
(:file "hello" :depends-on ("macros"))))
@end lisp
Some notes about this example:
@itemize
The file starts with an @code{in-package} form
to use package @code{asdf}.
You could instead start your definition by using
a qualified name @code{asdf:defsystem}.
If in addition to simply using @code{defsystem},
you are going to define functions,
create ASDF extension, globally bind symbols, etc.,