forked from mirrors/nixpkgs
Fix SBCL binary building with saved library path
This commit is contained in:
parent
4790b70fb5
commit
58e27a257e
|
@ -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))
|
||||||
|
|
Loading…
Reference in a new issue