summaryrefslogtreecommitdiff
path: root/dev-java/jflex
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-03-20 14:27:17 +0000
committerV3n3RiX <venerix@redcorelinux.org>2021-03-20 14:27:17 +0000
commit5bb9ff1ee56d2b5e75e01a7f066d8b0cec84ec02 (patch)
tree66e860a5099bcad013f1cf667255dc372a7c11b3 /dev-java/jflex
parent7218e1b46bceac05841e90472501742d905fb3fc (diff)
gentoo resync : 20.03.2021
Diffstat (limited to 'dev-java/jflex')
-rw-r--r--dev-java/jflex/Manifest1
-rw-r--r--dev-java/jflex/jflex-1.6.1-r1.ebuild124
2 files changed, 125 insertions, 0 deletions
diff --git a/dev-java/jflex/Manifest b/dev-java/jflex/Manifest
index f6d3ad857c40..a548d86b0c3b 100644
--- a/dev-java/jflex/Manifest
+++ b/dev-java/jflex/Manifest
@@ -1,4 +1,5 @@
AUX icedtea-arm.patch 710 BLAKE2B dc479f8db4f1188ecb63708700d1ef0905590aba6b552b573c9fc05027e195d2dc1143542ca1998a5a6feac53af4ef64326da3f746f8aff1149b0bb01a3793a9 SHA512 9ebf22f2771672bb9ef28fcb7eff0d907e9fe4466b18b3ec3915b27caa2edb07934a47311abf41fbe124b484cccbb19ca68f69acd5bd76e46a49b029dbf275b6
DIST jflex-1.6.1.tar.gz 3027791 BLAKE2B 4262f75c16a847314db8cb175901658ff6b424469e66523b41564179fa30f0e64bcf2d7ad0e06ad918336e5a41e166a74d55f19f7451662d19fbcaa29f716dce SHA512 436840c90d906042205d27e1d3c56dec724bf62cc3d8c8d3445f217af0a50c9ca2bb56ed91f0cd3c37a930f7ca22f4cc50e8c28dbe905f02adf695c8e96fb07b
+EBUILD jflex-1.6.1-r1.ebuild 3547 BLAKE2B 3f31c1b03cf1de496c4e97a9a4470758cf8809d457fefc29a140e2f1d5d23b2e517d3f9755a551e76680e7e2b96bdede3a9893d116a95561514978b57ae2fac1 SHA512 d5dc5c9ab7ada77845f6aadb93c69baac1a89d1068f50246a6a297cbeacdf84d8e88c151d74844796df3f24d8a0c29eff4a0492c790c2d55a2cb553521408a86
EBUILD jflex-1.6.1.ebuild 3550 BLAKE2B 60652de3c6f2251ce128ff058e36265a5ebc15b98db0f0ec5c1c611adcbf868a2cb3855f535ac15897bae15bdac1cba1dc813720a8adcf5968a3f7a3e2f0a5bb SHA512 5cb6e698518eb0d765c35647766a3cab0550e5c48f7e37330321a22039ba1c99fee64cbbaf26faca01f684cd7fe7ae98a03aa694c6eb32b8f4672541f2ea2977
MISC metadata.xml 232 BLAKE2B 513679b02247d8e4cb4c874abd785119d9ca62ad24c44969d52a42c3765d0ebf689024512a2c4c48e69688a4ce02a74ae05708b050a720bc73d8d2bf2ceff58d SHA512 00beaf2c81112ff757c4395f4ea47e85f2d48e369e241f10ddf200090dd6513d52ae2b1aef6d28b7417f1cf34608a7258a167eb307d5670323a2190f3710f893
diff --git a/dev-java/jflex/jflex-1.6.1-r1.ebuild b/dev-java/jflex/jflex-1.6.1-r1.ebuild
new file mode 100644
index 000000000000..d7bddcf955e5
--- /dev/null
+++ b/dev-java/jflex/jflex-1.6.1-r1.ebuild
@@ -0,0 +1,124 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+JAVA_PKG_IUSE="doc source"
+
+inherit java-pkg-2 java-pkg-simple
+
+DESCRIPTION="JFlex is a lexical analyzer generator for Java"
+HOMEPAGE="https://www.jflex.de/"
+SRC_URI="https://${PN}.de/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~ppc-macos ~x64-macos"
+IUSE="examples test vim-syntax"
+RESTRICT="!test? ( test )"
+
+CDEPEND="dev-java/ant-core:0"
+
+RDEPEND=">=virtual/jre-1.8:*
+ vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )
+ ${CDEPEND}"
+
+DEPEND=">=virtual/jdk-1.8:*
+ test? ( dev-java/junit:4 )
+ ${CDEPEND}"
+
+PDEPEND="dev-java/javacup:0"
+
+S="${WORKDIR}/${P}"
+JAVA_SRC_DIR="src/main/java"
+
+src_prepare() {
+ eapply_user
+
+ # See below for details.
+ eapply "${FILESDIR}/icedtea-arm.patch"
+
+ # We need the bundled jflex.jar.
+ rm -rv ${JAVA_SRC_DIR}/java_cup examples/pom.xml || die
+
+ # Remove the bundled java-cup.jar if unneeded.
+ if has_version ${PDEPEND}; then
+ rm -v lib/java-cup-*.jar || die
+ fi
+}
+
+src_configure() {
+ # javacup is a cyclic dependency. Use the package if we have it,
+ # otherwise use the bundled version and install the package later.
+ if has_version ${PDEPEND}; then
+ # Use PORTAGE_QUIET to suppress a QA warning that is spurious
+ # thanks to has_version above. This is Portage-specific but
+ # showing the warning elsewhere isn't the end of the world.
+ JAVACUP=$(PORTAGE_QUIET=1 java-pkg_getjar --build-only javacup javacup.jar)
+ else
+ JAVACUP=$(echo lib/java-cup-*.jar)
+ fi
+
+ JAVA_GENTOO_CLASSPATH_EXTRA="$(java-pkg_getjars --build-only ant-core):${JAVACUP}"
+}
+
+jflex_compile() {
+ java "${@}" jflex.Main -d ${JAVA_SRC_DIR}/${PN} --skel src/main/${PN}/skeleton.nested src/main/${PN}/LexScan.flex || die
+ java-pkg-simple_src_compile
+ java-pkg_addres ${PN}.jar src/main/resources
+}
+
+src_compile() {
+ java -jar "${JAVACUP}" -destdir ${JAVA_SRC_DIR}/${PN} -package ${PN} -parser LexParse -interface src/main/cup/LexParse.cup || die
+
+ # The IcedTea ARM HotSpot port (as of 2.6.1) hangs when running
+ # jflex. We have patched jflex to fix it but we have to run the
+ # bundled version first. -Xint works around the problem. See
+ # http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2678.
+ use arm && local JFLEX_ARGS="-Xint"
+
+ # First compile (without doc/source) using the bundled jflex.
+ JAVA_PKG_IUSE= jflex_compile -cp "lib/${P}.jar:${JAVACUP}" ${JFLEX_ARGS}
+
+ # Then recompile using the fresh jflex.
+ jflex_compile -cp "${PN}.jar:${JAVACUP}"
+}
+
+src_install() {
+ java-pkg-simple_src_install
+ java-pkg_dolauncher ${PN} --main ${PN}.Main
+
+ java-pkg_register-dependency javacup javacup-runtime.jar
+ java-pkg_register-ant-task
+
+ use examples && java-pkg_doexamples examples
+ dodoc {changelog,README}.md
+
+ if use doc; then
+ dodoc doc/*.pdf
+ docinto html
+ dodoc doc/*.{css,html,png} doc/COPYRIGHT
+ fi
+
+ if use vim-syntax; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins lib/${PN}.vim
+ fi
+}
+
+src_test() {
+ if use arm && java-pkg_current-vm-matches oracle-jdk-bin-1.8; then
+ # This results in a StackOverflowError as of 1.8.0.65 but works
+ # fine on icedtea:7. Don't know about icedtea:8 yet.
+ rm -v src/test/java/jflex/EmitterTest.java || die
+ fi
+
+ local CP="src/test/java:${PN}.jar:${JAVA_GENTOO_CLASSPATH_EXTRA}:$(java-pkg_getjars junit-4)"
+
+ local TESTS=$(find src/test/java -name "*Test*.java" -printf "%P\n")
+ TESTS="${TESTS//.java}"
+ TESTS="${TESTS//\//.}"
+
+ ejavac -classpath "${CP}" $(find src/test/java -name "*.java")
+ ejunit4 -classpath "${CP}" ${TESTS}
+}