mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
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@pogatzki.net> Part-of: https://github.com/gentoo/gentoo/pull/44017 Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
committed by
Sam James
parent
74969e0432
commit
09620e5a88
102
dev-java/javacup/javacup-11b_p20160615-r2.ebuild
Normal file
102
dev-java/javacup/javacup-11b_p20160615-r2.ebuild
Normal file
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user