Files
nixpkgs/pkgs/by-name/pa/packcc/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

80 lines
1.8 KiB
Nix

{
bats,
fetchFromGitHub,
lib,
python3,
stdenv,
testers,
uncrustify,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "packcc";
version = "2.2.0";
src = fetchFromGitHub {
owner = "arithy";
repo = "packcc";
rev = "v${finalAttrs.version}";
hash = "sha256-fmZL34UL7epFFGo0gCsj8TcyhBt5uCfnLCLCQugXF6U=";
};
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"
}
'';
doCheck = true;
nativeCheckInputs = [
bats
uncrustify
python3
];
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 = finalAttrs.finalPackage; };
meta = with lib; {
description = "Parser generator for C";
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,
- Gives your parser great efficiency by packrat parsing,
- Supports direct and indirect left-recursive grammar rules.
'';
homepage = "https://github.com/arithy/packcc";
changelog = "https://github.com/arithy/packcc/releases/tag/${finalAttrs.src.rev}";
license = licenses.mit;
maintainers = with maintainers; [ azahi ];
platforms = platforms.unix;
mainProgram = "packcc";
};
})