Merge pull request #278572 from TomaSajt/java-cup

javaCup: make deterministic and clean up
This commit is contained in:
Weijia Wang 2024-01-11 20:32:24 +01:00 committed by GitHub
commit 48799d385d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,38 +1,56 @@
{ lib, stdenv, fetchurl, jdk, ant } : { lib
, stdenv
, fetchurl
, ant
, jdk
, makeWrapper
, canonicalize-jars-hook
}:
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "java-cup"; pname = "java-cup";
version = "11b-20160615"; version = "11b-20160615";
src = fetchurl { src = fetchurl {
url = "http://www2.cs.tum.edu/projects/cup/releases/java-cup-src-${version}.tar.gz"; url = "http://www2.cs.tum.edu/projects/cup/releases/java-cup-src-${finalAttrs.version}.tar.gz";
sha256 = "1ymz3plngxclh7x3xr31537rvvak7lwyd0qkmnl1mkj5drh77rz0"; hash = "sha256-4OdzYG5FzhqorROD5jk9U+2dzyhh5D76gZT1Z+kdv/o=";
}; };
sourceRoot = "."; sourceRoot = ".";
nativeBuildInputs = [ jdk ant ];
patches = [ ./javacup-0.11b_beta20160615-build-xml-git.patch ]; patches = [ ./javacup-0.11b_beta20160615-build-xml-git.patch ];
buildPhase = "ant"; nativeBuildInputs = [
ant
jdk
makeWrapper
canonicalize-jars-hook
];
buildPhase = ''
runHook preBuild
ant
runHook postBuild
'';
installPhase = '' installPhase = ''
mkdir -p $out/{bin,share/{java,java-cup}} runHook preInstall
cp dist/java-cup-11b.jar $out/share/java-cup/
cp dist/java-cup-11b-runtime.jar $out/share/java/ install -Dm644 dist/java-cup-11b.jar -t $out/share/java-cup
cat > $out/bin/javacup <<EOF install -Dm644 dist/java-cup-11b-runtime.jar -t $out/share/java
#! $shell
exec ${jdk.jre}/bin/java -jar $out/share/java-cup/java-cup-11b.jar "\$@" makeWrapper ${jdk.jre}/bin/java $out/bin/javacup \
EOF --add-flags "-jar $out/share/java-cup/java-cup-11b.jar"
chmod a+x $out/bin/javacup
runHook postInstall
''; '';
meta = { meta = {
homepage = "http://www2.cs.tum.edu/projects/cup/";
description = "LALR parser generator for Java"; description = "LALR parser generator for Java";
homepage = "http://www2.cs.tum.edu/projects/cup/";
license = lib.licenses.mit; license = lib.licenses.mit;
platforms = lib.platforms.all; mainProgram = "javacup";
maintainers = [ lib.maintainers.romildo ]; maintainers = [ lib.maintainers.romildo ];
platforms = lib.platforms.all;
}; };
} })