summaryrefslogtreecommitdiff
blob: 2154b569b93a42f28bf970466c2c21c33d85d6c4 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-java/rhino/rhino-1.6.5.ebuild,v 1.9 2010/01/03 21:42:36 fauli Exp $

JAVA_PKG_IUSE="doc examples source"
inherit java-pkg-2 java-ant-2 eutils versionator

MY_P="${PN}$(replace_version_separator 1 _ $(replace_version_separator 2 R))"

DESCRIPTION="An open-source implementation of JavaScript written in Java."
SRC_URI="ftp://ftp.mozilla.org/pub/mozilla.org/js/${MY_P}.zip
	mirror://gentoo/rhino-swing-ex-1.0.zip"
HOMEPAGE="http://www.mozilla.org/rhino/"
# dual license for rhino and BSD-2 for the swing-ex from Sun's tutorial
LICENSE="|| ( MPL-1.1 GPL-2 ) BSD-2"
SLOT="1.6"
KEYWORDS="amd64 ~ia64 ppc ppc64 x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-macos"
IUSE=""

S="${WORKDIR}/${MY_P}"

CDEPEND="=dev-java/xml-xmlbeans-1*"
RDEPEND=">=virtual/jre-1.4
	${CDEPEND}"
DEPEND=">=virtual/jdk-1.4
	app-arch/unzip
	${CDEPEND}"

src_unpack() {
	unpack ${MY_P}.zip
	cd "${S}"

	# don't download src.zip from Sun
	epatch "${FILESDIR}/rhino-1.6-noget.patch"

	rm -v *.jar || die
	rm -rf docs/apidocs || die

	local dir="toolsrc/org/mozilla/javascript/tools/debugger/downloaded"
	mkdir ${dir} || die
	cp "${DISTDIR}/rhino-swing-ex-1.0.zip" ${dir}/swingExSrc.zip || die

	mkdir lib/ && cd lib/ || die
	java-pkg_jar-from xml-xmlbeans-1 xbean.jar
}

src_install() {
	java-pkg_dojar build/${MY_P}/js.jar

	java-pkg_dolauncher jsscript-${SLOT} \
		--main org.mozilla.javascript.tools.shell.Main

	if use doc; then
		local dir="build/${MY_P}/docs"
		mv "${dir}"/{apidocs,api} || die
		java-pkg_dohtml -r "${dir}"/*
		dosym /usr/share/doc/${PF}/html/{api,apidocs} || die
	fi
	use examples && java-pkg_doexamples examples
	use source && java-pkg_dosrc {src,toolsrc,xmlimplsrc}/org
}