javacc: make deterministic and clean up

This commit is contained in:
TomaSajt 2024-01-03 22:33:33 +01:00
parent d7db3ee91f
commit 45f234686c
No known key found for this signature in database
GPG key ID: F011163C050122A1

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;
};
}
})