asdf

asdf is Another System Definition Facility. It's used in common-lisp-controller, Portable Allegroserve, and as the basis for the contrib system in SBCL

It intends to solve the same basic class of problems as mk-defsystem, but internally it takes advantage of modern CL features like pathname support, etc, and it uses CLOS for extensibility.

Documentation on how to use ASDF can be found in the README text file which comes with ASDF. Or look at the online ASDF Manual. A short howto is also available. And here is a page which explains how to use ASDF with Corman Lisp.

If you have SBCL, OpenMCL, ECL or ACL, it's bundled and you need only (require 'asdf). If you have Debian or Gentoo and the Common Lisp Controller installed, you also already have it. Otherwise you can find it in the Sourceforge cCLan CVS repository:

The source code of ASDF is here.

Instructions on obtaining ASDF by anonymous CVS can be found at

There is also a Debian package.

Stale fasls?

From http://www.sbcl.org/manual/Automatic-Recompilation-of-Stale-Fasls.html

If you update your Lisp to a version that uses a different fasl-format you get a diskfull of stale fasls that ASDF will try to load in good faith, with predictable and unpleasant results.

The ugly brute force solution looks is to find and delete all the fasls -- but there are better ways. Add the following around-method to your .lisp-init, .sbclrc, or equivalent:

;;; If the fasl was stale, try to recompile and load (once). Since only SBCL
;;; has a separate condition for bogus fasls we retry on any old error
;;; on other lisps. Actually, Allegro has a similar condition, but it's 
;;; unexported.  Works nicely for the ACL7 upgrade, though.
;;; CMUCL has an invalid-fasl condition as of 19c.
(defmethod asdf:perform :around ((o asdf:load-op) (c asdf:cl-source-file))
  (handler-case (call-next-method o c)
    (#+sbcl sb-ext:invalid-fasl 
     #+allegro excl::file-incompatible-fasl-error
     #+lispworks conditions:fasl-error
     #+cmu ext:invalid-fasl
     #-(or sbcl allegro lispworks cmu) error ()
     (asdf:perform (make-instance 'asdf:compile-op) c)
     (call-next-method))))

Feature suggestions

From #lisp circa 2004-08-05:

IDE integration

Frequently Asked Questions

--- a quick script for creating packages can be found here, or in asdf-packaging-tools if you would prefer to be more thorough.

(Actually, this item doesn't belong here, either; it's really more appropriate for the page on ASDF-INSTALL.)


CMUCL

2005-04-14

The cclan version of asdf apparently doesn't have the necessary code to hook REQUIRE into CMUCL. So here is a small bit of code to make it so. You need at least cmucl 19a with patch 0 for this to work.

;; Simple support for ASDF and CMUCL

(in-package #:asdf)

(eval-when (:compile-toplevel :load-toplevel :execute) (when (find-symbol "*MODULE-PROVIDER-FUNCTIONS*" "EXT") (pushnew :cmu-hooks-require *features*)))

#+cmu-hooks-require (progn (defun module-provide-asdf (name) (handler-bind ((style-warning #'muffle-warning)) (let* ((*verbose-out* (make-broadcast-stream)) (name (string-downcase name)) (system (asdf:find-system name nil))) (when system (asdf:operate 'asdf:load-op name) t)))) (pushnew 'module-provide-asdf ext:*module-provider-functions*) ;; Add whatever use you need, like adding paths to asdf:*central-registry* )


Clisp

Getting Clisp on Windows to load asdf and getting asdf to look where you need it to is not the easiest process to figure out. Here's how I managed to do it.

  1. Get the latest asdf.lisp source file from the link above.
  2. Create a directory that will be the location for your ASDF Registry.
  3. For each ASDF capable library you have, create a shortcut to it's .asd file or files and put the shortcut/s in the ASDF Registry directory. Make sure the shortcuts have the same name as the file i.e. remove the "Shortcut to".
  4. Find out where CLISP expects to find its initialization files:
    (user-homedir-pathname)
    It is probably your Documents and Settings\\Username directory but it doesn't hurt to check.
  5. Create a file called .clisprc.lisp in the directory discovered in the previous step.
  6. Add the following to the .clisprc.lisp file:
    (load "path-to-asdf.lisp")
    (push "path-to-asdf-registry" asdf:*central-registry*)
  7. You should now be able to run clisp and do:
    (asdf:oos 'asdf:load-op 'Whatever-you-want)


Alternative Sysdef Search functionality

;; An alternative to the standard sysdef search can be defined.  This                
;; code below can be dropped into your Lisp init files and customized.               
;; It will search for all ASDF systems in subdirectories of the                      
;; specified directories.  That lets you simply "drop-in" new packages               
;; into one of the specified directories, and it will be available for               
;; loading without any further steps.                                                
(in-package #:asdf)
(defvar *subdir-search-registry* '(#p"/my/lisp/libraries/")
  "List of directories to search subdirectories within.")
(defvar *subdir-search-wildcard* :wild
  "Value of :wild means search only one level of subdirectories; value of :wild-inferiors means search all levels of subdirectories (I don't advise using this in big directories!)")
(defun sysdef-subdir-search (system)
  (let ((latter-path (make-pathname :name (coerce-name system)
                                    :directory (list :relative
                                                     *subdir-search-wildcard*)
                                    :type "asd"
                                    :version :newest
                                    :case :local)))
    (dolist (d *subdir-search-registry*)
      (let* ((wild-path (merge-pathnames latter-path d))
             (files (directory wild-path)))
        (when files
          (return (first files)))))))
(pushnew 'sysdef-subdir-search *system-definition-search-functions*)


In the system definition of Iterate, Jörg Höhle censures the practice of cluttering the package space with dozens of tiny definition packages and even more so the typically empty ASDFNNNN packages. His remark went largely unnoticed (certainly, no one reads .asd files); which does not make it any less justified, in my opinion. To be sure, the current revision of ASDF (1.104) deletes ASDFNNNN packages as soon as they are not needed, so that the latter problem has been dealt with; but the former problem persists. Maybe something should be done about it at last? The difficulty is not so much technical as social: persuading everyone to establish a conventional use of this facility. Even now there are writers that do not follow the current manual's recommended usage (to define one's system XYZ while in the XYZ-SYSTEM package).


Pages in this topic: asdf-dependency-grovel   asdf-packaging-tools   CL-XML   common-lisp-controller  


Also linked from: ASDF System   asdf-addons   ASDF-Binary-Locations   ASDF-Extension   ASDFed   aserve   cirCLe   cirCLe Task List   cl-cbr   cl-curl   cl-jointgen   cl-menusystem   cl-reversi   CL-S3   cl-syslog   cl-zlib   Closer to MOP   Corman Lisp   Current recommended libraries   Daniel Barlow   Daniel Lowe   development   Getting Started   hello-lisp   Leonardo Varuzza   Lint   ltd   Marko Kocic   ODCL   packages   ParenscriptWithApachePHP   Sandbox   SLIME-PPCRE   sys-analyser   system-menu   TemplateForASDF   Zebu   zlib  

CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively