diff --git a/grovel/asdf.lisp b/grovel/asdf.lisp index 2930d44e2c1a27f8f4b496b92724cc1d0a720684..c12e1b1f3d9d5bc55072023ca20b9ca0a5c7c44f 100644 --- a/grovel/asdf.lisp +++ b/grovel/asdf.lisp @@ -84,14 +84,14 @@ (list (list 'process-op (asdf:component-name c))))) (defmethod asdf:perform ((op asdf:compile-op) (c process-op-input)) - (let ((generated-lisp-file (asdf:output-file (make-instance 'process-op) c))) + (let ((generated-lisp-file (first (asdf:output-files (make-instance 'process-op) c)))) (asdf:perform op (make-instance 'asdf:cl-source-file :name (asdf:component-name c) :parent (asdf:component-parent c) :pathname generated-lisp-file)))) (defmethod asdf:perform ((op asdf:load-source-op) (c process-op-input)) - (let ((generated-lisp-file (asdf:output-file (make-instance 'process-op) c))) + (let ((generated-lisp-file (first (asdf:output-files (make-instance 'process-op) c)))) (asdf:perform op (make-instance 'asdf:cl-source-file :name (asdf:component-name c) :parent (asdf:component-parent c) @@ -109,10 +109,10 @@ by PROCESS-GROVEL-FILE."))) (defmethod asdf:perform ((op process-op) (c grovel-file)) - (let ((output-file (asdf:output-file op c)) + (let ((output-file (first (asdf:output-files op c))) (input-file (asdf:component-pathname c))) (ensure-directories-exist (directory-namestring output-file)) - (let ((tmp-file (process-grovel-file input-file (ensure-pathname output-file)))) + (let ((tmp-file (process-grovel-file input-file output-file))) (unwind-protect (alexandria:copy-file tmp-file output-file :if-to-exists :supersede) (delete-file tmp-file))))) @@ -130,12 +130,15 @@ matching CFFI bindings that are subsequently compiled and loaded."))) +(defun wrapper-soname (c) + (or (soname-of c) + (asdf:component-name c))) + (defmethod asdf:perform ((op process-op) (c wrapper-file)) - (let ((output-file (asdf:output-file op c)) + (let ((output-file (first (asdf:output-files op c))) (input-file (asdf:component-pathname c))) (ensure-directories-exist (directory-namestring output-file)) - (let ((tmp-file (process-wrapper-file input-file output-file (or (soname-of c) - (asdf:component-name c))))) + (let ((tmp-file (process-wrapper-file input-file output-file (wrapper-soname c)))) (unwind-protect (alexandria:copy-file tmp-file output-file :if-to-exists :supersede) (delete-file tmp-file))))) diff --git a/grovel/grovel.lisp b/grovel/grovel.lisp index 2310bb733cde9c16d33517ad1fd4568054187744..a0c150cab80a095f359ea92a0e8bdc9c3190759b 100644 --- a/grovel/grovel.lisp +++ b/grovel/grovel.lisp @@ -177,8 +177,11 @@ int main(int argc, char**argv) { (defun header-form-p (form) (member (form-kind form) *header-forms*)) +(defun make-c-file-name (output-defaults) + (make-pathname :type "c" :defaults output-defaults)) + (defun generate-c-file (input-file output-defaults) - (let ((c-file (make-pathname :type "c" :defaults output-defaults))) + (let ((c-file (make-c-file-name output-defaults))) (with-open-file (out c-file :direction :output :if-exists :supersede) (with-open-file (in input-file :direction :input) (flet ((read-forms (s) @@ -744,7 +747,7 @@ int main(int argc, char**argv) { (defun generate-c-lib-file (input-file output-defaults) (let ((*lisp-forms* nil) - (c-file (make-pathname :type "c" :defaults output-defaults))) + (c-file (make-c-file-name output-defaults))) (with-open-file (out c-file :direction :output :if-exists :supersede) (with-open-file (in input-file :direction :input) (write-string *header* out) @@ -780,13 +783,16 @@ int main(int argc, char**argv) { (terpri out)) lisp-file)) +(defun make-soname (lib-soname output-defaults) + (make-pathname :name lib-soname + :defaults output-defaults)) + ;;; *PACKAGE* is rebound so that the IN-PACKAGE form can set it during ;;; *the extent of a given wrapper file. (defun process-wrapper-file (input-file output-defaults lib-soname) (with-standard-io-syntax (let ((lib-file - (lib-filename (make-pathname :name lib-soname - :defaults output-defaults)))) + (lib-filename (make-soname lib-soname output-defaults)))) (multiple-value-bind (c-file lisp-forms) (generate-c-lib-file input-file output-defaults) (cc-compile-and-link c-file lib-file :library t)