Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 ''; 39 40 installPhase = '' 41 runHook preInstall 42 43 install -Dm755 release/bin/packcc $out/bin/packcc 44 45 runHook postInstall 46 ''; 47 48 passthru.tests.version = testers.testVersion { 49 package = packcc; 50 }; 51 52 meta = with lib; { 53 description = "A parser generator for C"; 54 longDescription = '' 55 PackCC is a parser generator for C. Its main features are as follows: 56 - Generates your parser in C from a grammar described in a PEG, 57 - Gives your parser great efficiency by packrat parsing, 58 - Supports direct and indirect left-recursive grammar rules. 59 ''; 60 homepage = "https://github.com/arithy/packcc"; 61 changelog = "https://github.com/arithy/packcc/releases/tag/${src.rev}"; 62 license = licenses.mit; 63 maintainers = with maintainers; [ azahi ]; 64 platforms = platforms.unix; 65 }; 66}