From 542b17798aeb7248e2824af22431d21dc8fa32c8 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sat, 13 Jul 2024 23:14:25 +0300 Subject: [PATCH] packcc: 1.8.0 -> 2.0.2 --- pkgs/development/tools/packcc/default.nix | 66 +++++++++++++---------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/pkgs/development/tools/packcc/default.nix b/pkgs/development/tools/packcc/default.nix index 2128e48886b8..0f756388be3b 100644 --- a/pkgs/development/tools/packcc/default.nix +++ b/pkgs/development/tools/packcc/default.nix @@ -1,59 +1,70 @@ -{ lib -, stdenv -, fetchFromGitHub -, bats -, uncrustify -, testers -, packcc +{ + bats, + fetchFromGitHub, + lib, + packcc, + python3, + stdenv, + testers, + uncrustify, }: stdenv.mkDerivation rec { pname = "packcc"; - version = "1.8.0"; + version = "2.0.2"; src = fetchFromGitHub { owner = "arithy"; repo = "packcc"; rev = "v${version}"; - hash = "sha256-T7PWM5IGly6jpGt04dh5meQjrZPUTs8VEFTQEPO5RSw="; + hash = "sha256-k1C/thvr/5fYrgu/j8YN3kwXp4k26sC9AhYhYAKQuX0="; }; + postPatch = '' + patchShebangs tests + ''; + dontConfigure = true; preBuild = '' - cd build/${if stdenv.cc.isGNU then "gcc" - else if stdenv.cc.isClang then "clang" - else throw "Unsupported C compiler"} + cd build/${ + if stdenv.cc.isGNU then + "gcc" + else if stdenv.cc.isClang then + "clang" + else + throw "Unsupported C compiler" + } ''; doCheck = true; - nativeCheckInputs = [ bats uncrustify ]; + nativeCheckInputs = [ + bats + uncrustify + python3 + ]; - preCheck = '' - patchShebangs ../../tests - - # Disable a failing test. - rm -rf ../../tests/style.d - '' + lib.optionalString stdenv.cc.isClang '' - export NIX_CFLAGS_COMPILE+=' -Wno-error=strict-prototypes -Wno-error=int-conversion' - ''; + preCheck = + '' + # Style tests will always fail because upstream uses an older version of + # uncrustify. + rm -rf ../../tests/style.d + '' + + lib.optionalString stdenv.cc.isClang '' + export NIX_CFLAGS_COMPILE+=' -Wno-error=strict-prototypes -Wno-error=int-conversion' + ''; installPhase = '' runHook preInstall - install -Dm755 release/bin/packcc $out/bin/packcc - runHook postInstall ''; - passthru.tests.version = testers.testVersion { - package = packcc; - }; + passthru.tests.version = testers.testVersion { package = packcc; }; meta = with lib; { description = "Parser generator for C"; - mainProgram = "packcc"; longDescription = '' PackCC is a parser generator for C. Its main features are as follows: - Generates your parser in C from a grammar described in a PEG, @@ -65,5 +76,6 @@ stdenv.mkDerivation rec { license = licenses.mit; maintainers = with maintainers; [ azahi ]; platforms = platforms.unix; + mainProgram = "packcc"; }; }