1- { lib
2- , stdenv
3- , fetchFromGitHub
4- , bats
5- , uncrustify
6- , testers
7- , packcc
1+ {
2+ bats ,
3+ fetchFromGitHub ,
4+ lib ,
5+ packcc ,
6+ python3 ,
7+ stdenv ,
8+ testers ,
9+ uncrustify ,
810} :
911
1012stdenv . mkDerivation rec {
1113 pname = "packcc" ;
12- version = "1.8.0 " ;
14+ version = "2.0.2 " ;
1315
1416 src = fetchFromGitHub {
1517 owner = "arithy" ;
1618 repo = "packcc" ;
1719 rev = "v${ version } " ;
18- hash = "sha256-T7PWM5IGly6jpGt04dh5meQjrZPUTs8VEFTQEPO5RSw =" ;
20+ hash = "sha256-k1C/thvr/5fYrgu/j8YN3kwXp4k26sC9AhYhYAKQuX0 =" ;
1921 } ;
2022
23+ postPatch = ''
24+ patchShebangs tests
25+ '' ;
26+
2127 dontConfigure = true ;
2228
2329 preBuild = ''
24- cd build/${ if stdenv . cc . isGNU then "gcc"
25- else if stdenv . cc . isClang then "clang"
26- else throw "Unsupported C compiler" }
30+ cd build/${
31+ if stdenv . cc . isGNU then
32+ "gcc"
33+ else if stdenv . cc . isClang then
34+ "clang"
35+ else
36+ throw "Unsupported C compiler"
37+ }
2738 '' ;
2839
2940 doCheck = true ;
3041
31- nativeCheckInputs = [ bats uncrustify ] ;
32-
33- preCheck = ''
34- patchShebangs ../../tests
42+ nativeCheckInputs = [
43+ bats
44+ uncrustify
45+ python3
46+ ] ;
3547
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- '' ;
48+ preCheck =
49+ ''
50+ # Style tests will always fail because upstream uses an older version of
51+ # uncrustify.
52+ rm -rf ../../tests/style.d
53+ ''
54+ + lib . optionalString stdenv . cc . isClang ''
55+ export NIX_CFLAGS_COMPILE+=' -Wno-error=strict-prototypes -Wno-error=int-conversion'
56+ '' ;
4157
4258 installPhase = ''
4359 runHook preInstall
44-
4560 install -Dm755 release/bin/packcc $out/bin/packcc
46-
4761 runHook postInstall
4862 '' ;
4963
50- passthru . tests . version = testers . testVersion {
51- package = packcc ;
52- } ;
64+ passthru . tests . version = testers . testVersion { package = packcc ; } ;
5365
5466 meta = with lib ; {
5567 description = "Parser generator for C" ;
56- mainProgram = "packcc" ;
5768 longDescription = ''
5869 PackCC is a parser generator for C. Its main features are as follows:
5970 - Generates your parser in C from a grammar described in a PEG,
@@ -65,5 +76,6 @@ stdenv.mkDerivation rec {
6576 license = licenses . mit ;
6677 maintainers = with maintainers ; [ azahi ] ;
6778 platforms = platforms . unix ;
79+ mainProgram = "packcc" ;
6880 } ;
6981}
0 commit comments