Next: , Previous: The defsystem form, Up: Defining systems with defsystem


6.2 A more involved example

Let's illustrate some more involved uses of defsystem via a slightly convoluted example:

     (in-package :asdf-user)
     
     (defsystem "foo"
       :version (:read-file-form "variables" :at (3 2))
       :components
       ((:file "package")
        (:file "variables" :depends-on ("package"))
        (:module "mod"
          :depends-on ("package")
          :serial t
          :components ((:file "utils")
                       (:file "reader")
                       (:file "cooker")
                       (:static-file "data.raw"))
          :output-files (compile-op (o c) (list "data.cooked"))
          :perform (compile-op :after (o c)
             (cook-data
              :in (component-pathname (find-component c "data.raw"))
              :out (first (output-files o c)))))
        (:file "foo" :depends-on ("mod"))))
     
     (defmethod action-description
         ((o compile-op) (c (eql (find-component "foo" "mod"))))
       "cooking data")

Here are some notes about this example:


Footnotes

[1] ASDF 1 and 2 (up until 2.26) used to dynamically create and delete temporary packages asdfN, one for each .asd file, in a misguided attempt to thereby reduce name clashes; but it failed at that goal and only made things more complex. ASDF 3 just uses a shared package asdf-user instead, and relies on the usual Common Lisp conventions to avoid clashes. As far as package oddities go, you may just notice that the asdf-user package also uses uiop/common-lisp, a variant of the common-lisp package that papers over deficiencies in more obscure Common Lisp implementations; but unless you care about Corman Lisp, GCL, Genera or MCL, you shouldn't be concerned.