+;;; Shared libraries
+
+(defclass library (component)
+ ((libdir :initarg :libdir)))
+
+
+(defun relative-pathname (path)
+ (etypecase path
+ (cons path)
+ (string (if (char= #\/ (char path 0))
+ (subseq path 1)
+ path))))
+
+(defmethod component-pathname ((lib library))
+ (make-pathname :type "so"
+ :name (component-name lib)
+ :directory (relative-pathname (slot-value lib 'libdir))))
+
+(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)