Re: ASDF vs. logical pathnames in CMUCL

[email protected] (Björn Lindberg)
Newsgroups gmane.lisp.cmucl.general,gmane.lisp.cclan.general
Message-ID <[email protected]>
Edi Weitz <[email protected]> writes:

> On 12 May 2004 16:05:07 -0400, "Christopher C. Stacy" <[email protected]> wrote:
> 
> > At this point, I must repeat my call to anyone who is using ASDF.
> > (So far only one person has answered, saying that they don't think
> > it works with logical pathnames!)  I was under the impression that
> > many people are actively using ASDF in CMUCL, and surely they must
> > be using logical pathnames.  I must be totally misunderstanding how
> > logical pathnames are supposed to be used, or how ASDF is supposed
> > to be used.  It works for everyone but me, and I can't see how.
> >
> > [...]
> >
> > How is anyone else loading UFFI and CL-SQL ? I know there are users.
> > Won't someone please just recite the incantations they are using?
> > Surely the whole problem must be that I am doing something really
> > stupid.
> 
> I don't use logical pathnames. My setup is very simple:
> 
> 1. I have a directory /usr/local/lisp/source where I unpack all the
>    source tarballs, so there is, e.g., 
> 
>      /usr/local/lisp/source/uffi-1.4.12
>      /usr/local/lisp/source/clsql-2.10.5
> 
> 2. I make symlinks to the names without versions, i.e.
> 
>      /usr/local/lisp/source/clsql -> clsql-2.10.5
>      /usr/local/lisp/source/uffi -> uffi-1.4.12
> 
> 3. From /usr/local/lisp/Registry I make symlinks to the symlinked .asd
>    files
>  
>      cd /usr/local/lisp/Registry
>      for i in ../source/{clsql,uffi}/*asd; do ln -s $i; done
> 
>    so I don't have to update them once I get new versions.
> 
> 4. My ~/.cmucl-init file contains this line:
> 
>      (pushnew "/usr/local/lisp/Registry/" asdf:*central-registry*)
> 
> That's it. Works fine for me, even with different Lisps as long as
> their FASL suffixes don't conflict as with SBCL and AllegroCL.[1][2]

I do the same thing, except for one difference which also solves the
FASL issue. I have the following in my startup script for CMUCL:

(in-package :asdf)

(pushnew "/home/bjorn/share/common-lisp/system/" *central-registry*)

(defvar *system-configuration-paths*
  '(("/home/bjorn/share/common-lisp/src/"
     "/home/bjorn/lib/common-lisp/cmucl/")))

(defun pathname-prefix-p (prefix pathname)
  "Tar två sökvägsnamn eller namnsträngar och returnerar sant om det
första är ett prefix i det andra. :ABSOLUTE/:RELATIVE först i
kataloglistan fungerar som ankare, vilket gör att SEARCH inte kan
matcha en dellista mitt i."
  (not (equal (enough-namestring pathname prefix) (namestring pathname))))

(defmethod output-files :around ((operation compile-op) (c source-file))
  (let ((source (component-pathname c))
	(paths (call-next-method)))
    (mapcar #'(lambda (path)
		(loop for (from to) in *system-configuration-paths*
		      when (pathname-prefix-p from source)
		      do (return 
			   (merge-pathnames
			    (make-pathname :type (pathname-type path))
			    (merge-pathnames (enough-namestring source from)
					     to)))
		      ;; Kommer bara hit om ingen sökväg matchade
		      finally (return path)))
	    paths)))

So I have the following set-up:

  Library directories

    /home/bjorn/share/common-lisp/src/uffi-1.4.6/
    /home/bjorn/share/common-lisp/src/cl-ppcre-0.6.1/
    ...

  Symlinks to system definitions

    /home/bjorn/share/common-lisp/system/uffi.asd
    /home/bjorn/share/common-lisp/system/cl-ppcre.asd
    ...

  FASLs for CMUCL

    /home/bjorn/lib/common-lisp/cmucl/uffi-1.4.6/
    /home/bjorn/lib/common-lisp/cmucl/cl-ppcre-0.6.1/
    ...

The around method on asdf:output-files makes the FASLs and other
compiled files (eg. FFI C binaries, etc) go into the CMUCL specific
directory. I mainly use CMUCL for now, but the idea is that when I use
CLISP or SBCL, I would have the same output-files method, but change
the *system-configuration-paths* variable to target a directory
specific to each lisp. This would be done in the lisp startup file.

I don't see that this couldn't work equally well with logical
pathnames in *system-configuration-paths*, as long as ASDF in general
supports them.


Björn
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.