From fa7bd53d0d002646870a18e202ac98b3ac0f598c Mon Sep 17 00:00:00 2001 From: Brad Jensen Date: Wed, 24 Jul 2019 09:21:04 -0700 Subject: [PATCH 1/2] Resolve symlinks before trying to recognize a lisp implementation The CCL package installs a symlink named "ccl" that points at the actual implementation executable: lx86cl64 (or lx86cl for 32 bit). When clwrapper is used with CCL as the backing implementation, this script fails to recognize the implementation. By resolving the symlink, we are able to recognize which implementation we're actually working with. --- pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh b/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh index 65fb6e615f5..3b35d7ba5a9 100755 --- a/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh +++ b/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh @@ -8,7 +8,12 @@ eval "$NIX_LISP_PREHOOK" NIX_LISP_COMMAND="$1" shift -[ -z "$NIX_LISP" ] && NIX_LISP="${NIX_LISP_COMMAND##*/}" +if [ -z "$NIX_LISP" ]; then + while [ -h "${NIX_LISP_COMMAND}" ]; do + NIX_LISP_COMMAND="$(readlink -n "${NIX_LISP_COMMAND}")" + done + NIX_LISP="${NIX_LISP_COMMAND##*/}" +fi export NIX_LISP NIX_LISP_LOAD_FILE NIX_LISP_EXEC_CODE NIX_LISP_COMMAND NIX_LISP_FINAL_PARAMETERS From 16e70997a8af42f62b6e00cce5776b00f93fb583 Mon Sep 17 00:00:00 2001 From: Brad Jensen Date: Wed, 24 Jul 2019 09:30:24 -0700 Subject: [PATCH 2/2] Use if instead of && for deciding whether to run a command The only difference between these forms is the return value when "$NIX_LISP_SKIP_CODE" is the empty string. In the original formulation, the script would return a false exit status. In the new formulation, it will return a true exit status. Its useful to be able to source cl-wrapper.sh (to get the variables it establishes), and its a bit annoying that sourcing it with NIX_LISP_SKIP_CODE=1 results in a false exit status. --- .../development/lisp-modules/clwrapper/cl-wrapper.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh b/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh index 3b35d7ba5a9..9836bbe5642 100755 --- a/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh +++ b/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh @@ -121,8 +121,10 @@ nix_lisp_build_system(){ eval "$NIX_LISP_PRELAUNCH_HOOK" -[ -z "$NIX_LISP_SKIP_CODE" ] && "$NIX_LISP_COMMAND" $NIX_LISP_EARLY_OPTIONS \ - $NIX_LISP_EXEC_CODE "${NIX_LISP_ASDF_LOAD:-"(load \"$NIX_LISP_ASDF/lib/common-lisp/asdf/build/asdf.$NIX_LISP_FASL_TYPE\")"}" \ - $NIX_LISP_EXEC_CODE "$NIX_LISP_ASDF_REGISTRY_CODE" \ - ${NIX_LISP_FINAL_PARAMETERS[*]:+"${NIX_LISP_FINAL_PARAMETERS[@]}"} \ - "$@" +if [ -z "$NIX_LISP_SKIP_CODE" ]; then + "$NIX_LISP_COMMAND" $NIX_LISP_EARLY_OPTIONS \ + $NIX_LISP_EXEC_CODE "${NIX_LISP_ASDF_LOAD:-"(load \"$NIX_LISP_ASDF/lib/common-lisp/asdf/build/asdf.$NIX_LISP_FASL_TYPE\")"}" \ + $NIX_LISP_EXEC_CODE "$NIX_LISP_ASDF_REGISTRY_CODE" \ + ${NIX_LISP_FINAL_PARAMETERS[*]:+"${NIX_LISP_FINAL_PARAMETERS[@]}"} \ + "$@" +fi