Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 82 lines 1.6 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 bison, 6 flex, 7 readline, 8 ncurses, 9}: 10 11stdenv.mkDerivation { 12 pname = "cdecl-blocks"; 13 version = "2.5-unstable-2024-05-07"; 14 15 src = fetchFromGitHub { 16 owner = "ridiculousfish"; 17 repo = "cdecl-blocks"; 18 rev = "1e6e1596771183d9bb90bcf152d6bc2055219a7e"; 19 hash = "sha256-5XuiYkFe+QvVBRIXRieKoE0zbISMvU1iLgEfkw6GnlE="; 20 }; 21 22 patches = [ 23 ./cdecl-2.5-lex.patch 24 # when `USE_READLINE` is enabled, this option will not be present 25 ./test_remove_interactive_line.patch 26 ]; 27 28 prePatch = '' 29 substituteInPlace cdecl.c \ 30 --replace 'getline' 'cdecl_getline' 31 ''; 32 33 strictDeps = true; 34 35 nativeBuildInputs = [ 36 bison 37 flex 38 ]; 39 40 buildInputs = [ 41 readline 42 ncurses 43 ]; 44 45 env = { 46 NIX_CFLAGS_COMPILE = toString ( 47 [ 48 "-DBSD" 49 "-DUSE_READLINE" 50 ] 51 ++ lib.optionals stdenv.cc.isClang [ 52 "-Wno-error=int-conversion" 53 "-Wno-error=incompatible-function-pointer-types" 54 ] 55 ); 56 NIX_LDFLAGS = "-lreadline"; 57 }; 58 59 makeFlags = [ 60 "CC=${lib.getExe stdenv.cc}" 61 "PREFIX=${placeholder "out"}" 62 "BINDIR=${placeholder "out"}/bin" 63 "MANDIR=${placeholder "out"}/man1" 64 "CATDIR=${placeholder "out"}/cat1" 65 ]; 66 67 doCheck = true; 68 checkTarget = "test"; 69 70 preInstall = '' 71 mkdir -p $out/bin; 72 ''; 73 74 meta = { 75 description = "Translator English -- C/C++ declarations"; 76 homepage = "https://cdecl.org"; 77 license = lib.licenses.publicDomain; 78 maintainers = with lib.maintainers; [ sigmanificient ]; 79 platforms = lib.platforms.unix; 80 mainProgram = "cdecl"; 81 }; 82}