summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-java/antlr
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-java/antlr')
-rw-r--r--dev-java/antlr/Manifest6
-rw-r--r--dev-java/antlr/antlr-2.7.7-r5.ebuild172
-rw-r--r--dev-java/antlr/antlr-2.7.7-r6.ebuild173
-rw-r--r--dev-java/antlr/antlr-3.1.3-r3.ebuild117
-rw-r--r--dev-java/antlr/antlr-4.4.ebuild70
-rw-r--r--dev-java/antlr/files/2.7.7-gcc-4.3.patch11
-rw-r--r--dev-java/antlr/files/2.7.7-gcc-4.4.patch10
-rw-r--r--dev-java/antlr/files/2.7.7-makefixes.patch68
-rw-r--r--dev-java/antlr/files/2.7.7-static-libs-fix.patch22
-rw-r--r--dev-java/antlr/files/antlr-3.1.3-jdk-8.patch28
-rw-r--r--dev-java/antlr/files/antlr-4.4-build.xml.patch20
-rw-r--r--dev-java/antlr/files/antlr.pc.in9
-rw-r--r--dev-java/antlr/metadata.xml14
13 files changed, 720 insertions, 0 deletions
diff --git a/dev-java/antlr/Manifest b/dev-java/antlr/Manifest
new file mode 100644
index 000000000000..9bce4f8f37ab
--- /dev/null
+++ b/dev-java/antlr/Manifest
@@ -0,0 +1,6 @@
+DIST 4.4.zip 1107695 SHA256 68a79e4accae4dfd9d45a8292fe9b2812c6a3ec1d903412e205a06ead083b8ae SHA512 5e4a92b3d0bb8583f52cbed554ef68909412cd3e9de7589870eead3359a6f5efb492029c3bcce50d6a19a220c83c809824dbde3d08a6b39a42e9fbe3eaef8ce4 WHIRLPOOL 80cf60f9679cd5d3cb512b2e1a9c4987d34fb7994a976b42c95351fb4670944343dd8b8cf0e1738b94cc177122dcf635ee5d1a262290f6b89a8e38d06adc2077
+DIST antlr-2.7.7.tar.gz 1816180 SHA256 853aeb021aef7586bda29e74a6b03006bcb565a755c86b66032d8ec31b67dbb9 SHA512 faa72d2ddcba434ef1233e70c1549e63eba67c00793966322e821cf7f015cccb804448cb92d8fbef0429f59928fad65ec954f8ffbda0acbb8e983de0806d349d WHIRLPOOL def5ac0ddfe5a65f9f7d5489d039048c5d630b46cd5626593bd12e9b393d5ec26884f90b013bcdf58511e26abbf06e0d7b3789a11298b017f7e70af2ec8dde4a
+DIST antlr-3.1.3-generated.tar.bz2 47167 SHA256 ed326de0f1f92dd72e8d9644e8eaf59d02b9725b4b5218f5c54e12100f8d05f4 SHA512 4ea01ad0d5fc99607ffa445fb99ae424648b713dca293d05ff4ec064cac0a0fe5073df3834f9b6990e99f3cefc5cdd191a1ee3c3951d97615908b94630070bba WHIRLPOOL 61f7829811251a35528c322952830dc5a6e82e23e36f664af179b41955734e771aaad070298666a15be0f41982dbb8b19955b5967987582c6b666e602384d060
+DIST antlr-3.1.3.tar.gz 10743515 SHA256 1fca0fc7304140807e64ec263a58d93ef1b380cfb6407084e6909f8220bc1039 SHA512 6814b970740bd61e6727f81b1a2fb4249f8f029e756694d852224eee54e0231540f8e23d2fa8f78eef234d6497f5fa1411e76020ffaed737d8c1a5178321a062 WHIRLPOOL 9d9a1caf39595dbb9b300f730091cfa38a12ab10b8a59d58c7bdd9ba4674bce9f49bc21b5b170129216ff9d880dbf5f0bdb5bfe614b003a4ffe948948b5413c9
+DIST antlr-3.5.2-complete-no-st3.jar 1862097 SHA256 46531814ba9739cdf20c6c1789c252d3d95b68932813d79fb8bbfdf8d5840417 SHA512 227f56edfb8d1935fc0f5bd69a730a2230b173f38baa7837b6dac9b4a10c5d4a9b2eb806416b21bed2621bb0b8e0fb98a6f48da2660b326728326f078bc28ea9 WHIRLPOOL 5c5285894e2d4182650a8a573ae83996e1f463d6ce866ddcff43959b16cf1070c3042b21d80c9350865716a6719d15fcd42b7370b4af69b6eca863d26ffcc325
+DIST antlr-4.3-complete.jar 1340431 SHA256 da9afec193edcc4d8080a4897e77e1e2f6a0c0bc265fccb8c44ae10660f7a8f0 SHA512 669cc21ef72ec899509181b1ec77d918fce9dba3db165d9d7429e0058c58a9d716cbf274d7a54b6bd9143d95d9a902d82acfa5bcb5e6c805c4e9fdf90b83349e WHIRLPOOL f665a200850d294ee0f8c3127bb918a9c9625098a97a960afe08b3a3940ba2c2ad54099e34c82fab5058b668a721b3ed5621a85820d0aca0e16af2f81627c723
diff --git a/dev-java/antlr/antlr-2.7.7-r5.ebuild b/dev-java/antlr/antlr-2.7.7-r5.ebuild
new file mode 100644
index 000000000000..dad4b634104d
--- /dev/null
+++ b/dev-java/antlr/antlr-2.7.7-r5.ebuild
@@ -0,0 +1,172 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PYTHON_COMPAT=( python2_7 )
+
+DISTUTILS_OPTIONAL="y"
+DISTUTILS_SINGLE_IMPL="y"
+DISTUTILS_IN_SOURCE_BUILD="y"
+
+inherit base java-pkg-2 mono autotools distutils-r1 multilib toolchain-funcs versionator
+
+DESCRIPTION="A parser generator for C++, C#, Java, and Python"
+HOMEPAGE="http://www.antlr2.org/"
+SRC_URI="http://www.antlr2.org/download/${P}.tar.gz"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="amd64 ~arm ppc ppc64 x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc debug examples mono +cxx +java python script source static-libs"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+# TODO do we actually need jdk at runtime?
+RDEPEND="python? ( ${PYTHON_DEPS} )
+ >=virtual/jdk-1.3
+ mono? ( dev-lang/mono )"
+DEPEND="${RDEPEND}
+ script? ( !dev-util/pccts )
+ source? ( app-arch/zip )"
+
+PATCHES=( "${FILESDIR}"/${PV}-{gcc-4.3,gcc-4.4,makefixes}.patch )
+
+make_shared_lib() {
+ local soname=$(basename "${1%.a}")$(get_libname $(get_major_version))
+ einfo "Making ${soname}"
+ [[ ${CHOST} == *-darwin* ]] \
+ && make_shared_lib_macho "${soname}" "$1" "$2"\
+ || make_shared_lib_elf "${soname}" "$1" "$2"
+}
+
+make_shared_lib_elf() {
+ local soname=$1 archive=$2 cc=$3
+ ${cc:-$(tc-getCXX)} ${LDFLAGS} \
+ -shared -Wl,-soname="${soname}" \
+ -Wl,--whole-archive "${archive}" -Wl,--no-whole-archive \
+ -o $(dirname "${archive}")/"${soname}" || return 1
+}
+
+make_shared_lib_macho() {
+ local soname=$1 archive=$2 cc=$3
+ ${cc:-$(tc-getCXX)} ${LDFLAGS} \
+ -dynamiclib -install_name "${EPREFIX}/usr/$(get_libdir)/${soname}" \
+ -force_load "${archive}" \
+ -o $(dirname "${archive}")/"${soname}" || return 1
+}
+
+pkg_setup() {
+ java-pkg-2_pkg_setup
+
+ if use python ; then
+ python-single-r1_pkg_setup
+ fi
+}
+
+src_prepare() {
+ base_src_prepare
+
+ sed -i \
+ -e 's/install:.*this-install/install:/' \
+ lib/cpp/src/Makefile.in || die
+
+ use static-libs || epatch "${FILESDIR}/${PV}-static-libs-fix.patch"
+
+ # See bug #468540, this can be removed once bug #469150 is fixed.
+ sed -i 's/tlib lib ar/ar/' configure.in || die
+ eautoreconf
+}
+
+src_configure() {
+ # don't ask why, but this is needed for stuff to get built properly
+ # across the various JDKs
+ JAVACFLAGS="+ ${JAVACFLAGS}"
+
+ # mcs for https://bugs.gentoo.org/show_bug.cgi?id=172104
+ CSHARPC="mcs" econf $(use_enable java) \
+ $(use_enable python) \
+ $(use_enable mono csharp) \
+ $(use_enable debug) \
+ $(use_enable examples) \
+ $(use_enable cxx) \
+ --enable-verbose
+}
+
+src_compile() {
+ emake CXXFLAGS="${CXXFLAGS} -fPIC"
+ if use cxx; then
+ pushd lib/cpp/src > /dev/null
+ make_shared_lib libantlr.a || die
+ if use static-libs; then
+ make clean
+ emake
+ fi
+ popd > /dev/null
+ fi
+
+ if use python ; then
+ pushd "${S}"/lib/python > /dev/null
+ distutils-r1_src_compile
+ popd > /dev/null
+ fi
+}
+
+src_install() {
+ dobin scripts/antlr-config
+
+ if use cxx ; then
+ pushd lib/cpp > /dev/null
+ einstall
+ dolib.so src/libantlr$(get_libname $(get_major_version))
+ dosym libantlr$(get_libname $(get_major_version)) \
+ /usr/$(get_libdir)/libantlr$(get_libname)
+ use static-libs && dolib.a src/libantlr.a
+ newdoc AUTHORS{,.cpp}
+ newdoc ChangeLog{,.cpp}
+ newdoc TODO{,.cpp}
+ popd > /dev/null
+ fi
+
+ if use java ; then
+ java-pkg_dojar antlr/antlr.jar
+ use script && java-pkg_dolauncher antlr --main antlr.Tool
+ use source && java-pkg_dosrc antlr
+ use doc && java-pkg_dohtml -r doc/*
+ fi
+
+ if use mono ; then
+ pushd lib > /dev/null
+ dodir /usr/$(get_libdir)/antlr/
+ insinto /usr/$(get_libdir)/antlr/
+ doins antlr.astframe.dll
+ doins antlr.runtime.dll
+ sed -e "s|@prefix@|${EPREFIX}/usr|" \
+ -e 's|@exec_prefix@|${prefix}|' \
+ -e "s|@libdir@|\$\{exec_prefix\}/$(get_libdir)/antlr|" \
+ -e 's|@libs@|-r:${libdir}/antlr.astframe.dll -r:${libdir}/antlr.runtime.dll|' \
+ -e "s|@VERSION@|${PV}|" \
+ "${FILESDIR}"/antlr.pc.in > antlr.pc
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins antlr.pc
+ popd > /dev/null
+ fi
+
+ if use python ; then
+ pushd "${S}"/lib/python > /dev/null
+ distutils-r1_src_install
+ popd > /dev/null
+ fi
+
+ if use examples ; then
+ find "${S}"/examples -iname Makefile\* -exec rm \{\} \;
+ insinto /usr/share/doc/${PF}/examples
+ use cxx && doins -r "${S}"/examples/cpp
+ use java && doins -r "${S}"/examples/java
+ use mono && doins -r "${S}"/examples/csharp
+ use python && doins -r "${S}"/examples/python
+ fi
+
+ dodoc README.txt
+}
diff --git a/dev-java/antlr/antlr-2.7.7-r6.ebuild b/dev-java/antlr/antlr-2.7.7-r6.ebuild
new file mode 100644
index 000000000000..783a98f4ff67
--- /dev/null
+++ b/dev-java/antlr/antlr-2.7.7-r6.ebuild
@@ -0,0 +1,173 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PYTHON_COMPAT=( python2_7 )
+
+DISTUTILS_OPTIONAL="y"
+DISTUTILS_SINGLE_IMPL="y"
+DISTUTILS_IN_SOURCE_BUILD="y"
+
+inherit base java-pkg-2 mono autotools distutils-r1 multilib toolchain-funcs versionator
+
+DESCRIPTION="A parser generator for C++, C#, Java, and Python"
+HOMEPAGE="http://www.antlr2.org/"
+SRC_URI="http://www.antlr2.org/download/${P}.tar.gz"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc debug examples mono +cxx +java python script source static-libs"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+# TODO do we actually need jdk at runtime?
+RDEPEND="python? ( ${PYTHON_DEPS} )
+ >=virtual/jdk-1.6
+ mono? ( dev-lang/mono )"
+DEPEND="${RDEPEND}
+ >=sys-devel/automake-1.15
+ script? ( !dev-util/pccts )
+ source? ( app-arch/zip )"
+
+PATCHES=( "${FILESDIR}"/${PV}-{gcc-4.3,gcc-4.4,makefixes}.patch )
+
+make_shared_lib() {
+ local soname=$(basename "${1%.a}")$(get_libname $(get_major_version))
+ einfo "Making ${soname}"
+ [[ ${CHOST} == *-darwin* ]] \
+ && make_shared_lib_macho "${soname}" "$1" "$2"\
+ || make_shared_lib_elf "${soname}" "$1" "$2"
+}
+
+make_shared_lib_elf() {
+ local soname=$1 archive=$2 cc=$3
+ ${cc:-$(tc-getCXX)} ${LDFLAGS} \
+ -shared -Wl,-soname="${soname}" \
+ -Wl,--whole-archive "${archive}" -Wl,--no-whole-archive \
+ -o $(dirname "${archive}")/"${soname}" || return 1
+}
+
+make_shared_lib_macho() {
+ local soname=$1 archive=$2 cc=$3
+ ${cc:-$(tc-getCXX)} ${LDFLAGS} \
+ -dynamiclib -install_name "${EPREFIX}/usr/$(get_libdir)/${soname}" \
+ -force_load "${archive}" \
+ -o $(dirname "${archive}")/"${soname}" || return 1
+}
+
+pkg_setup() {
+ java-pkg-2_pkg_setup
+
+ if use python ; then
+ python-single-r1_pkg_setup
+ fi
+}
+
+src_prepare() {
+ base_src_prepare
+
+ sed -i \
+ -e 's/install:.*this-install/install:/' \
+ lib/cpp/src/Makefile.in || die
+
+ use static-libs || epatch "${FILESDIR}/${PV}-static-libs-fix.patch"
+
+ # See bug #468540, this can be removed once bug #469150 is fixed.
+ sed -i 's/tlib lib ar/ar/' configure.in || die
+ eautoreconf
+}
+
+src_configure() {
+ # don't ask why, but this is needed for stuff to get built properly
+ # across the various JDKs
+ JAVACFLAGS="+ ${JAVACFLAGS}"
+
+ # mcs for https://bugs.gentoo.org/show_bug.cgi?id=172104
+ CSHARPC="mcs" econf $(use_enable java) \
+ $(use_enable python) \
+ $(use_enable mono csharp) \
+ $(use_enable debug) \
+ $(use_enable examples) \
+ $(use_enable cxx) \
+ --enable-verbose
+}
+
+src_compile() {
+ emake CXXFLAGS="${CXXFLAGS} -fPIC"
+ if use cxx; then
+ pushd lib/cpp/src > /dev/null
+ make_shared_lib libantlr.a || die
+ if use static-libs; then
+ make clean
+ emake
+ fi
+ popd > /dev/null
+ fi
+
+ if use python ; then
+ pushd "${S}"/lib/python > /dev/null
+ distutils-r1_src_compile
+ popd > /dev/null
+ fi
+}
+
+src_install() {
+ dobin scripts/antlr-config
+
+ if use cxx ; then
+ pushd lib/cpp > /dev/null
+ einstall
+ dolib.so src/libantlr$(get_libname $(get_major_version))
+ dosym libantlr$(get_libname $(get_major_version)) \
+ /usr/$(get_libdir)/libantlr$(get_libname)
+ use static-libs && dolib.a src/libantlr.a
+ newdoc AUTHORS{,.cpp}
+ newdoc ChangeLog{,.cpp}
+ newdoc TODO{,.cpp}
+ popd > /dev/null
+ fi
+
+ if use java ; then
+ java-pkg_dojar antlr/antlr.jar
+ use script && java-pkg_dolauncher antlr --main antlr.Tool
+ use source && java-pkg_dosrc antlr
+ use doc && java-pkg_dohtml -r doc/*
+ fi
+
+ if use mono ; then
+ pushd lib > /dev/null
+ dodir /usr/$(get_libdir)/antlr/
+ insinto /usr/$(get_libdir)/antlr/
+ doins antlr.astframe.dll
+ doins antlr.runtime.dll
+ sed -e "s|@prefix@|${EPREFIX}/usr|" \
+ -e 's|@exec_prefix@|${prefix}|' \
+ -e "s|@libdir@|\$\{exec_prefix\}/$(get_libdir)/antlr|" \
+ -e 's|@libs@|-r:${libdir}/antlr.astframe.dll -r:${libdir}/antlr.runtime.dll|' \
+ -e "s|@VERSION@|${PV}|" \
+ "${FILESDIR}"/antlr.pc.in > antlr.pc
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins antlr.pc
+ popd > /dev/null
+ fi
+
+ if use python ; then
+ pushd "${S}"/lib/python > /dev/null
+ distutils-r1_src_install
+ popd > /dev/null
+ fi
+
+ if use examples ; then
+ find "${S}"/examples -iname Makefile\* -exec rm \{\} \;
+ insinto /usr/share/doc/${PF}/examples
+ use cxx && doins -r "${S}"/examples/cpp
+ use java && doins -r "${S}"/examples/java
+ use mono && doins -r "${S}"/examples/csharp
+ use python && doins -r "${S}"/examples/python
+ fi
+
+ dodoc README.txt
+}
diff --git a/dev-java/antlr/antlr-3.1.3-r3.ebuild b/dev-java/antlr/antlr-3.1.3-r3.ebuild
new file mode 100644
index 000000000000..8a8c83b10f8f
--- /dev/null
+++ b/dev-java/antlr/antlr-3.1.3-r3.ebuild
@@ -0,0 +1,117 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+JAVA_PKG_IUSE="source"
+
+inherit eutils java-pkg-2 java-ant-2
+
+DESCRIPTION="A parser generator for C++, C#, Java, and Python"
+HOMEPAGE="http://www.antlr.org/"
+# You need to generate v3 grammars so that boostrapping works
+SRC_URI="http://www.antlr.org/download/${P}.tar.gz
+ mirror://gentoo/${P}-generated.tar.bz2"
+LICENSE="BSD"
+SLOT="3"
+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="gunit"
+
+COMMON_DEPEND=">=dev-java/stringtemplate-3.2:0
+ >=dev-java/antlr-2.7.7:0[java]
+ gunit? ( dev-java/junit:4 )"
+
+RDEPEND=">=virtual/jre-1.5
+ ${COMMON_DEPEND}"
+
+DEPEND="${RDEPEND}
+ >=virtual/jdk-1.5"
+
+java_prepare() {
+ epatch "${FILESDIR}"/${P}-jdk-8.patch || die
+
+ rm -v lib/*.jar lib/.*.jar || die
+ rm -v runtime/ActionScript/project/lib/*.jar || die
+ # We must bundle this as we can't depend on ourselves
+ cp -v "${WORKDIR}"/*.java tool/src/main/antlr/org/antlr/grammar/v3 || die
+ local version="${PV} $(date '+%B %d, %Y %T')"
+ local propertyfile="tool/src/main/resources/org/antlr/antlr.properties"
+ [[ $(egrep "^[^#]" ${propertyfile} | wc -l) != 1 ]] \
+ && die "Unknown property found"
+ sed -i "s/^\(antlr.version\)=.*$/\1=${version}/" ${propertyfile} || die
+}
+
+antlr2() {
+ java -cp $(java-pkg_getjars antlr) antlr.Tool "${@}" || die "antlr2 failed"
+}
+
+antlr3() {
+ local cp="${S}/bootstrap:${S}/tool/src/main/resources/"
+ java -cp "${cp}":$(java-pkg_getjars antlr,stringtemplate) \
+ org.antlr.Tool "${@}" || die "building v3 grammars failed"
+}
+
+build_antlr() {
+ cd "${S}"
+ local dest="${1}"
+ # runtime
+ find runtime -name "*.java" > "${T}/sources" || die
+ # tool
+ find tool/src/main -name "*.java" >> "${T}/sources" || die
+ ejavac -d "${dest}" -cp $(java-pkg_getjars antlr,stringtemplate) "@${T}/sources"
+}
+
+# Uses maven so let's just do things manully for now
+# when bumping use jardiff and apicheck to make sure
+# produced jars are good
+src_compile() {
+ einfo "Bootstrapping antlr3 with bundled sources"
+ cd tool/src/main/antlr2/org/antlr/grammar/v2/ || die
+ # the command line only takes one at a time
+ for grammar in *.g; do
+ antlr2 ${grammar} || die
+ done
+
+ cd "${S}" || die
+ mkdir bootstrap || die
+ build_antlr bootstrap
+
+ einfo "Building v3 grammars with boostrapped antlr"
+ local v3dir=tool/src/main/antlr/org/antlr/grammar/v3/
+ rm -v "${v3dir}"/*.java || die
+ antlr3 "${v3dir}"/*.g
+
+ mkdir build || die
+ cp -r "${S}"/tool/src/main/resources/* build || die
+ build_antlr build
+
+ if use gunit; then
+ einfo "building gunit"
+ antlr3 gunit/src/main/antlr3/org/antlr/gunit/*.g
+
+ find gunit -name "*.java" > "${T}/gunit" || die
+ ejavac -d build -cp $(java-pkg_getjars stringtemplate,junit-4):build \
+ "@${T}/gunit"
+
+ cp -vr gunit/src/main/resources/org build || die
+ fi
+
+ # jar things up
+ cd build
+ find -type f >> "${T}/classes" || die
+ jar cf ${PN}3.jar "@${T}/classes" || die "jar failed"
+}
+
+src_install() {
+ # Single jar like upstream
+ java-pkg_dojar build/antlr3.jar
+ java-pkg_dolauncher antlr3 --main org.antlr.Tool
+ use gunit && java-pkg_dolauncher gunit --main org.antlr.gunit.Interp
+
+ use source && java-pkg_dosrc tool/src/main/org \
+ runtime/Java/src/main/java/org/
+}
+
+pkg_postinst() {
+ elog "Currently the ebuild only has support for the Java backend."
+}
diff --git a/dev-java/antlr/antlr-4.4.ebuild b/dev-java/antlr/antlr-4.4.ebuild
new file mode 100644
index 000000000000..cc1b6136dfc0
--- /dev/null
+++ b/dev-java/antlr/antlr-4.4.ebuild
@@ -0,0 +1,70 @@
+# 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-ant-2
+
+# List of jar files we need to get from the Internets.
+JAR_LIST=(antlr-3.5.2-complete-no-st3.jar antlr-4.3-complete.jar)
+
+DESCRIPTION="A parser generator for C++, C#, Java, and Python"
+HOMEPAGE="http://www.antlr.org/"
+SRC_URI="https://github.com/${PN}/${PN}4/archive/${PV}.zip
+http://www.antlr3.org/download/${JAR_LIST[0]}
+http://www.antlr.org/download/${JAR_LIST[1]}"
+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="gunit"
+
+CDEPEND="
+ >=dev-java/stringtemplate-3.2:0
+ gunit? ( dev-java/junit:4 )"
+
+RDEPEND="${CDEPEND}
+ >=virtual/jre-1.6"
+
+DEPEND="${RDEPEND}
+ >=virtual/jdk-1.6"
+
+S="${WORKDIR}/${PN}4-${PV}"
+
+src_prepare() {
+ # Disable manual download + lib directory creation.
+ epatch "${FILESDIR}"/${P}-build.xml.patch
+
+ # Create lib directory ourselves.
+ mkdir "${S}"/lib/
+
+ # Copy downloaded jars in lib directory.
+ for myjar in ${JAR_LIST[@]}; do
+ cp "${DISTDIR}"/${myjar} "${S}"/lib/
+ done
+}
+
+src_compile() {
+ eant -f build.xml
+}
+
+src_install() {
+ # Single jar like upstream
+ java-pkg_newjar dist/antlr-4.4-complete.jar antlr.jar
+ java-pkg_dolauncher antlr4 --main org.antlr.v4.Tool
+
+ if use gunit; then
+ java-pkg_dolauncher gunit --main org.antlr.v4.gunit.Interp
+ fi
+
+ if use source; then
+ java-pkg_dosrc tool/src/org \
+ runtime/Java/src/org
+ fi
+}
+
+pkg_postinst() {
+ elog "This ebuild only supports the Java backend for the time being."
+}
diff --git a/dev-java/antlr/files/2.7.7-gcc-4.3.patch b/dev-java/antlr/files/2.7.7-gcc-4.3.patch
new file mode 100644
index 000000000000..628f8dd2645a
--- /dev/null
+++ b/dev-java/antlr/files/2.7.7-gcc-4.3.patch
@@ -0,0 +1,11 @@
+diff -Naur antlr-2.7.7.orig/lib/cpp/antlr/CharScanner.hpp antlr-2.7.7/lib/cpp/antlr/CharScanner.hpp
+--- antlr-2.7.7.orig/lib/cpp/antlr/CharScanner.hpp 2006-11-01 22:37:17.000000000 +0100
++++ antlr-2.7.7/lib/cpp/antlr/CharScanner.hpp 2008-03-19 20:09:21.000000000 +0100
+@@ -10,6 +10,7 @@
+
+ #include <antlr/config.hpp>
+
++#include <cstring>
+ #include <map>
+
+ #ifdef HAS_NOT_CCTYPE_H
diff --git a/dev-java/antlr/files/2.7.7-gcc-4.4.patch b/dev-java/antlr/files/2.7.7-gcc-4.4.patch
new file mode 100644
index 000000000000..e1790ec4e0c6
--- /dev/null
+++ b/dev-java/antlr/files/2.7.7-gcc-4.4.patch
@@ -0,0 +1,10 @@
+--- lib/cpp/antlr/CharScanner.hpp~ 2008-11-11 21:24:02.000000000 +0000
++++ lib/cpp/antlr/CharScanner.hpp 2008-11-11 21:24:33.000000000 +0000
+@@ -10,6 +10,7 @@
+
+ #include <antlr/config.hpp>
+
++#include <cstdio>
+ #include <cstring>
+ #include <map>
+
diff --git a/dev-java/antlr/files/2.7.7-makefixes.patch b/dev-java/antlr/files/2.7.7-makefixes.patch
new file mode 100644
index 000000000000..cb12752189a7
--- /dev/null
+++ b/dev-java/antlr/files/2.7.7-makefixes.patch
@@ -0,0 +1,68 @@
+diff -Nur antlr-2.7.7/examples/cpp/inherit.tinyc/Makefile.in antlr-2.7.7_patched/examples/cpp/inherit.tinyc/Makefile.in
+--- antlr-2.7.7/examples/cpp/inherit.tinyc/Makefile.in 2006-11-01 23:37:17.000000000 +0200
++++ antlr-2.7.7_patched/examples/cpp/inherit.tinyc/Makefile.in 2009-03-30 02:09:28.000000000 +0300
+@@ -143,7 +143,7 @@
+ @abs_this_builddir@/examples/cpp/tinyc/TinyCLexer.cpp \
+ @abs_this_builddir@/examples/cpp/tinyc/TinyCLexer.hpp \
+ :
+- @ @MAKE@ -C @abs_this_builddir@/examples/cpp/tinyc
++ @ $(MAKE) -C @abs_this_builddir@/examples/cpp/tinyc
+
+ $(objdir)/.subc.g : $(srcdir)/subc.g $(objdir)/TinyCParserTokenTypes.txt @ANTLR_JAR@
+ @ANTLRFLAGS="-glib `@CYGPATH_W@ $(_srcdir)/../tinyc/tinyc.g` -o `@CYGPATH_W@ $(thisdir)`" @ANTLR_COMPILE_CMD@ $(srcdir)/subc.g
+diff -Nur antlr-2.7.7/examples/java/inherit.tinyc/Makefile.in antlr-2.7.7_patched/examples/java/inherit.tinyc/Makefile.in
+--- antlr-2.7.7/examples/java/inherit.tinyc/Makefile.in 2006-11-01 23:37:17.000000000 +0200
++++ antlr-2.7.7_patched/examples/java/inherit.tinyc/Makefile.in 2009-03-30 02:07:25.000000000 +0300
+@@ -77,7 +77,7 @@
+ @ @CP@ $< $@
+
+ @abs_this_builddir@/examples/java/tinyc/TinyCParserTokenTypes.txt :
+- @ @MAKE@ -C @abs_this_builddir@/examples/java/tinyc test
++ @ $(MAKE) -C @abs_this_builddir@/examples/java/tinyc test
+
+
+ ## How to generated *.java ..
+diff -Nur antlr-2.7.7/examples/python/inherit.tinyc/Makefile.in antlr-2.7.7_patched/examples/python/inherit.tinyc/Makefile.in
+--- antlr-2.7.7/examples/python/inherit.tinyc/Makefile.in 2006-11-01 23:37:18.000000000 +0200
++++ antlr-2.7.7_patched/examples/python/inherit.tinyc/Makefile.in 2009-03-30 02:09:07.000000000 +0300
+@@ -61,11 +61,11 @@
+ ## file resides. Therefore we are going to "make" the base
+ ## grammar first and then copy required vocabulary over ..
+ TinyCTokenTypes.txt :
+- @MAKE@ -C ../tinyc
++ $(MAKE) -C ../tinyc
+ @CP@ ../tinyc/$@ $@
+
+ @abs_this_builddir@/examples/python/tinyc/%.py :
+- @MAKE@ -C ../tinyc
++ $(MAKE) -C ../tinyc
+
+ test :: test1
+
+diff -Nur antlr-2.7.7/Makefile.in antlr-2.7.7_patched/Makefile.in
+--- antlr-2.7.7/Makefile.in 2006-11-01 23:37:18.000000000 +0200
++++ antlr-2.7.7_patched/Makefile.in 2009-03-30 02:05:41.000000000 +0300
+@@ -31,7 +31,7 @@
+
+ test clean distclean install ::
+ @ if test -f examples/Makefile ; then \
+- @MAKE@ -C examples $@ ; \
++ $(MAKE) -C examples $@ ; \
+ fi
+
+ # Rule to remove all objects, cores, ANTLR generated,
+diff -Nur antlr-2.7.7/scripts/config.make.in antlr-2.7.7_patched/scripts/config.make.in
+--- antlr-2.7.7/scripts/config.make.in 2006-11-01 23:37:18.000000000 +0200
++++ antlr-2.7.7_patched/scripts/config.make.in 2009-03-30 02:04:54.000000000 +0300
+@@ -47,9 +47,9 @@
+ *) \
+ if test -f "$${d}/Makefile" ; then \
+ echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" ; \
+- echo ">> @MAKE@ -C $(subdir)/$${d} $@ " ; \
++ echo ">> $(MAKE) -C $(subdir)/$${d} $@ " ; \
+ echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" ; \
+- @MAKE@ -C "$$d" $@ || exit 1 ;\
++ $(MAKE) -C "$$d" $@ || exit 1 ;\
+ fi ; \
+ ;; \
+ esac ; \
diff --git a/dev-java/antlr/files/2.7.7-static-libs-fix.patch b/dev-java/antlr/files/2.7.7-static-libs-fix.patch
new file mode 100644
index 000000000000..163aa3e97e5c
--- /dev/null
+++ b/dev-java/antlr/files/2.7.7-static-libs-fix.patch
@@ -0,0 +1,22 @@
+diff --git a/scripts/antlr-config.in.old b/scripts/antlr-config.in
+index 75b94c6..adab1e6 100755
+--- a/scripts/antlr-config.in.old
++++ b/scripts/antlr-config.in
+@@ -19,7 +19,7 @@ Options:
+ [--cflags]
+ [--cxxflags]
+ Libraries:
+- libantlr.a
++ libantlr.so
+ EOF
+ exit $1
+ }
+@@ -58,7 +58,7 @@ while test $# -gt 0; do
+ libs="${libdir}/antlr.lib"
+ ;;
+ *)
+- libs="${libdir}/libantlr.a"
++ libs="${libdir}/libantlr.so"
+ ;;
+ esac
+ echo_libs=yes
diff --git a/dev-java/antlr/files/antlr-3.1.3-jdk-8.patch b/dev-java/antlr/files/antlr-3.1.3-jdk-8.patch
new file mode 100644
index 000000000000..a40fc60b16e6
--- /dev/null
+++ b/dev-java/antlr/files/antlr-3.1.3-jdk-8.patch
@@ -0,0 +1,28 @@
+From 126414cf2731a3fe8a42393d0b41ce0060844b34 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <sebastian@pipping.org>
+Date: Sat, 8 Aug 2015 03:46:00 +0200
+Subject: [PATCH] Fix CompositeGrammer.getIndirectDelegates for JDK 8
+
+https://github.com/antlr/antlr3/issues/151
+---
+ tool/src/main/java/org/antlr/tool/CompositeGrammar.java | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tool/src/main/java/org/antlr/tool/CompositeGrammar.java b/tool/src/main/java/org/antlr/tool/CompositeGrammar.java
+index bb15723..fc16f01 100644
+--- a/tool/src/main/java/org/antlr/tool/CompositeGrammar.java
++++ b/tool/src/main/java/org/antlr/tool/CompositeGrammar.java
+@@ -219,7 +219,9 @@ public class CompositeGrammar {
+ public List<Grammar> getIndirectDelegates(Grammar g) {
+ List<Grammar> direct = getDirectDelegates(g);
+ List<Grammar> delegates = getDelegates(g);
+- delegates.removeAll(direct);
++ if (direct != null) {
++ delegates.removeAll(direct);
++ }
+ return delegates;
+ }
+
+--
+2.5.0
+
diff --git a/dev-java/antlr/files/antlr-4.4-build.xml.patch b/dev-java/antlr/files/antlr-4.4-build.xml.patch
new file mode 100644
index 000000000000..1e64d30e9fc3
--- /dev/null
+++ b/dev-java/antlr/files/antlr-4.4-build.xml.patch
@@ -0,0 +1,20 @@
+--- build.xml.orig 2015-05-20 19:58:28.345000000 +0000
++++ build.xml 2015-05-20 19:58:44.809000000 +0000
+@@ -11,8 +11,6 @@
+ <property name="antlr3.version" value="3.5.2"/>
+ <property name="antlr3.jar.name" value="antlr-${antlr3.version}-complete-no-st3.jar"/>
+ <property name="antlr3.jar" value="${lib.dir}/${antlr3.jar.name}"/>
+- <mkdir dir="${lib.dir}"/>
+- <get src="http://www.antlr3.org/download/${antlr3.jar.name}" dest="${antlr3.jar}" skipexisting="true"/>
+ <path id="cp.antlr3" path="${antlr3.jar}"/>
+
+ <property name="build.antlr3.dir" value="${build.dir}/generated-sources/antlr3" />
+@@ -23,8 +21,6 @@
+ <property name="antlr4.version" value="4.3"/>
+ <property name="antlr4.jar.name" value="antlr-${antlr4.version}-complete.jar"/>
+ <property name="antlr4.jar" value="${lib.dir}/${antlr4.jar.name}"/>
+- <mkdir dir="${lib.dir}"/>
+- <get src="http://www.antlr.org/download/${antlr4.jar.name}" dest="${antlr4.jar}" skipexisting="true"/>
+ <path id="cp.antlr4" path="${antlr4.jar}"/>
+
+ <property name="build.antlr4.dir" value="${build.dir}/generated-sources/antlr4" />
diff --git a/dev-java/antlr/files/antlr.pc.in b/dev-java/antlr/files/antlr.pc.in
new file mode 100644
index 000000000000..fb5480637a90
--- /dev/null
+++ b/dev-java/antlr/files/antlr.pc.in
@@ -0,0 +1,9 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+
+
+Name: antlr
+Description: ANother Tool for Language Recognition
+Version: @VERSION@
+Libs: @libs@
diff --git a/dev-java/antlr/metadata.xml b/dev-java/antlr/metadata.xml
new file mode 100644
index 000000000000..b73c834d5599
--- /dev/null
+++ b/dev-java/antlr/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>java</herd>
+ <use>
+ <flag name="script">Install a script to run antlr</flag>
+ <flag name="gunit" restrict="&gt;=dev-java/antlr-3.1.3-r1">
+ gUnit is a "Unit Test" framework for ANTLR grammars
+ </flag>
+ </use>
+ <upstream>
+ <remote-id type="github">antlr/antlr4</remote-id>
+ </upstream>
+</pkgmetadata>