Skip to content

Commit

Permalink
lispPackages.clwrapper: build helper; saving dynamic library search p…
Browse files Browse the repository at this point in the history
…ath from NIX_LISP_
  • Loading branch information
7c6f434c committed Jan 29, 2018
1 parent 57ecb3a commit 0a70f37
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
27 changes: 27 additions & 0 deletions pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh
Expand Up @@ -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 \
Expand Down
15 changes: 6 additions & 9 deletions pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix
Expand Up @@ -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"
'';
Expand Down Expand Up @@ -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/"
'';
};
};
Expand Down

0 comments on commit 0a70f37

Please sign in to comment.