dev-cpp/antlr-cpp: New package, split from dev-java/antlr

The old ANTLR 2 ebuild tried to cram all the runtimes together, which
was messy. The C++ runtime does not need any Java components at build
time or runtime so it makes sense to split this out. The C++ runtime
for ANTLR 4 is maintained separately by upstream anyway.

This new package does a better job of building the shared library with
the help of libtool. It also supports multilib.

Package-Manager: portage-2.2.20.1
This commit is contained in:
James Le Cuirot 2015-10-14 14:35:05 +01:00
parent 2fa849db86
commit 28eb80ad21
No known key found for this signature in database
GPG Key ID: 21C632129C6D7DE4
5 changed files with 144 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST antlr-2.7.7.tar.gz 1816180 SHA256 853aeb021aef7586bda29e74a6b03006bcb565a755c86b66032d8ec31b67dbb9 SHA512 faa72d2ddcba434ef1233e70c1549e63eba67c00793966322e821cf7f015cccb804448cb92d8fbef0429f59928fad65ec954f8ffbda0acbb8e983de0806d349d WHIRLPOOL def5ac0ddfe5a65f9f7d5489d039048c5d630b46cd5626593bd12e9b393d5ec26884f90b013bcdf58511e26abbf06e0d7b3789a11298b017f7e70af2ec8dde4a

View File

@ -0,0 +1,105 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
# Upstream only installs a static library. The original antlr ebuild
# built a shared library manually, which isn't so great either. This
# ebuild applies libtool instead and therefore an autoreconf is
# required. A couple of errors concerning tr have been seen but the
# final result still looks good. This also sidesteps bug #554344 plus
# the need to call einstall.
AUTOTOOLS_AUTORECONF=1
inherit eutils autotools-multilib
MY_P="${PN%-cpp}-${PV}"
DESCRIPTION="The ANTLR 2 C++ Runtime"
HOMEPAGE="http://www.antlr2.org/"
SRC_URI="http://www.antlr2.org/download/${MY_P}.tar.gz"
LICENSE="public-domain"
SLOT="2"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="doc examples static-libs"
DEPEND="doc? ( app-doc/doxygen )"
RDEPEND="!!dev-java/antlr:0[cxx]"
S="${WORKDIR}/${MY_P}"
DOCS=( lib/cpp/AUTHORS lib/cpp/ChangeLog lib/cpp/README lib/cpp/TODO )
src_prepare() {
epatch "${FILESDIR}"/${PV}-{gcc,libtool}.patch
mv -v configure.in configure.ac || die
mv -v aclocal.m4 acinclude.m4 || die
# These silly test -z lines break badly under recent autoconfs.
sed -i '/AC_PATH_PROG/s/test -z "\$[^"]*" *&& *//' configure.ac || die
# Delete build files from examples.
find examples -name Makefile.in -delete || die
# Fix make invocations. See bug #256880.
find -name "*.in" -exec sed -i 's/@MAKE@/$(MAKE)/g' {} + || die
# Turn Makefile.in files into libtool-style Makefile.am
# files. Countable.hpp is actually missing.
local HPP=$(grep -E -o "\w+\.hpp" lib/cpp/antlr/Makefile.in | grep -v "Countable\.hpp" | tr "\n" " " || die)
local CPP=$(grep -E -o "\w+\.cpp" lib/cpp/src/Makefile.in | tr "\n" " " || die)
cat <<EOF > lib/cpp/antlr/Makefile.am || die
antlr_includedir = \$(includedir)/antlr
antlr_include_HEADERS = ${HPP}
EOF
cat <<EOF > lib/cpp/src/Makefile.am || die
AM_CPPFLAGS = -I\$(abs_top_srcdir)/lib/cpp
lib_LTLIBRARIES = libantlr.la
libantlr_la_LDFLAGS = -version-info 2
libantlr_la_SOURCES = ${CPP}
EOF
autotools-multilib_src_prepare
}
multilib_src_configure() {
local myeconfargs=(
--disable-csharp
--enable-cxx
--disable-examples
--disable-java
--disable-python
--enable-verbose
)
autotools-utils_src_configure
}
src_compile() {
autotools-multilib_src_compile
if use doc; then
cd "${S}/lib/cpp" || die
doxygen -u doxygen.cfg || die
doxygen doxygen.cfg || die
fi
}
multilib_src_install() {
# We only care about the C++ stuff.
emake -C lib/cpp install DESTDIR="${D}"
}
src_install() {
autotools-multilib_src_install
cd "${S}" || die
use doc && dohtml -r lib/cpp/gen_doc/html/
if use examples; then
docinto examples
dodoc -r examples/cpp/*
fi
}

View File

@ -0,0 +1,12 @@
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 21:37:17.000000000 +0000
+++ antlr-2.7.7/lib/cpp/antlr/CharScanner.hpp 2015-10-06 23:01:53.083655950 +0100
@@ -10,6 +10,8 @@
#include <antlr/config.hpp>
+#include <cstdio>
+#include <cstring>
#include <map>
#ifdef HAS_NOT_CCTYPE_H

View File

@ -0,0 +1,21 @@
diff -Naur antlr-2.7.7.orig/configure.in antlr-2.7.7/configure.in
--- antlr-2.7.7.orig/configure.in 2006-11-01 21:37:18.000000000 +0000
+++ antlr-2.7.7/configure.in 2015-10-11 13:49:09.166308712 +0100
@@ -13,6 +13,9 @@
AC_CONFIG_SRCDIR([LICENSE.txt])
AC_CONFIG_AUX_DIR(scripts)
+LT_INIT
+AM_INIT_AUTOMAKE
+
## This shall be the very first config file. Do not change
## this.
AC_CONFIG_FILES([scripts/config.vars])
@@ -841,7 +844,6 @@
AC_PROG_RANLIB
test -z "$MKDIR" && AC_PATH_PROG(MKDIR, mkdir$EXEEXT, mkdir$EXEEXT )
-test -z "$RM" && AC_PATH_PROG(RM, rm$EXEEXT, rm$EXEEXT )
AX_PATH_PROGS(
[TAR],

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>java</herd>
</pkgmetadata>