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 )))
|
||||||
(
|
(sb-ext:with-unlocked-packages (:sb-sys :sb-alien)
|
||||||
(old-fn (symbol-function 'sb-alien::dlopen-or-lose))
|
(defun sb-alien::dlopen-or-lose (&rest args)
|
||||||
(old-ldlp #.(sb-posix:getenv \"LD_LIBRARY_PATH\"))
|
(or
|
||||||
(ldlp-merged nil)
|
(ignore-errors (progn (apply old-fn args)))
|
||||||
)
|
(and
|
||||||
(defun sb-alien::dlopen-or-lose (&rest args)
|
args
|
||||||
(or
|
(loop
|
||||||
(ignore-errors (progn (apply old-fn args)))
|
with try = nil
|
||||||
(and
|
with obj = (first args)
|
||||||
args
|
with original-namestring = (sb-alien::shared-object-namestring obj)
|
||||||
(loop
|
for path in (list $(echo "$NIX_LISP_LD_LIBRARY_PATH" | sed -e 's/:/" "/g; s/^/"/; s/$/"/'))
|
||||||
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)
|
||||||
for try := (apply old-fn
|
when (ignore-errors
|
||||||
(format nil "~a/~a" path (first args))
|
(progn
|
||||||
(cdr args))
|
(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))
|
||||||
|
@ -46,7 +52,7 @@ case "$NIX_LISP" in
|
||||||
systems=":sb-posix $systems"
|
systems=":sb-posix $systems"
|
||||||
;;
|
;;
|
||||||
ecl)
|
ecl)
|
||||||
NIX_LISP_BUILD_CODE="()"
|
NIX_LISP_BUILD_CODE="()"
|
||||||
;;
|
;;
|
||||||
clisp)
|
clisp)
|
||||||
NIX_LISP_BUILD_CODE="(ext:saveinitmem \"$target\" :norc t :init-function (lambda () $code (ext:bye)) :script nil :executable 0)"
|
NIX_LISP_BUILD_CODE="(ext:saveinitmem \"$target\" :norc t :init-function (lambda () $code (ext:bye)) :script nil :executable 0)"
|
||||||
|
|
Loading…
Reference in a new issue