summaryrefslogtreecommitdiff
blob: 0bc0bc7197d03d05b43ebfb7dfd223dc1c609af9 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-java/eclipse-ecj/eclipse-ecj-3.2.2.ebuild,v 1.2 2007/05/08 14:33:26 armin76 Exp $

inherit eutils java-pkg-2

DESCRIPTION="Eclipse Compiler for Java"
HOMEPAGE="http://www.eclipse.org/"
SRC_URI="mirror://gentoo/${P}.tar.bz2"
LICENSE="EPL-1.0"
KEYWORDS="~amd64 ~ia64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
SLOT="3.2"
IUSE="doc"

RDEPEND=">=virtual/jre-1.4"
DEPEND="${RDEPEND}
	>=virtual/jdk-1.4
	dev-java/ant-core"

src_unpack() {
	unpack ${A}
	cd "${S}"

	# remove unzip, add javadoc target, put final ecj.jar and javadocs in dist/ and not ../
	epatch "${FILESDIR}/${PN}-${SLOT}-build-gentoo.patch"
}

src_compile() {
	# we don't use eant because the compile*.xml files specifically set -source -target and used compiler

	# bootstrap build with JDK's javac
	ant -f compilejdtcorewithjavac.xml || die "Failed to bootstrap build with javac"

	local ant_flags=""

	# for some weird reason, with kaffe it fails the build.xml's check for ecj.jar present (which it is)
	# which if successful sets this property, then checks if it was set and fails if not
	java-pkg_current-vm-matches kaffe && ant_flags="-Dbuild.compiler=org.eclipse.jdt.core.JDTCompilerAdapter"

	# recompile with ecj.jar made in first step, to get dist/ecj.jar
	ant ${ant_flags} -lib ecj.jar -f compilejdtcore.xml compile $(use_doc) || die "Failed to rebuild with ecj"
}

src_install() {
	java-pkg_dojar dist/ecj.jar

	java-pkg_dolauncher ecj-${SLOT} --main org.eclipse.jdt.internal.compiler.batch.Main

	use doc && java-pkg_dojavadoc dist/doc/api

	insinto /usr/share/java-config-2/compiler
	newins ${FILESDIR}/compiler-settings-${SLOT} ecj-${SLOT}
}