From 1f267934d9bf65e274a3d5ed0390f0a4bf845a3c Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Tue, 15 Jul 2025 08:01:26 +0200 Subject: [PATCH] clisp: fix broken symlinks --- pkgs/development/interpreters/clisp/default.nix | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkgs/development/interpreters/clisp/default.nix b/pkgs/development/interpreters/clisp/default.nix index e32bbbdf24d2..601aa9db8868 100644 --- a/pkgs/development/interpreters/clisp/default.nix +++ b/pkgs/development/interpreters/clisp/default.nix @@ -130,10 +130,16 @@ stdenv.mkDerivation { doCheck = true; - postInstall = lib.optionalString (withModules != [ ]) ( - ''bash ./clisp-link add "$out"/lib/clisp*/base "$(dirname "$out"/lib/clisp*/base)"/full'' - + lib.concatMapStrings (x: " " + x) withModules - ); + postInstall = lib.optionalString (withModules != [ ]) '' + bash ./clisp-link add "$out"/lib/clisp*/base "$(dirname "$out"/lib/clisp*/base)"/full \ + ${lib.concatMapStrings (x: " " + x) withModules} + + find "$out"/lib/clisp*/full -type l -name "*.o" | while read -r symlink; do + if [[ "$(readlink "$symlink")" =~ (.*\/builddir\/)(.*) ]]; then + ln -sf "../''${BASH_REMATCH[2]}" "$symlink" + fi + done + ''; env.NIX_CFLAGS_COMPILE = "-O0 -falign-functions=${ if stdenv.hostPlatform.is64bit then "8" else "4"