1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

Merge pull request #326898 from azahi/packcc-202

packcc: 1.8.0 -> 2.0.2
This commit is contained in:
Azat Bahawi 2024-07-23 18:59:00 +00:00 committed by GitHub
commit 42cc3406c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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";
};
}