at 24.11-pre 69 lines 1.7 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, bats 5, uncrustify 6, testers 7, packcc 8}: 9 10stdenv.mkDerivation rec { 11 pname = "packcc"; 12 version = "1.8.0"; 13 14 src = fetchFromGitHub { 15 owner = "arithy"; 16 repo = "packcc"; 17 rev = "v${version}"; 18 hash = "sha256-T7PWM5IGly6jpGt04dh5meQjrZPUTs8VEFTQEPO5RSw="; 19 }; 20 21 dontConfigure = true; 22 23 preBuild = '' 24 cd build/${if stdenv.cc.isGNU then "gcc" 25 else if stdenv.cc.isClang then "clang" 26 else throw "Unsupported C compiler"} 27 ''; 28 29 doCheck = true; 30 31 nativeCheckInputs = [ bats uncrustify ]; 32 33 preCheck = '' 34 patchShebangs ../../tests 35 36 # Disable a failing test. 37 rm -rf ../../tests/style.d 38 '' + lib.optionalString stdenv.cc.isClang '' 39 export NIX_CFLAGS_COMPILE+=' -Wno-error=strict-prototypes -Wno-error=int-conversion' 40 ''; 41 42 installPhase = '' 43 runHook preInstall 44 45 install -Dm755 release/bin/packcc $out/bin/packcc 46 47 runHook postInstall 48 ''; 49 50 passthru.tests.version = testers.testVersion { 51 package = packcc; 52 }; 53 54 meta = with lib; { 55 description = "A parser generator for C"; 56 mainProgram = "packcc"; 57 longDescription = '' 58 PackCC is a parser generator for C. Its main features are as follows: 59 - Generates your parser in C from a grammar described in a PEG, 60 - Gives your parser great efficiency by packrat parsing, 61 - Supports direct and indirect left-recursive grammar rules. 62 ''; 63 homepage = "https://github.com/arithy/packcc"; 64 changelog = "https://github.com/arithy/packcc/releases/tag/${src.rev}"; 65 license = licenses.mit; 66 maintainers = with maintainers; [ azahi ]; 67 platforms = platforms.unix; 68 }; 69}