Revert "dev-java/java-config: Python 3.8 compatibility"
[gentoo.git] / dev-java / jss / jss-4.3.2.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5
6 JAVA_PKG_IUSE="doc source"
7
8 inherit multilib toolchain-funcs java-pkg-2
9
10 DESCRIPTION="Network Security Services for Java (JSS)"
11 HOMEPAGE="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/JSS"
12 # 4.3.2 was released but was seemingly never announced. The binary jar
13 # exists on Mozilla's servers but Chewi could only find a source tarball
14 # at https://obs.kolabsys.com/package/show/Kolab:3.4/jss. However, you
15 # need to register in order to download it, hence he has mirrored it.
16 SRC_URI="https://dev.gentoo.org/~chewi/distfiles/${P}.tar.bz2"
17 LICENSE="MPL-1.1"
18 SLOT="3.4"
19 KEYWORDS="amd64 x86"
20 IUSE="examples test"
21
22 CDEPEND=">=dev-libs/nspr-4.7.1
23         >=dev-libs/nss-3.12.5"
24
25 DEPEND="${CDEPEND}
26         dev-lang/perl
27         >=virtual/jdk-1.6
28         virtual/pkgconfig
29         test? ( dev-libs/nss[utils] )"
30
31 RDEPEND="${CDEPEND}
32         >=virtual/jre-1.6"
33
34 S="${WORKDIR}/${P}/mozilla"
35
36 java_prepare() {
37         epatch "${FILESDIR}"/${PN}-3.4-target_source.patch
38         epatch "${FILESDIR}"/${PN}-4.2.5-use_pkg-config.patch
39         epatch "${FILESDIR}"/${PN}-4.3-cflags.patch
40         epatch "${FILESDIR}"/${PN}-4.3.2-ldflags.patch
41         epatch "${FILESDIR}"/${PN}-4.3-secitem.patch
42
43         if java-pkg_is-vm-version-ge 1.8; then
44                 epatch "${FILESDIR}"/${PN}-4.3-javadoc.patch
45         fi
46 }
47
48 src_compile() {
49         local ARGS=(
50                 "CC=$(tc-getCC)"
51                 "AR=$(tc-getAR) cr \$@"
52                 "OS_RELEASE=2.6"
53                 "BUILD_OPT=1"
54         )
55
56         export JAVA_GENTOO_OPTS="$(java-pkg_javac-args)"
57         use amd64 && export USE_64=1
58
59         cd "${S}/security/coreconf" || die
60         emake -j1 "${ARGS[@]}"
61
62         cd "${S}/security/jss" || die
63         emake -j1 "${ARGS[@]}" USE_PKGCONFIG=1 NSS_PKGCONFIG=nss NSPR_PKGCONFIG=nspr
64         use doc && emake -j1 "${ARGS[@]}" javadoc
65 }
66
67 # Chewi has managed to reach a test pass rate of 31/40 (78%) but the
68 # remainder fail due to JSS not having kept pace with the ciphersuites
69 # in NSS. There's not much we can do about that. The suite also leaves
70 # java processes running and exits successfully on failure.
71 RESTRICT="test"
72
73 src_test() {
74         # Parts of NSS are required for the tests.
75         ln -snf "${EROOT}usr/$(get_libdir)/libnssckbi.so" dist/Linux*.OBJ/lib/ || die
76         ln -snf "${EROOT}usr/bin" dist/Linux*.OBJ/ || die
77
78         # The tests must be run from this directory.
79         cd security/jss/org/mozilla/jss/tests || die
80         BUILD_OPT=1 perl all.pl dist "${S}"/dist/Linux*.OBJ/ || die "tests failed"
81 }
82
83 src_install() {
84         java-pkg_dojar dist/*.jar
85
86         # Use this instead of the one in dist because it is a symlink
87         # and doso handles symlinks by just symlinking to the original
88         java-pkg_doso ./security/${PN}/lib/*/*.so
89
90         use doc && java-pkg_dojavadoc dist/jssdoc
91         use source && java-pkg_dosrc ./security/jss/org
92         use examples && java-pkg_doexamples ./security/jss/samples
93 }