Fix make-array transforms.
[sbcl.git] / contrib / asdf / asdf.texinfo
1 \input texinfo          @c -*- texinfo -*-
2 @c %**start of header
3 @setfilename asdf.info
4 @settitle ASDF Manual
5 @c %**end of header
6
7 @c We use @&key, etc to escape & from TeX in lambda lists --
8 @c so we need to define them for info as well.
9 @macro AallowOtherKeys
10 &allow-other-keys
11 @end macro
12 @macro Aoptional
13 &optional
14 @end macro
15 @macro Arest
16 &rest
17 @end macro
18 @macro Akey
19 &key
20 @end macro
21 @macro Abody
22 &body
23 @end macro
24
25 @c for install-info
26 @dircategory Software development
27 @direntry
28 * asdf: (asdf).           Another System Definition Facility (for Common Lisp)
29 @end direntry
30
31 @copying
32 This manual describes ASDF, a system definition facility
33 for Common Lisp programs and libraries.
34
35 You can find the latest version of this manual at
36 @url{http://common-lisp.net/project/asdf/asdf.html}.
37
38 ASDF Copyright @copyright{} 2001-2013 Daniel Barlow and contributors.
39
40 This manual Copyright @copyright{} 2001-2013 Daniel Barlow and contributors.
41
42 This manual revised @copyright{} 2009-2013 Robert P. Goldman and Francois-Rene Rideau.
43
44 Permission is hereby granted, free of charge, to any person obtaining
45 a copy of this software and associated documentation files (the
46 ``Software''), to deal in the Software without restriction, including
47 without limitation the rights to use, copy, modify, merge, publish,
48 distribute, sublicense, and/or sell copies of the Software, and to
49 permit persons to whom the Software is furnished to do so, subject to
50 the following conditions:
51
52 The above copyright notice and this permission notice shall be
53 included in all copies or substantial portions of the Software.
54
55 THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
56 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
57 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
58 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
59 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
60 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
61 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
62
63 @end copying
64
65
66
67 @titlepage
68 @title ASDF: Another System Definition Facility
69
70 @c The following two commands start the copyright page.
71 @page
72 @vskip 0pt plus 1filll
73 @insertcopying
74 @end titlepage
75
76 @c Output the table of contents at the beginning.
77 @contents
78
79 @c -------------------
80
81 @ifnottex
82
83 @node Top, Introduction, (dir), (dir)
84 @top asdf: another system definition facility
85
86 @insertcopying
87
88 @menu
89 * Introduction::
90 * Loading ASDF::
91 * Configuring ASDF::
92 * Using ASDF::
93 * Defining systems with defsystem::
94 * The object model of ASDF::
95 * Controlling where ASDF searches for systems::
96 * Controlling where ASDF saves compiled files::
97 * Error handling::
98 * Miscellaneous additional functionality::
99 * Getting the latest version::
100 * FAQ::
101 * TODO list::
102 * Inspiration::
103 * Concept Index::
104 * Function and Class Index::
105 * Variable Index::
106
107 @c @detailmenu
108 @c  --- The Detailed Node Listing ---
109
110 @c Defining systems with defsystem
111
112 @c * The defsystem form::
113 @c * A more involved example::
114 @c * The defsystem grammar::
115 @c * Other code in .asd files::
116
117 @c The object model of ASDF
118
119 @c * Operations::
120 @c * Components::
121 @c * Functions::
122
123 @c Operations
124
125 @c * Predefined operations of ASDF::
126 @c * Creating new operations::
127
128 @c Components
129
130 @c * Common attributes of components::
131 @c * Pre-defined subclasses of component::
132 @c * Creating new component types::
133
134 @c properties
135
136 @c * Pre-defined subclasses of component::
137 @c * Creating new component types::
138
139 @c @end detailmenu
140 @end menu
141
142 @end ifnottex
143
144 @c -------------------
145
146 @node Introduction, Loading ASDF, Top, Top
147 @comment  node-name,  next,  previous,  up
148 @chapter Introduction
149 @cindex ASDF-related features
150 @vindex *features*
151 @cindex Testing for ASDF
152 @cindex ASDF versions
153 @cindex :asdf
154 @cindex :asdf2
155 @cindex :asdf3
156
157 ASDF is Another System Definition Facility:
158 a tool for specifying how systems of Common Lisp software
159 are comprised of components (sub-systems and files),
160 and how to operate on these components in the right order
161 so that they can be compiled, loaded, tested, etc.
162
163 ASDF presents three faces:
164 one for users of Common Lisp software who want to reuse other people's code,
165 one for writers of Common Lisp software who want to specify how to build their systems,
166 one for implementers of Common Lisp extensions who want to extend the build system.
167 @xref{Using ASDF,,Loading a system},
168 to learn how to use ASDF to load a system.
169 @xref{Defining systems with defsystem},
170 to learn how to define a system of your own.
171 @xref{The object model of ASDF}, for a description of
172 the ASDF internals and how to extend ASDF.
173
174 @emph{Nota Bene}:
175 We have released ASDF 2.000 on May 31st 2010,
176 and ASDF 3.0 on January 31st 2013.
177 Releases of ASDF 2 and later have since then been included
178 in all actively maintained CL implementations that used to bundle ASDF 1,
179 plus some implementations that didn't use to,
180 and has been made to work with all actively used CL implementations and a few more.
181 @xref{FAQ,,``What has changed between ASDF 1 and ASDF 2?''}.
182 Furthermore, it is possible to upgrade from ASDF 1 to ASDF 2 or ASDF 3 on the fly.
183 For this reason, we have stopped supporting ASDF 1 and ASDF 2.
184 If you are using ASDF 1 or ASDF 2 and are experiencing any kind of issues or limitations,
185 we recommend you upgrade to ASDF 3
186 --- and we explain how to do that. @xref{Loading ASDF}.
187
188 Also note that ASDF is not to be confused with ASDF-Install.
189 ASDF-Install is not part of ASDF, but a separate piece of software.
190 ASDF-Install is also unmaintained and obsolete.
191 We recommend you use Quicklisp instead,
192 which works great and is being actively maintained.
193 If you want to download software from version control instead of tarballs,
194 so you may more easily modify it, we recommend clbuild.
195
196
197 @node Loading ASDF, Configuring ASDF, Introduction, Top
198 @comment  node-name,  next,  previous,  up
199 @chapter Loading ASDF
200 @vindex *central-registry*
201 @cindex link farm
202 @findex load-system
203 @findex require-system
204 @findex compile-system
205 @findex test-system
206 @cindex system directory designator
207 @findex operate
208 @findex oos
209
210 @c @menu
211 @c * Installing ASDF::
212 @c @end menu
213
214
215 @section Loading a pre-installed ASDF
216
217 Most recent Lisp implementations include a copy of ASDF 2, and soon ASDF 3.
218 You can usually load this copy using Common Lisp's @code{require} function:
219
220 @lisp
221 (require "asdf")
222 @end lisp
223
224 As of the writing of this manual,
225 the following implementations provide ASDF 2 this way:
226 abcl allegro ccl clisp cmucl ecl lispworks mkcl sbcl xcl.
227 The following implementation doesn't provide it yet but will in an upcoming release:
228 scl.
229 The following implementations are obsolete, not actively maintained,
230 and most probably will never bundle it:
231 cormanlisp gcl genera mcl.
232
233 If the implementation you are using doesn't provide ASDF 2 or ASDF 3,
234 see @pxref{Loading ASDF,,Loading an otherwise installed ASDF} below.
235 If that implementation is still actively maintained,
236 you may also send a bug report to your Lisp vendor and complain
237 about their failing to provide ASDF.
238
239 NB: all implementations except clisp also accept
240 @code{(require "ASDF")}, @code{(require 'asdf)} and @code{(require :asdf)}.
241 For portability's sake, you probably want to use @code{(require "asdf")}.
242
243
244 @section Checking whether ASDF is loaded
245
246 To check whether ASDF is properly loaded in your current Lisp image,
247 you can run this form:
248
249 @lisp
250 (asdf:asdf-version)
251 @end lisp
252
253 If it returns a string,
254 that is the version of ASDF that is currently installed.
255
256 If it raises an error,
257 then either ASDF is not loaded, or
258 you are using an old version of ASDF.
259
260 You can check whether an old version is loaded
261 by checking if the ASDF package is present.
262 The form below will allow you to programmatically determine
263 whether a recent version is loaded, an old version is loaded,
264 or none at all:
265
266 @lisp
267 (when (find-package :asdf)
268   (let ((ver (symbol-value (or (find-symbol (string :*asdf-version*) :asdf)
269                                (find-symbol (string :*asdf-revision*) :asdf)))))
270     (etypecase ver
271       (string ver)
272       (cons (with-output-to-string (s)
273               (loop for (n . m) on ver do (princ n s) (when m (princ "." s)))))
274       (null "1.0"))))
275 @end lisp
276
277 If it returns @code{NIL} then ASDF is not installed.
278 Otherwise it should return a string.
279 If it returns @code{"1.0"}, then it can actually be
280 any version before 1.77 or so, or some buggy variant of 1.x.
281
282 If you are experiencing problems with ASDF,
283 please try upgrading to the latest released version,
284 using the method below,
285 before you contact us and raise an issue.
286
287
288 @section Upgrading ASDF
289
290 If your implementation provides ASDF 3 or later,
291 you only need to @code{(require "asdf")}:
292 ASDF will automatically look whether an updated version of itself is available
293 amongst the regularly configured systems, before it compiles anything else.
294 See @pxref{Configuring ASDF} below.
295
296 If your implementation does provide ASDF 2 or later,
297 but not ASDF 3 or later,
298 and you want to upgrade to a more recent version,
299 you need to install and configure your ASDF as above,
300 and additionally, you need to explicitly tell ASDF to load itself,
301 right after you require your implementation's old ASDF 2:
302
303 @lisp
304 (require "asdf")
305 (asdf:load-system :asdf)
306 @end lisp
307
308 If on the other hand, your implementation only provides an old ASDF,
309 you will require a special configuration step and an old-style loading.
310 Take special attention to not omit the trailing directory separator
311 @code{/} at the end of your pathname:
312
313 @lisp
314 (require "asdf")
315 (push #p"@var{/path/to/new/asdf/}" asdf:*central-registry*)
316 (asdf:oos 'asdf:load-op :asdf)
317 @end lisp
318
319 Note that ASDF 1 won't redirect its output files,
320 or at least won't do it according to your usual ASDF 2 configuration.
321 You therefore need write access on the directory
322 where you install the new ASDF,
323 and make sure you're not using it
324 for multiple mutually incompatible implementations.
325 At worst, you may have to have multiple copies of the new ASDF,
326 e.g. one per implementation installation, to avoid clashes.
327 Note that to our knowledge all implementations that provide ASDF
328 provide ASDF 2 in their latest release, so
329 you may want to upgrade your implementation rather than go through that hoop.
330
331 Finally, if you are using an unmaintained implementation
332 that does not provide ASDF at all,
333 see @pxref{Loading ASDF,,Loading an otherwise installed ASDF} below.
334
335 Note that there are some limitations to upgrading ASDF:
336 @itemize
337 @item
338 Previously loaded ASDF extension becomes invalid, and will need to be reloaded.
339 This applies to e.g. CFFI-Grovel, or to hacks used by ironclad, etc.
340 Since it isn't possible to automatically detect what extensions are present
341 that need to be invalidated,
342 ASDF will actually invalidate all previously loaded systems
343 when it is loaded on top of a different ASDF version,
344 starting with ASDF 2.014.8 (as far as releases go, 2.015);
345 and it will automatically attempt this self-upgrade as its very first step
346 starting with ASDF 3.
347
348 @item
349 For this an many other reasons,
350 it important reason to load, configure and upgrade ASDF (if needed)
351 as one of the very first things done by your build and startup scripts.
352 Until all implementations provide ASDF 3 or later,
353 it is safer if you upgrade ASDF and its extensions as a special step
354 at the very beginning of whatever script you are running,
355 before you start using ASDF to load anything else;
356 even afterwards, it is still a good idea, to avoid having to
357 load and reload code twice as it gets invalidated.
358
359 @item
360 Until all implementations provide ASDF 3 or later,
361 it is unsafe to upgrade ASDF as part of loading a system
362 that depends on a more recent version of ASDF,
363 since the new one might shadow the old one while the old one is running,
364 and the running old one will be confused
365 when extensions are loaded into the new one.
366 In the meantime, we recommend that your systems should @emph{not} specify
367 @code{:depends-on (:asdf)}, or @code{:depends-on ((:version :asdf "2.010"))},
368 but instead that they check that a recent enough ASDF is installed,
369 with such code as:
370 @example
371 (unless (or #+asdf2 (asdf:version-satisfies
372                      (asdf:asdf-version) *required-asdf-version*))
373   (error "FOO requires ASDF ~A or later." *required-asdf-version*))
374 @end example
375 @item
376 Until all implementations provide ASDF 3 or later,
377 it is unsafe for a system to transitively depend on ASDF
378 and not directly depend on ASDF;
379 if any of the system you use either depends-on asdf,
380 system-depends-on asdf, or transitively does,
381 you should also do as well.
382 @end itemize
383
384
385 @section Loading an otherwise installed ASDF
386
387 If your implementation doesn't include ASDF,
388 if for some reason the upgrade somehow fails,
389 does not or cannot apply to your case,
390 you will have to install the file @file{asdf.lisp}
391 somewhere and load it with:
392
393 @lisp
394 (load "/path/to/your/installed/asdf.lisp")
395 @end lisp
396
397 The single file @file{asdf.lisp} is all you normally need to use ASDF.
398
399 You can extract this file from latest release tarball on the
400 @url{http://common-lisp.net/project/asdf/,ASDF website}.
401 If you are daring and willing to report bugs, you can get
402 the latest and greatest version of ASDF from its git repository.
403 @xref{Getting the latest version}.
404
405 For maximum convenience you might want to have ASDF loaded
406 whenever you start your Lisp implementation,
407 for example by loading it from the startup script or dumping a custom core
408 --- check your Lisp implementation's manual for details.
409
410
411 @node Configuring ASDF, Using ASDF, Loading ASDF, Top
412 @comment  node-name,  next,  previous,  up
413
414 @chapter Configuring ASDF
415
416 @section Configuring ASDF to find your systems
417
418 So it may compile and load your systems, ASDF must be configured to find
419 the @file{.asd} files that contain system definitions.
420
421 Since ASDF 2, the preferred way to configure where ASDF finds your systems is
422 the @code{source-registry} facility,
423 fully described in its own chapter of this manual.
424 @xref{Controlling where ASDF searches for systems}.
425
426 The default location for a user to install Common Lisp software is under
427 @file{~/.local/share/common-lisp/source/}.
428 If you install software there (it can be a symlink),
429 you don't need further configuration.
430 If you're installing software yourself at a location that isn't standard,
431 you have to tell ASDF where you installed it. See below.
432 If you're using some tool to install software (e.g. Quicklisp),
433 the authors of that tool should already have configured ASDF.
434
435 The simplest way to add a path to your search path,
436 say @file{/home/luser/.asd-link-farm/}
437 is to create the directory
438 @file{~/.config/common-lisp/source-registry.conf.d/}
439 and there create a file with any name of your choice,
440 and with the type @file{conf},
441 for instance @file{42-asd-link-farm.conf}
442 containing the line:
443
444 @kbd{(:directory "/home/luser/.asd-link-farm/")}
445
446 If you want all the subdirectories under @file{/home/luser/lisp/}
447 to be recursively scanned for @file{.asd} files, instead use:
448
449 @kbd{(:tree "/home/luser/lisp/")}
450
451 Note that your Operating System distribution or your system administrator
452 may already have configured system-managed libraries for you.
453
454 The required @file{.conf} extension allows you to have disabled files
455 or editor backups (ending in @file{~}), and works portably
456 (for instance, it is a pain to allow both empty and non-empty extension on CLISP).
457 Excluded are files the name of which start with a @file{.} character.
458 It is customary to start the filename with two digits
459 that specify the order in which the directories will be scanned.
460
461 ASDF will automatically read your configuration
462 the first time you try to find a system.
463 You can reset the source-registry configuration with:
464
465 @lisp
466 (asdf:clear-source-registry)
467 @end lisp
468
469 And you probably should do so before you dump your Lisp image,
470 if the configuration may change
471 between the machine where you save it at the time you save it
472 and the machine you resume it at the time you resume it.
473 Actually, you should use @code{(asdf:clear-configuration)}
474 before you dump your Lisp image, which includes the above.
475
476
477 @section Configuring ASDF to find your systems --- old style
478
479 The old way to configure ASDF to find your systems is by
480 @code{push}ing directory pathnames onto the variable
481 @code{asdf:*central-registry*}.
482
483 You must configure this variable between the time you load ASDF
484 and the time you first try to use it.
485 Loading and configuring ASDF presumably happen
486 as part of some initialization script that builds or starts
487 your Common Lisp software system.
488 (For instance, some SBCL users used to put it in their @file{~/.sbclrc}.)
489
490 The @code{asdf:*central-registry*} is empty by default in ASDF 2 or ASDF 3,
491 but is still supported for compatibility with ASDF 1.
492 When used, it takes precedence over the above source-registry@footnote{
493 It is possible to further customize
494 the system definition file search.
495 That's considered advanced use, and covered later:
496 search forward for
497 @code{*system-definition-search-functions*}.
498 @xref{Defining systems with defsystem}.}.
499
500 For instance, if you wanted ASDF to find the @file{.asd} file
501 @file{/home/me/src/foo/foo.asd} your initialization script
502 could after it loads ASDF with @code{(require "asdf")}
503 configure it with:
504
505 @lisp
506 (push "/home/me/src/foo/" asdf:*central-registry*)
507 @end lisp
508
509 Note the trailing slash: when searching for a system,
510 ASDF will evaluate each entry of the central registry
511 and coerce the result to a pathname@footnote{
512 ASDF will indeed call @code{EVAL} on each entry.
513 It will also skip entries that evaluate to @code{NIL}.
514
515 Strings and pathname objects are self-evaluating,
516 in which case the @code{EVAL} step does nothing;
517 but you may push arbitrary SEXP onto the central registry,
518 that will be evaluated to compute e.g. things that depend
519 on the value of shell variables or the identity of the user.
520
521 The variable @code{asdf:*central-registry*} is thus a list of
522 ``system directory designators''.
523 A @dfn{system directory designator} is a form
524 which will be evaluated whenever a system is to be found,
525 and must evaluate to a directory to look in.
526 By ``directory'' here, we mean
527 ``designator for a pathname with a supplied DIRECTORY component''.
528 }
529 at which point the presence of the trailing directory name separator
530 is necessary to tell Lisp that you're discussing a directory
531 rather than a file.
532
533 Typically, however, there are a lot of @file{.asd} files, and
534 a common idiom was to have to put
535 a bunch of @emph{symbolic links} to @file{.asd} files
536 in a common directory
537 and push @emph{that} directory (the ``link farm'')
538 to the
539 @code{asdf:*central-registry*}
540 instead of pushing each of the many involved directories
541 to the @code{asdf:*central-registry*}.
542 ASDF knows how to follow such @emph{symlinks}
543 to the actual file location when resolving the paths of system components
544 (on Windows, you can use Windows shortcuts instead of POSIX symlinks;
545 if you try aliases under MacOS, we are curious to hear about your experience).
546
547 For example, if @code{#p"/home/me/cl/systems/"} (note the trailing slash)
548 is a member of @code{*central-registry*}, you could set up the
549 system @var{foo} for loading with asdf with the following
550 commands at the shell:
551
552 @example
553 $ cd /home/me/cl/systems/
554 $ ln -s ~/src/foo/foo.asd .
555 @end example
556
557 This old style for configuring ASDF is not recommended for new users,
558 but it is supported for old users, and for users who want to programmatically
559 control what directories are added to the ASDF search path.
560
561
562 @section Configuring where ASDF stores object files
563 @findex clear-output-translations
564
565 ASDF lets you configure where object files will be stored.
566 Sensible defaults are provided and
567 you shouldn't normally have to worry about it.
568
569 This allows the same source code repository may be shared
570 between several versions of several Common Lisp implementations,
571 between several users using different compilation options
572 and without write privileges on shared source directories, etc.
573 This also allows to keep source directories uncluttered
574 by plenty of object files.
575
576 Starting with ASDF 2, the @code{asdf-output-translations} facility
577 was added to ASDF itself, that controls where object files will be stored.
578 This facility is fully described in a chapter of this manual,
579 @ref{Controlling where ASDF saves compiled files}.
580
581 The simplest way to add a translation to your search path,
582 say from @file{/foo/bar/baz/quux/}
583 to @file{/where/i/want/my/fasls/}
584 is to create the directory
585 @file{~/.config/common-lisp/asdf-output-translations.conf.d/}
586 and there create a file with any name of your choice and the type @file{conf},
587 for instance @file{42-bazquux.conf}
588 containing the line:
589
590 @kbd{("/foo/bar/baz/quux/" "/where/i/want/my/fasls/")}
591
592 To disable output translations for source under a given directory,
593 say @file{/toto/tata/}
594 you can create a file @file{40-disable-toto.conf}
595 with the line:
596
597 @kbd{("/toto/tata/")}
598
599 To wholly disable output translations for all directories,
600 you can create a file @file{00-disable.conf}
601 with the line:
602
603 @kbd{(t t)}
604
605 Note that your Operating System distribution or your system administrator
606 may already have configured translations for you.
607 In absence of any configuration, the default is to redirect everything
608 under an implementation-dependent subdirectory of @file{~/.cache/common-lisp/}.
609 @xref{Controlling where ASDF searches for systems}, for full details.
610
611 The required @file{.conf} extension allows you to have disabled files
612 or editor backups (ending in @file{~}), and works portably
613 (for instance, it is a pain to allow both empty and non-empty extension on CLISP).
614 Excluded are files the name of which start with a @file{.} character.
615 It is customary to start the filename with two digits
616 that specify the order in which the directories will be scanned.
617
618 ASDF will automatically read your configuration
619 the first time you try to find a system.
620 You can reset the source-registry configuration with:
621
622 @lisp
623 (asdf:clear-output-translations)
624 @end lisp
625
626 And you probably should do so before you dump your Lisp image,
627 if the configuration may change
628 between the machine where you save it at the time you save it
629 and the machine you resume it at the time you resume it.
630 (Once again, you should use @code{(asdf:clear-configuration)}
631 before you dump your Lisp image, which includes the above.)
632
633 Finally note that before ASDF 2,
634 other ASDF add-ons offered the same functionality,
635 each in subtly different and incompatible ways:
636 ASDF-Binary-Locations, cl-launch, common-lisp-controller.
637 ASDF-Binary-Locations is now not needed anymore and should not be used.
638 cl-launch 3.000 and common-lisp-controller 7.2 have been updated
639 to just delegate this functionality to ASDF.
640
641 @node Using ASDF, Defining systems with defsystem, Configuring ASDF, Top
642 @comment  node-name,  next,  previous,  up
643
644
645 @section Resetting Configuration
646
647 When you dump and restore an image, or when you tweak your configuration,
648 you may want to reset the ASDF configuration.
649 For that you may use the following function:
650
651 @defun clear-configuration
652    undoes any ASDF configuration,
653    regarding source-registry or output-translations.
654 @end defun
655
656 If you use SBCL, CMUCL or SCL, you may use this snippet
657 so that the ASDF configuration be cleared automatically as you dump an image:
658
659 @example
660 #+(or cmu sbcl scl)
661 (pushnew 'clear-configuration
662          #+(or cmu scl) ext:*before-save-initializations*
663          #+sbcl sb-ext:*save-hooks*)
664 @end example
665
666 For compatibility with all Lisp implementations, however,
667 you might want instead your build script to explicitly call
668 @code{(asdf:clear-configuration)} at an appropriate moment before dumping.
669
670
671 @chapter Using ASDF
672
673 @section Loading a system
674
675 The system @var{foo} is loaded (and compiled, if necessary)
676 by evaluating the following Lisp form:
677
678 @example
679 (asdf:load-system :@var{foo})
680 @end example
681
682 On some implementations (namely recent versions of
683 ABCL, Allegro CL, Clozure CL, CMUCL, ECL, GNU CLISP,
684 LispWorks, MKCL, SBCL and XCL),
685 ASDF hooks into the @code{CL:REQUIRE} facility
686 and you can just use:
687
688 @example
689 (require :@var{foo})
690 @end example
691
692 In older versions of ASDF, you needed to use
693 @code{(asdf:oos 'asdf:load-op :@var{foo})}.
694 If your ASDF is too old to provide @code{asdf:load-system} though
695 we recommend that you upgrade to ASDF 3.
696 @xref{Loading ASDF,,Loading an otherwise installed ASDF}.
697
698 Note the name of a system is specified as a string or a symbol,
699 typically a keyword.
700 If a symbol (including a keyword), its name is taken and lowercased.
701 The name must be a suitable value for the @code{:name} initarg
702 to @code{make-pathname} in whatever filesystem the system is to be found.
703 The lower-casing-symbols behaviour is unconventional,
704 but was selected after some consideration.
705 Observations suggest that the type of systems we want to support
706 either have lowercase as customary case (unix, mac, windows)
707 or silently convert lowercase to uppercase (lpns),
708 so this makes more sense than attempting to use @code{:case :common},
709 which is reported not to work on some implementations
710
711
712 @section Other Operations
713
714 ASDF provides three commands for the most common system operations:
715 @code{load-system}, @code{compile-system} or @code{test-system}.
716 It also provides @code{require-system}, a version of @code{load-system}
717 that skips trying to update systems that are already loaded.
718
719 Because ASDF is an extensible system
720 for defining @emph{operations} on @emph{components},
721 it also provides a generic function @code{operate}
722 (which is usually abbreviated by @code{oos}).
723 You'll use @code{oos} whenever you want to do something beyond
724 compiling, loading and testing.
725
726 Output from ASDF and ASDF extensions are supposed to be sent
727 to the CL stream @code{*standard-output*},
728 and so rebinding that stream around calls to @code{asdf:operate}
729 should redirect all output from ASDF operations.
730
731 Reminder: before ASDF can operate on a system, however,
732 it must be able to find and load that system's definition.
733 @xref{Configuring ASDF,,Configuring ASDF to find your systems}.
734
735 For the advanced users, note that
736 @code{require-system} calls @code{load-system}
737 with keyword arguments @code{:force-not (loaded-systems)}.
738 @code{loaded-systems} returns a list of the names of loaded systems.
739 @code{load-system} applies @code{operate} with the operation from
740 @code{*load-system-operation*}, which by default is @code{load-op},
741 the system, and any provided keyword arguments.
742
743 @section Summary
744
745 To use ASDF:
746
747 @itemize
748 @item
749 Load ASDF itself into your Lisp image, either through
750 @code{(require "asdf")} or else through
751 @code{(load "/path/to/asdf.lisp")}.
752
753 @item
754 Make sure ASDF can find system definitions
755 thanks to proper source-registry configuration.
756
757 @item
758 Load a system with @code{(asdf:load-system :my-system)}
759 or use some other operation on some system of your choice.
760
761 @end itemize
762
763 @section Moving on
764
765 That's all you need to know to use ASDF to load systems written by others.
766 The rest of this manual deals with writing system definitions
767 for Common Lisp software you write yourself,
768 including how to extend ASDF to define new operation and component types.
769
770
771 @node Defining systems with defsystem, The object model of ASDF, Using ASDF, Top
772 @comment  node-name,  next,  previous,  up
773 @chapter Defining systems with defsystem
774
775 This chapter describes how to use asdf to define systems and develop
776 software.
777
778
779 @menu
780 * The defsystem form::
781 * A more involved example::
782 * The defsystem grammar::
783 * Other code in .asd files::
784 @end menu
785
786 @node  The defsystem form, A more involved example, Defining systems with defsystem, Defining systems with defsystem
787 @comment  node-name,  next,  previous,  up
788 @section The defsystem form
789
790 Systems can be constructed programmatically
791 by instantiating components using @code{make-instance}.
792 Most of the time, however, it is much more practical to use
793 a static @code{defsystem} form.
794 This section begins with an example of a system definition,
795 then gives the full grammar of @code{defsystem}.
796
797 Let's look at a simple system.
798 This is a complete file that would
799 usually be saved as @file{hello-lisp.asd}:
800
801 @lisp
802 (in-package :asdf)
803
804 (defsystem "hello-lisp"
805   :description "hello-lisp: a sample Lisp system."
806   :version "0.2.1"
807   :author "Joe User <joe@@example.com>"
808   :licence "Public Domain"
809   :components ((:file "packages")
810                (:file "macros" :depends-on ("packages"))
811                (:file "hello" :depends-on ("macros"))))
812 @end lisp
813
814 Some notes about this example:
815
816 @itemize
817
818 @item
819 The file starts with an @code{in-package} form
820 to use package @code{asdf}.
821 You could instead start your definition by using
822 a qualified name @code{asdf:defsystem}.
823
824 @item
825 If in addition to simply using @code{defsystem},
826 you are going to define functions,
827 create ASDF extension, globally bind symbols, etc.,
828 it is recommended that to avoid namespace pollution between systems,
829 you should create your own package for that purpose,
830 for instance replacing the above @code{(in-package :asdf)} with:
831
832 @lisp
833 (defpackage :foo-system
834   (:use :cl :asdf))
835
836 (in-package :foo-system)
837 @end lisp
838
839 @item
840 The @code{defsystem} form defines a system named @code{hello-lisp}
841 that contains three source files:
842 @file{packages}, @file{macros} and @file{hello}.
843
844 @item
845 The file @file{macros} depends on @file{packages}
846 (presumably because the package it's in is defined in @file{packages}),
847 and the file @file{hello} depends on @file{macros}
848 (and hence, transitively on @file{packages}).
849 This means that ASDF will compile and load @file{packages} and @file{macros}
850 before starting the compilation of file @file{hello}.
851
852 @item
853 The files are located in the same directory
854 as the file with the system definition.
855 ASDF resolves symbolic links (or Windows shortcuts)
856 before loading the system definition file and
857 stores its location in the resulting system@footnote{
858 It is possible, though almost never necessary, to override this behaviour.}.
859 This is a good thing because the user can move the system sources
860 without having to edit the system definition.
861
862 @c FIXME: Should have cross-reference to "Version specifiers" in the
863 @c defsystem grammar, but the cross-referencing is so broken by
864 @c insufficient node breakdown that I have not put one in.
865 @item
866 Make sure you know how the @code{:version} numbers will be parsed!
867 They are parsed as period-separated lists of integers.
868 I.e., in the example, @code{0.2.1} is to be interpreted,
869 roughly speaking, as @code{(0 2 1)}.
870 In particular, version @code{0.2.1}
871 is interpreted the same as @code{0.0002.1} and
872 is strictly version-less-than version @code{0.20.1},
873 even though the two are the same when interpreted as decimal fractions.
874 Instead of a string representing the version,
875 the @code{:version} argument can be an expression that is resolved to
876 such a string using the following trivial domain-specific language:
877 in addition to being a literal string, it can be an expression of the form
878 @code{(:read-file-form <pathname-or-string> :at <access-at-specifier>)},
879 which will be resolved by reading a form in the specified pathname
880 (read as a subpathname of the current system if relative or a unix-namestring).
881 You may use a @code{uiop:access-at} specifier
882 with the (optional) @code{:at} keyword,
883 by default the specifier is @code{0}, meaning the first form is returned.
884
885 @cindex :version
886
887 @end itemize
888
889 @node  A more involved example, The defsystem grammar, The defsystem form, Defining systems with defsystem
890 @comment  node-name,  next,  previous,  up
891 @section A more involved example
892
893 Let's illustrate some more involved uses of @code{defsystem} via a
894 slightly convoluted example:
895
896 @lisp
897 (defsystem "foo"
898   :version "1.0.0"
899   :components ((:module "mod"
900                             :components ((:file "bar")
901                                                   (:file"baz")
902                                                   (:file "quux"))
903                             :perform (compile-op :after (op c)
904                                                   (do-something c))
905                             :explain (compile-op :after (op c)
906                                             (explain-something c)))
907                          (:file "blah")))
908 @end lisp
909
910 The @code{:module} component named @code{"mod"} is a collection of three files,
911 which will be located in a subdirectory of the main code directory named
912 @file{mod} (this location can be overridden; see the discussion of the
913 @code{:pathname} option in @ref{The defsystem grammar}).
914
915 The method-form tokens provide a shorthand for defining methods on
916 particular components.  This part
917
918 @lisp
919                 :perform (compile-op :after (op c)
920                           (do-something c))
921                 :explain (compile-op :after (op c)
922                           (explain-something c))
923 @end lisp
924
925 has the effect of
926
927 @lisp
928 (defmethod perform :after ((op compile-op) (c (eql ...)))
929            (do-something c))
930 (defmethod explain :after ((op compile-op) (c (eql ...)))
931            (explain-something c))
932 @end lisp
933
934 where @code{...} is the component in question.
935 In this case @code{...} would expand to something like
936
937 @lisp
938 (find-component (find-system "foo") "mod")
939 @end lisp
940
941 For more details on the syntax of such forms, see @ref{The defsystem
942 grammar}.
943 For more details on what these methods do, @pxref{Operations} in
944 @ref{The object model of ASDF}.
945
946 @c The following plunge into the weeds is not appropriate in this
947 @c location. [2010/10/03:rpg]
948 @c note that although this also supports @code{:before} methods,
949 @c they may not do what you want them to ---
950 @c a @code{:before} method on perform @code{((op compile-op) (c (eql ...)))}
951 @c will run after all the dependencies and sub-components have been processed,
952 @c but before the component in question has been compiled.
953
954 @node  The defsystem grammar, Other code in .asd files, A more involved example, Defining systems with defsystem
955 @comment  node-name,  next,  previous,  up
956 @section The defsystem grammar
957
958 @c FIXME: @var typesetting not consistently used here.  We should either expand
959 @c its use to everywhere, or we should kill it everywhere.
960
961
962 @example
963 system-definition := ( defsystem system-designator @var{system-option}* )
964
965 system-option := :defsystem-depends-on system-list
966                  | :weakly-depends-on @var{system-list}
967                  | :class class-name (see discussion below)
968                  | module-option
969                  | option
970
971 module-option := :components component-list
972                  | :serial [ t | nil ]
973
974 option :=
975         | :pathname pathname-specifier
976         | :default-component-class class-name
977         | :perform method-form
978         | :explain method-form
979         | :output-files method-form
980         | :operation-done-p method-form
981         | :if-feature feature-expression
982         | :depends-on ( @var{dependency-def}* )
983         | :in-order-to ( @var{dependency}+ )
984
985
986 system-list := ( @var{simple-component-name}* )
987
988 component-list := ( @var{component-def}* )
989
990 component-def  := ( component-type simple-component-name @var{option}* )
991
992 component-type := :module | :file | :static-file | other-component-type
993
994 other-component-type := symbol-by-name (@pxref{The defsystem grammar,,Component types})
995
996 dependency-def := simple-component-name
997                | ( :feature name )
998                | ( :version simple-component-name version-specifier)
999
1000 dependency := (dependent-op @var{requirement}+)
1001 requirement := (required-op @var{required-component}+)
1002              | (feature feature-name)
1003 dependent-op := operation-name
1004 required-op := operation-name | feature
1005
1006 simple-component-name := string
1007                       |  symbol
1008
1009 pathname-specifier := pathname | string | symbol
1010
1011 method-form := (operation-name qual lambda-list @Arest body)
1012 qual := method qualifier
1013
1014 component-dep-fail-option := :fail | :try-next | :ignore
1015
1016 feature-expression := keyword | (:and @var{feature-expression}*)
1017                       | (:or @var{feature-expression}*) | (:not @var{feature-expression})
1018 @end example
1019
1020
1021 @subsection Component names
1022
1023 Component names (@code{simple-component-name})
1024 may be either strings or symbols.
1025
1026 @subsection Component types
1027
1028 Component type names, even if expressed as keywords, will be looked up
1029 by name in the current package and in the asdf package, if not found in
1030 the current package.  So a component type @code{my-component-type}, in
1031 the current package @code{my-system-asd} can be specified as
1032 @code{:my-component-type}, or @code{my-component-type}.
1033
1034 @code{system} and its subclasses are @emph{not}
1035 allowed as component types for such children components.
1036
1037 @subsection System class names
1038
1039 A system class name will be looked up
1040 in the same way as a Component type (see above),
1041 except that only @code{system} and its subclasses are allowed.
1042 Typically, one will not need to specify a system
1043 class name, unless using a non-standard system class defined in some
1044 ASDF extension, typically loaded through @code{DEFSYSTEM-DEPENDS-ON},
1045 see below.  For such class names in the ASDF package, we recommend that
1046 the @code{:class} option be specified using a keyword symbol, such as
1047
1048 @example
1049 :class :MY-NEW-SYSTEM-SUBCLASS
1050 @end example
1051
1052 This practice will ensure that package name conflicts are avoided.
1053 Otherwise, the symbol @code{MY-NEW-SYSTEM-SUBCLASS} will be read into
1054 the current package @emph{before} it has been exported from the ASDF
1055 extension loaded by @code{:defsystem-depends-on}, causing a name
1056 conflict in the current package.
1057
1058 @subsection Defsystem depends on
1059 @cindex :defsystem-depends-on
1060
1061 The @code{:defsystem-depends-on} option to @code{defsystem} allows the
1062 programmer to specify another ASDF-defined system or set of systems that
1063 must be loaded @emph{before} the system definition is processed.
1064 Typically this is used to load an ASDF extension that is used in the
1065 system definition.
1066
1067 @subsection Weakly depends on 
1068 @cindex :weakly-depends-on
1069
1070 We do @emph{NOT} recommend you use this feature.
1071 If you are tempted to write a system @var{foo}
1072 that weakly-depends-on a system @var{bar},
1073 we recommend that you should instead
1074 write system @var{foo} in a parametric way,
1075 and offer some special variable and/or some hook to specialize its behavior;
1076 then you should write a system @var{foo+bar}
1077 that does the hooking of things together.
1078
1079 The (deprecated) @code{:weakly-depends-on} option to @code{defsystem}
1080 allows the programmer to specify another ASDF-defined system or set of systems
1081 that ASDF should @emph{try} to load,
1082 but need not load in order to be successful.
1083 Typically this is used if there are a number of systems
1084 that, if present, could provide additional functionality,
1085 but which are not necessary for basic function.
1086
1087 Currently, although it is specified to be an option only to @code{defsystem},
1088 this option is accepted at any component, but it probably
1089 only makes sense at the @code{defsystem} level.
1090 Programmers are cautioned not
1091 to use this component option except at the @code{defsystem} level, as
1092 this anomalous behavior may be removed without warning.
1093
1094 Finally, you might look into the @code{asdf-system-connections} extension,
1095 that will let you define additional code to be loaded
1096 when two systems are simultaneously loaded.
1097 It may or may not be considered good style, but at least it can be used
1098 in a way that has deterministic behavior independent of load order,
1099 unlike @code{weakly-depends-on}.
1100
1101
1102 @subsection Pathname specifiers
1103 @cindex pathname specifiers
1104
1105 A pathname specifier (@code{pathname-specifier})
1106 may be a pathname, a string or a symbol.
1107 When no pathname specifier is given for a component,
1108 which is the usual case, the component name itself is used.
1109
1110 If a string is given, which is the usual case,
1111 the string will be interpreted as a Unix-style pathname
1112 where @code{/} characters will be interpreted as directory separators.
1113 Usually, Unix-style relative pathnames are used
1114 (i.e. not starting with @code{/}, as opposed to absolute pathnames);
1115 they are relative to the path of the parent component.
1116 Finally, depending on the @code{component-type},
1117 the pathname may be interpreted as either a file or a directory,
1118 and if it's a file,
1119 a file type may be added corresponding to the @code{component-type},
1120 or else it will be extracted from the string itself (if applicable).
1121
1122 For instance, the @code{component-type} @code{:module}
1123 wants a directory pathname, and so a string @code{"foo/bar"}
1124 will be interpreted as the pathname @file{#p"foo/bar/"}.
1125 On the other hand, the @code{component-type} @code{:file}
1126 wants a file of type @code{lisp}, and so a string @code{"foo/bar"}
1127 will be interpreted as the pathname @file{#p"foo/bar.lisp"},
1128 and a string @code{"foo/bar.quux"}
1129 will be interpreted as the pathname @file{#p"foo/bar.quux.lisp"}.
1130 Finally, the @code{component-type} @code{:static-file}
1131 wants a file without specifying a type, and so a string @code{"foo/bar"}
1132 will be interpreted as the pathname @file{#p"foo/bar"},
1133 and a string @code{"foo/bar.quux"}
1134 will be interpreted as the pathname @file{#p"foo/bar.quux"}.
1135
1136 ASDF does not interpret the string @code{".."} to designate the parent
1137 directory.  This string will be passed through to the underlying
1138 operating system for interpretation.  We @emph{believe} that this will
1139 work on all platforms where ASDF is deployed, but do not guarantee this
1140 behavior.  A pathname object with a relative directory component of
1141 @code{:up} or @code{:back} is the only guaranteed way to specify a
1142 parent directory.
1143
1144 If a symbol is given, it will be translated into a string,
1145 and downcased in the process.
1146 The downcasing of symbols is unconventional,
1147 but was selected after some consideration.
1148 Observations suggest that the type of systems we want to support
1149 either have lowercase as customary case (Unix, Mac, windows)
1150 or silently convert lowercase to uppercase (lpns),
1151 so this makes more sense than attempting to use @code{:case :common}
1152 as argument to @code{make-pathname},
1153 which is reported not to work on some implementations.
1154
1155 Pathname objects may be given to override the path for a component.
1156 Such objects are typically specified using reader macros such as @code{#p}
1157 or @code{#.(make-pathname ...)}.
1158 Note however, that @code{#p...} is a shorthand for @code{#.(parse-namestring ...)}
1159 and that the behavior of @code{parse-namestring} is completely non-portable,
1160 unless you are using Common Lisp @code{logical-pathname}s
1161 (@pxref{The defsystem grammar,,Using logical pathnames}, below).
1162 Pathnames made with @code{#.(make-pathname ...)}
1163 can usually be done more easily with the string syntax above.
1164 The only case that you really need a pathname object is to override
1165 the component-type default file type for a given component.
1166 Therefore, pathname objects should only rarely be used.
1167 Unhappily, ASDF 1 didn't properly support
1168 parsing component names as strings specifying paths with directories,
1169 and the cumbersome @code{#.(make-pathname ...)} syntax had to be used.
1170 An alternative to @code{#.} read-time evaluation is to use
1171 @code{(eval `(defsystem ... ,pathname ...))}.
1172
1173 Note that when specifying pathname objects,
1174 ASDF does not do any special interpretation of the pathname
1175 influenced by the component type, unlike the procedure for
1176 pathname-specifying strings.
1177 On the one hand, you have to be careful to provide a pathname that correctly
1178 fulfills whatever constraints are required from that component type
1179 (e.g. naming a directory or a file with appropriate type);
1180 on the other hand, you can circumvent the file type that would otherwise
1181 be forced upon you if you were specifying a string.
1182
1183 @subsection Version specifiers
1184 @cindex version specifiers
1185 @cindex :version
1186
1187 Version specifiers are strings to be parsed as period-separated lists of integers.
1188 I.e., in the example, @code{"0.2.1"} is to be interpreted,
1189 roughly speaking, as @code{(0 2 1)}.
1190 In particular, version @code{"0.2.1"} is interpreted the same as @code{"0.0002.1"},
1191 though the latter is not canonical and may lead to a warning being issued.
1192 Also, @code{"1.3"} and @code{"1.4"} are both strictly @code{uiop:version<} to @code{"1.30"},
1193 quite unlike what would have happened
1194 had the version strings been interpreted as decimal fractions.
1195
1196 System definers are encouraged to use version identifiers of the form
1197 @var{x}.@var{y}.@var{z} for
1198 major version, minor version and patch level,
1199 where significant API incompatibilities are signaled by an increased major number.
1200
1201 @xref{Common attributes of components}.
1202
1203
1204 @subsection Using logical pathnames
1205 @cindex logical pathnames
1206
1207 We do not generally recommend the use of logical pathnames,
1208 especially not so to newcomers to Common Lisp.
1209 However, we do support the use of logical pathnames by old timers,
1210 when such is their preference.
1211
1212 To use logical pathnames,
1213 you will have to provide a pathname object as a @code{:pathname} specifier
1214 to components that use it, using such syntax as
1215 @code{#p"LOGICAL-HOST:absolute;path;to;component.lisp"}.
1216
1217 You only have to specify such logical pathname
1218 for your system or some top-level component.
1219 Sub-components' relative pathnames,
1220 specified using the string syntax for names,
1221 will be properly merged with the pathnames of their parents.
1222 The specification of a logical pathname host however is @emph{not}
1223 otherwise directly supported in the ASDF syntax
1224 for pathname specifiers as strings.
1225
1226 The @code{asdf-output-translation} layer will
1227 avoid trying to resolve and translate logical pathnames.
1228 The advantage of this is that
1229 you can define yourself what translations you want to use
1230 with the logical pathname facility.
1231 The disadvantage is that if you do not define such translations,
1232 any system that uses logical pathnames will behave differently under
1233 asdf-output-translations than other systems you use.
1234
1235 If you wish to use logical pathnames you will have to configure the
1236 translations yourself before they may be used.
1237 ASDF currently provides no specific support
1238 for defining logical pathname translations.
1239
1240 Note that the reasons we do not recommend logical pathnames are that
1241 (1) there is no portable way to set up logical pathnames before they are used,
1242 (2) logical pathnames are limited to only portably use
1243 a single character case, digits and hyphens.
1244 While you can solve the first issue on your own,
1245 describing how to do it on each of fifteen implementations supported by ASDF
1246 is more than we can document.
1247 As for the second issue, mind that the limitation is notably enforced on SBCL,
1248 and that you therefore can't portably violate the limitations
1249 but must instead define some encoding of your own and add individual mappings
1250 to name physical pathnames that do not fit the restrictions.
1251 This can notably be a problem when your Lisp files are part of a larger project
1252 in which it is common to name files or directories in a way that
1253 includes the version numbers of supported protocols,
1254 or in which files are shared with software written
1255 in different programming languages where conventions include the use of
1256 underscores, dots or CamelCase in pathnames.
1257
1258
1259 @subsection Serial dependencies
1260 @cindex serial dependencies
1261
1262 If the @code{:serial t} option is specified for a module,
1263 ASDF will add dependencies for each child component,
1264 on all the children textually preceding it.
1265 This is done as if by @code{:depends-on}.
1266
1267 @lisp
1268 :serial t
1269 :components ((:file "a") (:file "b") (:file "c"))
1270 @end lisp
1271
1272 is equivalent to
1273
1274 @lisp
1275 :components ((:file "a")
1276              (:file "b" :depends-on ("a"))
1277              (:file "c" :depends-on ("a" "b")))
1278 @end lisp
1279
1280
1281 @subsection Source location
1282
1283 The @code{:pathname} option is optional in all cases for systems
1284 defined via @code{defsystem},
1285 and in the usual case the user is recommended not to supply it.
1286
1287 Instead, ASDF follows a hairy set of rules that are designed so that
1288 @enumerate
1289 @item
1290 @code{find-system}
1291 will load a system from disk
1292 and have its pathname default to the right place.
1293
1294 @item
1295 This pathname information will not be overwritten with
1296 @code{*default-pathname-defaults*}
1297 (which could be somewhere else altogether)
1298 if the user loads up the @file{.asd} file into his editor
1299 and interactively re-evaluates that form.
1300 @end enumerate
1301
1302 If a system is being loaded for the first time,
1303 its top-level pathname will be set to:
1304
1305 @itemize
1306 @item
1307 The host/device/directory parts of @code{*load-truename*},
1308 if it is bound.
1309 @item
1310 @code{*default-pathname-defaults*}, otherwise.
1311 @end itemize
1312
1313 If a system is being redefined, the top-level pathname will be
1314
1315 @itemize
1316 @item
1317 changed, if explicitly supplied or obtained from @code{*load-truename*}
1318 (so that an updated source location is reflected in the system definition)
1319
1320 @item
1321 changed if it had previously been set from @code{*default-pathname-defaults*}
1322
1323 @item
1324 left as before, if it had previously been set from @code{*load-truename*}
1325 and @code{*load-truename*} is currently unbound
1326 (so that a developer can evaluate a @code{defsystem} form
1327 from within an editor without clobbering its source location)
1328 @end itemize
1329
1330 @subsection if-feature option
1331 This option allows you to specify a feature expression to be evaluated
1332 as if by @code{#+} to conditionally include a component in your build.
1333 If the expression is false, the component is dropped
1334 as well as any dependency pointing to it.
1335 As compared to using @code{#+} which is expanded at read-time,
1336 this allows you to have an object in your component hierarchy
1337 that can be used for manipulations beside building your project.
1338 This option was added in ASDF 3.
1339
1340 @subsection if-component-dep-fails option
1341 This option was removed in ASDF 3.
1342 Its semantics was limited in purpose and dubious to explain,
1343 and its implementation was breaking a hole into the ASDF object model.
1344 Please use the @code{if-feature} option instead.
1345
1346 @node Other code in .asd files,  , The defsystem grammar, Defining systems with defsystem
1347 @section Other code in .asd files
1348
1349 Files containing @code{defsystem} forms
1350 are regular Lisp files that are executed by @code{load}.
1351 Consequently, you can put whatever Lisp code you like into these files.
1352 However, it is recommended to keep such forms to a minimal,
1353 and to instead define @code{defsystem} extensions
1354 that you use with @code{:defsystem-depends-on}.
1355
1356 If however, you might insist on including code in the @code{.asd} file itself,
1357 e.g., to examine and adjust the compile-time environment,
1358 possibly adding appropriate features to @code{*features*}.
1359 If so, here are some conventions we recommend you follow,
1360 so that users can control certain details of execution
1361 of the Lisp in @file{.asd} files:
1362
1363 @itemize
1364 @item
1365 Any informative output
1366 (other than warnings and errors,
1367 which are the condition system's to dispose of)
1368 should be sent to the standard CL stream @code{*standard-output*},
1369 so that users can easily control the disposition
1370 of output from ASDF operations.
1371 @end itemize
1372
1373
1374 @node The object model of ASDF, Controlling where ASDF searches for systems, Defining systems with defsystem, Top
1375 @comment  node-name,  next,  previous,  up
1376 @chapter The object model of ASDF
1377
1378 ASDF is designed in an object-oriented way from the ground up.
1379 Both a system's structure and the operations that can be performed on systems
1380 follow a extensible protocol.
1381
1382 This allows the addition of behaviours:
1383 for example, @code{cffi} adds support of special FFI description files
1384 to interface with C libraries and of wrapper files to embed C code in Lisp;
1385 @code{abcl-jar} supports creating Java JAR archives in ABCL;
1386 and @code{poiu} supports for compiling code in parallel using background processes.
1387
1388 This chapter deals with @code{component}s and @code{operation}s.
1389
1390 A @code{component} represents an individual source file or a group of source files,
1391 and the things that get transformed into.
1392 A @code{system} is a component at the top level of the component hierarchy.
1393 A @code{source-file} is a component representing a single source-file
1394 and the successive output files into which it is transformed.
1395 A @code{module} is an intermediate component itself grouping several other components,
1396 themselves source-files or further modules.
1397
1398 An @code{Operation} represents a transformation that can be performed on a component,
1399 turning them from source files to intermediate results to final outputs.
1400
1401 A pair of an @code{operation} and a @code{component} is called an @code{action}.
1402 An @code{action} represents a particular build step to be @code{perform}ed,
1403 after all its dependencies have been fulfilled.
1404 In the ASDF model, actions depend on other actions.
1405 The term @emph{action} itself was used by Kent Pitman in his old article,
1406 but was only used by ASDF hackers starting with the ASDF 2;
1407 but the concept is ubiquitous since the very beginning of ASDF 1,
1408 though previously implicit.
1409
1410 Then, there are many @emph{functions} available
1411 to users, extenders and implementers of ASDF
1412 to use, define or implement the activities
1413 that are part of building your software.
1414 Though they manipulate @code{action}s,
1415 most of these functions do not take as an argument
1416 a reified pair (a CONS cell) of an operation and a component;
1417 instead, they usually take two separate arguments,
1418 which allows to take advantage of the power CLOS-style multiple dispatch
1419 for fun and profit.
1420
1421 There are many @emph{hooks} in which to add functionality,
1422 by customizing the behavior of existing @emph{functions}.
1423
1424 Last but not least is the notion of @emph{dependency} between two actions.
1425 The structure of dependencies between actions is
1426 a directed @emph{dependency graph}.
1427 ASDF is invoked by being told to @emph{operate}
1428 with some @emph{operation} on some toplevel @emph{system};
1429 it will then @emph{traverse} the graph and build a @emph{plan}
1430 that follows its structure.
1431 To be successfully buildable, this graph of actions but be acyclic.
1432 If, as a user, extender or implementer of ASDF, you fail
1433 to keep the dependency graph without cycles,
1434 ASDF will fail loudly as it eventually finds one.
1435 To clearly distinguish the direction of dependencies,
1436 ASDF 3 uses the words @emph{requiring} and @emph{required}
1437 as applied to an action depending on the other:
1438 the requiring action @code{depends-on} the completion of all required actions
1439 before it may itself be @code{perform}ed.
1440
1441 Using the @code{defsystem} syntax, users may easily express
1442 direct dependencies along the graph of the object hierarchy:
1443 between a component and its parent, its children, and its siblings.
1444 By defining custom CLOS methods, you can express more elaborate dependencies as you wish.
1445 Most common operations, such as @code{load-op}, @code{compile-op} or @code{load-source-op}
1446 are automatically propagate ``downward'' the component hierarchy and are ``covariant'' with it:
1447 to act the operation on the parent module, you must first act it on all the children components,
1448 with the action on the parent being parent of the action on each child.
1449 Other operations, such as @code{prepare-op} and @code{prepare-source-op}
1450 (introduced in ASDF 3) are automatically propagated ``upward'' the component hierarchy
1451 and are ``contravariant'' with it:
1452 to perform the operation of preparing for compilation of a child component,
1453 you must perform the operation of preparing for compilation of its parent component, and so on,
1454 ensuring that all the parent's dependencies are (compiled and) loaded
1455 before the child component may be compiled and loaded.
1456 Yet other operations, such as @code{test-op} or @code{load-fasl-op}
1457 remain at the system level, and are not propagated along the hierarchy,
1458 but instead do something global on the system.
1459
1460 @menu
1461 * Operations::
1462 * Components::
1463 * Functions::
1464 @end menu
1465
1466 @node  Operations, Components, The object model of ASDF, The object model of ASDF
1467 @comment  node-name,  next,  previous,  up
1468 @section Operations
1469 @cindex operation
1470
1471 An @dfn{operation} object of the appropriate type is instantiated
1472 whenever the user wants to do something with a system like
1473
1474 @itemize
1475 @item compile all its files
1476 @item load the files into a running lisp environment
1477 @item copy its source files somewhere else
1478 @end itemize
1479
1480 Operations can be invoked directly, or examined
1481 to see what their effects would be without performing them.
1482 There are a bunch of methods specialised on operation and component type
1483 that actually do the grunt work.
1484
1485 The operation object contains whatever state is relevant for this purpose
1486 (perhaps a list of visited nodes, for example)
1487 but primarily is a nice thing to specialise operation methods on
1488 and easier than having them all be @code{EQL} methods.
1489
1490 Operations are invoked on systems via @code{operate}.
1491 @anchor{operate}
1492 @deffn {Generic function} @code{operate} @var{operation} @var{system} @Arest @var{initargs} @Akey @code{force} @code{force-not} @code{verbose} @AallowOtherKeys
1493 @deffnx {Generic function} @code{oos} @var{operation} @var{system} @Arest @var{initargs} @Akey @AallowOtherKeys
1494 @code{operate} invokes @var{operation} on @var{system}.
1495 @code{oos} is a synonym for @code{operate}.
1496
1497 @var{operation} is a symbol that is passed, along with the supplied
1498 @var{initargs}, to @code{make-instance} to create the operation object.
1499 @var{system} is a system designator.
1500
1501 The @var{initargs} are passed to the @code{make-instance} call
1502 when creating the operation object.
1503 Note that dependencies may cause the operation
1504 to invoke other operations on the system or its components:
1505 the new operations will be created
1506 with the same @var{initargs} as the original one.
1507
1508 If @var{force} is @code{:all}, then all systems
1509 are forced to be recompiled even if not modified since last compilation.
1510 If @var{force} is @code{t}, then only the system being loaded
1511 is forced to be recompiled even if not modified since last compilation,
1512 but other systems are not affected.
1513 If @var{force} is a list, then it specifies a list of systems that
1514 are forced to be recompiled even if not modified since last compilation.
1515 If @var{force-not} is @code{:all}, then all systems
1516 are forced not to be recompiled even if modified since last compilation.
1517 If @var{force-not} is @code{t}, then only the system being loaded
1518 is forced not to be recompiled even if modified since last compilation,
1519 but other systems are not affected.
1520 If @var{force-not} is a list, then it specifies a list of systems that
1521 are forced not to be recompiled even if modified since last compilation.
1522 @var{force} takes precedences over @var{force-not};
1523 both of them apply to systems that are dependencies and were already compiled.
1524
1525 To see what @code{operate} would do, you can use:
1526 @example
1527 (asdf::traverse (make-instance operation-class initargs ...) (find-system system-name))
1528 @end example
1529
1530 @end deffn
1531
1532 @menu
1533 * Predefined operations of ASDF::
1534 * Creating new operations::
1535 @end menu
1536
1537 @node Predefined operations of ASDF, Creating new operations, Operations, Operations
1538 @comment  node-name,  next,  previous,  up
1539 @subsection Predefined operations of ASDF
1540
1541 All the operations described in this section are in the @code{asdf} package.
1542 They are invoked via the @code{operate} generic function.
1543
1544 @lisp
1545 (asdf:operate 'asdf:@var{operation-name} :@var{system-name} @{@var{operation-options ...}@})
1546 @end lisp
1547
1548 @deffn Operation @code{compile-op} @Akey @code{proclamations}
1549
1550 This operation compiles the specified component.
1551 If proclamations are supplied, they will be proclaimed.
1552 This is a good place to specify optimization settings.
1553
1554 When creating a new component type,
1555 you should provide methods for @code{compile-op}.
1556
1557 When @code{compile-op} is invoked,
1558 component dependencies often cause some parts of the system
1559 to be loaded as well as compiled.
1560 Invoking @code{compile-op}
1561 does not necessarily load all the parts of the system, though;
1562 use @code{load-op} to load a system.
1563 @end deffn
1564
1565 @deffn Operation @code{load-op} @Akey @code{proclamations}
1566
1567 This operation loads a system.
1568
1569 The default methods for @code{load-op} compile files before loading them.
1570 For parity, your own methods on new component types should probably do so too.
1571 @end deffn
1572
1573 @deffn Operation @code{parent-load-op} @Akey @code{proclamations}
1574
1575 This operation ensures that the dependencies
1576 of a module, and its parent, and so on, are loaded (as per @code{load-op})
1577 before the components within that module may be operated upon.
1578
1579 By default, all operations depend on this @code{parent-operation}
1580 for actions on components to depend on this ``parent operation'' being acted on the parent.
1581
1582 The default methods for @code{load-op} compile files before loading them.
1583 For parity, your own methods on new component types should probably do so too.
1584 @end deffn
1585
1586 @deffn Operation @code{load-source-op}
1587
1588 This operation will load the source for the files in a module
1589 even if the source files have been compiled.
1590 Systems sometimes have knotty dependencies
1591 which require that sources are loaded
1592 before they can be compiled.
1593 This is how you do that.
1594
1595 If you are creating a component type,
1596 you need to implement this operation --- at least, where meaningful.
1597 @end deffn
1598
1599 @anchor{test-op}
1600 @deffn Operation @code{test-op}
1601
1602 This operation will perform some tests on the module.
1603 The default method will do nothing.
1604 The default dependency is to require
1605 @code{load-op} to be performed on the module first.
1606 The default @code{operation-done-p} is that the operation is @emph{never} done
1607 ---
1608 we assume that if you invoke the @code{test-op},
1609 you want to test the system, even if you have already done so.
1610
1611 The results of this operation are not defined by ASDF.
1612 It has proven difficult to define how the test operation
1613 should signal its results to the user
1614 in a way that is compatible with all of the various test libraries
1615 and test techniques in use in the community.
1616
1617 People typically define @code{test-op} methods like thus:
1618 @example
1619 (defmethod perform ((o asdf:test-op) (s (eql (asdf:find-system @var{:mysystem}))))
1620   (asdf:load-system @var{:mysystem})
1621   (eval (read-from-string "(some expression that runs the tests)"))
1622   t)
1623 @end example
1624 @end deffn
1625
1626 @deffn Operation @code{load-fasl-op}
1627
1628 This operation will load and create if need be
1629 a single fasl file for all the files in each loaded system.
1630 (Its compilation-only equivalent is @code{asdf::fasl-op}.)
1631
1632 Once you have created such a fasl,
1633 you can use @code{precompiled-system} to deliver it in a way
1634 that is compatible with clients having asdf dependencies
1635 on your system whether it is distributed as source of as a single binary.
1636
1637 On your build platform, you run something like that:
1638 @example
1639 @code{(asdf:operate 'load-fasl-op @var{:mysystem})}
1640 @end example
1641
1642 And on your delivery platform, a form like this is evaluated
1643 in a prologue or at some point before you save your image:
1644 @example
1645 (defsystem :mysystem :class :precompiled-system
1646     :fasl (some expression that will evaluate to a pathname))
1647 @end example
1648
1649 Of course, @emph{before} you define such systems,
1650 you should not forget to @code{(asdf:clear-configuration)}.
1651
1652 @code{load-fasl-op} is available on all actively supported Lisp implementations,
1653 and on those implementations only, and only since ASDF 3.
1654 This functionality was previously available for select implementations,
1655 as part of a separate system @code{asdf-bundle},
1656 itself descended from @code{asdf-ecl}.
1657 @end deffn
1658
1659
1660 @node  Creating new operations,  , Predefined operations of ASDF, Operations
1661 @comment  node-name,  next,  previous,  up
1662 @subsection Creating new operations
1663
1664 ASDF was designed to be extensible in an object-oriented fashion.
1665 To teach ASDF new tricks, a programmer can implement the behaviour he wants
1666 by creating a subclass of @code{operation}.
1667
1668 ASDF's pre-defined operations are in no way ``privileged'',
1669 but it is requested that developers never use the @code{asdf} package
1670 for operations they develop themselves.
1671 The rationale for this rule is that we don't want to establish a
1672 ``global asdf operation name registry'',
1673 but also want to avoid name clashes.
1674
1675 An operation must provide methods for the following generic functions
1676 when invoked with an object of type @code{source-file}:
1677 @emph{FIXME describe this better}
1678
1679 @itemize
1680
1681 @item @code{input-files}
1682 ASDF has a pretty clever default @code{input-files} mechanism.
1683 You only need create a method if there are multiple ultimate input files,
1684 and/or the bottom one doesn't depend
1685 on the @code{component-pathname} of the component.
1686
1687 @item @code{output-files}
1688 The @code{output-files} method determines where the method will put its files.
1689 It returns two values, a list of pathnames, and a boolean.
1690 If the boolean is @code{T} then the pathnames are marked
1691 not be translated by enclosing @code{:around} methods.
1692 If the boolean is @code{NIL} then enclosing @code{:around} methods
1693 may translate these pathnames, e.g. to ensure object files
1694 are somehow stored in some implementation-dependent cache.
1695
1696 @item @code{perform}
1697 The @code{perform} method must call @code{output-files}
1698 to find out where to put its files,
1699 because the user is allowed to override.
1700 @item @code{output-files}
1701 for local policy @code{explain}
1702
1703 @item @code{operation-done-p}
1704 You only need to define a method on that function
1705 if you can detect conditions that invalidate previous runs of the operation,
1706 even though no filesystem timestamp has changed,
1707 in which case you return @code{nil} (the default is @code{t}).
1708
1709 For instance, the method for @code{test-op} always returns @code{nil},
1710 so that tests are always run afresh.
1711 Of course, the @code{test-op} for your system could depend
1712 on a deterministically repeatable @code{test-report-op},
1713 and just read the results from the report files.
1714
1715 @item @code{component-depends-on}
1716 When you add new operations, you probably need to explain
1717 how they relate to loading, compiling, testing, etc.,
1718 in terms of dependencies between actions.
1719
1720 That's where you typically define methods on @code{component-depends-on}.
1721 Your method will take as arguments
1722 some properly specialized operation
1723 and a component denoting a current action,
1724 and return a list of entries,
1725 denoting the children actions that the current action depends on.
1726 The format of entries is described below.
1727
1728 It is @emph{strongly} advised that
1729 you should always append the results of @code{(call-next-method)}
1730 to the results of your method,
1731 or ``interesting'' failures will likely occur,
1732 unless you're a true specialist of ASDF internals.
1733
1734 Each entry returned by @code{component-depends-on} is itself a list.
1735
1736 The first element of an entry is the name of an operation:
1737 a symbol that you can use with @code{make-instance}
1738 (ASDF will instead use with @code{asdf::make-sub-operation}),
1739 to create a related operation for use in a build plan.
1740 For instance, @code{load-op} and @code{compile-op}
1741 are common such names, denoting the respective operations.
1742
1743 The rest of an entry is a list of identifiers
1744 each denote a component such that
1745 the pair of the previous operation and this component
1746 is a children action of current action.
1747
1748 Identifiers follow the @code{defsystem} grammar
1749 previously documented.
1750 The main format for identifiers is a string or symbol
1751 (that will be downcase as per @code{coerce-name}),
1752 and looked up against the sibling list of the parent module's children components,
1753 as per @code{find-component}.
1754 As a special case, @code{nil} denotes the parent itself.
1755 Other syntaxes are allowed, for instance to specify a component with a version.
1756
1757 @end itemize
1758
1759 Operations that print output should send that output to the standard
1760 CL stream @code{*standard-output*}, as the Lisp compiler and loader do.
1761
1762 @node Components, Functions, Operations, The object model of ASDF
1763 @comment  node-name,  next,  previous,  up
1764 @section Components
1765 @cindex component
1766 @cindex system
1767 @cindex system designator
1768 @vindex *system-definition-search-functions*
1769
1770 A @dfn{component} represents a source file or
1771 (recursively) a collection of components.
1772 A @dfn{system} is (roughly speaking) a top-level component
1773 that can be found via @code{find-system}.
1774
1775 A @dfn{system designator} is a string or symbol
1776 and behaves just like any other component name
1777 (including with regard to the case conversion rules for component names).
1778
1779
1780 @defun find-system system-designator &optional (error-p t)
1781
1782 Given a system designator, @code{find-system} finds and returns a system.
1783 If no system is found, an error of type
1784 @code{missing-component} is thrown,
1785 or @code{nil} is returned if @code{error-p} is false.
1786
1787 To find and update systems, @code{find-system} funcalls each element
1788 in the @code{*system-definition-search-functions*} list,
1789 expecting a pathname to be returned, or a system object,
1790 from which a pathname may be extracted, and that will be registered.
1791 The resulting pathname (if any) is loaded
1792 if one of the following conditions is true:
1793
1794 @itemize
1795 @item
1796 there is no system of that name in memory
1797 @item
1798 the pathname is different from that which was previously loaded
1799 @item
1800 the file's @code{last-modified} time exceeds the @code{last-modified} time
1801 of the system in memory
1802 @end itemize
1803
1804 When system definitions are loaded from @file{.asd} files,
1805 a new scratch package is created for them to load into,
1806 so that different systems do not overwrite each others operations.
1807 The user may also wish to (and is recommended to)
1808 include @code{defpackage} and @code{in-package} forms
1809 in his system definition files, however,
1810 so that they can be loaded manually if need be.
1811
1812 The default value of @code{*system-definition-search-functions*}
1813 is a list of two functions.
1814 The first function looks in each of the directories given
1815 by evaluating members of @code{*central-registry*}
1816 for a file whose name is the name of the system and whose type is @file{asd}.
1817 The first such file is returned,
1818 whether or not it turns out to actually define the appropriate system.
1819 The second function does something similar,
1820 for the directories specified in the @code{source-registry}.
1821 Hence, it is strongly advised to define a system
1822 @var{foo} in the corresponding file @var{foo.asd}.
1823 @end defun
1824
1825
1826 @menu
1827 * Common attributes of components::
1828 * Pre-defined subclasses of component::
1829 * Creating new component types::
1830 @end menu
1831
1832 @node  Common attributes of components, Pre-defined subclasses of component, Components, Components
1833 @comment  node-name,  next,  previous,  up
1834 @subsection Common attributes of components
1835
1836 All components, regardless of type, have the following attributes.
1837 All attributes except @code{name} are optional.
1838
1839 @subsubsection Name
1840
1841 A component name is a string or a symbol.
1842 If a symbol, its name is taken and lowercased.
1843
1844 Unless overridden by a @code{:pathname} attribute,
1845 the name will be interpreted as a pathname specifier according
1846 to a Unix-style syntax.
1847 @xref{The defsystem grammar,,Pathname specifiers}.
1848
1849 @subsubsection Version identifier
1850 @findex version-satisfies
1851 @cindex :version
1852
1853 This optional attribute specifies a version for the current component.
1854 The version should typically be a string of integers separated by dots,
1855 for example @samp{1.0.11}.
1856 For more information on version specifiers, see @ref{The defsystem grammar}.
1857
1858 A version may then be queried by the generic function @code{version-satisfies},
1859 to see if @code{:version} dependencies are satisfied,
1860 and when specifying dependencies, a constraint of minimal version to satisfy
1861 can be specified using e.g. @code{(:version "mydepname" "1.0.11")}.
1862
1863 Note that in the wild, we typically see version numbering
1864 only on components of type @code{system}.
1865 Presumably it is much less useful within a given system,
1866 wherein the library author is responsible to keep the various files in synch.
1867
1868 @subsubsection Required features
1869
1870 Traditionally defsystem users have used @code{#+} reader conditionals
1871 to include or exclude specific per-implementation files.
1872 This means that any single implementation cannot read the entire system,
1873 which becomes a problem if it doesn't wish to compile it,
1874 but instead for example to create an archive file containing all the sources,
1875 as it will omit to process the system-dependent sources for other systems.
1876
1877 Each component in an asdf system may therefore specify using @code{:if-feature}
1878 a feature expression using the same syntax as @code{#+} does,
1879 such that any reference to the component will be ignored
1880 during compilation, loading and/or linking if the expression evaluates to false.
1881 Since the expression is read by the normal reader,
1882 you must explicitly prefix your symbols with @code{:} so they be read as keywords;
1883 this is as contrasted with the @code{#+} syntax
1884 that implicitly reads symbols in the keyword package by default.
1885
1886 For instance, @code{:if-feature (:and :x86 (:or :sbcl :cmu :scl))} specifies that
1887 the given component is only to be compiled and loaded
1888 when the implementation is SBCL, CMUCL or Scieneer CL on an x86 machine.
1889 You can not write it as @code{:if-feature (and x86 (or sbcl cmu scl))}
1890 since the symbols would presumably fail to be read as keywords.
1891
1892 @subsubsection Dependencies
1893
1894 This attribute specifies dependencies of the component on its siblings.
1895 It is optional but often necessary.
1896
1897 There is an excitingly complicated relationship between the initarg
1898 and the method that you use to ask about dependencies
1899
1900 Dependencies are between (operation component) pairs.
1901 In your initargs for the component, you can say
1902
1903 @lisp
1904 :in-order-to ((compile-op (load-op "a" "b") (compile-op "c"))
1905               (load-op (load-op "foo")))
1906 @end lisp
1907
1908 This means the following things:
1909 @itemize
1910 @item
1911 before performing compile-op on this component, we must perform
1912 load-op on @var{a} and @var{b}, and compile-op on @var{c},
1913 @item
1914 before performing @code{load-op}, we have to load @var{foo}
1915 @end itemize
1916
1917 The syntax is approximately
1918
1919 @verbatim
1920 (this-op @{(other-op required-components)@}+)
1921
1922 simple-component-name := string
1923                       |  symbol
1924
1925 required-components := simple-component-name
1926                      | (required-components required-components)
1927
1928 component-name := simple-component-name
1929                 | (:version simple-component-name minimum-version-object)
1930 @end verbatim
1931
1932 Side note:
1933
1934 This is on a par with what ACL defsystem does.
1935 mk-defsystem is less general: it has an implied dependency
1936
1937 @verbatim
1938   for all source file x, (load x) depends on (compile x)
1939 @end verbatim
1940
1941 and using a @code{:depends-on} argument to say that @var{b} depends on
1942 @var{a} @emph{actually} means that
1943
1944 @verbatim
1945   (compile b) depends on (load a)
1946 @end verbatim
1947
1948 This is insufficient for e.g. the McCLIM system, which requires that
1949 all the files are loaded before any of them can be compiled ]
1950
1951 End side note
1952
1953 In ASDF, the dependency information for a given component and operation
1954 can be queried using @code{(component-depends-on operation component)},
1955 which returns a list
1956
1957 @lisp
1958 ((load-op "a") (load-op "b") (compile-op "c") ...)
1959 @end lisp
1960
1961 @code{component-depends-on} can be subclassed for more specific
1962 component/operation types: these need to @code{(call-next-method)}
1963 and append the answer to their dependency, unless
1964 they have a good reason for completely overriding the default dependencies.
1965
1966 If it weren't for CLISP, we'd be using @code{LIST} method
1967 combination to do this transparently.
1968 But, we need to support CLISP.
1969 If you have the time for some CLISP hacking,
1970 I'm sure they'd welcome your fixes.
1971 @c Doesn't CLISP now support LIST method combination?
1972
1973 A minimal version can be specified for a component you depend on
1974 (typically another system), by specifying @code{(:version "other-system" "1.2.3")}
1975 instead of simply @code{"other-system"} as the dependency.
1976 See the discussion of the semantics of @code{:version}
1977 in the defsystem grammar.
1978
1979 @c FIXME: Should have cross-reference to "Version specifiers" in the
1980 @c defsystem grammar, but the cross-referencing is so broken by
1981 @c insufficient node breakdown that I have not put one in.
1982
1983
1984 @subsubsection pathname
1985
1986 This attribute is optional and if absent (which is the usual case),
1987 the component name will be used.
1988
1989 @xref{The defsystem grammar,,Pathname specifiers},
1990 for an explanation of how this attribute is interpreted.
1991
1992 Note that the @code{defsystem} macro (used to create a ``top-level'' system)
1993 does additional processing to set the filesystem location of
1994 the top component in that system.
1995 This is detailed elsewhere. @xref{Defining systems with defsystem}.
1996
1997
1998 @subsubsection properties
1999
2000 This attribute is optional.
2001
2002 Packaging systems often require information about files or systems
2003 in addition to that specified by ASDF's pre-defined component attributes.
2004 Programs that create vendor packages out of ASDF systems therefore
2005 have to create ``placeholder'' information to satisfy these systems.
2006 Sometimes the creator of an ASDF system may know the additional
2007 information and wish to provide it directly.
2008
2009 @code{(component-property component property-name)} and
2010 associated @code{setf} method will allow
2011 the programmatic update of this information.
2012 Property names are compared as if by @code{EQL},
2013 so use symbols or keywords or something.
2014
2015 @menu
2016 * Pre-defined subclasses of component::
2017 * Creating new component types::
2018 @end menu
2019
2020 @node Pre-defined subclasses of component, Creating new component types, Common attributes of components, Components
2021 @comment  node-name,  next,  previous,  up
2022 @subsection Pre-defined subclasses of component
2023
2024 @deffn Component source-file
2025
2026 A source file is any file that the system does not know how to
2027 generate from other components of the system.
2028
2029 Note that this is not necessarily the same thing as
2030 ``a file containing data that is typically fed to a compiler''.
2031 If a file is generated by some pre-processor stage
2032 (e.g. a @file{.h} file from @file{.h.in} by autoconf)
2033 then it is not, by this definition, a source file.
2034 Conversely, we might have a graphic file
2035 that cannot be automatically regenerated,
2036 or a proprietary shared library that we received as a binary:
2037 these do count as source files for our purposes.
2038
2039 Subclasses of source-file exist for various languages.
2040 @emph{FIXME: describe these.}
2041 @end deffn
2042
2043 @deffn Component module
2044
2045 A module is a collection of sub-components.
2046
2047 A module component has the following extra initargs:
2048
2049 @itemize
2050 @item
2051 @code{:components} the components contained in this module
2052
2053 @item
2054 @code{:default-component-class}
2055 All children components which don't specify their class explicitly
2056 are inferred to be of this type.
2057
2058 @item
2059 @code{:if-component-dep-fails}
2060 This attribute was removed in ASDF 3. Do not use it.
2061 Use @code{:if-feature} instead.
2062
2063 @item
2064 @code{:serial} When this attribute is set,
2065 each subcomponent of this component is assumed to depend on all subcomponents
2066 before it in the list given to @code{:components}, i.e.
2067 all of them are loaded before a compile or load operation is performed on it.
2068
2069 @end itemize
2070
2071 The default operation knows how to traverse a module, so
2072 most operations will not need to provide methods specialised on modules.
2073
2074 @code{module} may be subclassed to represent components such as
2075 foreign-language linked libraries or archive files.
2076 @end deffn
2077
2078 @deffn Component system
2079
2080 @code{system} is a subclass of @code{module}.
2081
2082 A system is a module with a few extra attributes for documentation
2083 purposes; these are given elsewhere.
2084 @xref{The defsystem grammar}.
2085
2086 Users can create new classes for their systems:
2087 the default @code{defsystem} macro takes a @code{:class} keyword argument.
2088 @end deffn
2089
2090 @node  Creating new component types,  , Pre-defined subclasses of component, Components
2091 @comment  node-name,  next,  previous,  up
2092 @subsection Creating new component types
2093
2094 New component types are defined by subclassing one of the existing
2095 component classes and specializing methods on the new component class.
2096
2097 @emph{FIXME: this should perhaps be explained more throughly,
2098 not only by example ...}
2099
2100 As an example, suppose we have some implementation-dependent
2101 functionality that we want to isolate
2102 in one subdirectory per Lisp implementation our system supports.
2103 We create a subclass of
2104 @code{cl-source-file}:
2105
2106 @lisp
2107 (defclass unportable-cl-source-file (cl-source-file)
2108   ())
2109 @end lisp
2110
2111 Function @code{asdf:implementation-type} (exported since 2.014.14)
2112 gives us the name of the subdirectory.
2113 All that's left is to define how to calculate the pathname
2114 of an @code{unportable-cl-source-file}.
2115
2116 @lisp
2117 (defmethod component-pathname ((component unportable-cl-source-file))
2118   (merge-pathnames*
2119    (coerce-pathname (format nil "~(~A~)/" (asdf:implementation-type)))
2120    (call-next-method)))
2121 @end lisp
2122
2123 The new component type is used in a @code{defsystem} form in this way:
2124
2125 @lisp
2126 (defsystem :foo
2127     :components
2128     ((:file "packages")
2129      ...
2130      (:unportable-cl-source-file "threads"
2131       :depends-on ("packages" ...))
2132      ...
2133     )
2134 @end lisp
2135
2136 @node Functions,  , Components, The object model of ASDF
2137 @comment  node-name,  next,  previous,  up
2138 @section Functions
2139 @findex version-satisfies
2140
2141 @deffn version-satisfies @var{version} @var{version-spec}
2142 Does @var{version} satisfy the @var{version-spec}.  A generic function.
2143 ASDF provides built-in methods for @var{version} being a @code{component} or @code{string}.
2144 @var{version-spec} should be a string.
2145 If it's a component, its version is extracted as a string before further processing.
2146
2147 A version string satisfies the version-spec if after parsing,
2148 the former is no older than the latter.
2149 Therefore @code{"1.9.1"}, @code{"1.9.2"} and @code{"1.10"} all satisfy @code{"1.9.1"},
2150 but @code{"1.8.4"} or @code{"1.9"} do not.
2151 For more information about how @code{version-satisfies} parses and interprets
2152 version strings and specifications,
2153 @pxref{The defsystem grammar} (version specifiers) and
2154 @ref{Common attributes of components}.
2155
2156 Note that in versions of ASDF prior to 3.0.1,
2157 including the entire ASDF 1 and ASDF 2 series,
2158 @code{version-satisfies} would also require that the version and the version-spec
2159 have the same major version number (the first integer in the list);
2160 if the major version differed, the version would be considered as not matching the spec.
2161 But that feature was not documented, therefore presumably not relied upon,
2162 whereas it was a nuisance to several users.
2163 Starting with ASDF 3.0.1,
2164 @code{version-satisfies} does not treat the major version number specially,
2165 and returns T simply if the first argument designates a version that isn't older
2166 than the one specified as a second argument.
2167 If needs be, the @code{(:version ...)} syntax for specifying dependencies
2168 could be in the future extended to specify an exclusive upper bound for compatible versions
2169 as well as an inclusive lower bound.
2170 @end deffn
2171
2172 @node Controlling where ASDF searches for systems, Controlling where ASDF saves compiled files, The object model of ASDF, Top
2173 @comment  node-name,  next,  previous,  up
2174 @chapter Controlling where ASDF searches for systems
2175
2176 @section Configurations
2177
2178 Configurations specify paths where to find system files.
2179
2180 @enumerate
2181
2182 @item
2183 The search registry may use some hardcoded wrapping registry specification.
2184 This allows some implementations (notably SBCL) to specify where to find
2185 some special implementation-provided systems that
2186 need to precisely match the version of the implementation itself.
2187
2188 @item
2189 An application may explicitly initialize the source-registry configuration
2190 using the configuration API
2191 (@pxref{Controlling where ASDF searches for systems,Configuration API,Configuration API}, below)
2192 in which case this takes precedence.
2193 It may itself compute this configuration from the command-line,
2194 from a script, from its own configuration file, etc.
2195
2196 @item
2197 The source registry will be configured from
2198 the environment variable @code{CL_SOURCE_REGISTRY} if it exists.
2199
2200 @item
2201 The source registry will be configured from
2202 user configuration file
2203 @file{$XDG_CONFIG_DIRS/common-lisp/source-registry.conf}
2204 (which defaults to
2205 @file{~/.config/common-lisp/source-registry.conf})
2206 if it exists.
2207
2208 @item
2209 The source registry will be configured from
2210 user configuration directory
2211 @file{$XDG_CONFIG_DIRS/common-lisp/source-registry.conf.d/}
2212 (which defaults to
2213 @file{~/.config/common-lisp/source-registry.conf.d/})
2214 if it exists.
2215
2216 @item
2217 The source registry will be configured from
2218 system configuration file
2219 @file{/etc/common-lisp/source-registry.conf}
2220 if it exists/
2221
2222 @item
2223 The source registry will be configured from
2224 system configuration directory
2225 @file{/etc/common-lisp/source-registry.conf.d/}
2226 if it exists.
2227
2228 @item
2229 The source registry will be configured from a default configuration.
2230 This configuration may allow for implementation-specific systems
2231 to be found, for systems to be found the current directory
2232 (at the time that the configuration is initialized) as well as
2233 @code{:directory} entries for @file{$XDG_DATA_DIRS/common-lisp/systems/} and
2234 @code{:tree} entries for @file{$XDG_DATA_DIRS/common-lisp/source/}.
2235 For instance, SBCL will include directories for its contribs
2236 when it can find them; it will look for them where SBCL was installed,
2237 or at the location specified by the @code{SBCL_HOME} environment variable.
2238
2239 @end enumerate
2240
2241 Each of these configurations is specified as an s-expression
2242 in a trivial domain-specific language (defined below).
2243 Additionally, a more shell-friendly syntax is available
2244 for the environment variable (defined yet below).
2245
2246 Each of these configurations is only used if the previous
2247 configuration explicitly or implicitly specifies that it
2248 includes its inherited configuration.
2249
2250 Additionally, some implementation-specific directories
2251 may be automatically prepended to whatever directories are specified
2252 in configuration files, no matter if the last one inherits or not.
2253
2254
2255 @section Truenames and other dangers
2256
2257 One great innovation of the original ASDF was its ability to leverage
2258 @code{CL:TRUENAME} to locate where your source code was and where to build it,
2259 allowing for symlink farms as a simple but effective configuration mechanism
2260 that is easy to control programmatically.
2261 ASDF 3 still supports this configuration style, and it is enabled by default;
2262 however we recommend you instead use
2263 our source-registry configuration mechanism described below,
2264 because it is easier to setup in a portable way across users and implementations.
2265
2266 Addtionally, some people dislike truename,
2267 either because it is very slow on their system, or
2268 because they are using content-addressed storage where the truename of a file
2269 is related to a digest of its individual contents,
2270 and not to other files in the same intended project.
2271 For these people, ASDF 3 allows to eschew the @code{TRUENAME} mechanism,
2272 by setting the variable @var{asdf:*resolve-symlinks*} to @code{NIL}.
2273
2274 PS: Yes, if you haven't read Vernor Vinge's short but great classic
2275 ``True Names... and Other Dangers'' then you're in for a treat.
2276
2277
2278 @section XDG base directory
2279
2280 Note that we purport to respect the XDG base directory specification
2281 as to where configuration files are located,
2282 where data files are located,
2283 where output file caches are located.
2284 Mentions of XDG variables refer to that document.
2285
2286 @url{http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html}
2287
2288 This specification allows the user to specify some environment variables
2289 to customize how applications behave to his preferences.
2290
2291 On Windows platforms, when not using Cygwin,
2292 instead of the XDG base directory specification,
2293 we try to use folder configuration from the registry regarding
2294 @code{Common AppData} and similar directories.
2295 Since support for querying the Windows registry
2296 is not possible to do in reasonable amounts of portable Common Lisp code,
2297 ASDF 3 relies on the environment variables that Windows usually exports.
2298
2299 @section Backward Compatibility
2300
2301 For backward compatibility as well as to provide a practical backdoor for hackers,
2302 ASDF will first search for @code{.asd} files in the directories specified in
2303 @code{asdf:*central-registry*}
2304 before it searches in the source registry above.
2305
2306 @xref{Configuring ASDF,,Configuring ASDF to find your systems --- old style}.
2307
2308 By default, @code{asdf:*central-registry*} will be empty.
2309
2310 This old mechanism will therefore not affect you if you don't use it,
2311 but will take precedence over the new mechanism if you do use it.
2312
2313 @section Configuration DSL
2314
2315 Here is the grammar of the s-expression (SEXP) DSL for source-registry
2316 configuration:
2317
2318 @c FIXME: This is too wide for happy compilation into pdf.
2319
2320 @example
2321 ;; A configuration is a single SEXP starting with keyword :source-registry
2322 ;; followed by a list of directives.
2323 CONFIGURATION := (:source-registry DIRECTIVE ...)
2324
2325 ;; A directive is one of the following:
2326 DIRECTIVE :=
2327     ;; INHERITANCE DIRECTIVE:
2328     ;; Your configuration expression MUST contain
2329     ;; exactly one of either of these:
2330     :inherit-configuration | ; splices inherited configuration (often specified last)
2331     :ignore-inherited-configuration | ; drop inherited configuration (specified anywhere)
2332
2333     ;; forward compatibility directive (since ASDF 2.011.4), useful when
2334     ;; you want to use new configuration features but have to bootstrap a
2335     ;; the newer required ASDF from an older release that doesn't sport said features:
2336     :ignore-invalid-entries | ; drops subsequent invalid entries instead of erroring out
2337
2338     ;; add a single directory to be scanned (no recursion)
2339     (:directory DIRECTORY-PATHNAME-DESIGNATOR) |
2340
2341     ;; add a directory hierarchy, recursing but excluding specified patterns
2342     (:tree DIRECTORY-PATHNAME-DESIGNATOR) |
2343
2344     ;; override the defaults for exclusion patterns
2345     (:exclude EXCLUSION-PATTERN ...) |
2346     ;; augment the defaults for exclusion patterns
2347     (:also-exclude EXCLUSION-PATTERN ...) |
2348     ;; Note that the scope of a an exclude pattern specification is
2349     ;; the rest of the current configuration expression or file.
2350
2351     ;; splice the parsed contents of another config file
2352     (:include REGULAR-FILE-PATHNAME-DESIGNATOR) |
2353
2354     ;; This directive specifies that some default must be spliced.
2355     :default-registry
2356
2357 REGULAR-FILE-PATHNAME-DESIGNATOR := PATHNAME-DESIGNATOR ;; interpreted as a file
2358 DIRECTORY-PATHNAME-DESIGNATOR := PATHNAME-DESIGNATOR ;; interpreted as a directory name
2359
2360 PATHNAME-DESIGNATOR :=
2361     NIL | ;; Special: skip this entry.
2362     ABSOLUTE-COMPONENT-DESIGNATOR ;; see pathname DSL
2363
2364 EXCLUSION-PATTERN := a string without wildcards, that will be matched exactly
2365         against the name of a any subdirectory in the directory component
2366         of a path. e.g. @code{"_darcs"} will match @file{#p"/foo/bar/_darcs/src/bar.asd"}
2367 @end example
2368
2369 Pathnames are designated using another DSL,
2370 shared with the output-translations configuration DSL below.
2371 The DSL is resolved by the function @code{asdf::resolve-location},
2372 to be documented and exported at some point in the future.
2373
2374 @example
2375 ABSOLUTE-COMPONENT-DESIGNATOR :=
2376     (ABSOLUTE-COMPONENT-DESIGNATOR RELATIVE-COMPONENT-DESIGNATOR ...) |
2377     STRING | ;; namestring (better be absolute or bust, directory assumed where applicable).
2378              ;; In output-translations, directory is assumed and **/*.*.* added if it's last.
2379              ;; On MCL, a MacOSX-style POSIX namestring (for MacOS9 style, use #p"...");
2380              ;; Note that none of the above applies to strings used in *central-registry*,
2381              ;; which doesn't use this DSL: they are processed as normal namestrings.
2382              ;; however, you can compute what you put in the *central-registry*
2383              ;; based on the results of say (asdf::resolve-location "/Users/fare/cl/cl-foo/")
2384     PATHNAME | ;; pathname (better be an absolute path, or bust)
2385                ;; In output-translations, unless followed by relative components,
2386                ;; it better have appropriate wildcards, as in **/*.*.*
2387     :HOME | ;; designates the user-homedir-pathname ~/
2388     :USER-CACHE | ;; designates the default location for the user cache
2389     :HERE | ;; designates the location of the configuration file
2390             ;; (or *default-pathname-defaults*, if invoked interactively)
2391     :ROOT ;; magic, for output-translations source only: paths that are relative
2392           ;; to the root of the source host and device
2393     ;; Not valid anymore: :SYSTEM-CACHE (was a security hazard)
2394
2395 RELATIVE-COMPONENT-DESIGNATOR :=
2396     (RELATIVE-COMPONENT-DESIGNATOR RELATIVE-COMPONENT-DESIGNATOR ...) |
2397     STRING | ;; relative directory pathname as interpreted by coerce-pathname.
2398              ;; In output translations, if last component, **/*.*.* is added
2399     PATHNAME | ;; pathname; unless last component, directory is assumed.
2400     :IMPLEMENTATION | ;; directory based on implementation, e.g. sbcl-1.0.45-linux-x64
2401     :IMPLEMENTATION-TYPE | ;; a directory based on lisp-implementation-type only, e.g. sbcl
2402     :DEFAULT-DIRECTORY | ;; a relativized version of the default directory
2403     :*/ | ;; any direct subdirectory (since ASDF 2.011.4)
2404     :**/ | ;; any recursively inferior subdirectory (since ASDF 2.011.4)
2405     :*.*.* | ;; any file (since ASDF 2.011.4)
2406     ;; Not supported (anymore): :UID and :USERNAME
2407 @end example
2408
2409 For instance, as a simple case, my @file{~/.config/common-lisp/source-registry.conf},
2410 which is the default place ASDF looks for this configuration, once contained:
2411 @example
2412 (:source-registry
2413   (:tree (:home "cl")) ;; will expand to e.g. "/home/joeluser/cl/"
2414   :inherit-configuration)
2415 @end example
2416
2417 @section Configuration Directories
2418
2419 Configuration directories consist in files each containing
2420 a list of directives without any enclosing @code{(:source-registry ...)} form.
2421 The files will be sorted by namestring as if by @code{string<} and
2422 the lists of directives of these files with be concatenated in order.
2423 An implicit @code{:inherit-configuration} will be included
2424 at the @emph{end} of the list.
2425
2426 This allows for packaging software that has file granularity
2427 (e.g. Debian's @code{dpkg} or some future version of @code{clbuild})
2428 to easily include configuration information about distributed software.
2429
2430 The convention is that, for sorting purposes,
2431 the names of files in such a directory begin with two digits
2432 that determine the order in which these entries will be read.
2433 Also, the type of these files is conventionally @code{"conf"}
2434 and as a limitation to some implementations (e.g. GNU clisp),
2435 the type cannot be @code{NIL}.
2436
2437 Directories may be included by specifying a directory pathname
2438 or namestring in an @code{:include} directive, e.g.:
2439
2440 @example
2441         (:include "/foo/bar/")
2442 @end example
2443
2444 Hence, to achieve the same effect as
2445 my example @file{~/.config/common-lisp/source-registry.conf} above,
2446 I could simply create a file
2447 @file{~/.config/common-lisp/source-registry.conf.d/33-home-fare-cl.conf}
2448 alone in its directory with the following contents:
2449 @example
2450 (:tree "/home/fare/cl/")
2451 @end example
2452
2453 @subsection The :here directive
2454
2455 The @code{:here} directive is an absolute pathname designator that
2456 refers to the directory containing the configuration file currently
2457 being processed.
2458
2459 The @code{:here} directive is intended to simplify the delivery of
2460 complex CL systems, and for easy configuration of projects shared through
2461 revision control systems, in accordance with our design principle that
2462 each participant should be able to provide all and only the information
2463 available to him or her.
2464
2465 Consider a person X who has set up the source code repository for a
2466 complex project with a master directory @file{dir/}.  Ordinarily, one
2467 might simply have the user add a directive that would look something
2468 like this:
2469 @example
2470    (:tree  "path/to/dir")
2471 @end example
2472 But what if X knows that there are very large subtrees
2473 under dir that are filled with, e.g., Java source code, image files for
2474 icons, etc.?  All of the asdf system definitions are contained in the
2475 subdirectories @file{dir/src/lisp/} and @file{dir/extlib/lisp/}, and
2476 these are the only directories that should be searched.
2477
2478 In this case, X can put into @file{dir/} a file @file{asdf.conf} that
2479 contains the following:
2480 @example
2481 (:source-registry
2482    (:tree (:here "src/lisp/"))
2483    (:tree (:here "extlib/lisp"))
2484    (:directory (:here "outlier/")))
2485 @end example
2486
2487 Then when someone else (call her Y) checks out a copy of this
2488 repository, she need only add
2489 @example
2490 (:include "/path/to/my/checkout/directory/asdf.conf")
2491 @end example
2492 to one of her previously-existing asdf source location configuration
2493 files, or invoke @code{initialize-source-registry} with a configuration
2494 form containing that s-expression.  ASDF will find the .conf file that X
2495 has provided, and then set up source locations within the working
2496 directory according to X's (relative) instructions.
2497
2498 @section Shell-friendly syntax for configuration
2499
2500 When considering environment variable @code{CL_SOURCE_REGISTRY}
2501 ASDF will skip to next configuration if it's an empty string.
2502 It will @code{READ} the string as a SEXP in the DSL
2503 if it begins with a paren @code{(}
2504 and it will be interpreted much like @code{TEXINPUTS}
2505 list of paths, where
2506
2507   * paths are separated
2508    by a @code{:} (colon) on Unix platforms (including cygwin),
2509    by a @code{;} (semicolon) on other platforms (mainly, Windows).
2510
2511   * each entry is a directory to add to the search path.
2512
2513   * if the entry ends with a double slash @code{//}
2514     then it instead indicates a tree in the subdirectories
2515     of which to recurse.
2516
2517   * if the entry is the empty string (which may only appear once),
2518     then it indicates that the inherited configuration should be
2519     spliced there.
2520
2521
2522 @section Search Algorithm
2523 @vindex *default-source-registry-exclusions*
2524
2525 In case that isn't clear, the semantics of the configuration is that
2526 when searching for a system of a given name,
2527 directives are processed in order.
2528
2529 When looking in a directory, if the system is found, the search succeeds,
2530 otherwise it continues.
2531
2532 When looking in a tree, if one system is found, the search succeeds.
2533 If multiple systems are found, the consequences are unspecified:
2534 the search may succeed with any of the found systems,
2535 or an error may be raised.
2536 ASDF currently returns the first system found,
2537 XCVB currently raised an error.
2538 If none is found, the search continues.
2539
2540 Exclude statements specify patterns of subdirectories
2541 the systems from which to ignore.
2542 Typically you don't want to use copies of files kept by such
2543 version control systems as Darcs.
2544 Exclude statements are not propagated to further included or inherited
2545 configuration files or expressions;
2546 instead the defaults are reset around every configuration statement
2547 to the default defaults from @code{asdf::*default-source-registry-exclusions*}.
2548
2549 Include statements cause the search to recurse with the path specifications
2550 from the file specified.
2551
2552 An inherit-configuration statement cause the search to recurse with the path
2553 specifications from the next configuration
2554 (@pxref{Controlling where ASDF searches for systems,,Configurations} above).
2555
2556
2557 @section Caching Results
2558
2559 The implementation is allowed to either eagerly compute the information
2560 from the configurations and file system, or to lazily re-compute it
2561 every time, or to cache any part of it as it goes.
2562 To explicitly flush any information cached by the system, use the API below.
2563
2564
2565 @section Configuration API
2566
2567 The specified functions are exported from your build system's package.
2568 Thus for ASDF the corresponding functions are in package ASDF,
2569 and for XCVB the corresponding functions are in package XCVB.
2570
2571 @defun initialize-source-registry @Aoptional PARAMETER
2572    will read the configuration and initialize all internal variables.
2573    You may extend or override configuration
2574    from the environment and configuration files
2575    with the given @var{PARAMETER}, which can be
2576    @code{NIL} (no configuration override),
2577    or a SEXP (in the SEXP DSL),
2578    a string (as in the string DSL),
2579    a pathname (of a file or directory with configuration),
2580    or a symbol (fbound to function that when called returns one of the above).
2581 @end defun
2582
2583 @defun clear-source-registry
2584    undoes any source registry configuration
2585    and clears any cache for the search algorithm.
2586    You might want to call this function
2587    (or better, @code{clear-configuration})
2588    before you dump an image that would be resumed
2589    with a different configuration,
2590    and return an empty configuration.
2591    Note that this does not include clearing information about
2592    systems defined in the current image, only about
2593    where to look for systems not yet defined.
2594 @end defun
2595
2596 @defun ensure-source-registry @Aoptional PARAMETER
2597    checks whether a source registry has been initialized.
2598    If not, initialize it with the given @var{PARAMETER}.
2599 @end defun
2600
2601 Every time you use ASDF's @code{find-system}, or
2602 anything that uses it (such as @code{operate}, @code{load-system}, etc.),
2603 @code{ensure-source-registry} is called with parameter NIL,
2604 which the first time around causes your configuration to be read.
2605 If you change a configuration file,
2606 you need to explicitly @code{initialize-source-registry} again,
2607 or maybe simply to @code{clear-source-registry} (or @code{clear-configuration})
2608 which will cause the initialization to happen next time around.
2609
2610
2611 @section Status
2612
2613 This mechanism is vastly successful, and we have declared
2614 that @code{asdf:*central-registry*} is not recommended anymore,
2615 though we will continue to support it.
2616 All hooks into implementation-specific search mechanisms
2617 have been integrated in the @code{wrapping-source-registry}
2618 that everyone uses implicitly.
2619
2620
2621 @section Rejected ideas
2622
2623 Alternatives I considered and rejected included:
2624
2625 @enumerate
2626 @item Keep @code{asdf:*central-registry*} as the master with its current semantics,
2627    and somehow the configuration parser expands the new configuration
2628    language into a expanded series of directories of subdirectories to
2629    lookup, pre-recursing through specified hierarchies. This is kludgy,
2630    and leaves little space of future cleanups and extensions.
2631
2632 @item Keep @code{asdf:*central-registry*} remains the master but extend its semantics
2633    in completely new ways, so that new kinds of entries may be implemented
2634    as a recursive search, etc. This seems somewhat backwards.
2635
2636 @item Completely remove @code{asdf:*central-registry*}
2637    and break backwards compatibility.
2638    Hopefully this will happen in a few years after everyone migrate to
2639    a better ASDF and/or to XCVB, but it would be very bad to do it now.
2640
2641 @item Replace @code{asdf:*central-registry*} by a symbol-macro with appropriate magic
2642    when you dereference it or setf it. Only the new variable with new
2643    semantics is handled by the new search procedure.
2644    Complex and still introduces subtle semantic issues.
2645 @end enumerate
2646
2647
2648 I've been suggested the below features, but have rejected them,
2649 for the sake of keeping ASDF no more complex than strictly necessary.
2650
2651 @itemize
2652 @item
2653   More syntactic sugar: synonyms for the configuration directives, such as
2654   @code{(:add-directory X)} for @code{(:directory X)}, or @code{(:add-directory-hierarchy X)}
2655   or @code{(:add-directory X :recurse t)} for @code{(:tree X)}.
2656
2657 @item
2658    The possibility to register individual files instead of directories.
2659
2660 @item
2661   Integrate Xach Beane's tilde expander into the parser,
2662   or something similar that is shell-friendly or shell-compatible.
2663   I'd rather keep ASDF minimal. But maybe this precisely keeps it
2664   minimal by removing the need for evaluated entries that ASDF has?
2665   i.e. uses of @code{USER-HOMEDIR-PATHNAME} and @code{$SBCL_HOME}
2666   Hopefully, these are already superseded by the @code{:default-registry}
2667
2668 @item
2669   Using the shell-unfriendly syntax @code{/**} instead of @code{//} to specify recursion
2670   down a filesystem tree in the environment variable.
2671   It isn't that Lisp friendly either.
2672 @end itemize
2673
2674 @section TODO
2675
2676 @itemize
2677 @item Add examples
2678 @end itemize
2679
2680
2681 @section Credits for the source-registry
2682
2683 Thanks a lot to Stelian Ionescu for the initial idea.
2684
2685 Thanks to Rommel Martinez for the initial implementation attempt.
2686
2687 All bad design ideas and implementation bugs are to mine, not theirs.
2688 But so are good design ideas and elegant implementation tricks.
2689
2690  --- Francois-Rene Rideau @email{fare@@tunes.org}, Mon, 22 Feb 2010 00:07:33 -0500
2691
2692
2693
2694 @node Controlling where ASDF saves compiled files, Error handling, Controlling where ASDF searches for systems, Top
2695 @comment  node-name,  next,  previous,  up
2696 @chapter Controlling where ASDF saves compiled files
2697 @cindex asdf-output-translations
2698 @vindex ASDF_OUTPUT_TRANSLATIONS
2699
2700 Each Common Lisp implementation has its own format
2701 for compiled files (fasls for short, short for ``fast loading'').
2702 If you use multiple implementations
2703 (or multiple versions of the same implementation),
2704 you'll soon find your source directories
2705 littered with various @file{fasl}s, @file{dfsl}s, @file{cfsl}s and so on.
2706 Worse yet, some implementations use the same file extension
2707 while changing formats from version to version (or platform to platform)
2708 which means that you'll have to recompile binaries
2709 as you switch from one implementation to the next.
2710
2711 Since ASDF 2, ASDF includes the @code{asdf-output-translations} facility
2712 to mitigate the problem.
2713
2714 @section Configurations
2715
2716 Configurations specify mappings from input locations to output locations.
2717 Once again we rely on the XDG base directory specification for configuration.
2718 @xref{Controlling where ASDF searches for systems,,XDG base directory}.
2719
2720 @enumerate
2721
2722 @item
2723 Some hardcoded wrapping output translations configuration may be used.
2724 This allows special output translations (or usually, invariant directories)
2725 to be specified corresponding to the similar special entries in the source registry.
2726
2727 @item
2728 An application may explicitly initialize the output-translations
2729 configuration using the Configuration API
2730 in which case this takes precedence.
2731 (@pxref{Controlling where ASDF saves compiled files,,Configuration API}.)
2732 It may itself compute this configuration from the command-line,
2733 from a script, from its own configuration file, etc.
2734
2735 @item
2736 The source registry will be configured from
2737 the environment variable @code{ASDF_OUTPUT_TRANSLATIONS} if it exists.
2738
2739 @item
2740 The source registry will be configured from
2741 user configuration file
2742 @file{$XDG_CONFIG_DIRS/common-lisp/asdf-output-translations.conf}
2743 (which defaults to
2744 @file{~/.config/common-lisp/asdf-output-translations.conf})
2745 if it exists.
2746
2747 @item
2748 The source registry will be configured from
2749 user configuration directory
2750 @file{$XDG_CONFIG_DIRS/common-lisp/asdf-output-translations.conf.d/}
2751 (which defaults to
2752 @file{~/.config/common-lisp/asdf-output-translations.conf.d/})
2753 if it exists.
2754
2755 @item
2756 The source registry will be configured from
2757 system configuration file
2758 @file{/etc/common-lisp/asdf-output-translations.conf}
2759 if it exists.
2760
2761 @item
2762 The source registry will be configured from
2763 system configuration directory
2764 @file{/etc/common-lisp/asdf-output-translations.conf.d/}
2765 if it exists.
2766
2767 @end enumerate
2768
2769 Each of these configurations is specified as a SEXP
2770 in a trival domain-specific language (defined below).
2771 Additionally, a more shell-friendly syntax is available
2772 for the environment variable (defined yet below).
2773
2774 Each of these configurations is only used if the previous
2775 configuration explicitly or implicitly specifies that it
2776 includes its inherited configuration.
2777
2778 Note that by default, a per-user cache is used for output files.
2779 This allows the seamless use of shared installations of software
2780 between several users, and takes files out of the way of the developers
2781 when they browse source code,
2782 at the expense of taking a small toll when developers have to clean up
2783 output files and find they need to get familiar with output-translations first.
2784
2785
2786 @section Backward Compatibility
2787 @cindex ASDF-BINARY-LOCATIONS compatibility
2788
2789
2790 We purposefully do NOT provide backward compatibility with earlier versions of
2791 @code{ASDF-Binary-Locations} (8 Sept 2009),
2792 @code{common-lisp-controller} (7.0) or
2793 @code{cl-launch} (2.35),
2794 each of which had similar general capabilities.
2795 The previous APIs of these programs were not designed
2796 for configuration by the end-user
2797 in an easy way with configuration files.
2798 Recent versions of same packages use
2799 the new @code{asdf-output-translations} API as defined below:
2800 @code{common-lisp-controller} (7.2) and @code{cl-launch} (3.000).
2801 @code{ASDF-Binary-Locations} is fully superseded and not to be used anymore.
2802
2803 This incompatibility shouldn't inconvenience many people.
2804 Indeed, few people use and customize these packages;
2805 these few people are experts who can trivially adapt to the new configuration.
2806 Most people are not experts, could not properly configure these features
2807 (except inasmuch as the default configuration of
2808 @code{common-lisp-controller} and/or @code{cl-launch}
2809 might have been doing the right thing for some users),
2810 and yet will experience software that ``just works'',
2811 as configured by the system distributor, or by default.
2812
2813 Nevertheless, if you are a fan of @code{ASDF-Binary-Locations},
2814 we provide a limited emulation mode:
2815
2816 @defun enable-asdf-binary-locations-compatibility @Akey centralize-lisp-binaries default-toplevel-directory include-per-user-information map-all-source-files source-to-target-mappings
2817 This function will initialize the new @code{asdf-output-translations} facility in a way
2818 that emulates the behavior of the old @code{ASDF-Binary-Locations} facility.
2819 Where you would previously set global variables
2820 @var{*centralize-lisp-binaries*},
2821 @var{*default-toplevel-directory*},
2822 @var{*include-per-user-information*},
2823 @var{*map-all-source-files*} or @var{*source-to-target-mappings*}
2824 you will now have to pass the same values as keyword arguments to this function.
2825 Note however that as an extension the @code{:source-to-target-mappings} keyword argument
2826 will accept any valid pathname designator for @code{asdf-output-translations}
2827 instead of just strings and pathnames.
2828 @end defun
2829
2830 If you insist, you can also keep using the old @code{ASDF-Binary-Locations}
2831 (the one available as an extension to load of top of ASDF,
2832 not the one built into a few old versions of ASDF),
2833 but first you must disable @code{asdf-output-translations}
2834 with @code{(asdf:disable-output-translations)},
2835 or you might experience ``interesting'' issues.
2836
2837 Also, note that output translation is enabled by default.
2838 To disable it, use @code{(asdf:disable-output-translations)}.
2839
2840
2841 @section Configuration DSL
2842
2843 Here is the grammar of the SEXP DSL
2844 for @code{asdf-output-translations} configuration:
2845
2846 @verbatim
2847 ;; A configuration is single SEXP starting with keyword :source-registry
2848 ;; followed by a list of directives.
2849 CONFIGURATION := (:output-translations DIRECTIVE ...)
2850
2851 ;; A directive is one of the following:
2852 DIRECTIVE :=
2853     ;; INHERITANCE DIRECTIVE:
2854     ;; Your configuration expression MUST contain
2855     ;; exactly one of either of these:
2856     :inherit-configuration | ; splices inherited configuration (often specified last)
2857     :ignore-inherited-configuration | ; drop inherited configuration (specified anywhere)
2858
2859     ;; forward compatibility directive (since ASDF 2.011.4), useful when
2860     ;; you want to use new configuration features but have to bootstrap a
2861     ;; the newer required ASDF from an older release that doesn't sport said features:
2862     :ignore-invalid-entries | ; drops subsequent invalid entries instead of erroring out
2863
2864     ;; include a configuration file or directory
2865     (:include PATHNAME-DESIGNATOR) |
2866
2867     ;; enable global cache in ~/.common-lisp/cache/sbcl-1.0.45-linux-amd64/ or something.
2868     :enable-user-cache |
2869     ;; Disable global cache. Map / to /
2870     :disable-cache |
2871
2872     ;; add a single directory to be scanned (no recursion)
2873     (DIRECTORY-DESIGNATOR DIRECTORY-DESIGNATOR)
2874
2875     ;; use a function to return the translation of a directory designator
2876     (DIRECTORY-DESIGNATOR (:function TRANSLATION-FUNCTION))
2877
2878 DIRECTORY-DESIGNATOR :=
2879     NIL | ;; As source: skip this entry. As destination: same as source
2880     T | ;; as source matches anything, as destination leaves pathname unmapped.
2881     ABSOLUTE-COMPONENT-DESIGNATOR ;; same as in the source-registry language
2882
2883 TRANSLATION-FUNCTION :=
2884     SYMBOL | ;; symbol of a function that takes two arguments,
2885              ;; the pathname to be translated and the matching DIRECTORY-DESIGNATOR
2886     LAMBDA   ;; A form which evalutates to a function taking two arguments consisting of
2887              ;; the pathname to be translated and the matching DIRECTORY-DESIGNATOR
2888
2889 @end verbatim
2890
2891 Relative components better be either relative
2892 or subdirectories of the path before them, or bust.
2893
2894 The last component, if not a pathname, is notionally completed by @file{/**/*.*}.
2895 You can specify more fine-grained patterns
2896 by using a pathname object as the last component
2897 e.g. @file{#p"some/path/**/foo*/bar-*.fasl"}
2898
2899 You may use @code{#+features} to customize the configuration file.
2900
2901 The second designator of a mapping may be @code{NIL}, indicating that files are not mapped
2902 to anything but themselves (same as if the second designator was the same as the first).
2903
2904 When the first designator is @code{t},
2905 the mapping always matches.
2906 When the first designator starts with @code{:root},
2907 the mapping matches any host and device.
2908 In either of these cases, if the second designator
2909 isn't @code{t} and doesn't start with @code{:root},
2910 then strings indicating the host and pathname are somehow copied
2911 in the beginning of the directory component of the source pathname
2912 before it is translated.
2913
2914 When the second designator is @code{t}, the mapping is the identity.
2915 When the second designator starts with @code{:root},
2916 the mapping preserves the host and device of the original pathname.
2917 Notably, this allows you to map files
2918 to a subdirectory of the whichever directory the file is in.
2919 Though the syntax is not quite as easy to use as we'd like,
2920 you can have an (source destination) mapping entry such as follows
2921 in your configuration file,
2922 or you may use @code{enable-asdf-binary-locations-compatibility}
2923 with @code{:centralize-lisp-binaries nil}
2924 which will do the same thing internally for you:
2925 @verbatim
2926   #.(let ((wild-subdir (make-pathname :directory '(:relative :wild-inferiors)))
2927           (wild-file (make-pathname :name :wild :version :wild :type :wild)))
2928      `((:root ,wild-subdir ,wild-file) ;; Or using the implicit wildcard, just :root
2929        (:root ,wild-subdir :implementation ,wild-file)))
2930 @end verbatim
2931 Starting with ASDF 2.011.4, you can use the simpler:
2932         @code{`(:root (:root :**/ :implementation :*.*.*))}
2933
2934
2935
2936 @code{:include} statements cause the search to recurse with the path specifications
2937 from the file specified.
2938
2939 If the @code{translate-pathname} mechanism cannot achieve a desired
2940 translation, the user may provide a function which provides the
2941 required algorithim.  Such a translation function is specified by
2942 supplying a list as the second @code{directory-designator}
2943 the first element of which is the keyword @code{:function},
2944 and the second element of which is
2945 either a symbol which designates a function or a lambda expression.
2946 The function designated by the second argument must take two arguments,
2947 the first being the pathname of the source file,
2948 the second being the wildcard that was matched.
2949 The result of the function invocation should be the translated pathname.
2950
2951 An @code{:inherit-configuration} statement cause the search to recurse with the path
2952 specifications from the next configuration.
2953 @xref{Controlling where ASDF saves compiled files,,Configurations}, above.
2954
2955 @itemize
2956 @item
2957 @code{:enable-user-cache} is the same as @code{(t :user-cache)}.
2958 @item
2959 @code{:disable-cache} is the same as @code{(t t)}.
2960 @item
2961 @code{:user-cache} uses the contents of variable @code{asdf::*user-cache*}
2962 which by default is the same as using
2963 @code{(:home ".cache" "common-lisp" :implementation)}.
2964 @item
2965 @code{:system-cache} uses the contents of variable @code{asdf::*system-cache*}
2966 which by default is the same as using
2967 @code{("/var/cache/common-lisp" :uid :implementation-type)}
2968 (on Unix and cygwin), or something semi-sensible on Windows.
2969 @end itemize
2970
2971
2972 @section Configuration Directories
2973
2974 Configuration directories consist in files each contains
2975 a list of directives without any enclosing
2976 @code{(:output-translations ...)} form.
2977 The files will be sorted by namestring as if by @code{string<} and
2978 the lists of directives of these files with be concatenated in order.
2979 An implicit @code{:inherit-configuration} will be included
2980 at the @emph{end} of the list.
2981
2982 This allows for packaging software that has file granularity
2983 (e.g. Debian's @command{dpkg} or some future version of @command{clbuild})
2984 to easily include configuration information about software being distributed.
2985
2986 The convention is that, for sorting purposes,
2987 the names of files in such a directory begin with two digits
2988 that determine the order in which these entries will be read.
2989 Also, the type of these files is conventionally @code{"conf"}
2990 and as a limitation of some implementations, the type cannot be @code{NIL}.
2991
2992 Directories may be included by specifying a directory pathname
2993 or namestring in an @code{:include} directive, e.g.:
2994 @verbatim
2995         (:include "/foo/bar/")
2996 @end verbatim
2997
2998 @section Shell-friendly syntax for configuration
2999
3000 When considering environment variable @code{ASDF_OUTPUT_TRANSLATIONS}
3001 ASDF will skip to next configuration if it's an empty string.
3002 It will @code{READ} the string as an SEXP in the DSL
3003 if it begins with a paren @code{(}
3004 and it will be interpreted as a list of directories.
3005 Directories should come by pairs, indicating a mapping directive.
3006 Entries are separated
3007 by a @code{:} (colon) on Unix platforms (including cygwin),
3008 by a @code{;} (semicolon) on other platforms (mainly, Windows).
3009
3010 The magic empty entry,
3011 if it comes in what would otherwise be the first entry in a pair,
3012 indicates the splicing of inherited configuration.
3013 If it comes as the second entry in a pair,
3014 it indicates that the directory specified first is to be left untranslated
3015 (which has the same effect as if the directory had been repeated).
3016
3017
3018 @section Semantics of Output Translations
3019
3020 From the specified configuration,
3021 a list of mappings is extracted in a straightforward way:
3022 mappings are collected in order, recursing through
3023 included or inherited configuration as specified.
3024 To this list is prepended some implementation-specific mappings,
3025 and is appended a global default.
3026
3027 The list is then compiled to a mapping table as follows:
3028 for each entry, in order, resolve the first designated directory
3029 into an actual directory pathname for source locations.
3030 If no mapping was specified yet for that location,
3031 resolve the second designated directory to an output location directory
3032 add a mapping to the table mapping the source location to the output location,
3033 and add another mapping from the output location to itself
3034 (unless a mapping already exists for the output location).
3035
3036 Based on the table, a mapping function is defined,
3037 mapping source pathnames to output pathnames:
3038 given a source pathname, locate the longest matching prefix
3039 in the source column of the mapping table.
3040 Replace that prefix by the corresponding output column
3041 in the same row of the table, and return the result.
3042 If no match is found, return the source pathname.
3043 (A global default mapping the filesystem root to itself
3044 may ensure that there will always be a match,
3045 with same fall-through semantics).
3046
3047 @section Caching Results
3048
3049 The implementation is allowed to either eagerly compute the information
3050 from the configurations and file system, or to lazily re-compute it
3051 every time, or to cache any part of it as it goes.
3052 To explicitly flush any information cached by the system, use the API below.
3053
3054
3055 @section Output location API
3056
3057 The specified functions are exported from package ASDF.
3058
3059 @defun initialize-output-translations @Aoptional PARAMETER
3060    will read the configuration and initialize all internal variables.
3061    You may extend or override configuration
3062    from the environment and configuration files
3063    with the given @var{PARAMETER}, which can be
3064    @code{NIL} (no configuration override),
3065    or a SEXP (in the SEXP DSL),
3066    a string (as in the string DSL),
3067    a pathname (of a file or directory with configuration),
3068    or a symbol (fbound to function that when called returns one of the above).
3069 @end defun
3070
3071 @defun disable-output-translations
3072    will initialize output translations in a way
3073    that maps every pathname to itself,
3074    effectively disabling the output translation facility.
3075 @end defun
3076
3077 @defun clear-output-translations
3078    undoes any output translation configuration
3079    and clears any cache for the mapping algorithm.
3080    You might want to call this function
3081    (or better, @code{clear-configuration})
3082    before you dump an image that would be resumed
3083    with a different configuration,
3084    and return an empty configuration.
3085    Note that this does not include clearing information about
3086    systems defined in the current image, only about
3087    where to look for systems not yet defined.
3088 @end defun
3089
3090 @defun ensure-output-translations @Aoptional PARAMETER
3091    checks whether output translations have been initialized.
3092    If not, initialize them with the given @var{PARAMETER}.
3093    This function will be called before any attempt to operate on a system.
3094 @end defun
3095
3096 @defun apply-output-translations PATHNAME
3097    Applies the configured output location translations to @var{PATHNAME}
3098    (calls @code{ensure-output-translations} for the translations).
3099 @end defun
3100
3101 Every time you use ASDF's @code{output-files}, or
3102 anything that uses it (that may compile, such as @code{operate}, @code{perform}, etc.),
3103 @code{ensure-output-translations} is called with parameter NIL,
3104 which the first time around causes your configuration to be read.
3105 If you change a configuration file,
3106 you need to explicitly @code{initialize-output-translations} again,
3107 or maybe @code{clear-output-translations} (or @code{clear-configuration}),
3108 which will cause the initialization to happen next time around.
3109
3110
3111 @section Credits for output translations
3112
3113 Thanks a lot to Bjorn Lindberg and Gary King for @code{ASDF-Binary-Locations},
3114 and to Peter van Eynde for @code{Common Lisp Controller}.
3115
3116 All bad design ideas and implementation bugs are to mine, not theirs.
3117 But so are good design ideas and elegant implementation tricks.
3118
3119  --- Francois-Rene Rideau @email{fare@@tunes.org}
3120
3121 @c @section Default locations
3122 @c @findex output-files-for-system-and-operation
3123
3124 @c The default binary location for each Lisp implementation
3125 @c is a subdirectory of each source directory.
3126 @c To account for different Lisps, Operating Systems, Implementation versions,
3127 @c and so on, ASDF borrows code from SLIME
3128 @c to create reasonable custom directory names.
3129 @c Here are some examples:
3130
3131 @c @itemize
3132 @c @item
3133 @c SBCL, version 1.0.45 on Mac OS X for Intel: @code{sbcl-1.0.45-darwin-x86}
3134
3135 @c @item
3136 @c Franz Allegro, version 8.0, ANSI Common Lisp: @code{allegro-8.0a-macosx-x86}
3137
3138 @c @item
3139 @c Franz Allegro, version 8.1, Modern (case sensitive) Common Lisp: @code{allegro-8.1m-macosx-x86}
3140 @c @end itemize
3141
3142 @c By default, all output file pathnames will be relocated
3143 @c to some thus-named subdirectory of @file{~/.cache/common-lisp/}.
3144
3145 @c See the document @file{README.asdf-output-translations}
3146 @c for a full specification on how to configure @code{asdf-output-translations}.
3147
3148 @node  Error handling, Miscellaneous additional functionality, Controlling where ASDF saves compiled files, Top
3149 @comment  node-name,  next,  previous,  up
3150 @chapter Error handling
3151 @findex SYSTEM-DEFINITION-ERROR
3152 @findex OPERATION-ERROR
3153
3154 @section ASDF errors
3155
3156 If ASDF detects an incorrect system definition, it will signal a generalised instance of
3157 @code{SYSTEM-DEFINITION-ERROR}.
3158
3159 Operations may go wrong (for example when source files contain errors).
3160 These are signalled using generalised instances of
3161 @code{OPERATION-ERROR}.
3162
3163 @section Compilation error and warning handling
3164 @vindex *compile-file-warnings-behaviour*
3165 @vindex *compile-file-errors-behavior*
3166
3167 ASDF checks for warnings and errors when a file is compiled.
3168 The variables @var{*compile-file-warnings-behaviour*} and
3169 @var{*compile-file-errors-behavior*}
3170 control the handling of any such events.
3171 The valid values for these variables are
3172 @code{:error}, @code{:warn}, and @code{:ignore}.
3173
3174 @node  Miscellaneous additional functionality, Getting the latest version, Error handling, Top
3175 @comment  node-name,  next,  previous,  up
3176 @chapter Miscellaneous additional functionality
3177
3178 ASDF includes several additional features that are generally
3179 useful for system definition and development.
3180
3181 @section Controlling file compilation
3182
3183 When declaring a component (system, module, file),
3184 you can specify a keyword argument @code{:around-compile function}.
3185 If left unspecified (and therefore unbound),
3186 the value will be inherited from the parent component if any,
3187 or with a default of @code{nil}
3188 if no value is specified in any transitive parent.
3189
3190 The argument must be a either @code{nil}, a fbound symbol,
3191 a lambda-expression (e.g. @code{(lambda (thunk) ...(funcall thunk ...) ...)})
3192 a function object (e.g. using @code{#.#'} but that's discouraged
3193 because it prevents the introspection done by e.g. asdf-dependency-grovel),
3194 or a string that when @code{read} yields a symbol or a lambda-expression.
3195 @code{nil} means the normal compile-file function will be called.
3196 A non-nil value designates a function of one argument
3197 that will be called with a function that will
3198 invoke @code{compile-file*} with various arguments;
3199 the around-compile hook may supply additional keyword arguments
3200 to pass to that call to @code{compile-file*}.
3201
3202 One notable argument that is heeded by @code{compile-file*} is
3203 @code{:compile-check},
3204 a function called when the compilation was otherwise a success,
3205 with the same arguments as @code{compile-file};
3206 the function shall return true if the compilation
3207 and its resulting compiled file respected all system-specific invariants,
3208 and false (@code{nil}) if it broke any of those invariants;
3209 it may issue warnings or errors before it returns @code{nil}.
3210 (NB: The ability to pass such extra flags
3211 is only available starting with ASDF 2.22.3.)
3212 This feature is notably exercised by asdf-finalizers.
3213
3214 By using a string, you may reference
3215 a function, symbol and/or package
3216 that will only be created later during the build, but
3217 isn't yet present at the time the defsystem form is evaluated.
3218 However, if your entire system is using such a hook, you may have to
3219 explicitly override the hook with @code{nil} for all the modules and files
3220 that are compiled before the hook is defined.
3221
3222 Using this hook, you may achieve such effects as:
3223 locally renaming packages,
3224 binding @var{*readtables*} and other syntax-controlling variables,
3225 handling warnings and other conditions,
3226 proclaiming consistent optimization settings,
3227 saving code coverage information,
3228 maintaining meta-data about compilation timings,
3229 setting gensym counters and PRNG seeds and other sources of non-determinism,
3230 overriding the source-location and/or timestamping systems,
3231 checking that some compile-time side-effects were properly balanced,
3232 etc.
3233
3234 Note that there is no around-load hook. This is on purpose.
3235 Some implementations such as ECL, GCL or MKCL link object files,
3236 which allows for no such hook.
3237 Other implementations allow for concatenating FASL files,
3238 which doesn't allow for such a hook either.
3239 We aim to discourage something that's not portable,
3240 and has some dubious impact on performance and semantics
3241 even when it is possible.
3242 Things you might want to do with an around-load hook
3243 are better done around-compile,
3244 though it may at times require some creativity
3245 (see e.g. the @code{package-renaming} system).
3246
3247
3248 @section Controlling source file character encoding
3249
3250 Starting with ASDF 2.21, components accept a @code{:encoding} option
3251 so authors may specify which character encoding should be used
3252 to read and evaluate their source code.
3253 When left unspecified, the encoding is inherited
3254 from the parent module or system;
3255 if no encoding is specified at any point,
3256 the default @code{:autodetect} is assumed.
3257 By default, only @code{:default}, @code{:utf-8}
3258 and @code{:autodetect} are accepted.
3259 @code{:autodetect}, the default, calls
3260 @code{*encoding-detection-hook*} which by default always returns
3261 @code{*default-encoding*} which itself defaults to @code{:default}.
3262
3263 In other words, there now are plenty of extension hooks, but
3264 by default ASDF follows the backwards compatible behavior
3265 of using whichever @code{:default} encoding your implementation uses,
3266 which itself may or may not vary based on environment variables
3267 and other locale settings.
3268 In practice this means that only source code that only uses ASCII
3269 is guaranteed to be read the same on all implementations
3270 independently from any user setting.
3271
3272 Additionally, for backward-compatibility with older versions of ASDF
3273 and/or with implementations that do not support unicode and its many encodings,
3274 you may want to use
3275 the reader conditionals @code{#+asdf-unicode #+asdf-unicode}
3276 to protect any @code{:encoding @emph{encoding}} statement
3277 as @code{:asdf-unicode} will be present in @code{*features*}
3278 only if you're using a recent ASDF
3279 on an implementation that supports unicode.
3280 We recommend that you avoid using unprotected @code{:encoding} specifications
3281 until after ASDF 2.21 or later becomes widespread, hopefully by the end of 2012.
3282
3283 While it offers plenty of hooks for extension,
3284 and one such extension is being developed (see below),
3285 ASDF itself only recognizes one encoding beside @code{:default},
3286 and that is @code{:utf-8}, which is the @emph{de facto} standard,
3287 already used by the vast majority of libraries that use more than ASCII.
3288 On implementations that do not support unicode,
3289 the feature @code{:asdf-unicode} is absent, and
3290 the @code{:default} external-format is used
3291 to read even source files declared as @code{:utf-8}.
3292 On these implementations, non-ASCII characters
3293 intended to be read as one CL character
3294 may thus end up being read as multiple CL characters.
3295 In most cases, this shouldn't affect the software's semantics:
3296 comments will be skipped just the same, strings with be read and printed
3297 with slightly different lengths, symbol names will be accordingly longer,
3298 but none of it should matter.
3299 But a few systems that actually depend on unicode characters
3300 may fail to work properly, or may work in a subtly different way.
3301 See for instance @code{lambda-reader}.
3302
3303 We invite you to embrace UTF-8
3304 as the encoding for non-ASCII characters starting today,
3305 even without any explicit specification in your @code{.asd} files.
3306 Indeed, on some implementations and configurations,
3307 UTF-8 is already the @code{:default},
3308 and loading your code may cause errors if it is encoded in anything but UTF-8.
3309 Therefore, even with the legacy behavior,
3310 non-UTF-8 is guaranteed to break for some users,
3311 whereas UTF-8 is pretty much guaranteed not to break anywhere
3312 (provided you do @emph{not} use a BOM),
3313 although it might be read incorrectly on some implementations.
3314 In the future, we intend to make @code{:utf-8}
3315 the default value of @code{*default-encoding*},
3316 to be enforced everywhere, so at least the code is guaranteed
3317 to be read correctly everywhere it can be.
3318
3319 If you need non-standard character encodings for your source code,
3320 use the extension system @code{asdf-encodings}, by specifying
3321 @code{:defsystem-depends-on (:asdf-encodings)} in your @code{defsystem}.
3322 This extension system will register support for more encodings using the
3323 @code{*encoding-external-format-hook*} facility,
3324 so you can explicitly specify @code{:encoding :latin1}
3325 in your @code{.asd} file.
3326 Using the @code{*encoding-detection-hook*} it will also
3327 eventually implement some autodetection of a file's encoding
3328 from an emacs-style @code{-*- mode: lisp ; coding: latin1 -*-} declaration,
3329 or otherwise based on an analysis of octet patterns in the file.
3330 At this point, asdf-encoding only supports the encodings
3331 that are supported as part of your implementation.
3332 Since the list varies depending on implementations,
3333 we once again recommend you use @code{:utf-8} everywhere,
3334 which is the most portable (next is @code{:latin1}).
3335
3336 If you're not using a version of Quicklisp that has it,
3337 you may get the source for @code{asdf-encodings} using git:
3338 @kbd{git clone git://common-lisp.net/projects/asdf/asdf-encodings.git}
3339 or
3340 @kbd{git clone ssh://common-lisp.net/project/asdf/git/asdf-encodings.git}.
3341 You can also browse the repository on
3342 @url{http://common-lisp.net/gitweb?p=projects/asdf/asdf-encodings.git}.
3343
3344 In the future, we intend to change the default @code{*default-encoding*}
3345 to @code{:utf-8}, which is already the de facto standard
3346 for most libraries that use non-ASCII characters:
3347 utf-8 works everywhere and was backhandedly enforced by
3348 a lot of people using SBCL and utf-8 and sending reports to authors
3349 so they make their packages compatible.
3350 A survey showed only about a handful few libraries
3351 are incompatible with non-UTF-8, and then, only in comments,
3352 and we believe that authors will adopt UTF-8 when prompted.
3353 See the April 2012 discussion on the asdf-devel mailing-list.
3354 For backwards compatibility with users who insist on a non-UTF-8 encoding,
3355 but cannot immediately transition to using @code{asdf-encodings}
3356 (maybe because it isn't ready), it will still be possible to use
3357 the @code{:encoding :default} option in your @code{defsystem} form
3358 to restore the behavior of ASDF 2.20 and earlier.
3359 This shouldn't be required in libraries,
3360 because user pressure as mentioned above will already have pushed
3361 library authors towards using UTF-8;
3362 but authors of end-user programs might care.
3363
3364 When you use @code{asdf-encodings}, any further loaded @code{.asd} file
3365 will use the autodetection algorithm to determine its encoding;
3366 yet if you depend on this detection happening,
3367 you may want to explicitly load @code{asdf-encodings} early in your build,
3368 for by the time you can use @code{:defsystem-depends-on},
3369 it is already too late to load it.
3370 In practice, this means that the @code{*default-encoding*}
3371 is usually used for @code{.asd} files.
3372 Currently, this defaults to @code{:default} for backwards compatibility,
3373 and that means that you shouldn't rely on non-ASCII characters in a .asd file.
3374 Since component (path)names are the only real data in these files,
3375 and non-ASCII characters are not very portable for file names,
3376 this isn't too much of an issue.
3377 We still encourage you to use either plain ASCII or UTF-8
3378 in @code{.asd} files,
3379 as we intend to make @code{:utf-8} the default encoding in the future.
3380 This might matter, for instance, in meta-data about author's names.
3381
3382
3383 @section Miscellaneous Functions
3384
3385 Most of these functions are not exported by ASDF anymore,
3386 but only used for private purposes of ASDF.
3387 Please use ASDF-UTILS for the same functions exported from a stable library.
3388
3389 @defun coerce-pathname name @Akey type defaults
3390
3391 This function (available starting with ASDF 2.012.11)
3392 takes an argument, and portably interprets it as a pathname.
3393 If the argument @var{name} is a pathname or @code{nil}, it is passed through;
3394 if it's a symbol, it's interpreted as a string by downcasing it;
3395 if it's a string, it is first separated using @code{/} into substrings;
3396 the leading substrings denote subdirectories of a relative pathname.
3397 If @var{type} is @code{:directory} or the string ends with @code{/},
3398 the last substring is also a subdirectory;
3399 if @var{type} is a string, it is used as the type of the pathname, and
3400 the last substring is the name component of the pathname;
3401 if @var{type} is @code{nil}, the last substring specifies both name and type components
3402 of the pathname, with the last @code{.} separating them, or only the name component
3403 if there's no last @code{.} or if there is only one dot and it's the first character.
3404 The host, device and version components come from @var{defaults}, which defaults to
3405 @var{*default-pathname-defaults*}; but that shouldn't matter if you use @code{merge-pathnames*}.
3406
3407 @end defun
3408
3409 @defun merge-pathnames* @Akey specified defaults
3410
3411 This function is a replacement for @code{merge-pathnames} that uses the host and device
3412 from the @var{defaults} rather than the @var{specified} pathname when the latter
3413 is a relative pathname. This allows ASDF and its users to create and use relative pathnames
3414 without having to know beforehand what are the host and device
3415 of the absolute pathnames they are relative to.
3416
3417 @end defun
3418
3419 @defun system-relative-pathname system name @Akey type
3420
3421 It's often handy to locate a file relative to some system.
3422 The @code{system-relative-pathname} function meets this need.
3423
3424 It takes two mandatory arguments @var{system} and @var{name}
3425 and a keyword argument @var{type}:
3426 @var{system} is name of a system, whereas @var{name} and optionally @var{type}
3427 specify a relative pathname, interpreted like a component pathname specifier
3428 by @code{coerce-pathname}. @xref{The defsystem grammar,,Pathname specifiers}.
3429
3430 It returns a pathname built from the location of the system's
3431 source directory and the relative pathname. For example:
3432
3433 @lisp
3434 > (asdf:system-relative-pathname 'cl-ppcre "regex.data")
3435 #P"/repository/other/cl-ppcre/regex.data"
3436 @end lisp
3437
3438 @end defun
3439
3440 @defun system-source-directory system-designator
3441
3442 ASDF does not provide a turnkey solution for locating
3443 data (or other miscellaneous) files
3444 that are distributed together with the source code of a system.
3445 Programmers can use @code{system-source-directory} to find such files.
3446 Returns a pathname object.
3447 The @var{system-designator} may be a string, symbol, or ASDF system object.
3448 @end defun
3449
3450 @defun clear-system system-designator
3451
3452 It is sometimes useful to force recompilation of a previously loaded system.
3453 In these cases, it may be useful to @code{(asdf:clear-system :foo)}
3454 to remove the system from the table of currently loaded systems;
3455 the next time the system @code{foo} or one that depends on it is re-loaded,
3456 @code{foo} will then be loaded again.
3457 Alternatively, you could touch @code{foo.asd} or
3458 remove the corresponding fasls from the output file cache.
3459 (It was once conceived that one should provide
3460 a list of systems the recompilation of which to force
3461 as the @code{:force} keyword argument to @code{load-system};
3462 but this has never worked, and though the feature was fixed in ASDF 2.000,
3463 it remains @code{cerror}'ed out as nobody ever used it.)
3464
3465 Note that this does not and cannot by itself undo the previous loading
3466 of the system. Common Lisp has no provision for such an operation,
3467 and its reliance on irreversible side-effects to global datastructures
3468 makes such a thing impossible in the general case.
3469 If the software being re-loaded is not conceived with hot upgrade in mind,
3470 this re-loading may cause many errors, warnings or subtle silent problems,
3471 as packages, generic function signatures, structures, types, macros, constants, etc.
3472 are being redefined incompatibly.
3473 It is up to the user to make sure that reloading is possible and has the desired effect.
3474 In some cases, extreme measures such as recursively deleting packages,
3475 unregistering symbols, defining methods on @code{update-instance-for-redefined-class}
3476 and much more are necessary for reloading to happen smoothly.
3477 ASDF itself goes through notable pains to make such a hot upgrade possible
3478 with respect to its own code, and what it does is ridiculously complex;
3479 look at the beginning of @file{asdf.lisp} to see what it does.
3480 @end defun
3481
3482 @defun run-program
3483
3484 run-program takes a @var{COMMAND} argument that is either
3485 a list of a program path and its arguments,
3486 or a string to be executed by a shell.
3487 It spawns the command, waits for it to return,
3488 verifies that it exited cleanly (unless told not too below),
3489 and optionally captures and processes its output.
3490 It accepts many keyword arguments to configure its behavior.
3491
3492 @code{output} is its most important argument;
3493 it specifies how the output is captured and processed.
3494 If it is @code{nil}, then the output is not captured.
3495 If it is @code{:interactive}, then
3496 input and output are inherited from the current process,
3497 which the subprocess can control until it exits.
3498 Otherwise, the output is captured and redirected to a stream,
3499 and processed by @code{slurp-input-stream} with the object as first argument.
3500 See below.
3501
3502 @code{element-type} and @code{external-format} are passed on
3503 to your Lisp implementation, when available, for creation of the output stream.
3504
3505 @code{force-shell} forces evaluation of the command through a shell,
3506 even if it was passed as a list rather than a string.
3507
3508 @code{ignore-error-status} causes @code{run-program}
3509 to not raise an error if the spawned program exits in error.
3510 Following POSIX convention, an error is anything but
3511 a normal exit with status code zero.
3512
3513 run-program works on all platforms supported by ASDF, except Genera.
3514
3515 @end defun
3516
3517 @defun slurp-input-stream
3518
3519 It's a generic function of two arguments, a target object and an input stream,
3520 and accepting keyword arguments.
3521 Predefined methods based on the target object are as follow:
3522
3523 If the object is a function, the function is called with the stream as argument.
3524
3525 If the object is a cons, its first element is applied to its rest appended by
3526 a list of the input stream.
3527
3528 If the object is an output stream, the contents of the input stream are copied to it.
3529 If the linewise argument is provided, copying happens line by line,
3530 and an optional prefix is printed before each line.
3531 Otherwise, copying happen based on a buffer of size buffer-size,
3532 using the element-type.
3533
3534 If the object is 'string or :string, the content is captured into a string
3535 of the given element-type.
3536
3537 If the object is :lines, the content is captured as a list of strings,
3538 one per line, without line ending. If the count argument is provided,
3539 it is a maximum count of lines to be read.
3540
3541 If the object is :line, the content is capture as with :lines above,
3542 and then its sub-object is extracted with the path argument,
3543 which defaults to 0, extracting the first line.
3544 A number will extract the corresponding line.
3545 See the documentation for asdf-driver:sub-object.
3546
3547 If the object is :forms, the content is captured as a list of S-expressions,
3548 as read by the Lisp reader.
3549 If the count argument is provided,
3550 it is a maximum count of lines to be read.
3551 We recommend you control the syntax with such macro as
3552 asdf-driver:with-safe-io-syntax.
3553
3554 If the object is :form, the content is capture as with :forms above,
3555 and then its sub-object is extracted with the path argument,
3556 which defaults to 0, extracting the first form.
3557 A number will extract the corresponding form.
3558 See the documentation for asdf-driver:sub-object.
3559 We recommend you control the syntax with such macro as
3560 asdf-driver:with-safe-io-syntax.
3561
3562 @end defun
3563
3564 @defun run-shell-command
3565
3566 This function is obsolete and present only for the sake of backwards-compatibility:
3567 ``If it's not backwards, it's not compatible''. We strongly discourage its use.
3568 Its current behavior is only well-defined on Unix platforms
3569 (which include MacOS X and cygwin). On Windows, anything goes.
3570 The following documentation is only for the purpose of your migrating away from it
3571 in a way that preserves semantics.
3572
3573 Instead we recommend the use @code{run-program} above
3574 available as part of ASDF since ASDF 3.
3575
3576 @code{run-shell-command} takes as arguments a @code{format} control-string
3577 and arguments to be passed to @code{format} after this control-string
3578 to produce a string.
3579 This string is a command that will be evaluated with a POSIX shell if possible;
3580 yet, on Windows, some implementations will use CMD.EXE,
3581 while others (like SBCL) will make an attempt at invoking a POSIX shell
3582 (and fail if it is not present).
3583 @end defun
3584
3585
3586 @node Getting the latest version, FAQ, Miscellaneous additional functionality, Top
3587 @comment  node-name,  next,  previous,  up
3588 @chapter Getting the latest version
3589
3590 Decide which version you want.
3591 The @code{master} branch is where development happens;
3592 its @code{HEAD} is usually OK, including the latest fixes and portability tweaks,
3593 but an occasional regression may happen despite our (limited) test suite.
3594
3595 The @code{release} branch is what cautious people should be using;
3596 it has usually been tested more, and releases are cut at a point
3597 where there isn't any known unresolved issue.
3598
3599 You may get the ASDF source repository using git:
3600 @kbd{git clone git://common-lisp.net/projects/asdf/asdf.git}
3601
3602 You will find the above referenced tags in this repository.
3603 You can also browse the repository on
3604 @url{http://common-lisp.net/gitweb?p=projects/asdf/asdf.git}.
3605
3606 Discussion of ASDF development is conducted on the
3607 mailing list
3608 @kbd{asdf-devel@@common-lisp.net}.
3609 @url{http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel}
3610
3611
3612 @node FAQ, TODO list, Getting the latest version, Top
3613 @comment  node-name,  next,  previous,  up
3614 @chapter FAQ
3615
3616 @section  ``Where do I report a bug?''
3617
3618 ASDF bugs are tracked on launchpad: @url{https://launchpad.net/asdf}.
3619
3620 If you're unsure about whether something is a bug, or for general discussion,
3621 use the @url{http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel,asdf-devel mailing list}
3622
3623
3624 @section ``What has changed between ASDF 1 and ASDF 2?''
3625
3626 @subsection What are ASDF 1 and ASDF 2?
3627
3628 On May 31st 2010, we have released ASDF 2.
3629 ASDF 2 refers to release 2.000 and later.
3630 (Releases between 1.656 and 1.728 were development releases for ASDF 2.)
3631 ASDF 1 to any release earlier than 1.369 or so.
3632 If your ASDF doesn't sport a version, it's an old ASDF 1.
3633
3634 ASDF 2 and its release candidates push
3635 @code{:asdf2} onto @code{*features*} so that if you are writing
3636 ASDF-dependent code you may check for this feature
3637 to see if the new API is present.
3638 @emph{All} versions of ASDF should have the @code{:asdf} feature.
3639
3640 Additionally, all versions of ASDF 2
3641 define a function @code{(asdf:asdf-version)} you may use to query the version;
3642 and the source code of recent versions of ASDF 2 features the version number
3643 prominently on the second line of its source code.
3644
3645 If you are experiencing problems or limitations of any sort with ASDF 1,
3646 we recommend that you should upgrade to ASDF 2,
3647 or whatever is the latest release.
3648
3649
3650 @subsection ASDF can portably name files in subdirectories
3651
3652 Common Lisp namestrings are not portable,
3653 except maybe for logical pathnamestrings,
3654 that themselves have various limitations and require a lot of setup
3655 that is itself ultimately non-portable.
3656
3657 In ASDF 1, the only portable ways to refer to pathnames inside systems and components
3658 were very awkward, using @code{#.(make-pathname ...)} and
3659 @code{#.(merge-pathnames ...)}.
3660 Even the above were themselves were inadequate in the general case
3661 due to host and device issues, unless horribly complex patterns were used.
3662 Plenty of simple cases that looked portable actually weren't,
3663 leading to much confusion and greavance.
3664
3665 ASDF 2 implements its own portable syntax for strings as pathname specifiers.
3666 Naming files within a system definition becomes easy and portable again.
3667 @xref{Miscellaneous additional functionality,asdf:system-relative-pathname},
3668 @code{merge-pathnames*},
3669 @code{coerce-pathname}.
3670
3671 On the other hand, there are places where systems used to accept namestrings
3672 where you must now use an explicit pathname object:
3673 @code{(defsystem ... :pathname "LOGICAL-HOST:PATH;TO;SYSTEM;" ...)}
3674 must now be written with the @code{#p} syntax:
3675 @code{(defsystem ... :pathname #p"LOGICAL-HOST:PATH;TO;SYSTEM;" ...)}
3676
3677 @xref{The defsystem grammar,,Pathname specifiers}.
3678
3679
3680 @subsection Output translations
3681
3682 A popular feature added to ASDF was output pathname translation:
3683 @code{asdf-binary-locations}, @code{common-lisp-controller},
3684 @code{cl-launch} and other hacks were all implementing it in ways
3685 both mutually incompatible and difficult to configure.
3686
3687 Output pathname translation is essential to share
3688 source directories of portable systems across multiple implementations
3689 or variants thereof,
3690 or source directories of shared installations of systems across multiple users,
3691 or combinations of the above.
3692
3693 In ASDF 2, a standard mechanism is provided for that,
3694 @code{asdf-output-translations},
3695 with sensible defaults, adequate configuration languages,
3696 a coherent set of configuration files and hooks,
3697 and support for non-Unix platforms.
3698
3699 @xref{Controlling where ASDF saves compiled files}.
3700
3701 @subsection Source Registry Configuration
3702
3703 Configuring ASDF used to require special magic
3704 to be applied just at the right moment,
3705 between the moment ASDF is loaded and the moment it is used,
3706 in a way that is specific to the user,
3707 the implementation he is using and the application he is building.
3708
3709 This made for awkward configuration files and startup scripts
3710 that could not be shared between users, managed by administrators
3711 or packaged by distributions.
3712
3713 ASDF 2 provides a well-documented way to configure ASDF,
3714 with sensible defaults, adequate configuration languages,
3715 and a coherent set of configuration files and hooks.
3716
3717 We believe it's a vast improvement because it decouples
3718 application distribution from library distribution.
3719 The application writer can avoid thinking where the libraries are,
3720 and the library distributor (dpkg, clbuild, advanced user, etc.)
3721 can configure them once and for every application.
3722 Yet settings can be easily overridden where needed,
3723 so whoever needs control has exactly as much as required.
3724
3725 At the same time, ASDF 2 remains compatible
3726 with the old magic you may have in your build scripts
3727 (using @code{*central-registry*} and
3728 @code{*system-definition-search-functions*})
3729 to tailor the ASDF configuration to your build automation needs,
3730 and also allows for new magic, simpler and more powerful magic.
3731
3732 @xref{Controlling where ASDF searches for systems}.
3733
3734
3735 @subsection Usual operations are made easier to the user
3736
3737 In ASDF 1, you had to use the awkward syntax
3738 @code{(asdf:oos 'asdf:load-op :foo)}
3739 to load a system,
3740 and similarly for @code{compile-op}, @code{test-op}.
3741
3742 In ASDF 2, you can use shortcuts for the usual operations:
3743 @code{(asdf:load-system :foo)}, and
3744 similarly for @code{compile-system}, @code{test-system}.
3745
3746
3747 @subsection Many bugs have been fixed
3748
3749 The following issues and many others have been fixed:
3750
3751 @itemize
3752 @item
3753 The infamous TRAVERSE function has been revamped completely
3754 between ASDF 1 and ASDF 2, with many bugs squashed.
3755 In particular, dependencies were not correctly propagated
3756 across modules but now are.
3757 It has been completely rewritten many times over
3758 between ASDF 2.000 and ASDF 3,
3759 with fundamental issues in the original model being fixed.
3760 Timestamps were not propagated at all, and now are.
3761 The internal model of how actions depend on each other
3762 is now both consistent and complete.
3763 The :version and
3764 the :force (system1 .. systemN) feature have been fixed.
3765
3766 @item
3767 Performance has been notably improved for large systems
3768 (say with thousands of components) by using
3769 hash-tables instead of linear search,
3770 and linear-time list accumulation
3771 instead of quadratic-time recursive appends.
3772
3773 @item
3774 Many features used to not be portable,
3775 especially where pathnames were involved.
3776 Windows support was notably quirky because of such non-portability.
3777
3778 @item
3779 The internal test suite used to massively fail on many implementations.
3780 While still incomplete, it now fully passes
3781 on all implementations supported by the test suite,
3782 except for GCL (due to GCL bugs).
3783
3784 @item
3785 Support was lacking for some implementations.
3786 ABCL and GCL were notably wholly broken.
3787 ECL extensions were not integrated with ASDF release.
3788
3789 @item
3790 The documentation was grossly out of date.
3791
3792 @end itemize
3793
3794
3795 @subsection ASDF itself is versioned
3796
3797 Between new features, old bugs fixed, and new bugs introduced,
3798 there were various releases of ASDF in the wild,
3799 and no simple way to check which release had which feature set.
3800 People using or writing systems had to either make worst-case assumptions
3801 as to what features were available and worked,
3802 or take great pains to have the correct version of ASDF installed.
3803
3804 With ASDF 2, we provide a new stable set of working features
3805 that everyone can rely on from now on.
3806 Use @code{#+asdf2} to detect presence of ASDF 2,
3807 @code{(asdf:version-satisfies (asdf:asdf-version) "2.345.67")}
3808 to check the availability of a version no earlier than required.
3809
3810
3811 @subsection ASDF can be upgraded
3812
3813 When an old version of ASDF was loaded,
3814 it was very hard to upgrade ASDF in your current image
3815 without breaking everything.
3816 Instead you had to exit the Lisp process and
3817 somehow arrange to start a new one from a simpler image.
3818 Something that can't be done from within Lisp,
3819 making automation of it difficult,
3820 which compounded with difficulty in configuration,
3821 made the task quite hard.
3822 Yet as we saw before, the task would have been required
3823 to not have to live with the worst case or non-portable
3824 subset of ASDF features.
3825
3826 With ASDF 2, it is easy to upgrade
3827 from ASDF 2 to later versions from within Lisp,
3828 and not too hard to upgrade from ASDF 1 to ASDF 2 from within Lisp.
3829 We support hot upgrade of ASDF and any breakage is a bug
3830 that we will do our best to fix.
3831 There are still limitations on upgrade, though,
3832 most notably the fact that after you upgrade ASDF,
3833 you must also reload or upgrade all ASDF extensions.
3834
3835 @subsection Decoupled release cycle
3836
3837 When vendors were releasing their Lisp implementations with ASDF,
3838 they had to basically never change version
3839 because neither upgrade nor downgrade was possible
3840 without breaking something for someone,
3841 and no obvious upgrade path was visible and recommendable.
3842
3843 With ASDF 2, upgrade is possible, easy and can be recommended.
3844 This means that vendors can safely ship a recent version of ASDF,
3845 confident that if a user isn't fully satisfied,
3846 he can easily upgrade ASDF and deal
3847 with a supported recent version of it.
3848 This means that release cycles will be causally decoupled,
3849 the practical consequence of which will mean faster convergence
3850 towards the latest version for everyone.
3851
3852
3853 @subsection Pitfalls of the transition to ASDF 2
3854
3855 The main pitfalls in upgrading to ASDF 2 seem to be related
3856 to the output translation mechanism.
3857
3858 @itemize
3859
3860 @item
3861 Output translations is enabled by default. This may surprise some users,
3862 most of them in pleasant way (we hope), a few of them in an unpleasant way.
3863 It is trivial to disable output translations.
3864 @xref{FAQ,,``How can I wholly disable the compiler output cache?''}.
3865
3866 @item
3867 Some systems in the large have been known
3868 not to play well with output translations.
3869 They were relatively easy to fix.
3870 Once again, it is also easy to disable output translations,
3871 or to override its configuration.
3872
3873 @item
3874 The new ASDF output translations are incompatible with ASDF-Binary-Locations.
3875 They replace A-B-L, and there is compatibility mode to emulate
3876 your previous A-B-L configuration.
3877 See @code{enable-asdf-binary-locations-compatibility} in
3878 @pxref{Controlling where ASDF saves compiled files,,Backward Compatibility}.
3879 But thou shalt not load ABL on top of ASDF 2.
3880
3881 @end itemize
3882
3883 Other issues include the following:
3884
3885 @itemize
3886
3887 @item
3888 ASDF pathname designators are now specified
3889 in places where they were unspecified,
3890 and a few small adjustments have to be made to some non-portable defsystems.
3891 Notably, in the @code{:pathname} argument
3892 to a @code{defsystem} and its components,
3893 a logical pathname (or implementation-dependent hierarchical pathname)
3894 must now be specified with @code{#p} syntax
3895 where the namestring might have previously sufficed;
3896 moreover when evaluation is desired @code{#.} must be used,
3897 where it wasn't necessary in the toplevel @code{:pathname} argument
3898 (but necessary in other @code{:pathname} arguments).
3899
3900 @item
3901 There is a slight performance bug, notably on SBCL,
3902 when initially searching for @file{asd} files,
3903 the implicit @code{(directory "/configured/path/**/*.asd")}
3904 for every configured path @code{(:tree "/configured/path/")}
3905 in your @code{source-registry} configuration can cause a slight pause.
3906 Try to @code{(time (asdf:initialize-source-registry))}
3907 to see how bad it is or isn't on your system.
3908 If you insist on not having this pause,
3909 you can avoid the pause by overriding the default source-registry configuration
3910 and not use any deep @code{:tree} entry but only @code{:directory} entries
3911 or shallow @code{:tree} entries.
3912 Or you can fix your implementation to not be quite that slow
3913 when recursing through directories.
3914 @emph{Update}: This performance bug fixed the hard way in 2.010.
3915
3916 @item
3917 On Windows, only LispWorks supports proper default configuration pathnames
3918 based on the Windows registry.
3919 Other implementations make do with environment variables,
3920 that you may have to define yourself
3921 if you're using an older version of Windows.
3922 Windows support is somewhat less tested than Unix support.
3923 Please help report and fix bugs.
3924 @emph{Update}: As of ASDF 2.21, all implementations
3925 should now use the same proper default configuration pathnames
3926 and they should actually work, though they haven't all been tested.
3927
3928 @item
3929 The mechanism by which one customizes a system so that Lisp files
3930 may use a different extension from the default @file{.lisp} has changed.
3931 Previously, the pathname for a component
3932 was lazily computed when operating on a system,
3933 and you would
3934 @code{(defmethod source-file-type ((component cl-source-file) (system (eql (find-system 'foo))))
3935   (declare (ignorable component system)) "lis")}.
3936 Now, the pathname for a component is eagerly computed when defining the system,
3937 and instead you will @code{(defclass cl-source-file.lis (cl-source-file) ((type :initform "lis")))}
3938 and use @code{:default-component-class cl-source-file.lis}
3939 as argument to @code{defsystem},
3940 as detailed in a @pxref{FAQ,How do I create a system definition where all the source files have a .cl extension?} below.
3941
3942 @findex source-file-type
3943
3944
3945 @end itemize
3946
3947
3948 @section Issues with installing the proper version of ASDF
3949
3950 @subsection ``My Common Lisp implementation comes with an outdated version of ASDF. What to do?''
3951
3952 We recommend you upgrade ASDF.
3953 @xref{Loading ASDF,,Upgrading ASDF}.
3954
3955 If this does not work, it is a bug, and you should report it.
3956 @xref{FAQ, report-bugs, Where do I report a bug}.
3957 In the meantime, you can load @file{asdf.lisp} directly.
3958 @xref{Loading ASDF,Loading an otherwise installed ASDF}.
3959
3960
3961 @subsection ``I'm a Common Lisp implementation vendor. When and how should I upgrade ASDF?''
3962
3963 Since ASDF 2,
3964 it should always be a good time to upgrade to a recent version of ASDF.
3965 You may consult with the maintainer for which specific version they recommend,
3966 but the latest @code{release} should be correct.
3967 We trust you to thoroughly test it with your implementation
3968 before you release it.
3969 If there are any issues with the current release,
3970 it's a bug that you should report upstream and that we will fix ASAP.
3971
3972 As to how to include ASDF, we recommend the following:
3973
3974 @itemize
3975 @item
3976 If ASDF isn't loaded yet, then @code{(require "asdf")}
3977 should load the version of ASDF that is bundled with your system.
3978 If possible so should @code{(require "ASDF")}.
3979 You may have it load some other version configured by the user,
3980 if you allow such configuration.
3981
3982 @item
3983 If your system provides a mechanism to hook into @code{CL:REQUIRE},
3984 then it would be nice to add ASDF to this hook the same way that
3985 ABCL, CCL, CLISP, CMUCL, ECL, SBCL and SCL do it.
3986 Please send us appropriate code to this end.
3987
3988 @item
3989 You may, like SBCL, have ASDF be implicitly used to require systems
3990 that are bundled with your Lisp distribution.
3991 If you do have a few magic systems that come with your implementation
3992 in a precompiled way such that one should only use the binary version
3993 that goes with your distribution, like SBCL does,
3994 then you should add them in the beginning of @code{wrapping-source-registry}.
3995
3996 @item
3997 If you have magic systems as above, like SBCL does,
3998 then we explicitly ask you to @emph{NOT} distribute
3999 @file{asdf.asd} as part of those magic systems.
4000 You should still include the file @file{asdf.lisp} in your source distribution
4001 and precompile it in your binary distribution,
4002 but @file{asdf.asd} if included at all,
4003 should be secluded from the magic systems,
4004 in a separate file hierarchy.
4005 Alternatively, you may provide the system
4006 after renaming it and its @file{.asd} file to e.g.
4007 @code{asdf-ecl} and @file{asdf-ecl.asd}, or
4008 @code{sb-asdf} and @file{sb-asdf.asd}.
4009 Indeed, if you made @file{asdf.asd} a magic system,
4010 then users would no longer be able to upgrade ASDF using ASDF itself
4011 to some version of their preference that
4012 they maintain independently from your Lisp distribution.
4013
4014 @item
4015 If you do not have any such magic systems, or have other non-magic systems
4016 that you want to bundle with your implementation,
4017 then you may add them to the @code{wrapping-source-registry},
4018 and you are welcome to include @file{asdf.asd} amongst them.
4019 Non-magic systems should be at the back of the @code{wrapping-source-registry}
4020 while magic systems are at the front.
4021
4022 @item
4023 Please send us upstream any patches you make to ASDF itself,
4024 so we can merge them back in for the benefit of your users
4025 when they upgrade to the upstream version.
4026
4027 @end itemize
4028
4029
4030
4031 @section Issues with configuring ASDF
4032
4033 @subsection ``How can I customize where fasl files are stored?''
4034
4035 @xref{Controlling where ASDF saves compiled files}.
4036
4037 Note that in the past there was an add-on to ASDF called
4038 @code{ASDF-binary-locations}, developed by Gary King.
4039 That add-on has been merged into ASDF proper,
4040 then superseded by the @code{asdf-output-translations} facility.
4041
4042 Note that use of @code{asdf-output-translations}
4043 can interfere with one aspect of your systems
4044 --- if your system uses @code{*load-truename*} to find files
4045 (e.g., if you have some data files stored with your program),
4046 then the relocation that this ASDF customization performs
4047 is likely to interfere.
4048 Use @code{asdf:system-relative-pathname} to locate a file
4049 in the source directory of some system, and
4050 use @code{asdf:apply-output-translations} to locate a file
4051 whose pathname has been translated by the facility.
4052
4053 @subsection ``How can I wholly disable the compiler output cache?''
4054
4055 To permanently disable the compiler output cache
4056 for all future runs of ASDF, you can:
4057
4058 @example
4059 mkdir -p ~/.config/common-lisp/asdf-output-translations.conf.d/
4060 echo ':disable-cache' > ~/.config/common-lisp/asdf-output-translations.conf.d/99-disable-cache.conf
4061 @end example
4062
4063 This assumes that you didn't otherwise configure the ASDF files
4064 (if you did, edit them again),
4065 and don't somehow override the configuration at runtime
4066 with a shell variable (see below) or some other runtime command
4067 (e.g. some call to @code{asdf:initialize-output-translations}).
4068
4069 To disable the compiler output cache in Lisp processes
4070 run by your current shell, try (assuming @code{bash} or @code{zsh})
4071 (on Unix and cygwin only):
4072
4073 @example
4074 export ASDF_OUTPUT_TRANSLATIONS=/:
4075 @end example
4076
4077 To disable the compiler output cache just in the current Lisp process,
4078 use (after loading ASDF but before using it):
4079
4080 @example
4081 (asdf:disable-output-translations)
4082 @end example
4083
4084 @section Issues with using and extending ASDF to define systems
4085
4086 @subsection ``How can I cater for unit-testing in my system?''
4087
4088 ASDF provides a predefined test operation, @code{test-op}.
4089 @xref{Predefined operations of ASDF, test-op}.
4090 The test operation, however, is largely left to the system definer to specify.
4091 @code{test-op} has been
4092 a topic of considerable discussion on the
4093 @url{http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel,asdf-devel mailing list},
4094 and on the
4095 @url{https://launchpad.net/asdf,launchpad bug-tracker}.
4096
4097 Here are some guidelines:
4098
4099 @itemize
4100 @item
4101 For a given system, @var{foo}, you will want to define a corresponding
4102 test system, such as @var{foo-test}.  The reason that you will want this
4103 separate system is that ASDF does not out of the box supply components
4104 that are conditionally loaded.  So if you want to have source files
4105 (with the test definitions) that will not be loaded except when testing,
4106 they should be put elsewhere.
4107
4108 @item
4109 The @var{foo-test} system can be defined in an asd file of its own or
4110 together with @var{foo}.  An aesthetic preference against cluttering up
4111 the filesystem with extra asd files should be balanced against the
4112 question of whether one might want to directly load @var{foo-test}.
4113 Typically one would not want to do this except in early stages of
4114 debugging.
4115
4116 @item
4117 Record that testing is implemented by @var{foo-test}.  For example:
4118 @example
4119 (defsystem @var{foo}
4120    :in-order-to ((test-op (test-op @var{foo-test})))
4121    ....)
4122
4123 (defsystem @var{foo-test}
4124    :depends-on (@var{foo} @var{my-test-library} ...)
4125    ....)
4126 @end example
4127 @end itemize
4128
4129 This procedure will allow you to support users who do not wish to
4130 install your test framework.
4131
4132 One oddity of ASDF is that @code{operate} (@pxref{Operations,operate})
4133 does not return a value.  So in current versions of ASDF there is no
4134 reliable programmatic means of determining whether or not a set of tests
4135 has passed, or which tests have failed.  The user must simply read the
4136 console output.  This limitation has been the subject of much
4137 discussion.
4138
4139 @subsection ``How can I cater for documentation generation in my system?''
4140
4141 The ASDF developers are currently working to add a @code{doc-op}
4142 to the set of predefined ASDF operations.
4143 @xref{Predefined operations of ASDF}.
4144 See also @url{https://bugs.launchpad.net/asdf/+bug/479470}.
4145
4146
4147
4148 @subsection ``How can I maintain non-Lisp (e.g. C) source files?''
4149
4150 See @code{cffi}'s @code{cffi-grovel}.
4151
4152 @anchor{report-bugs}
4153
4154
4155 @subsection ``I want to put my module's files at the top level.  How do I do this?''
4156
4157 By default, the files contained in an asdf module go
4158 in a subdirectory with the same name as the module.
4159 However, this can be overridden by adding a @code{:pathname ""} argument
4160 to the module description.
4161 For example, here is how it could be done
4162 in the spatial-trees ASDF system definition for ASDF 2:
4163
4164 @example
4165 (asdf:defsystem :spatial-trees
4166   :components
4167   ((:module base
4168             :pathname ""
4169             :components
4170             ((:file "package")
4171              (:file "basedefs" :depends-on ("package"))
4172              (:file "rectangles" :depends-on ("package"))))
4173    (:module tree-impls
4174             :depends-on (base)
4175             :pathname ""
4176             :components
4177             ((:file "r-trees")
4178              (:file "greene-trees" :depends-on ("r-trees"))
4179              (:file "rstar-trees" :depends-on ("r-trees"))
4180              (:file "rplus-trees" :depends-on ("r-trees"))
4181              (:file "x-trees" :depends-on ("r-trees" "rstar-trees"))))
4182    (:module viz
4183             :depends-on (base)
4184             :pathname ""
4185             :components
4186             ((:static-file "spatial-tree-viz.lisp")))
4187    (:module tests
4188             :depends-on (base)
4189             :pathname ""
4190             :components
4191             ((:static-file "spatial-tree-test.lisp")))
4192    (:static-file "LICENCE")
4193    (:static-file "TODO")))
4194 @end example
4195
4196 All of the files in the @code{tree-impls} module are at the top level,
4197 instead of in a @file{tree-impls/} subdirectory.
4198
4199 Note that the argument to @code{:pathname} can be either a pathname object or a string.
4200 A pathname object can be constructed with the @file{#p"foo/bar/"} syntax,
4201 but this is discouraged because the results of parsing a namestring are not portable.
4202 A pathname can only be portably constructed with such syntax as
4203 @code{#.(make-pathname :directory '(:relative "foo" "bar"))},
4204 and similarly the current directory can only be portably specified as
4205 @code{#.(make-pathname :directory '(:relative))}.
4206 However, as of ASDF 2, you can portably use a string to denote a pathname.
4207 The string will be parsed as a @code{/}-separated path from the current directory,
4208 such that the empty string @code{""} denotes the current directory, and
4209 @code{"foo/bar"} (no trailing @code{/} required in the case of modules)
4210 portably denotes the same subdirectory as above.
4211 When files are specified, the last @code{/}-separated component is interpreted
4212 either as the name component of a pathname
4213 (if the component class specifies a pathname type),
4214 or as a name component plus optional dot-separated type component
4215 (if the component class doesn't specifies a pathname type).
4216
4217 @subsection How do I create a system definition where all the source files have a .cl extension?
4218
4219 Starting with ASDF 2.014.14, you may just pass
4220 the builtin class @code{cl-source-file.cl} as
4221 the @code{:default-component-class} argument to @code{defsystem}:
4222
4223 @lisp
4224 (defsystem my-cl-system
4225   :default-component-class cl-source-file.cl
4226   ...)
4227 @end lisp
4228
4229 Another builtin class @code{cl-source-file.lsp} is offered
4230 for files ending in @file{.lsp}.
4231
4232 If you want to use a different extension
4233 for which ASDF doesn't provide builtin support,
4234 or want to support versions of ASDF
4235 earlier than 2.014.14 (but later than 2.000),
4236 you can define a class as follows:
4237
4238 @lisp
4239 ;; Prologue: make sure we're using a sane package.
4240 (defpackage :my-asdf-extension
4241    (:use :asdf :common-lisp)
4242    (:export #:cl-source-file.lis))
4243 (in-package :my-asdf-extension)
4244
4245 (defclass cl-source-file.lis (cl-source-file)
4246   ((type :initform "lis")))
4247 @end lisp
4248
4249 Then you can use it as follows:
4250 @lisp
4251 (defsystem my-cl-system
4252   :default-component-class my-asdf-extension:cl-source-file.lis
4253   ...)
4254 @end lisp
4255
4256 Of course, if you're in the same package, e.g. in the same file,
4257 you won't need to use the package qualifier before @code{cl-source-file.lis}.
4258 Actually, if all you're doing is defining this class
4259 and using it in the same file without other fancy definitions,
4260 you might skip package complications:
4261
4262 @lisp
4263 (in-package :asdf)
4264 (defclass cl-source-file.lis (cl-source-file)
4265    ((type :initform "lis")))
4266 (defsystem my-cl-system
4267   :default-component-class cl-source-file.lis
4268   ...)
4269 @end lisp
4270
4271 It is possible to achieve the same effect
4272 in a way that supports both ASDF 1 and ASDF 2,
4273 but really, friends don't let friends use ASDF 1.
4274 Please upgrade to ASDF 3.
4275 In short, though: do same as above, but
4276 @emph{before} you use the class in a @code{defsystem},
4277 you also define the following method:
4278
4279 @lisp
4280 (defmethod source-file-type ((f cl-source-file.lis) (s system))
4281   (declare (ignorable f s))
4282   "lis")
4283 @end lisp
4284
4285 @comment FIXME: Add a FAQ about how to use a new system class...
4286
4287
4288 @node  TODO list, Inspiration, FAQ, Top
4289 @comment  node-name,  next,  previous,  up
4290 @chapter TODO list
4291
4292 Here is an old list of things to do,
4293 in addition to the bugs that are now tracked on launchpad:
4294 @url{https://launchpad.net/asdf}.
4295
4296 @section Outstanding spec questions, things to add
4297
4298 ** packaging systems
4299
4300 *** manual page component?
4301
4302 ** style guide for .asd files
4303
4304 You should either use keywords or be careful
4305 with the package that you evaluate defsystem forms in.
4306 Otherwise @code{(defsystem partition ...)}
4307 being read in the @code{cl-user} package
4308 will intern a @code{cl-user:partition} symbol,
4309 which will then collide with the @code{partition:partition} symbol.
4310
4311 Actually there's a hairier packages problem to think about too.
4312 @code{in-order-to} is not a keyword:
4313 if you read @code{defsystem} forms in a package that doesn't use ASDF,
4314 odd things might happen.
4315
4316
4317 ** extending defsystem with new options
4318
4319 You might not want to write a whole parser,
4320 but just to add options to the existing syntax.
4321 Reinstate @code{parse-option} or something akin.
4322
4323
4324 ** Diagnostics
4325
4326 A ``dry run'' of an operation can be made with the following form:
4327
4328 @lisp
4329 (let ((asdf::*verbose-out* *standard-output*))
4330   (loop :for (op . comp) :in
4331     (asdf::traverse (make-instance '<operation-name> :force t)
4332                     (asdf:find-system <system-name>))
4333     :do (asdf:explain op comp)))
4334 @end lisp
4335
4336 This uses unexported symbols.
4337 What would be a nice interface for this functionality?
4338
4339 @section Missing bits in implementation
4340
4341 ** reuse the same scratch package whenever a system is reloaded from disk
4342
4343 Have a package ASDF-USER instead of all these temporary packages?
4344
4345 ** proclamations probably aren't
4346
4347 ** A revert function
4348
4349 Other possible interface: have a ``revert'' function akin to @code{make clean}.
4350
4351 @lisp
4352 (asdf:revert 'asdf:compile-op 'araneida)
4353 @end lisp
4354
4355 would delete any files produced by @code{(compile-system :araneida)}.
4356 Of course, it wouldn't be able to do much about stuff in the image itself.
4357
4358 How would this work?
4359
4360 @code{traverse}
4361
4362 There's a difference between a module's dependencies (peers)
4363 and its components (children).
4364 Perhaps there's a similar difference in operations?
4365 For example, @code{(load "use") depends-on (load "macros")} is a peer,
4366 whereas @code{(load "use") depends-on (compile "use")}
4367 is more of a ``subservient'' relationship.
4368
4369 @node  Inspiration, Concept Index, TODO list, Top
4370 @comment  node-name,  next,  previous,  up
4371 @chapter Inspiration
4372
4373 @section mk-defsystem (defsystem-3.x)
4374
4375 We aim to solve basically the same problems as @code{mk-defsystem} does.
4376 However, our architecture for extensibility
4377 better exploits CL language features (and is documented),
4378 and we intend to be portable rather than just widely-ported.
4379 No slight on the @code{mk-defsystem} authors and maintainers is intended here;
4380 that implementation has the unenviable task
4381 of supporting pre-ANSI implementations, which is no longer necessary.
4382
4383 The surface defsystem syntax of asdf is more-or-less compatible with
4384 @code{mk-defsystem}, except that we do not support
4385 the @code{source-foo} and @code{binary-foo} prefixes
4386 for separating source and binary files, and
4387 we advise the removal of all options to specify pathnames.
4388
4389 The @code{mk-defsystem} code for topologically sorting
4390 a module's dependency list was very useful.
4391
4392 @section defsystem-4 proposal
4393
4394 Marco and Peter's proposal for defsystem 4 served as the driver for
4395 many of the features in here.  Notable differences are:
4396
4397 @itemize
4398 @item
4399 We don't specify output files or output file extensions
4400 as part of the system.
4401
4402 If you want to find out what files an operation would create,
4403 ask the operation.
4404
4405 @item
4406 We don't deal with CL packages
4407
4408 If you want to compile in a particular package, use an @code{in-package} form
4409 in that file (ilisp / SLIME will like you more if you do this anyway)
4410
4411 @item
4412 There is no proposal here that @code{defsystem} does version control.
4413
4414 A system has a given version which can be used to check dependencies,
4415 but that's all.
4416 @end itemize
4417
4418 The defsystem 4 proposal tends to look more at the external features,
4419 whereas this one centres on a protocol for system introspection.
4420
4421 @section kmp's ``The Description of Large Systems'', MIT AI Memo 801
4422
4423 Available in updated-for-CL form on the web at
4424 @url{http://nhplace.com/kent/Papers/Large-Systems.html}
4425
4426 In our implementation we borrow kmp's overall @code{PROCESS-OPTIONS}
4427 and concept to deal with creating component trees
4428 from @code{defsystem} surface syntax.
4429 [ this is not true right now, though it used to be and
4430 probably will be again soon ]
4431
4432
4433 @c -------------------
4434
4435
4436 @node Concept Index, Function and Class Index, Inspiration, Top
4437 @unnumbered Concept Index
4438
4439 @printindex cp
4440
4441 @node Function and Class Index, Variable Index, Concept Index, Top
4442 @unnumbered Function and Class Index
4443
4444 @printindex fn
4445
4446 @node Variable Index,  , Function and Class Index, Top
4447 @unnumbered Variable Index
4448
4449 @printindex vr
4450
4451 @bye