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