3
0
Fork 0
forked from mirrors/nixpkgs

Fix SBCL binary building with saved library path

This commit is contained in:
Michael Raskin 2014-11-16 16:28:50 +03:00
parent 4790b70fb5
commit 58e27a257e

View file

@ -15,28 +15,34 @@ NIX_LISP_BUILD_CODE=
case "$NIX_LISP" in case "$NIX_LISP" in
sbcl) sbcl)
NIX_LISP_BUILD_CODE="(progn NIX_LISP_BUILD_CODE="(progn
(sb-ext:with-unlocked-packages (:sb-sys :sb-alien)
(let* (let*
( ((old-fn (symbol-function 'sb-alien::dlopen-or-lose )))
(old-fn (symbol-function 'sb-alien::dlopen-or-lose)) (sb-ext:with-unlocked-packages (:sb-sys :sb-alien)
(old-ldlp #.(sb-posix:getenv \"LD_LIBRARY_PATH\"))
(ldlp-merged nil)
)
(defun sb-alien::dlopen-or-lose (&rest args) (defun sb-alien::dlopen-or-lose (&rest args)
(or (or
(ignore-errors (progn (apply old-fn args))) (ignore-errors (progn (apply old-fn args)))
(and (and
args args
(loop (loop
for path in (list $(echo "$NIX_LISP_LD_LIBRARY_PATH" | sed -e 's/:/" "/g; s/^/"; s/$/"')) with try = nil
for try := (apply old-fn with obj = (first args)
(format nil "~a/~a" path (first args)) with original-namestring = (sb-alien::shared-object-namestring obj)
(cdr args)) for path in (list $(echo "$NIX_LISP_LD_LIBRARY_PATH" | sed -e 's/:/" "/g; s/^/"/; s/$/"/'))
for target := (format nil \"~a/~a\" path original-namestring)
when (ignore-errors
(progn
(setf (sb-alien::shared-object-namestring obj) target)
(setf try (apply old-fn args))
t)) do
(progn (return try))
finally (progn (setf (sb-alien::shared-object-namestring obj) original-namestring)
(return (apply old-fn args)))
)
)
) )
) )
) )
) )
))
(sb-ext:save-lisp-and-die \"$target\" (sb-ext:save-lisp-and-die \"$target\"
:toplevel (lambda () :toplevel (lambda ()
(setf common-lisp:*standard-input* (sb-sys::make-fd-stream 0 :input t :buffering :line)) (setf common-lisp:*standard-input* (sb-sys::make-fd-stream 0 :input t :buffering :line))