From: Frederic Brunel
Subject: ASDF and build directory
Date: 
Message-ID: <m2k6t3x5f7.fsf@sheridan.local>
Hi,

I'd like to know how ASDF can be extended to support a "build
directory" feature, that is, the ability to produce fasl files into a
specific directory (and not the root) and to load up the system 
from it. It's kind of annoying to have fasl polluting your project
directory (especially when they conflicts between CL implementations).

Actually, I saw a lot of projects doing that kind of stuff manually
(like SLIME) and I wonder why ASDF is not handling that. Franz shows
an exemple of such extension using their own defsystem utility. Maybe
there is a simple way to do it in ASDF but I didn't find it reading
the documentation.

-- 
Frederic Brunel

From: Christophe Rhodes
Subject: Re: ASDF and build directory
Date: 
Message-ID: <sqwtx37uzd.fsf@cam.ac.uk>
Frederic Brunel <···············@free.fr> writes:

> Hi,
>
> I'd like to know how ASDF can be extended to support a "build
> directory" feature, that is, the ability to produce fasl files into a
> specific directory (and not the root) and to load up the system 
> from it. It's kind of annoying to have fasl polluting your project
> directory (especially when they conflicts between CL implementations).
>
> Actually, I saw a lot of projects doing that kind of stuff manually
> (like SLIME) and I wonder why ASDF is not handling that. Franz shows
> an exemple of such extension using their own defsystem utility. Maybe
> there is a simple way to do it in ASDF but I didn't find it reading
> the documentation.

Specialize the ASDF:OUTPUT-FILES method on ASDF:COMPILE-OP.

Christophe
From: Björn Lindberg
Subject: Re: ASDF and build directory
Date: 
Message-ID: <hcsfz3rglc7.fsf@my.nada.kth.se>
Frederic Brunel <···············@free.fr> writes:

> Hi,
> 
> I'd like to know how ASDF can be extended to support a "build
> directory" feature, that is, the ability to produce fasl files into a
> specific directory (and not the root) and to load up the system 
> from it. It's kind of annoying to have fasl polluting your project
> directory (especially when they conflicts between CL implementations).
> 
> Actually, I saw a lot of projects doing that kind of stuff manually
> (like SLIME) and I wonder why ASDF is not handling that. Franz shows
> an exemple of such extension using their own defsystem utility. Maybe
> there is a simple way to do it in ASDF but I didn't find it reading
> the documentation.

Here is what I have in my ~/.cmucl-init.lisp:

(in-package :asdf)

(pushnew "/home/compbio/d95-bli/share/common-lisp/system/" *central-registry*)

(defvar *system-configuration-paths*
  '(("/nfs/home/compbio/d95-bli/share/common-lisp/src/"
     "/nfs/home/compbio/d95-bli/lib/common-lisp/cmucl/")))

(defun pathname-prefix-p (prefix pathname)
  (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)))

It works well, and it is extensible so that you can add other
source-fasl locations to the global variable. My clisp and sbcl init
files contain the same thing but with different fasl directories.

The only thing regarding this method that is sometimes problematic is
for packages which come with data files. The way ASDF works, it will
look for those data files in the fasl directory instead of the source
directory, and you will get a sometimes cryptic compilation error. The
way I solve this in the few cases where it happens is by manually
copying the files to the fasl directory.


Bj�rn
From: Frederic Brunel
Subject: Re: ASDF and build directory
Date: 
Message-ID: <418bfbce$0$30959$636a15ce@news.free.fr>
> Here is what I have in my ~/.cmucl-init.lisp:
> 
> (in-package :asdf)
> 
> (pushnew "/home/compbio/d95-bli/share/common-lisp/system/" *central-registry*)
> 
> (defvar *system-configuration-paths*
>   '(("/nfs/home/compbio/d95-bli/share/common-lisp/src/"
>      "/nfs/home/compbio/d95-bli/lib/common-lisp/cmucl/")))
> 
> (defun pathname-prefix-p (prefix pathname)
>   (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)))
> 
> It works well, and it is extensible so that you can add other
> source-fasl locations to the global variable. My clisp and sbcl init
> files contain the same thing but with different fasl directories.
> 
> The only thing regarding this method that is sometimes problematic is
> for packages which come with data files. The way ASDF works, it will
> look for those data files in the fasl directory instead of the source
> directory, and you will get a sometimes cryptic compilation error. The
> way I solve this in the few cases where it happens is by manually
> copying the files to the fasl directory.

   That's very interesting, thanx for your reply. I guess this kind of
   features could be available within ASDF. I think of extensions to be
   pretty much like ANT, the Java build tool.

-- 
Frederic Brunel
From: Rahul Jain
Subject: Re: ASDF and build directory
Date: 
Message-ID: <877jp240pb.fsf@nyct.net>
Frederic Brunel <···············@free.fr> writes:

> I'd like to know how ASDF can be extended to support a "build
> directory" feature, that is, the ability to produce fasl files into a
> specific directory (and not the root) and to load up the system 
> from it. It's kind of annoying to have fasl polluting your project
> directory (especially when they conflicts between CL implementations).
>
> Actually, I saw a lot of projects doing that kind of stuff manually
> (like SLIME) and I wonder why ASDF is not handling that. Franz shows
> an exemple of such extension using their own defsystem utility. Maybe
> there is a simple way to do it in ASDF but I didn't find it reading
> the documentation.

Actually, debian does exactly this, checking to see if the asd file is
from the systemwide repository in asdf:output-files :around...

-- 
Rahul Jain
·····@nyct.net
Professional Software Developer, Amateur Quantum Mechanicist
From: Frederic Brunel
Subject: Re: ASDF and build directory
Date: 
Message-ID: <418bfb4a$0$30959$636a15ce@news.free.fr>
>>I'd like to know how ASDF can be extended to support a "build
>>directory" feature, that is, the ability to produce fasl files into a
>>specific directory (and not the root) and to load up the system 
>>from it. It's kind of annoying to have fasl polluting your project
>>directory (especially when they conflicts between CL implementations).
>>
>>Actually, I saw a lot of projects doing that kind of stuff manually
>>(like SLIME) and I wonder why ASDF is not handling that. Franz shows
>>an exemple of such extension using their own defsystem utility. Maybe
>>there is a simple way to do it in ASDF but I didn't find it reading
>>the documentation.
> 
> Actually, debian does exactly this, checking to see if the asd file is
> from the systemwide repository in asdf:output-files :around...

   Debian? You're talking about the Common Lisp Controller?

-- 
Frederic Brunel