From: Chris Hanson Date: Tue, 23 Oct 2018 21:09:47 +0000 (-0700) Subject: Change plugin support to work in uninstalled build directory. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~186 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=b2c53245471c82aa3d6f8d8d5365de9c44c8ccc7;p=mit-scheme.git Change plugin support to work in uninstalled build directory. --- diff --git a/src/runtime/ffi.scm b/src/runtime/ffi.scm index 5799e4a53..f07cf8b46 100644 --- a/src/runtime/ffi.scm +++ b/src/runtime/ffi.scm @@ -262,25 +262,36 @@ USA. (file-loadable? path)))) (define (plugin-pathname name) - (or (libtool-pathname name) - (system-library-pathname - (pathname-new-type (string-append name"-shim") "so")) - (error "Could not find plugin:" name))) + (let ((try-name + (lambda (name) + (or (libtool-pathname name) + (let ((path + (system-library-pathname + (pathname-new-type (string-append name"-shim") "so") + #f))) + (and (file-exists? path) + path)))))) + (or (try-name name) + (and (system-library-directory-pathname name) + (try-name (string-append name "/" name))) + (error "Could not find plugin:" name)))) (define (libtool-pathname name) - (let ((la-pathname (system-library-pathname - (pathname-new-type (string-append name"-shim") - "la")))) - (let ((dlname (libtool-dlname la-pathname)) - (dirname (directory-pathname la-pathname))) - - (define (existing-file name) - (let ((p (merge-pathnames name dirname))) - (and (file-exists? p) - p))) - - (or (existing-file dlname) - (existing-file (string-append ".libs/"dlname)))))) + (let ((la-pathname + (system-library-pathname + (pathname-new-type (string-append name"-shim") "la") + #f))) + (and (file-exists? la-pathname) + (let ((dlname (libtool-dlname la-pathname)) + (dirname (directory-pathname la-pathname))) + + (define (existing-file name) + (let ((p (merge-pathnames name dirname))) + (and (file-exists? p) + p))) + + (or (existing-file dlname) + (existing-file (string-append ".libs/"dlname))))))) (define (libtool-dlname la-pathname) (call-with-input-file la-pathname