summaryrefslogtreecommitdiff
blob: dd3d8bffbb093848613e192d07f7be64d88c2c4d (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=4
JAVA_PKG_IUSE="doc examples source test"

inherit java-pkg-2 java-ant-2

DESCRIPTION="A library of several reusable components used by Apache Batik and Apache FOP."
HOMEPAGE="http://xmlgraphics.apache.org/commons/index.html"
SRC_URI="mirror://apache/xmlgraphics/commons/source/${P}-src.tar.gz"

LICENSE="Apache-2.0"
SLOT="1.5"
KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x86-solaris"
IUSE="jpeg"

CDEPEND="dev-java/commons-io:1
	 >=dev-java/commons-logging-1:0"
DEPEND="|| ( =virtual/jdk-1.6* =virtual/jdk-1.5* )
		test? (
			dev-java/junit:4
		)
		${CDEPEND}"
RDEPEND=">=virtual/jre-1.5
		${CDEPEND}"

# TODO investigate producing .net libraries
# stratigies for non sun jdk's/jre's

pkg_setup() {
	java-pkg-2_pkg_setup

	if use jpeg && java-pkg_current-vm-matches kaffe; then
		eerror "Sun-private JPEG support cannot be built with kaffe."
		eerror "Please set your build VM to Sun, Blackdown, IBM or JRockit JDK."
		eerror "See http://www.gentoo.org/doc/en/java.xml for details."
		eerror "Alternatively, install this package with USE=-jpeg"
		die "Cannot build with USE=jpeg and kaffe."
	fi
}

JAVA_ANT_IGNORE_SYSTEM_CLASSES="true"
JAVA_ANT_REWRITE_CLASSPATH="true"
EANT_GENTOO_CLASSPATH="commons-io-1,commons-logging"
EANT_EXTRA_ARGS="-Djdk15.present=true"
EANT_BUILD_TARGET="jar-main"
EANT_DOC_TARGET="javadocs"
EANT_TEST_GENTOO_CLASSPATH="${EANT_GENTOO_CLASSPATH},junit-4"
EANT_TEST_TARGET="junit"
EANT_TEST_EXTRA_ARGS="-Djunit.present=true"

java_prepare() {
	find "${S}" -name '*.jar' -print -delete || die
	#refers to mockito, which we don't have yet
	rm -v test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java
}

src_test() {
	ANT_TASKS="ant-junit" java-pkg-2_src_test
}

src_install(){
	java-pkg_newjar build/${P}.jar
	use source && java-pkg_dosrc src/java/org
	use doc && java-pkg_dojavadoc build/javadocs
}