dev-java/bcpkix: Stable for amd64. Stable for ppc+ppc64+x86 using the ALLARCHES policy.
[gentoo.git] / dev-java / bcpkix / bcpkix-1.52.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 JAVA_PKG_IUSE="doc source test"
8
9 inherit java-pkg-2 java-ant-2
10
11 MY_P="${PN}-jdk15on-${PV/./}"
12
13 DESCRIPTION="Java cryptography APIs"
14 HOMEPAGE="http://www.bouncycastle.org/java.html"
15 SRC_URI="http://www.bouncycastle.org/download/${MY_P}.tar.gz"
16
17 LICENSE="BSD"
18 SLOT="0"
19 KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x64-macos"
20
21 # Tests are currently broken. Needs further investigation.
22 #
23 #  - java.lang.RuntimeException: java.security.NoSuchProviderException:
24 #    JCE cannot authenticate the provider BC
25 #
26 #  - error: package org.bouncycastle.util.test does not exist
27 RESTRICT="test"
28
29 CDEPEND="
30         >=dev-java/bcprov-${PV}:0[test?]"
31
32 DEPEND=">=virtual/jdk-1.6
33         app-arch/unzip
34         test? (
35                 dev-java/junit:0
36         )
37         ${CDEPEND}"
38
39 RDEPEND=">=virtual/jre-1.6
40         ${CDEPEND}"
41
42 S="${WORKDIR}/${MY_P}"
43
44 src_unpack() {
45         default
46         cd "${S}"
47         unpack ./src.zip
48 }
49
50 java_prepare() {
51         mkdir "${S}"/classes
52
53         if use test ; then
54                 java-pkg_jar-from --build-only junit
55         fi
56
57         java-pkg_jar-from bcprov
58 }
59
60 src_compile() {
61         find org -name "*.java" > "${T}"/src.list
62
63         local cp="bcprov.jar"
64         if use test ; then
65                 cp="${cp}:junit.jar"
66         else
67                 sed -i '/\/test\//d' "${T}"/src.list || die "Failed to remove test classes"
68         fi
69
70         ejavac -d "${S}"/classes -cp ${cp} "@${T}"/src.list
71
72         cd "${S}"/classes || die
73
74         jar -cf "${S}"/${PN}.jar * || die "Failed to create jar."
75 }
76
77 src_test() {
78         local cp="${PN}.jar:bcprov.jar:junit.jar"
79         local pkg="org.bouncycastle"
80
81         java -cp ${cp} ${pkg}.tsp.test.AllTests | tee tsp.tests
82         java -cp ${cp} ${pkg}.pkcs.test.AllTests | tee pkcs.tests
83         java -cp ${cp} ${pkg}.openssl.test.AllTests | tee openssl.tests
84         java -cp ${cp} ${pkg}.mozilla.test.AllTests | tee mozilla.tests
85         java -cp ${cp} ${pkg}.eac.test.AllTests | tee eac.tests
86         java -cp ${cp} ${pkg}.dvcs.test.AllTests | tee dvcs.tests
87         java -cp ${cp} ${pkg}.cms.test.AllTests | tee cms.tests
88         java -cp ${cp} ${pkg}.cert.test.AllTests | tee cert.tests
89         java -cp ${cp} ${pkg}.cert.ocsp.test.AllTests | tee cert.ocsp.tests
90         java -cp ${cp} ${pkg}.cert.crmf.test.AllTests | tee cert.crmf.tests
91         java -cp ${cp} ${pkg}.cert.cmp.test.AllTests | tee cert.cmp.tests
92
93         grep -q FAILURES *.tests && die "Tests failed."
94 }
95
96 src_install() {
97         java-pkg_dojar "${S}"/${PN}.jar
98
99         use source && java-pkg_dosrc org
100         use doc && java-pkg_dojavadoc docs
101 }