[Ecls-list] ASDF to build FAS libraries
Greg Pfeil
pfeil at amazon.com
Wed Oct 19 10:23:47 UTC 2005
On 10/19/05 8:09 AM, "Goffioul Michael" <goffioul at imec.be> wrote:
> Hi,
>
> I tried to play with ASDF in order to compile FAS libraries (I mean FAS
> files containing several LISP files). To do that, I applied to attached
> patch to asdf.lisp and defined a new build-op operation as the following:
This seems really cool. Just a couple hours earlier I was wondering what the
best way to do something similar was. Is it true that this could build
shared libs just by changing c::build-fasl to c::build-shared-library?
That's what I need to do.
>
> ========================================
>
> (defclass build-op (compile-op) ())
>
> (defmethod initialize-instance :after ((instance build-op) &rest initargs &key
> &allow-other-keys)
> (setf (slot-value instance 'system-p) t))
>
> (defmethod output-files ((o build-op) (c cl-source-file))
> (list (compile-file-pathname (component-pathname c) :type :object)))
>
> (defmethod traverse ((o build-op) (c cl-source-file))
> (let ((op (make-instance 'load-source-op))
> (tree (call-next-method)))
> (unless (operation-done-p op c)
> (push (cons op c) tree))
> tree))
>
> (defgeneric get-files (component type))
>
> (defmethod get-files ((m module) type)
> (loop for c in (module-components m)
> append (get-files c type)))
>
> (defmethod get-files ((c cl-source-file) type)
> (case type
> (:input (list c))
> (:output (output-files (make-instance 'build-op) c))))
>
> (defmethod output-files ((o build-op) (c system))
> (list (compile-file-pathname (component-name c))))
>
> (defmethod input-files ((o build-op) (c system))
> (get-files c :output))
>
> (defmethod perform ((o build-op) (c system))
> (let ((obj-files (get-files c :output))
> (out-file (car (output-files o c))))
> (c::build-fasl out-file :lisp-files obj-files)))
>
> ========================================
>
> Maybe this could be a nice addition to ECL asdf support. Isn't it?
> (Note: I'm not an ASDF expert, I guess the code can be improved...)
>
> Michael.
More information about the ecl-devel
mailing list