lispPackages.clwrapper: build helper; saving dynamic library search path from NIX_LISP_

This commit is contained in:
Michael Raskin
2018-01-29 15:15:00 +01:00
parent 57ecb3a8f0
commit 0a70f37275
2 changed files with 33 additions and 9 deletions

View File

@@ -87,6 +87,33 @@ nix_lisp_run_single_form(){
"$NIX_LISP_EXEC_CODE" "$NIX_LISP_QUIT" $NIX_LISP_NODEBUG)
}
nix_lisp_build_system(){
NIX_LISP_FINAL_PARAMETERS=(
"$NIX_LISP_EXEC_CODE" "(progn
(asdf:make :$1)
(loop for s in (list $(for i in $3; do echo ":$i"; done)) do (asdf:make s)))"
"$NIX_LISP_EXEC_CODE" "(progn
(setf (asdf/system:component-entry-point (asdf:find-system :$1)) ${2:-nil})
#+cffi(setf cffi:*foreign-library-directories*
(cffi::explode-path-environment-variable \"NIX_LISP_LD_LIBRARY_PATH\"))
#+sbcl(loop
with libpath := (uiop:split-string (uiop:getenv \"NIX_LISP_LD_LIBRARY_PATH\")
:separator \":\")
for l in sb-alien::*shared-objects*
for ns := (sb-alien::shared-object-namestring l)
do (and (> (length ns) 0) (not (equal (elt ns 0) "/"))
(let*
((prefix (find-if (lambda (s) (probe-file (format nil \"~a/~a\" s ns))) libpath))
(fullpath (and prefix (format nil \"~a/~a\" prefix ns))))
(when fullpath
(setf
(sb-alien::shared-object-namestring l) fullpath
(sb-alien::shared-object-pathname l) (probe-file fullpath)))))
)
(asdf:perform (quote asdf:program-op) :$1)
)")
}
eval "$NIX_LISP_PRELAUNCH_HOOK"
[ -z "$NIX_LISP_SKIP_CODE" ] && "$NIX_LISP_COMMAND" $NIX_LISP_EARLY_OPTIONS \