diff options
author | Hraban Luyat <hraban@0brg.net> | 2024-01-24 15:10:00 -0500 |
---|---|---|
committer | Hraban Luyat <hraban@0brg.net> | 2024-02-23 22:26:42 -0500 |
commit | 5cd820b39a0aa98c1a8aeb86f7df4b53c7ff95e7 (patch) | |
tree | 8766bab5ab09d963575cce6ccac7df1724ba6792 /pkgs/development/compilers | |
parent | 65e6531546311119ceda42a10848b43990f9f39b (diff) |
sbcl: patch all paths to uname, env and sh
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r-- | pkgs/development/compilers/sbcl/default.nix | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 62cb4ebbd5878..7a5b4170c9766 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, callPackage, clisp, fetchurl, strace, texinfo, which, writeText, zstd +{ lib, stdenv, callPackage, clisp, coreutils, fetchurl, strace, texinfo, which, writeText, zstd , threadSupport ? (stdenv.hostPlatform.isx86 || "aarch64-linux" == stdenv.hostPlatform.system || "aarch64-darwin" == stdenv.hostPlatform.system) , linkableRuntime ? stdenv.hostPlatform.isx86 , disableImmobileSpace ? false @@ -100,7 +100,7 @@ stdenv.mkDerivation (self: rec { ./fix-2.4.0-aarch64-darwin.patch ]; - postPatch = (lib.optionalString (builtins.elem stdenv.hostPlatform.system [ + postPatch = lib.optionalString (builtins.elem stdenv.hostPlatform.system [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" @@ -110,19 +110,25 @@ stdenv.mkDerivation (self: rec { # https://sourceforge.net/p/sbcl/mailman/message/58728554/ rm -f tests/compiler.pure.lisp \ tests/float.pure.lisp - '') + (if purgeNixReferences - then - # This is the default location to look for the core; by default in $out/lib/sbcl - '' - sed 's@^\(#define SBCL_HOME\) .*$@\1 "/no-such-path"@' \ - -i src/runtime/runtime.c - '' - else - # Fix software version retrieval - '' - sed -e "s@/bin/uname@$(command -v uname)@g" -i src/code/*-os.lisp \ - src/code/run-program.lisp - ''); + '' + + lib.optionalString purgeNixReferences '' + # This is the default location to look for the core; by default in $out/lib/sbcl + sed 's@^\(#define SBCL_HOME\) .*$@\1 "/no-such-path"@' \ + -i src/runtime/runtime.c + '' + + '' + ( + shopt -s nullglob + # Tests need patching regardless of purging of paths from the final + # binary. There are some tricky files in nested directories which should + # definitely NOT be patched this way, hence just a single * (and no + # globstar). + substituteInPlace ${if purgeNixReferences then "tests" else "{tests,src/code}"}/*.{lisp,sh} \ + --replace-quiet /usr/bin/env "${coreutils}/bin/env" \ + --replace-quiet /bin/uname "${coreutils}/bin/uname" \ + --replace-quiet /bin/sh "${stdenv.shell}" + ) + ''; preBuild = '' export INSTALL_ROOT=$out |