Previous: , Up: Issues with using and extending ASDF to define systems   [Contents][Index]


13.6.10 How can I produce a binary at a specific path from sources at a specific path?

Especially when integrating with outside build systems, it’s useful to have fine-grained control over where ASDF puts output files. The following is an example of a build script that takes the directory to find the source and the path to put the resulting binary at, and compiles a system there.

(in-package :cl-user)

;; Tell ASDF where to find your source files. This may not
;; be necessary if you've already configured this elsewhere.
(asdf:initialize-source-registry
  `(:source-registry
     :inherit-configuration
     (:directory ,(uiop:getenv-absolute-directory "SRC"))))

;; Set the output pathname when building the system.
(defmethod asdf:output-files ((o asdf:image-op)
                              (system (eql (asdf:find-system foo))))
  (declare (ignorable system))
  (values (list (uiop:getenv-pathname "OUT")) t))

;; Build the system.
(asdf:operate-on-system 'asdf:program-op foo)
(uiop:quit)