New component types are defined by subclassing one of the existing component classes and specializing methods on the new component class.
FIXME: this should perhaps be explained more throughly, not only by example ...
As an example, suppose we have some implementation-dependent
functionality that we want to isolate
in one subdirectory per Lisp implementation our system supports.
We create a subclass of
(defclass unportable-cl-source-file (cl-source-file) ())
asdf:implementation-type (exported since 2.014.14)
gives us the name of the subdirectory.
All that's left is to define how to calculate the pathname
(defmethod component-pathname ((component unportable-cl-source-file)) (merge-pathnames* (parse-unix-namestring (format nil "~(~A~)/" (asdf:implementation-type))) (call-next-method)))
The new component type is used in a
defsystem form in this way:
(defsystem :foo :components ((:file "packages") ... (:unportable-cl-source-file "threads" :depends-on ("packages" ...)) ... )