1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00: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 bats,
, fetchFromGitHub fetchFromGitHub,
, bats lib,
, uncrustify packcc,
, testers python3,
, packcc stdenv,
testers,
uncrustify,
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "packcc"; pname = "packcc";
version = "1.8.0"; version = "2.0.2";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "arithy"; owner = "arithy";
repo = "packcc"; repo = "packcc";
rev = "v${version}"; rev = "v${version}";
hash = "sha256-T7PWM5IGly6jpGt04dh5meQjrZPUTs8VEFTQEPO5RSw="; hash = "sha256-k1C/thvr/5fYrgu/j8YN3kwXp4k26sC9AhYhYAKQuX0=";
}; };
postPatch = ''
patchShebangs tests
'';
dontConfigure = true; dontConfigure = true;
preBuild = '' preBuild = ''
cd build/${if stdenv.cc.isGNU then "gcc" cd build/${
else if stdenv.cc.isClang then "clang" if stdenv.cc.isGNU then
else throw "Unsupported C compiler"} "gcc"
else if stdenv.cc.isClang then
"clang"
else
throw "Unsupported C compiler"
}
''; '';
doCheck = true; doCheck = true;
nativeCheckInputs = [ bats uncrustify ]; nativeCheckInputs = [
bats
uncrustify
python3
];
preCheck = '' preCheck =
patchShebangs ../../tests ''
# Style tests will always fail because upstream uses an older version of
# Disable a failing test. # uncrustify.
rm -rf ../../tests/style.d rm -rf ../../tests/style.d
'' + lib.optionalString stdenv.cc.isClang '' ''
export NIX_CFLAGS_COMPILE+=' -Wno-error=strict-prototypes -Wno-error=int-conversion' + lib.optionalString stdenv.cc.isClang ''
''; export NIX_CFLAGS_COMPILE+=' -Wno-error=strict-prototypes -Wno-error=int-conversion'
'';
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
install -Dm755 release/bin/packcc $out/bin/packcc install -Dm755 release/bin/packcc $out/bin/packcc
runHook postInstall runHook postInstall
''; '';
passthru.tests.version = testers.testVersion { passthru.tests.version = testers.testVersion { package = packcc; };
package = packcc;
};
meta = with lib; { meta = with lib; {
description = "Parser generator for C"; description = "Parser generator for C";
mainProgram = "packcc";
longDescription = '' longDescription = ''
PackCC is a parser generator for C. Its main features are as follows: 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, - Generates your parser in C from a grammar described in a PEG,
@ -65,5 +76,6 @@ stdenv.mkDerivation rec {
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ azahi ]; maintainers = with maintainers; [ azahi ];
platforms = platforms.unix; platforms = platforms.unix;
mainProgram = "packcc";
}; };
} }