summaryrefslogtreecommitdiff
blob: b4a08ca891e8fdc8819eea8f1d7642ec29c5dd00 (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
85
86
87
88
89
90
91
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-java/groovy/groovy-1.0.06.ebuild,v 1.2 2006/11/30 15:40:35 caster Exp $

inherit versionator java-pkg-2 java-ant-2

MY_PV="$(get_version_component_range 1-2)-JSR-$(get_version_component_range 3)"
MY_P="${PN}-${MY_PV}"

DESCRIPTION="Groovy is a high-level dynamic language for the JVM"
HOMEPAGE="http://groovy.codehaus.org/"
SRC_URI="http://dist.codehaus.org/groovy/distributions/${MY_P/JSR/jsr}-src.tar.gz"
LICENSE="codehaus-groovy"
SLOT="1"
KEYWORDS="~amd64 ~x86"
IUSE="source"

COMMON_DEPS="
	=dev-java/asm-2.2*
	>=dev-java/antlr-2.7.5
	>=dev-java/xerces-2.7
	>=dev-java/ant-core-1.6.5
	>=dev-java/xstream-1.1.1
	>=dev-java/junit-3.8.1
	dev-java/qdox
	>=dev-java/commons-cli-1.0
	>=dev-java/bsf-2.3.0_rc1
	>=dev-java/mockobjects-0.09
	~dev-java/servletapi-2.4
	dev-java/sun-jmx"
RDEPEND=">=virtual/jre-1.4
	${COMMON_DEPS}"
# FIXME doesn't compile with 1.6 due to JDBC api change
DEPEND="|| ( =virtual/jdk-1.4* =virtual/jdk-1.5* )
	${COMMON_DEPS}"

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

src_unpack() {
	unpack ${A}

	cd ${S}
	epatch ${FILESDIR}/${P}-compiler-exit-code.patch

	mkdir -p ${S}/target/lib

	cd ${S}/target/lib
	java-pkg_jar-from commons-cli-1
	java-pkg_jar-from xerces-2
	java-pkg_jar-from ant-core ant.jar
	java-pkg_jar-from antlr
	java-pkg_jar-from asm-2.2
	java-pkg_jar-from qdox-1.6
	java-pkg_jar-from xstream
	java-pkg_jar-from mockobjects
	java-pkg_jar-from junit
	java-pkg_jar-from servletapi-2.4
	java-pkg_jar-from bsf-2.3
	java-pkg_jar-from sun-jmx

	cd ${S}

	# We use ant NOT maven
	cp ${FILESDIR}/build.xml-${PV} ${S}/build.xml || die "Failed to update build.xml"

	cd src/main
	# This won't compile without an incestuous relationship with radeox.
	rm -rf org/codehaus/groovy/wiki
}

src_compile() {
	eant -Dnoget=true jar

	# need to compile .groovy files to .class files
	cd src/main
	java -classpath ../../target/${MY_P}.jar:$(java-pkg_getjars commons-cli-1,asm-2.2,antlr,junit,qdox-1.6) \
		org.codehaus.groovy.tools.FileSystemCompiler \
		$(find -name *.groovy) || die "Failed to invoke groovyc"

	# add the now compiled .class files to our jar
	jar uf ../../target/${MY_P}.jar  $(find -name *.class) || die "Failed to backpatch Console*.class"
}

src_install() {
	java-pkg_newjar target/${MY_P}.jar
	java-pkg_dolauncher "grok" --main org.codehaus.groovy.tools.Grok
	java-pkg_dolauncher "groovyc" --main org.codehaus.groovy.tools.FileSystemCompiler
	java-pkg_dolauncher "groovy" --main groovy.ui.GroovyMain
	java-pkg_dolauncher "groovysh" --main groovy.ui.InteractiveShell
	java-pkg_dolauncher "groovyConsole" --main groovy.ui.Console
}