dev-java/tomcat-servlet-api: removed obsolete versions
[gentoo.git] / dev-java / rhino / rhino-1.7.7-r1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5 JAVA_PKG_IUSE="doc examples source test"
6 inherit java-pkg-2 java-ant-2 versionator
7
8 # rhino -> Rhino
9 MY_PN="${PN^}"
10
11 # 1.7.7 -> 1_7_7
12 MY_PV="$(replace_all_version_separators _ ${PV})"
13
14 # rhino1.7.7
15 MY_P="${PN}${PV}"
16
17 # Rhino1_7_7_RELEASE
18 MY_RELEASE="${MY_PN}${MY_PV}_RELEASE"
19
20 DESCRIPTION="An open-source implementation of JavaScript written in Java"
21 SRC_URI="https://github.com/mozilla/${PN}/archive/${MY_RELEASE}.zip"
22 HOMEPAGE="http://www.mozilla.org/rhino/"
23
24 LICENSE="MPL-1.1 GPL-2"
25 SLOT="1.6"
26 KEYWORDS="amd64 ~arm arm64 ppc64 x86"
27 IUSE=""
28
29 # ../rhino-Rhino1_7_7_RELEASE
30 S="${WORKDIR}/${PN}-${MY_RELEASE}"
31
32 CDEPEND=""
33 RDEPEND=">=virtual/jre-1.6
34         ${CDEPEND}"
35 DEPEND=">=virtual/jdk-1.6
36         test? (
37                 dev-java/emma:0
38                 dev-java/junit:4
39                 dev-java/ant-junit:0
40                 dev-java/hamcrest-core:1.3
41         )
42         ${CDEPEND}"
43
44 JAVA_ANT_REWRITE_CLASSPATH="yes"
45
46 PATCHES=(
47         "${FILESDIR}"/${P}-testsrc-build.xml.patch
48 )
49
50 EANT_TEST_TARGET="junit"
51
52 # StackOverFlow errors arise on some tests.
53 # Further, the test suite takes way too much time (> 5 min).
54 # Maybe reduce the numbers of tests?
55 RESTRICT="test"
56
57 java_prepare() {
58         java-pkg_clean
59
60         epatch "${PATCHES[@]}"
61
62         if use test; then
63                 mkdir lib || die
64                 java-pkg_jar-from --build-only emma emma.jar lib/emma.jar
65                 java-pkg_jar-from --build-only emma emma_ant.jar lib/emma_ant.jar
66                 java-pkg_jar-from --build-only hamcrest-core-1.3 hamcrest-core.jar lib/hamcrest.jar
67                 java-pkg_jar-from --build-only junit-4 junit.jar lib/junit.jar
68         fi
69 }
70
71 src_compile() {
72         java-pkg-2_src_compile
73
74         if use source; then
75                 EANT_BUILD_TARGET="source-zip" \
76                         java-pkg-2_src_compile
77         fi
78 }
79
80 src_test() {
81         java-pkg-2_src_test
82 }
83
84 src_install() {
85         java-pkg_dojar build/${MY_P}/js.jar
86
87         java-pkg_dolauncher jsscript-${SLOT} \
88                 --main org.mozilla.javascript.tools.shell.Main
89
90         use doc && java-pkg_dojavadoc "build/${MY_P}/javadoc"
91         use examples && java-pkg_doexamples examples
92         use source && java-pkg_dosrc {src,toolsrc,xmlimplsrc}/org
93 }