commit: 09620e5a88839c2a02fe05b6f710706e1d9deb9c Author: Volkmar W. Pogatzki <gentoo <AT> pogatzki <DOT> net> AuthorDate: Sat Jul 20 11:06:29 2024 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Fri Oct 3 16:24:35 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=09620e5a
dev-java/javacup: do not depend on jflex, build with bundled JFlex.jar There is a circular dependency between javacup and jflex and in the past we used to build jflex with a bundled javacup-runtime. The newer version of jflex-1.9.1 however does not provide such bundled javacup-runtime. For this reason we change the emege order to build javacup first using its bundled bin/JFlex.jar. Also, PORTAGE_QUIET=1 is re-added to allow re-compilation with itself without receiving 'QA Notice: java-pkg_ensure-dep' (bug #937047). Bug: https://bugs.gentoo.org/937047 Signed-off-by: Volkmar W. Pogatzki <gentoo <AT> pogatzki.net> Part-of: https://github.com/gentoo/gentoo/pull/44017 Signed-off-by: Sam James <sam <AT> gentoo.org> dev-java/javacup/javacup-11b_p20160615-r2.ebuild | 102 +++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/dev-java/javacup/javacup-11b_p20160615-r2.ebuild b/dev-java/javacup/javacup-11b_p20160615-r2.ebuild new file mode 100644 index 000000000000..102c9ef1481f --- /dev/null +++ b/dev-java/javacup/javacup-11b_p20160615-r2.ebuild @@ -0,0 +1,102 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +JAVA_PKG_IUSE="doc source" + +inherit java-pkg-2 java-pkg-simple + +DESCRIPTION="CUP Parser Generator for Java" +HOMEPAGE="https://www2.cs.tum.edu/projects/cup/" +SRC_URI="https://www2.cs.tum.edu/projects/cup/releases/java-cup-src-${PV/_p/-}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~ppc64 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris" +IUSE="ant-task" + +DEPEND=" + >=virtual/jdk-1.8:* + ant-task? ( >=dev-java/ant-1.10.15:0 ) +" + +RDEPEND=" + >=virtual/jre-1.8:* + ant-task? ( >=dev-java/ant-1.10.15:0 ) +" + +DOCS=( changelog.txt ) +HTML_DOCS=( manual.html ) + +JAVA_MAIN_CLASS="java_cup/Main" +JAVA_SRC_DIR=( "src" "java" ) + +src_prepare() { + java-pkg-2_src_prepare + if use ant-task; then + JAVA_GENTOO_CLASSPATH+="ant" + else + rm src/java_cup/anttask/CUPTask.java || die + fi +} + +src_compile() { + if has_version \>=${CATEGORY}/${PN}-11b:${SLOT}; then + einfo "Get path of installed JAVACUP" + # PORTAGE_QUIET=1 to suppress "QA Notice: java-pkg_ensure-dep", bug #937047 + CP_CUP="$(PORTAGE_QUIET=1 java-pkg_getjar --build-only javacup javacup.jar)" + else + einfo "Get path of bundled JAVACUP" + CP_CUP="$(echo bin/java-cup-*.jar)" + fi + einfo "Path to JAVACUP is ${CP_CUP}" + + if has_version \~dev-java/jflex-1.9.1:0; then + einfo "Get path of installed jflex" + MAIN="jflex.Main" + CP_FLEX="$(PORTAGE_QUIET=1 java-pkg_getjar --build-only jflex jflex.jar)" + else + einfo "Get path to the bundled JFlex" + MAIN="JFlex.Main" + CP_FLEX="$(echo bin/JFlex.jar)" + fi + einfo "Path to JFlex is ${CP_FLEX}" + + einfo "Generate parser with: ${CP_CUP}" + "$(java-config -J)" -jar "${CP_CUP}" \ + -interface -destdir "java" -parser "parser" -symbols "sym" \ + cup/parser.cup || die + + einfo "Generate lexer" + # https://jflex.de/manual.html#running-jflex + $(java-config -J) -cp "${CP_CUP}:${CP_FLEX}" "${MAIN}" \ + flex/Lexer.jflex -d java/javacup || die + + einfo "Build intermediate jar" + JAVA_JAR_FILENAME="seco.jar" + java-pkg-simple_src_compile + + einfo "Remove classes and generated code" + rm -rv java/* target/classes/ || die + + einfo "Regenerate parser with intermediate jar file" + "$(java-config -J)" -jar ./seco.jar \ + -interface -destdir "java" -parser "parser" -symbols "sym" \ + cup/parser.cup || die + + einfo "Regenerate lexer with intermediate jar file" + $(java-config -J) -cp "$(echo ./seco.jar):${CP_FLEX}" "${MAIN}" \ + flex/Lexer.jflex -d java/javacup || die + + einfo "Build final jar with regenerated parser and lexer" + JAVA_JAR_FILENAME="${PN}.jar" + java-pkg-simple_src_compile + "$(java-config --jar)" cvf "${PN}-runtime.jar" -C target/classes java_cup/runtime || die +} + +src_install() { + java-pkg-simple_src_install + java-pkg_dojar "${PN}-runtime.jar" + use ant-task && java-pkg_register-ant-task +}
