summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2015-12-06 13:45:10 +0000
committerJames Le Cuirot <chewi@gentoo.org>2015-12-06 13:46:12 +0000
commit287c3d3d13374e24c70ea97e4c959dfba8005d02 (patch)
tree9c77ca944c544d86f732388e64954fcf0b78478c /dev-java/antlr/antlr-4.5.1.ebuild
parentsys-kernel/hardened-sources: version bump to 4.2.6-r8 (diff)
downloadgentoo-287c3d3d13374e24c70ea97e4c959dfba8005d02.tar.gz
gentoo-287c3d3d13374e24c70ea97e4c959dfba8005d02.tar.bz2
gentoo-287c3d3d13374e24c70ea97e4c959dfba8005d02.zip
dev-java/antlr: Version bump to 4.5.1 (closes bug #545384)
This is a rewrite as the 4.4 ebuild bundled a lot of prebuilt stuff and didn't include any tests. gunit support has been dropped because no one uses it and it is not worth the hassle. Nothing in the tree truly needs at present this as the existing dependencies are bogus but no doubt something will before long. Package-Manager: portage-2.2.26
Diffstat (limited to 'dev-java/antlr/antlr-4.5.1.ebuild')
-rw-r--r--dev-java/antlr/antlr-4.5.1.ebuild91
1 files changed, 91 insertions, 0 deletions
diff --git a/dev-java/antlr/antlr-4.5.1.ebuild b/dev-java/antlr/antlr-4.5.1.ebuild
new file mode 100644
index 000000000000..17c21dc8af41
--- /dev/null
+++ b/dev-java/antlr/antlr-4.5.1.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+JAVA_PKG_IUSE="source"
+
+inherit java-pkg-2 java-pkg-simple
+
+DESCRIPTION="A parser generator for many languages"
+HOMEPAGE="http://www.antlr.org/"
+SRC_URI="https://github.com/${PN}/${PN}4/archive/${PV}.tar.gz -> ${P}.tar.gz
+ http://www.antlr.org/download/${P}-complete.jar" # Prebuilt version needed.
+LICENSE="BSD"
+SLOT="4"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~x64-freebsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc test"
+
+CDEPEND="dev-java/antlr:3.5
+ dev-java/stringtemplate:4
+ dev-java/treelayout:0"
+
+RDEPEND="${CDEPEND}
+ >=virtual/jre-1.6"
+
+DEPEND="${CDEPEND}
+ >=virtual/jdk-1.6
+ test? (
+ dev-java/hamcrest-core:1.3
+ dev-java/junit:4
+ )"
+
+S="${WORKDIR}/${PN}4-${PV}"
+JAVA_GENTOO_CLASSPATH="stringtemplate-4,treelayout"
+
+src_unpack() {
+ unpack ${P}.tar.gz
+}
+
+java_prepare() {
+ java-pkg_clean
+}
+
+src_configure() {
+ # TODO: Make java-config accept a jar@package query.
+ JAVA_GENTOO_CLASSPATH_EXTRA="${S}/${PN}-runtime.jar:$(java-pkg_getjar antlr-3.5 antlr-runtime.jar)"
+}
+
+src_compile() {
+ cd "${S}/runtime/Java/src"
+ local G PKG
+
+ for G in $(find * -name "*.g4"); do
+ PKG="${G%/*}"
+ PKG="${PKG//\//.}"
+ java -jar "${DISTDIR}/${P}-complete.jar" -package "${PKG}" "${G}" || die
+ done
+
+ JAVA_JAR_FILENAME="${S}/${PN}-runtime.jar" JAVA_PKG_IUSE="doc" java-pkg-simple_src_compile
+
+ cd "${S}/tool/src"
+ antlr3.5 $(find -name "*.g") || die
+ JAVA_JAR_FILENAME="${S}/${PN}-tool.jar" java-pkg-simple_src_compile
+ java-pkg_addres "${S}/${PN}-tool.jar" ../resources
+}
+
+src_install() {
+ java-pkg_dojar ${PN}-{runtime,tool}.jar
+ java-pkg_dolauncher ${PN}${SLOT} --main org.antlr.v4.Tool
+ use doc && java-pkg_dojavadoc runtime/Java/src/target/api
+ use source && java-pkg_dosrc runtime/Java/src/org tool/src/org
+}
+
+junit_suite() {
+ cd "${S}/$1-testsuite/test" || die
+ local CP=".:${S}/runtime-testsuite/test:${S}/${PN}-tool.jar:$(java-pkg_getjars hamcrest-core-1.3,junit-4,${JAVA_GENTOO_CLASSPATH}):${JAVA_GENTOO_CLASSPATH_EXTRA}"
+
+ local TESTS=$(find ${2:-*} -name "Test*.java")
+ TESTS="${TESTS//.java}"
+ TESTS="${TESTS//\//.}"
+
+ ejavac -classpath "${CP}" $(find ${2:-*} -name "*.java")
+ ejunit4 -classpath "${CP}" ${TESTS}
+}
+
+src_test() {
+ # Only run Java runtime tests as we haven't built other languages.
+ junit_suite runtime org/antlr/v4/test/runtime/java
+ junit_suite tool
+}