From 3bda40c1503d509258c3b8ec07e10295a5e3c53d Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Tue, 29 Oct 2013 11:29:46 +0400 Subject: [PATCH] A few hooks for easier library handling when CFFI is used --- pkgs/development/lisp-modules/clwrapper/setup-hook.sh | 8 +++++++- pkgs/development/lisp-modules/define-package.nix | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh index 5de43dc0e9a9..e5deb47fd5df 100644 --- a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh +++ b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh @@ -25,9 +25,15 @@ setLisp () { fi } +collectNixLispLDLP () { + if echo "$1/lib"/lib*.so* | grep . > /dev/null; then + export NIX_LISP_LD_LIBRARY_PATH="$NIX_LISP_LD_LIBRARY_PATH${NIX_LISP_LD_LIBRARY_PATH:+:}$1/lib" + fi +} + export NIX_LISP_COMMAND NIX_LISP CL_SOURCE_REGISTRY NIX_LISP_ASDF -envHooks=(envHooks[@] addASDFPaths setLisp) +envHooks=(envHooks[@] addASDFPaths setLisp collectNixLispLDLP) mkdir -p "$HOME"/.cache/common-lisp || HOME="$TMP/.temp-$USER-home" mkdir -p "$HOME"/.cache/common-lisp diff --git a/pkgs/development/lisp-modules/define-package.nix b/pkgs/development/lisp-modules/define-package.nix index 4fe3bb68373a..675fc7e74681 100644 --- a/pkgs/development/lisp-modules/define-package.nix +++ b/pkgs/development/lisp-modules/define-package.nix @@ -9,6 +9,10 @@ let echo "export NIX_LISP_COMMAND='$NIX_LISP_COMMAND'" >> "$config_script" echo "export NIX_LISP_ASDF='$NIX_LISP_ASDF'" >> "$config_script" echo "export CL_SOURCE_REGISTRY="\$CL_SOURCE_REGISTRY\''${CL_SOURCE_REGISTRY:+:}"'$CL_SOURCE_REGISTRY:$out/lib/common-lisp/${args.baseName}/'" >> "$config_script" + test -n "$LD_LIBRARY_PATH" && + echo "export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH\''${LD_LIBRARY_PATH:+:}\"'$LD_LIBRARY_PATH'" >> "$config_script" + test -n "$NIX_LISP_LD_LIBRARY_PATH" && + echo "export NIX_LISP_LD_LIBRARY_PATH=\"\$NIX_LISP_LD_LIBRARY_PATH\''${NIX_LISP_LD_LIBRARY_PATH:+:}\"'$NIX_LISP_LD_LIBRARY_PATH'" >> "$config_script" ''; deployLaunchScript = '' launch_script="$out"/bin/${args.baseName}-lisp-launcher.sh @@ -17,6 +21,7 @@ let chmod a+x "$launch_script" echo "#! /bin/sh" >> "$launch_script" echo "source '$config_script'" >> "$launch_script" + echo "export LD_LIBRARY_PATH=\"\$NIX_LISP_LD_LIBRARY_PATH\''${NIX_LISP_LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH\"" >> "$launch_script" echo '"${clwrapper}/bin/common-lisp.sh" "$@"' >> "$launch_script" ''; basePackage = {