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

EAPI=2

JAVA_PKG_IUSE="doc examples source test"
inherit eutils java-pkg-2 java-ant-2
MY_PN=jsr-305

DESCRIPTION="Reference implementation for JSR 305: Annotations for Software Defect Detection in Java"
SRC_URI="mirror://gentoo/${MY_PN}-source.tar.gz"
HOMEPAGE="https://code.google.com/p/jsr-305/"

LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 ppc ppc64 x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos"
IUSE=""

DEPEND=">=virtual/jdk-1.5
	app-arch/unzip
	test? ( dev-java/ant-junit )"
RDEPEND=">=virtual/jre-1.5"

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

src_compile() {
	# create jar
	cd ri
	mkdir -p build/classes
	ejavac -sourcepath src/main/java -d build/classes $(find src/main/java -name "*.java") \
		|| die "Cannot compile sources"
	mkdir dist
	cd build/classes
	jar -cvf "${S}"/ri/dist/${PN}.jar javax || die "Cannot create JAR"

	# generate javadoc
	if use doc ; then
		cd "${S}"/ri
		mkdir javadoc
		javadoc -d javadoc -sourcepath src/main/java -subpackages javax \
			|| die "Javadoc creation failed"
	fi
}

src_install() {
	cd ri
	java-pkg_dojar dist/${PN}.jar

	if use examples; then
		dodir /usr/share/doc/${PF}/examples/
		cp -r "${S}"/sampleUses/* "${D}"/usr/share/doc/${PF}/examples/ || die "Could not install examples"
	fi

	if use source ; then
		cd "${S}"/ri/src/main/java
		java-pkg_dosrc javax
	fi

	if use doc ; then
		cd "${S}"/ri
		java-pkg_dojavadoc javadoc
	fi
}