summaryrefslogtreecommitdiff
blob: d18bd3ec8a8afa955e8e70d5baf38aa8fd581798 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-java/jython/jython-2.1-r5.ebuild,v 1.10 2004/10/16 08:39:31 absinthe Exp $

inherit java-pkg

DESCRIPTION="An implementation of Python written in Java"
HOMEPAGE="http://www.jython.org"
MY_PV="21"
SRC_URI="mirror://sourceforge/${PN}/${PN}-${MY_PV}.class"
LICENSE="JPython"
SLOT="0"
KEYWORDS="x86 ppc sparc amd64"
IUSE="readline jikes"
# servlet

DEPEND=">=virtual/jdk-1.2
	readline? ( >=dev-java/libreadline-java-0.8.0 )
	jikes? ( >=dev-java/jikes-1.18 )"
#	servlet? ( >=net-www/tomcat-5.0 )

src_unpack() {
	cp ${DISTDIR}/${A} ${WORKDIR}
	cd ${WORKDIR}
	`java-config -J` -classpath . ${PN}-${MY_PV} -o ${S}/ demo lib source || die "unpack failed"
}

src_compile() {
	javac=$(java-config -c)
	if use jikes ; then
		java=$(which jikes)
	fi

	local cp=".:${CLASSPATH}"
	local exclude=""

	if use readline ; then
		cp=${cp}:$(java-config -p libreadline-java)
	else
		exclude="${exclude} ! -name ReadlineConsole.java"
	fi

	#if use servlet; then
	#	cp=${cp}:$(java-config -p servlet)
	#else
		exclude="${exclude} ! -name PyServlet.java"
	#fi

	find org -name "*.java" ${exclude} | xargs ${javac} -source 1.3 -classpath ${cp} -nowarn || die "Failed to compile"

	find org -name "*.class" | xargs jar cf jython-${PV}.jar
}

src_install() {
	java-pkg_dojar jython-${PV}.jar || die "install failed"

	dodoc {README,LICENSE}.txt NEWS ACKNOWLEDGMENTS
	dohtml -A .css .jpg .gif -r Doc
	newbin ${FILESDIR}/jython jython
	newbin ${FILESDIR}/jythonc jythonc

	dodir /usr/share/jython/cachedir
	chmod a+rw ${D}/usr/share/jython/cachedir

	cp -R Lib ${D}/usr/share/${PN}/
	cp -R Demo ${D}/usr/share/${PN}/

	dodir /usr/share/${PN}/tools/
	cp -R Tools/* ${D}/usr/share/${PN}/tools/
	cp registry ${D}/usr/share/${PN}/
}

pkg_postinst() {
	if use readline; then
		einfo "To use readline you need to add the following to your registery"
		einfo
		einfo "python.console=org.python.util.ReadlineConsole"
		einfo "python.console.readlinelib=GnuReadline"
		einfo
		einfo "The global registry can be found in /usr/share/${PN}/registry"
		einfo "User registry in \$HOME/.jython"
		einfo "See http://www.jython.org/docs/registry.html for more information"
	fi
}