dev-java/antlr: fixed bug #385797
authorMiroslav Šulc <fordfrog@gentoo.org>
Wed, 19 Oct 2011 01:42:15 +0000 (01:42 +0000)
committerMiroslav Šulc <fordfrog@gentoo.org>
Wed, 19 Oct 2011 01:42:15 +0000 (01:42 +0000)
Package-Manager: portage-2.1.10.29/cvs/Linux x86_64

dev-java/antlr/ChangeLog
dev-java/antlr/Manifest
dev-java/antlr/antlr-2.7.7-r4.ebuild [new file with mode: 0644]
dev-java/antlr/files/2.7.7-static-libs-fix.patch [new file with mode: 0644]

index 162ac1db30654224c4c989a5e014be94563111c8..b2a470f60d04b78fbac139d2c42afbb312fd9062 100644 (file)
@@ -1,6 +1,13 @@
 # ChangeLog for dev-java/antlr
 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-java/antlr/ChangeLog,v 1.89 2011/08/18 19:21:40 grobian Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-java/antlr/ChangeLog,v 1.90 2011/10/19 01:42:15 fordfrog Exp $
+
+*antlr-2.7.7-r4 (19 Oct 2011)
+
+  19 Oct 2011; Miroslav Šulc <fordfrog@gentoo.org>
+  +files/2.7.7-static-libs-fix.patch, +antlr-2.7.7-r4.ebuild:
+  Fixed linking when static-libs is disabled (bug #385797, thanks to Roeland
+  Douma <roeland@rullzer.com> for the patch)
 
 *antlr-2.7.7-r3 (18 Aug 2011)
 
index c7269baf3e7f63f89054cd5fd35674e9d252998a..af46dd813e08e466ace25bda27cceb7a91b86f46 100644 (file)
@@ -1,6 +1,7 @@
 AUX 2.7.7-gcc-4.3.patch 383 RMD160 b07b999bd1fe9ed4e90c2c4240c6b8dcececa460 SHA1 9561c692ccfad5f320739897da0ce985d8c804d7 SHA256 de68d3a12a03d7bcdbd3e1cf5ab7d773123a55b4d9e8bb9f3a873fa2c2be84e2
 AUX 2.7.7-gcc-4.4.patch 257 RMD160 b1b2058707e6132e4db8d4f7dbd7648c8d3799eb SHA1 b618b5a3f603a3cb07acda07e85ab022cfb3cdef SHA256 4d1c713424893be36f5b29f73a9e7f491274abe6535af31c26bf0aa8dbf00256
 AUX 2.7.7-makefixes.patch 3151 RMD160 260811a8fd616fa2acd8ee92b57e004bef1af2d7 SHA1 81eedd78cb7f71e783ee4450c9eda72411ffbdc8 SHA256 04c15e4c6054c3504e21ed5ef00bfb011f5345146e5c044f607e14a30fda1360
+AUX 2.7.7-static-libs-fix.patch 507 RMD160 bd5a104dd8f7ecdaba0595111415307ffec298d6 SHA1 ab309857d06ae4b9c9dced7bd96f95eb75dae954 SHA256 a4a3e56c1c583e868f3dff477ca052fd80abfb49889e848b79b57ebdee8a134e
 AUX antlr.pc.in 155 RMD160 9e65e2d813b035fceba2893da2b14e21b579ff22 SHA1 008e6316a5f75884749bd88925a888fa0f7de78e SHA256 31bf717831c33e3088958712f2c6629427a505ee0a48030e65b4f733e0bf277f
 DIST antlr-2.7.7.tar.gz 1816180 RMD160 0b7951a28b748e912721fe0f6de4095d9f8da57d SHA1 802655c343cc7806aaf1ec2177a0e663ff209de1 SHA256 853aeb021aef7586bda29e74a6b03006bcb565a755c86b66032d8ec31b67dbb9
 DIST antlr-3.1.3-generated.tar.bz2 47167 RMD160 9ea64a67aba65bf27e8abbdfbd1a28a0ea2b7698 SHA1 21addec96267b43742e2b2bbd6c7e245db644c38 SHA256 ed326de0f1f92dd72e8d9644e8eaf59d02b9725b4b5218f5c54e12100f8d05f4
@@ -8,7 +9,8 @@ DIST antlr-3.1.3.tar.gz 10743515 RMD160 e772197a8a89783ec7cb3e0005913e0396a0ca4c
 EBUILD antlr-2.7.7-r1.ebuild 2947 RMD160 c839f55ba5c00ffbb01fc39bf82415055b51ff47 SHA1 cc3a51c392e6fb9c45b5920b11a4a1b4b41b470b SHA256 05b8bc38cfa262ebbd2b124f6e736f858ca75520440fb7f916bd7cba020bab8f
 EBUILD antlr-2.7.7-r2.ebuild 3725 RMD160 ec7bc481551f808cdf084a9a0ca483159bdfae1a SHA1 ea207169f9b6dedd3222a946d6b8e526cff73376 SHA256 cc324f6fe80924888dd80f1311a85ece9c1ce624d777fca44c4cc5efefd02aab
 EBUILD antlr-2.7.7-r3.ebuild 4386 RMD160 ed8d880ed7014ee63e971e3f5496e1f457e47399 SHA1 5f69cffa5a78346772098fd9c8844e47cb9e9c59 SHA256 5bca894c9229d8584f06395d8f2c28c533963f61bcb40568a8d46ebc7cda833d
+EBUILD antlr-2.7.7-r4.ebuild 4470 RMD160 dd5aec2b255091a71042fc8b7fdb858e198a48cb SHA1 a8498bb0a71f25371d08ddc3a97e5c65dea2ea0a SHA256 01d04272660fdfb272fa94c5ccdbf6df8edd81b8d27582123f8888373d5dfd02
 EBUILD antlr-2.7.7.ebuild 2934 RMD160 b11efc4a4e8d5e68b423a4c8e16cb4a8d2f8c374 SHA1 1612e05a6715cba4ae1da0a2fd0ca91d4356b53b SHA256 3db0e8b0f1de5a77d714e10784fa550ad84a24e636e6503d2f9ad99a27376385
 EBUILD antlr-3.1.3-r2.ebuild 3482 RMD160 0c589316a1d2f154d0add9cc0423be2ac0ee7a40 SHA1 6f71e90bdc12ef28d4f66b3d19c9cda515933c9e SHA256 4bee733cf85ddac23b038534a6decc5c5aa96cb649f059ef6cf285605c5c2247
-MISC ChangeLog 12112 RMD160 f9163efb2ae9ce6dbae0fe2ca3e3eed9aa4128d0 SHA1 0d6f0fb0ecc36c425e0b44809e6ebf8fddc79d87 SHA256 f47a6f789f5acc5bfeb9c80542ccf017deb9c4707bab572974c499fd0e018901
+MISC ChangeLog 12381 RMD160 eb42ec0ebeae3635c54b33f81b44bff05a82066e SHA1 4c03eb9597ac0a5c2a1a1b70e01aa44affeeaecb SHA256 a85bcbda20f9407614515a5befab9749c7aae8ed8d4af2b05b8648288ec6b502
 MISC metadata.xml 363 RMD160 72102b036fe76e530f4519a0aa081778aae7262a SHA1 b8f61d984af7ca03255f57bf4126799e58863f2d SHA256 6aa7ec680dc08ab936d6f59f1444bba56902fec42eaf16d5c9919350a5c355cc
diff --git a/dev-java/antlr/antlr-2.7.7-r4.ebuild b/dev-java/antlr/antlr-2.7.7-r4.ebuild
new file mode 100644 (file)
index 0000000..c24db12
--- /dev/null
@@ -0,0 +1,167 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-java/antlr/antlr-2.7.7-r4.ebuild,v 1.1 2011/10/19 01:42:15 fordfrog Exp $
+
+EAPI="3"
+PYTHON_DEPEND="python? 2"
+
+inherit base java-pkg-2 mono distutils 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="ANTLR"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~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"
+
+# TODO do we actually need jdk at runtime?
+RDEPEND=">=virtual/jdk-1.3
+       mono? ( dev-lang/mono )"
+DEPEND="${RDEPEND}
+       script? ( !dev-util/pccts )
+       source? ( app-arch/zip )"
+
+PATCHES=( "${FILESDIR}/2.7.7-gcc-4.3.patch" "${FILESDIR}/2.7.7-gcc-4.4.patch" "${FILESDIR}/2.7.7-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-getCC)} ${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_set_active_version 2
+               python_pkg_setup
+       fi
+}
+
+src_prepare() {
+       base_src_prepare
+       sed -i \
+               -e 's/install:.*this-install/install:/' \
+               lib/cpp/src/Makefile.in || die
+
+       if ! use static-libs ; then
+               epatch "${FILESDIR}/${PV}-static-libs-fix.patch"
+       fi
+}
+
+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" || die "compile failed"
+       if use cxx; then
+               pushd lib/cpp/src > /dev/null
+               make_shared_lib libantlr.a || die
+               if use static-libs; then
+                       make clean
+                       emake || die "compile static failed"
+               fi
+               popd > /dev/null
+       fi
+       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 > "${S}"/antlr.pc
+}
+
+src_install() {
+       exeinto /usr/bin
+       doexe "${S}"/scripts/antlr-config
+
+       if use cxx ; then
+               cd "${S}"/lib/cpp
+               einstall || die "failed to install C++ files"
+               dolib.so src/libantlr$(get_libname $(get_major_version)) || die
+               dosym libantlr$(get_libname $(get_major_version)) \
+                       /usr/$(get_libdir)/libantlr$(get_libname)
+               use static-libs && dolib.a src/libantlr.a
+       fi
+
+       if use java ; then
+               java-pkg_dojar "${S}"/antlr/antlr.jar
+
+               use script && java-pkg_dolauncher antlr --main antlr.Tool
+
+               use source && java-pkg_dosrc "${S}"/antlr
+               use doc && java-pkg_dohtml -r "${S}"/doc/*
+       fi
+
+       if use mono ; then
+               cd "${S}"/lib
+
+               dodir /usr/$(get_libdir)/antlr/
+               insinto /usr/$(get_libdir)/antlr/
+
+               doins antlr.astframe.dll
+               doins antlr.runtime.dll
+
+               insinto /usr/$(get_libdir)/pkgconfig
+               doins "${S}"/antlr.pc
+       fi
+
+       if use python ; then
+               cd "${S}"/lib/python
+               distutils_src_install
+       fi
+
+       if use examples ; then
+               find "${S}"/examples -iname Makefile\* -exec rm \{\} \;
+
+               dodir /usr/share/doc/${PF}/examples
+               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
+
+       newdoc "${S}"/README.txt README || die
+}
+
+pkg_postinst() {
+       use python && distutils_pkg_postinst
+}
+
+pkg_postrm() {
+       use python && distutils_pkg_postrm
+}
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 (file)
index 0000000..163aa3e
--- /dev/null
@@ -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