10 stdenv.mkDerivation rec {
14 src = fetchFromGitHub {
18 hash = "sha256-T7PWM5IGly6jpGt04dh5meQjrZPUTs8VEFTQEPO5RSw=";
24 cd build/${if stdenv.cc.isGNU then "gcc"
25 else if stdenv.cc.isClang then "clang"
26 else throw "Unsupported C compiler"}
31 nativeCheckInputs = [ bats uncrustify ];
34 patchShebangs ../../tests
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'
45 install -Dm755 release/bin/packcc $out/bin/packcc
50 passthru.tests.version = testers.testVersion {
55 description = "A parser generator for C";
56 mainProgram = "packcc";
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.
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;