dev-java/bcpkix: Stable for amd64. Stable for ppc+ppc64+x86 using the ALLARCHES policy.
[gentoo.git] / dev-java / bcpkix / bcpkix-1.50.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 COMMON_DEPEND="
30         >=dev-java/bcprov-${PV}:0[test?]"
31
32 DEPEND=">=virtual/jdk-1.5
33         app-arch/unzip
34         test? ( dev-java/junit:0 )
35         ${COMMON_DEPEND}"
36
37 RDEPEND=">=virtual/jre-1.5
38         ${COMMON_DEPEND}"
39
40 S="${WORKDIR}/${MY_P}"
41
42 src_unpack() {
43         default
44         cd "${S}"
45         unpack ./src.zip
46 }
47
48 java_prepare() {
49         mkdir "${S}"/classes
50
51         if use test ; then
52                 java-pkg_jar-from --build-only junit
53         fi
54
55         java-pkg_jar-from bcprov
56 }
57
58 src_compile() {
59         find org -name "*.java" > "${T}"/src.list
60
61         local cp="bcprov.jar"
62         if use test ; then
63                 cp="${cp}:junit.jar"
64         else
65                 sed -i '/\/test\//d' "${T}"/src.list || die "Failed to remove test classes"
66         fi
67
68         ejavac -d "${S}"/classes -cp ${cp} "@${T}"/src.list
69
70         cd "${S}"/classes || die
71
72         jar -cf "${S}"/${PN}.jar * || die "Failed to create jar."
73 }
74
75 src_test() {
76         local cp="${PN}.jar:bcprov.jar:junit.jar"
77         local pkg="org.bouncycastle"
78
79         java -cp ${cp} ${pkg}.tsp.test.AllTests | tee tsp.tests
80         java -cp ${cp} ${pkg}.pkcs.test.AllTests | tee pkcs.tests
81         java -cp ${cp} ${pkg}.openssl.test.AllTests | tee openssl.tests
82         java -cp ${cp} ${pkg}.mozilla.test.AllTests | tee mozilla.tests
83         java -cp ${cp} ${pkg}.eac.test.AllTests | tee eac.tests
84         java -cp ${cp} ${pkg}.dvcs.test.AllTests | tee dvcs.tests
85         java -cp ${cp} ${pkg}.cms.test.AllTests | tee cms.tests
86         java -cp ${cp} ${pkg}.cert.test.AllTests | tee cert.tests
87         java -cp ${cp} ${pkg}.cert.ocsp.test.AllTests | tee cert.ocsp.tests
88         java -cp ${cp} ${pkg}.cert.crmf.test.AllTests | tee cert.crmf.tests
89         java -cp ${cp} ${pkg}.cert.cmp.test.AllTests | tee cert.cmp.tests
90
91         grep -q FAILURES *.tests && die "Tests failed."
92 }
93
94 src_install() {
95         java-pkg_dojar "${S}"/${PN}.jar
96
97         use source && java-pkg_dosrc org
98         use doc && java-pkg_dojavadoc docs
99 }