summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev-java/antlr/Manifest2
-rw-r--r--dev-java/antlr/antlr-4.5.1.ebuild91
2 files changed, 93 insertions, 0 deletions
diff --git a/dev-java/antlr/Manifest b/dev-java/antlr/Manifest
index dd63ef1efe31..2aa81bacbe11 100644
--- a/dev-java/antlr/Manifest
+++ b/dev-java/antlr/Manifest
@@ -8,3 +8,5 @@ DIST antlr-3.5.2-complete-no-st3.jar 1862097 SHA256 46531814ba9739cdf20c6c1789c2
DIST antlr-3.5.2-complete.jar 2456317 SHA256 26ca659f47d77384f518cf2b6463892fcd4f0b0d4d8c0de2addf697e63e7326b SHA512 560f208e38759b5e626de56816e1fce9c191c526c04ca782513859d468ac444d1e8e62c03870a68f8f9d8daee0f45fca465150e2bbfc71b46e46b952519044b1 WHIRLPOOL bdbbb081bf0aab83fa26a4a75f7f42487da688a5e3c765ea4cbd7b8c1bcb80b66e8b98bf95ee8bcd2acd60b4eacb6745f879cb899b672ea7fc4489d651a6f2e0
DIST antlr-3.5.2.tar.gz 6927126 SHA256 529baf7d11f06b773543e25271c1a6e1735d2f8061f4866d1ea5c99a5d71ee1f SHA512 e2a0520093fb2a77dcd9d44f26a9fdd612dceaffb398c53b2b8cd29f4630830647ede29e8dd55b434cb2c165b0fd1d77968ec6e6de0798f14d9cdfd9e6fccd99 WHIRLPOOL a3a2bf81cc91a332725a4ce15dcccf10df5395b27a521656b1f3e80fed10197edc132fa2a8b9a259b2ee603320492b4b1f664692a967fdfdbb574d919b9aa20e
DIST antlr-4.3-complete.jar 1340431 SHA256 da9afec193edcc4d8080a4897e77e1e2f6a0c0bc265fccb8c44ae10660f7a8f0 SHA512 669cc21ef72ec899509181b1ec77d918fce9dba3db165d9d7429e0058c58a9d716cbf274d7a54b6bd9143d95d9a902d82acfa5bcb5e6c805c4e9fdf90b83349e WHIRLPOOL f665a200850d294ee0f8c3127bb918a9c9625098a97a960afe08b3a3940ba2c2ad54099e34c82fab5058b668a721b3ed5621a85820d0aca0e16af2f81627c723
+DIST antlr-4.5.1-complete.jar 1478820 SHA256 9cff6c76bc5aafcbf51cac7f0974ae01e4f6119402e75436abbb97f8ab15c211 SHA512 1109087c44706694d75a7f88f6ce96e8653467d5721505db747e7e70a4f40a24469b1fb3ffcb327819bba1548b0025412e46a11a41e329b0ecf847cb1094238c WHIRLPOOL 54d8a59bbd935b84a76370645d57eb07ee9160297ad457106b7b773682f915c9632446fc818a9fb23ab37074c923b918c168a7eca98555513cfb4dfa2eb106e5
+DIST antlr-4.5.1.tar.gz 6158475 SHA256 faaaea662e7b4792fc2264bbefaf0e196e74f45ebe29ec638f978b008e6bb5ff SHA512 949306b0ee87a0c002664ee7ac0f32c43385c501b4e28f181417559ce09b07cc12a8441c3bb81f8a72feba3d4ccc693a3c03bcccad7fc81223cddb19e10468a9 WHIRLPOOL 00aeb41f8864d65d7693cf3ca4d36a10f094967fe96fefd67e4d64eb22d1502658ff2355125ab5e36f88a276d143247c0a2814cfcd990e08ec3fe6f6212ea42e
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
+}