summaryrefslogtreecommitdiff
blob: e0b7a34e56fab1167304eb7e5fead7a9a96c0172 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit autotools multilib-minimal

MY_PN="${PN%-c}"
DESCRIPTION="The ANTLR3 C Runtime"
HOMEPAGE="https://www.antlr3.org/"
SRC_URI="https://github.com/${MY_PN}/${MY_PN}3/archive/${PV}.tar.gz -> ${MY_PN}-${PV}.tar.gz"
S="${WORKDIR}/${MY_PN}3-${PV}/runtime/C"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="debug debugger doc"

BDEPEND="doc? ( app-doc/doxygen[dot] )"

PATCHES=( "${FILESDIR}/3.5-cflags.patch" )
MULTILIB_WRAPPED_HEADERS=( /usr/include/antlr3config.h )
DOCS=( AUTHORS ChangeLog NEWS README )

src_prepare() {
	default
	sed -i '/^QUIET/s/NO/YES/' doxyfile || die
	eautoreconf
	multilib_copy_sources
}

multilib_src_configure() {
	local econfargs=(
		--enable-shared
		--disable-static
		$(use_enable debug debuginfo)
		$(use_enable debugger antlrdebug)
	)

	case "${ABI}" in
		*64*) econfargs+=( --enable-64bit ) ;;
		*) econfargs+=( --disable-64bit ) ;;
	esac

	econf "${econfargs[@]}"
}

src_compile() {
	multilib-minimal_src_compile

	if use doc; then
		einfo "Generating API documentation ..."
		cd "${S}" || die
		doxygen -u doxyfile || die
		doxygen doxyfile || die
	fi
}

src_install() {
	use doc && HTML_DOCS=( "${S}/api/" )

	multilib-minimal_src_install

	find "${ED}" -name '*.la' -delete || die
}