Re: asdf example sought

Christophe Rhodes <[email protected]>
Newsgroups gmane.lisp.cclan.general
Message-ID <[email protected]>
David Kleiner <[email protected]> writes:

> I am tinkering with getting cl-http to compile with sbcl using
> asdf.  A part of this involves getting defsystem declarations 
> translated into asdf's .asd file.
>
> I am having hard time doing it, as the source tree structure
> is fairly complex and my asdf does not seem to understand portable
> *;**:blah.lisp path designation.
>
> All suggestions are welcome, as are suggestions on why this 
> cannot or should not be done (not the right tool for the job, etc)

There are two ways for asdf to find its files, in general.  The first,
most commonly used (on Unix, at least), is to organize one's system to
reflect the filesystem, and have asdf do pathname merging relative to
the truename of the .asd system file.  So, under this scheme, we have
something like
  (defsystem foo
    :components
    ((:module bar
       :components (:file "baz"))
     (:file "quux" :depends-on (bar))))
which defines a system that looks like
  bar/baz.lisp
  quux.lisp
relative to the .asd file, where compiling quux.lisp depends on
loading the BAR module.

While this is terribly convenient for new software, it's perfectly
plausible that it doesn't work so well for legacy software with its
own ideas of filesystem layout.  So the :pathname option to components
can be used to override this default.
[untested]
  (eval-when (:compile-toplevel :load-toplevel :execute)
    (setf (logical-pathname-translations "FOO") '(("**;*.*.*" "/tmp/**/*.*"))))
  (defsystem foo
    :components
    ((:module bar
       :pathname #p"FOO:"
       :components (:file "baz"))
     (:file "quux"
       :pathname #p"FOO:ZOT;"
       :depends-on (bar))))
This provides the same "logical" system definition; the same
dependencies exist between the files as above.  However, the
filesystem layout is
  /tmp/baz.lisp
  /tmp/zot/quux.lisp

The reason that this second is less favoured is that it is not
position-independent "out of the box", which makes it hard (in the
absence of a coherent policy over all lisp packages) to develop
automated tools for download and installation (such as asdf-install, a
way of chasing dependencies for packages following certain minimal
standards; see http://www.cliki.net/asdf-install).  So while the
second form might well be more convenient for porting the existing
system definition, it might be worth investigating the possibility of
using the first form, where all pathname information is implicit, not
explicit.

I hope that helps somewhat.  Let me know if you hit other sticking
points.  (For some mildly complex asdf systems, you may wish to have a
look at clx.asd as distributed with telent CLX, which unfortunately is
probably down at the moment; and sb-md5.asd as distributed with SBCL).

Cheers,

Christophe
-- 
http://www-jcsu.jesus.cam.ac.uk/~csr21/       +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%")    (pprint #36rJesusCollegeCambridge)


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.