cdecl: 2.5 -> 2.5-unstable-2024-05-07, add check, refactor

Jumping almost 8 years ahead, to the repo latest commit

cdecl: add check phase

cdecl: further refactoring
This commit is contained in:
Sigmanificient 2024-05-07 05:29:57 +02:00 committed by Weijia Wang
parent de8d1617da
commit 11c2265d7e
2 changed files with 46 additions and 12 deletions

View File

@ -10,38 +10,62 @@
stdenv.mkDerivation {
pname = "cdecl";
version = "2.5";
version = "2.5-unstable-2024-05-07";
src = fetchFromGitHub {
owner = "ridiculousfish";
repo = "cdecl-blocks";
# github repo has no tag, but the 2.5 version match this commit
rev = "cb130ea7e61df5b6fa1e84f996e3f04e21a0181c";
hash = "sha256-lErAxTpPIT49QdOpdjM9e3Qyaajzc+iwv27B3XUFUuE=";
rev = "1e6e1596771183d9bb90bcf152d6bc2055219a7e";
hash = "sha256-5XuiYkFe+QvVBRIXRieKoE0zbISMvU1iLgEfkw6GnlE=";
};
buildInputs = [
patches = [
./cdecl-2.5-lex.patch
# when `USE_READLINE` is enabled, this option will not be present
./test_remove_interactive_line.patch
];
prePatch = ''
substituteInPlace cdecl.c \
--replace 'getline' 'cdecl_getline'
'';
strictDeps = true;
nativeBuildInputs = [
bison
flex
];
buildInputs = [
readline
ncurses
];
NIX_CFLAGS_COMPILE = "-DBSD -DUSE_READLINE -std=gnu89";
NIX_LDFLAGS = "-lreadline";
env = {
NIX_CFLAGS_COMPILE = toString (
[
"-DBSD"
"-DUSE_READLINE"
]
++ lib.optionals stdenv.cc.isClang [
"-Wno-error=int-conversion"
"-Wno-error=incompatible-function-pointer-types"
]
);
NIX_LDFLAGS = "-lreadline";
};
makeFlags = [
"CC=${stdenv.cc}/bin/cc" # otherwise fails on x86_64-darwin
"CC=${stdenv.cc.targetPrefix}cc"
"PREFIX=${placeholder "out"}"
"BINDIR=${placeholder "out"}/bin"
"MANDIR=${placeholder "out"}/man1"
"CATDIR=${placeholder "out"}/cat1"
];
patches = [ ./cdecl-2.5-lex.patch ];
prePatch = ''
substituteInPlace cdecl.c --replace 'getline' 'cdecl_getline'
'';
doCheck = true;
checkTarget = "test";
preInstall = ''
mkdir -p $out/bin;

View File

@ -0,0 +1,10 @@
--- a/test_expected_output.txt 2024-05-07 05:47:13.184419240 +0200
+++ b/test_expected_output.txt 2024-05-07 05:48:38.980122345 +0200
@@ -26,7 +26,6 @@
options
create (-c), nocreate
prompt, noprompt (-q)
- interactive (-i), nointeractive
ritchie (-r), preansi (-p), ansi (-a) or cplusplus (-+)
Current set values are: