nixpkgs/pkgs/development/tools/parsing/javacc/default.nix
2024-01-03 22:33:33 +01:00

65 lines
1.2 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, ant
, jdk
, jre
, makeWrapper
, canonicalize-jars-hook
}:
stdenv.mkDerivation (finalAttrs: {
pname = "javacc";
version = "7.0.13";
src = fetchFromGitHub {
owner = "javacc";
repo = "javacc";
rev = "javacc-${finalAttrs.version}";
hash = "sha256-nDJvKIbJc23Tvfn7Zqvt5tDDffNf4KQ0juGQQCZ+i1c=";
};
nativeBuildInputs = [
ant
jdk
makeWrapper
canonicalize-jars-hook
];
buildPhase = ''
runHook preBuild
ant jar
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dm644 target/javacc.jar -t $out/target
install -Dm755 scripts/{javacc,jjdoc,jjtree,jjrun} -t $out/bin
for file in $out/bin/*; do
wrapProgram "$file" --suffix PATH : ${jre}/bin
done
runHook postInstall
'';
doCheck = true;
checkPhase = ''
runHook preCheck
ant test
runHook postCheck
'';
meta = with lib; {
changelog = "https://github.com/javacc/javacc/blob/${finalAttrs.src.rev}/docs/release-notes.md";
description = "A parser generator for building parsers from grammars";
homepage = "https://javacc.github.io/javacc";
license = licenses.bsd2;
mainProgram = "javacc";
maintainers = teams.deshaw.members;
};
})