public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Miroslav Šulc" <fordfrog@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-java/jflex/
Date: Tue, 16 Mar 2021 10:22:47 +0000 (UTC)	[thread overview]
Message-ID: <1615889905.4646341ff87a562a08278240a3cb17df655e12d3.fordfrog@gentoo> (raw)

commit:     4646341ff87a562a08278240a3cb17df655e12d3
Author:     Volkmar W. Pogatzki <gentoo <AT> pogatzki <DOT> net>
AuthorDate: Mon Mar 15 21:33:41 2021 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Tue Mar 16 10:18:25 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4646341f

dev-java/jflex: EAPI 7

Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Volkmar W. Pogatzki <gentoo <AT> pogatzki.net>
Closes: https://github.com/gentoo/gentoo/pull/19943
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 dev-java/jflex/jflex-1.6.1-r1.ebuild | 123 +++++++++++++++++++++++++++++++++++
 1 file changed, 123 insertions(+)

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 00000000000..0306f5b6643
--- /dev/null
+++ b/dev-java/jflex/jflex-1.6.1-r1.ebuild
@@ -0,0 +1,123 @@
+# 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="dev-java/javacup:0
+	>=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() {
+	# See below for details.
+	eapply_user "${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}
+}


             reply	other threads:[~2021-03-16 10:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 10:22 Miroslav Šulc [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-09-28 14:03 [gentoo-commits] repo/gentoo:master commit in: dev-java/jflex/ Arthur Zamarin
2024-08-30 11:06 Arthur Zamarin
2024-06-24  4:46 Sam James
2024-06-24  4:46 Sam James
2024-06-24  4:46 Sam James
2024-05-25  9:21 Miroslav Šulc
2024-05-25  9:21 Miroslav Šulc
2024-04-17  9:13 Miroslav Šulc
2021-11-11 11:02 Miroslav Šulc
2021-11-11 10:56 Jakov Smolić
2021-05-16 19:36 Sam James
2021-03-16 20:24 Sam James
2021-03-16 20:19 Sam James
2020-05-17 16:55 Aaron Bauman
2019-05-18  1:14 Aaron Bauman
2017-07-13  7:48 Alexis Ballier
2016-04-24 20:17 James Le Cuirot
2016-04-24 20:17 James Le Cuirot
2015-11-22 21:37 James Le Cuirot
2015-10-01  8:39 Patrice Clement
2015-10-01  8:39 Patrice Clement
2015-08-13 18:04 Patrice Clement
2015-08-13 14:46 Patrice Clement
2015-08-11  8:59 Patrice Clement

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1615889905.4646341ff87a562a08278240a3cb17df655e12d3.fordfrog@gentoo \
    --to=fordfrog@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox