Merge pull request #278577 from TomaSajt/javacc

javacc: make deterministic and clean up
This commit is contained in:
Weijia Wang 2024-01-11 20:30:13 +01:00 committed by GitHub
commit a264bba538
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,39 +1,64 @@
{ stdenv, lib, fetchFromGitHub, ant, jdk, jre, makeWrapper }:
{ lib
, stdenv
, fetchFromGitHub
, ant
, jdk
, jre
, makeWrapper
, canonicalize-jars-hook
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "javacc";
version = "7.0.13";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "${pname}-${version}";
sha256 = "sha256-nDJvKIbJc23Tvfn7Zqvt5tDDffNf4KQ0juGQQCZ+i1c=";
owner = "javacc";
repo = "javacc";
rev = "javacc-${finalAttrs.version}";
hash = "sha256-nDJvKIbJc23Tvfn7Zqvt5tDDffNf4KQ0juGQQCZ+i1c=";
};
nativeBuildInputs = [ ant jdk makeWrapper ];
nativeBuildInputs = [
ant
jdk
makeWrapper
canonicalize-jars-hook
];
buildPhase = ''
runHook preBuild
ant jar
runHook postBuild
'';
installPhase = ''
mkdir -p $out/target
mv scripts $out/bin
mv target/javacc.jar $out/target/
find -L "$out/bin" -type f -executable -print0 \
| while IFS= read -r -d ''' file; do
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 = "ant test";
checkPhase = ''
runHook preCheck
ant test
runHook postCheck
'';
meta = with lib; {
homepage = "https://javacc.github.io/javacc";
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;
};
}
})