Common Lisp/External libraries/ASDF/Configuring ASDF
Configuring ASDF
Most frequently, you will add settings for asdf to the configuration file for your lisp system. For example, sbcl uses ~/.sbclrc while cmucl uses ~/.cmucl-init. The most important setting is the central registry described below. Most of the other configuration settings are optional.
asdf:*central-registry*
The central-registry is a list of file directories that will be searched for system definition (.asd) files and is the least you need to know about configuring ASDF. The safest way to modify asdf:*central-registry* is to use pushnew to push a new directory onto the list.
(pushnew "/Path/to/asd/files/" asdf:*central-registry*)
Automatically updating stale fasl files
From http://www.cliki.net/asdf
;;; 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))))
Alternative to symlinks, search directories recursively
The standard way of adding libraries to ASDF involves either:
- Making a symbolic link for the
.asdfile in a directory listed inasdf:*central-registry*or - Adding directories to
asdf:*central-registry*.
The following code snippit shows how to recursively search through subdirectories for asdf packages.
From http://www.cliki.net/asdf
;; 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*)