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 \

View file

@ -15,9 +15,8 @@ in
export configureFlags="$configureFlags --with-$NIX_LISP=common-lisp.sh";
'';
postInstall = ''
"$out/bin/stumpwm-lisp-launcher.sh" --eval '(asdf:make :stumpwm)' \
--eval '(setf (asdf/system:component-entry-point (asdf:find-system :stumpwm)) (function stumpwm:stumpwm))' \
--eval '(asdf:perform (quote asdf:program-op) :stumpwm)'
export NIX_LISP_PRELAUNCH_HOOK="nix_lisp_build_system stumpwm '(function stumpwm:stumpwm)'"
"$out/bin/stumpwm-lisp-launcher.sh"
cp "$out/lib/common-lisp/stumpwm/stumpwm" "$out/bin"
'';
@ -69,12 +68,10 @@ in
export NIX_LISP_ASDF_PATHS="$NIX_LISP_ASDF_PATHS
$out/lib/common-lisp/query-fs"
export HOME=$PWD
"$out/bin/query-fs-lisp-launcher.sh" --eval '(asdf:make :query-fs)' \
--eval "(progn $(for i in $linkedSystems; do echo "(asdf:make :$i)"; done) )" \
--eval '(setf (asdf/system:component-entry-point (asdf:find-system :query-fs))
(function query-fs:run-fs-with-cmdline-args))' \
--eval '(asdf:perform (quote asdf:program-op) :query-fs)'
cp "$out/lib/common-lisp/query-fs/query-fs" "$out/bin/"
export NIX_LISP_PRELAUNCH_HOOK="nix_lisp_build_system query-fs \
'(function query-fs:run-fs-with-cmdline-args)' '$linkedSystems'"
"$out/bin/query-fs-lisp-launcher.sh"
cp "$out/lib/common-lisp/query-fs/query-fs" "$out/bin/"
'';
};
};