summaryrefslogtreecommitdiff
blob: be89da27f17e9e56622d621496135732139392b3 (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit java-pkg-2

DESCRIPTION="A parser generator for many languages"
HOMEPAGE="https://www.antlr.org/"
# Reuse tarball for DOCS
SRC_URI="https://github.com/${PN}/${PN}4/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="BSD"
SLOT="4"
KEYWORDS="amd64 ~arm arm64 ppc64 x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"

CP_DEPEND="
	~dev-java/antlr-runtime-${PV}:${SLOT}
	~dev-java/antlr-tool-${PV}:${SLOT}
"

DEPEND="
	>=virtual/jdk-1.8:*
	${CP_DEPEND}
"

RDEPEND="
	>=virtual/jre-1.8:*
	${CP_DEPEND}
"

S="${WORKDIR}/${PN}4-${PV}"

DOCS=( CHANGES.txt CONTRIBUTING.md contributors.txt README.md doc )

src_compile() {
	:
}

src_install() {
	java-pkg_regjar "$(java-pkg_getjar "antlr-runtime-${SLOT}" antlr-runtime.jar)"
	java-pkg_regjar "$(java-pkg_getjar "antlr-tool-${SLOT}" antlr-tool.jar)"

	java-pkg_dolauncher "${PN}${SLOT}" --main org.antlr.v4.Tool
	einstalldocs # https://bugs.gentoo.org/789582
}

pkg_postinst() {
	# If upgrading from a version of this slot that installs JARs,
	# display a message about submodule split
	local changed_ver="4.9.3"
	local should_show_msg
	for replaced_ver in ${REPLACING_VERSIONS}; do
		if ver_test "${replaced_ver}" -lt "${changed_ver}"; then
			should_show_msg=1
			break
		fi
	done
	[[ "${should_show_msg}" ]] || return
	elog "Since version ${changed_ver}, ${PN}-${SLOT} no longer installs JARs."
	elog "Please find the JARs from files installed by submodule packages"
	elog "antlr-runtime-${SLOT} and antlr-tool-${SLOT}."
}