s7: move patchPhase to postPatch, fix installCheck problem

This commit is contained in:
rczb
2024-12-11 11:40:14 +08:00
parent 7208217d78
commit 757989eb98
+40 -17
View File
@@ -2,11 +2,17 @@
lib,
fetchFromGitLab,
stdenv,
notcurses,
gmp,
mpfr,
libmpc,
flint3,
gmp,
libmpc,
mpfr,
notcurses,
gsl,
man,
pkg-config,
unstableGitUpdater,
writeScript,
}:
@@ -33,13 +39,9 @@ stdenv.mkDerivation (finalAttrs: {
# The following scripts are modified from [Guix's](https://packages.guix.gnu.org/packages/s7/).
patchPhase = ''
runHook prePatch
postPatch = ''
substituteInPlace s7.c \
--replace-fail libc_s7.so $out/lib/libc_s7.so
runHook postPatch
'';
buildPhase = ''
@@ -78,11 +80,6 @@ stdenv.mkDerivation (finalAttrs: {
-O2 -I. \
-ldl -lm
cc ffitest.c s7.o -o ffitest \
-I. \
-Wl,-export-dynamic \
-ldl -lm
./s7-repl libc.scm
runHook postBuild
@@ -99,9 +96,9 @@ stdenv.mkDerivation (finalAttrs: {
dst_doc=$out/share/doc/s7
mkdir -p $dst_bin $dst_lib $dst_inc $dst_share $dst_scm $dst_doc
cp -pr -t $dst_bin s7-repl s7-nrepl
mv -t $dst_bin s7-repl s7-nrepl
ln -s s7-nrepl $dst_bin/s7
cp -pr -t $dst_lib libarb_s7.so libnotcurses_s7.so libc_s7.so
mv -t $dst_lib libarb_s7.so libnotcurses_s7.so libc_s7.so
cp -pr -t $dst_share s7.c
cp -pr -t $dst_inc s7.h
cp -pr -t $dst_scm *.scm
@@ -112,10 +109,36 @@ stdenv.mkDerivation (finalAttrs: {
doInstallCheck = true;
nativeInstallCheckInputs = [
man
pkg-config
];
installCheckInputs = [
gsl
];
/*
XXX: The upstream assumes that `$HOME` is `/home/$USER`, and the source files
lie in `$HOME/cl` . The script presented here uses a fake `$USER` and a
symbolic linked `$HOME/cl` , which make the test suite work but do not meet
the conditions completely.
*/
installCheckPhase = ''
runHook preInstallCheck
$dst_bin/s7-repl s7test.scm
cc ffitest.c s7.o -o ffitest \
-I. \
-Wl,-export-dynamic \
-ldl -lm
mv ffitest $dst_bin
mkdir -p nix-build/home
ln -sr . nix-build/home/cl
USER=nix-s7-builder PATH="$dst_bin:$PATH" HOME=$PWD/nix-build/home \
s7-repl s7test.scm
rm $dst_bin/ffitest
runHook postInstallCheck
'';