X-Git-Url: https://git.distorted.org.uk/~mdw/clg/blobdiff_plain/1a9c1e082036adf2cb81fdf2234bc1e8417fa831..e006ad3191ca52a8d24058ef4ab152e7b2f63e05:/tools/asdf-extensions.lisp diff --git a/tools/asdf-extensions.lisp b/tools/asdf-extensions.lisp index 76a180b..6b3da93 100644 --- a/tools/asdf-extensions.lisp +++ b/tools/asdf-extensions.lisp @@ -12,7 +12,7 @@ (concatenate-strings (rest strings) delimiter)))) ;;; The following code is more or less copied frm sb-bsd-sockets.asd, -;;; but extended to allow flags set in a general way +;;; but extended to allow flags to be set in a general way (defclass unix-dso (module) ()) (defun unix-name (pathname) @@ -51,25 +51,10 @@ (module-components dso))))) (error 'operation-error :operation operation :component dso)))) -;; Taken from foreign.lisp in the CMUCL tree, but modified to delay -;; resolving of symbols until they are used -(defun load-dso (file) - (system::ensure-lisp-table-opened) - ; rtld global: so it can find all the symbols previously loaded - ; rtld lazy: that way dlopen will not fail if not all symbols are defined. - (let ((filename (namestring file))) - (format t ";;; Loading shared library ~A ...~%" filename) - (let ((sap (system::dlopen filename (logior system::rtld-lazy system::rtld-global)))) - (cond ((zerop (system:sap-int sap)) - (let ((err-string (system::dlerror))) - - ;; For some reason dlerror always seems to return NIL, - ;; which isn't very informative. - (error "Can't open object ~S: ~S" file err-string))) - ((null (assoc sap system::*global-table* :test #'system:sap=)) - (setf system::*global-table* (acons sap file system::*global-table*)) - t) - (t nil))))) + +(defun load-dso (filename) + #+sbcl(sb-alien:load-shared-object filename) + #+cmu(ext:load-foreign filename)) (defmethod perform ((o load-op) (c unix-dso)) @@ -87,9 +72,7 @@ (defmethod output-files ((op compile-op) (c c-source-file)) - (list - (make-pathname :type "o" :defaults - (component-pathname c)))) + (list (make-pathname :type "o" :defaults (component-pathname c)))) (defmethod perform ((op compile-op) (c c-source-file)) @@ -117,8 +100,9 @@ t) +;;; Shared libraries -(defclass library (static-file) +(defclass library (component) ((libdir :initarg :libdir))) @@ -136,3 +120,17 @@ (defmethod perform ((o load-op) (c library)) (load-dso (component-pathname c))) + +(defmethod perform ((operation operation) (c library)) + nil) + +(defmethod operation-done-p ((o load-op) (c library)) + #+sbcl(find (sb-ext::unix-namestring (component-pathname c)) sb-alien::*shared-objects* :key #'sb-alien::shared-object-file :test #'equal) + #+cmu(rassoc (unix::unix-namestring (component-pathname c)) + system::*global-table* + :key #'(lambda (pathname) + (when pathname (unix::unix-namestring pathname))) + :test #'equal)) + +(defmethod operation-done-p ((o operation) (c library)) + t)