summaryrefslogtreecommitdiff
blob: ec42db04a9da2691c3c84e990d8f393dde522b0c (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-java/groovy/groovy-1.0_beta4-r1.ebuild,v 1.2 2004/05/06 12:30:54 karltk Exp $

inherit java-pkg

DESCRIPTION="Groovy is a high-level dynamic language for the JVM"
HOMEPAGE="http://groovy.codehaus.org/"
SRC_URI="http://dist.codehaus.org/groovy/distributions/${PN}-1.0-beta-4-src.tar.gz"
LICENSE="codehaus-groovy"
SLOT="1"
KEYWORDS="~x86"
IUSE="doc jikes"
DEPEND="=dev-java/xerces-2.6* \
	>=dev-java/commons-cli-1.0-r3
	=dev-java/ant-1.5*
	=dev-java/junit-3.8*
	=dev-java/asm-1.4*
	>=dev-java/classworlds-1.0-r2
	=dev-java/mockobjects-0.0*
	=dev-java/bsf-2.3*
	=net-www/tomcat-5*
	=dev-java/xmojo-bin-5.0*"
# karltk:
# xmojo-bin is a JMX provider, we should add a list of alternatives


S=${WORKDIR}/${PN}-1.0-beta-4

src_unpack() {
	unpack ${A}

	mkdir -p ${S}/target/lib

	cd ${S}/target/lib
	java-pkg_jar-from xerces-2 || die "Missing xerces"
	java-pkg_jar-from junit || die "Missing junit"
	java-pkg_jar-from asm-1 || die "Missing asm"
	java-pkg_jar-from commons-cli-1 || die "Missing commons-cli"
	java-pkg_jar-from classworlds-1 || die "Missing classworlds"
	java-pkg_jar-from bsf-2.3 || die "Missing bsf"
	java-pkg_jar-from mockobjects || die "Missing mockobjects"
	java-pkg_jar-from xmojo-bin-5.0 || die "Missing xmojo-bin"
	ln -s /opt/tomcat/common/lib/servlet-api.jar .

	cd ${S}

	# The original build.xml will only build on a MacOSX machine when you're
	# logged in as jstrachan. I don't reckon many Gentoo users are...
	cp ${FILESDIR}/build.xml-${PV} ${S}/build.xml || die "Failed to update build.xml"

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

src_compile() {
	local myconf
	use jikes && myconf="${myconf} -Dbuild.compiler=jikes"

	ant ${myconf} jar || die "Failed to compile jar"
	if use doc ; then
		ant javadoc || die "Failed to generate docs"
	fi

	# Generate command-line scripts
	for x in grok groovy groovyc groovysh groovyConsole ; do
		generate_script $x
	done

	cd src/main
	sh groovyc \
		--classpath ../../target/classes/ \
		groovy/ui/Console.groovy || die "Failed to invoke groovyc"

	jar uf ../../target/groovy-1.0-beta-4.jar groovy/ui/Console*.class || die "Failed to backpatch Console*.class"
}

generate_script() {
	scriptname=$1
	classworlds_classpath="$(java-config -p classworlds-1)"
	asm_classpath="$(java-config -p asm-1)"
	bsf_classpath="$(java-config -p bsf-2.3)"
	classworlds_classpath="$(java-config -p classworlds-1)"
	commons_cli_classpath="$(java-config -p commons-cli-1)"
	mockobjects_classpath="$(java-config -p mockobjects)"
	xerces_classpath="$(java-config -p xerces-2)"
	xmojo_classpath="$(java-config -p xmojo-bin-5.0)"

	sed -e "s;@scriptname@;${scriptname};" \
		-e "s;@groovy-home@;/usr/share/groovy-${SLOT};" \
		-e "s;@classworlds_classpath@;${classworlds_classpath};" \
		-e "s;@asm_classpath@;${asm_classpath};" \
		-e "s;@bsf_classpath@;${bsf_classpath};" \
		-e "s;@commons_cli_classpath@;${commons_cli_classpath};" \
		-e "s;@mockobjects_classpath@;${mockobjects_classpath};" \
		-e "s;@xerces_classpath@;${xerces_classpath};" \
		-e "s;@xmojo_classpath@;${xmojo_classpath};" \
		< ${FILESDIR}/basescript-${PV} \
		> ${scriptname} || die "Failed to generate ${scriptname}"
}

src_install() {

	# Install misc. documentation
	dodoc LICENSE.txt

	# Install jar files
	java-pkg_dojar target/groovy-1.0-beta-4.jar

	# Install API documentation
	if use doc ; then
		dohtml -r dist/docs/api
	fi

	# Install configuration files
	confdir=/usr/share/groovy-${SLOT}/conf
	dodir ${confdir}
	insinto ${confdir}
	doins src/conf/{groovy,groovyc,groovysh,groovyConsole,grok}-classworlds.conf

	# Install command-line scripts
	exeinto /usr/bin
	for x in grok groovy groovyc groovysh groovyConsole ; do
		doexe $x || die "Failed to install ${x}"
	done
}