net-libs/webkit-gtk: amd64 stable wrt bug #712260
[gentoo.git] / net-libs / nativebiginteger / nativebiginteger-0.9.42.ebuild
1 # Copyright 2018-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit java-pkg-2 toolchain-funcs
7
8 DESCRIPTION="jbigi library used by net-vpn/i2p"
9 HOMEPAGE="https://geti2p.net"
10 SRC_URI="https://download.i2p2.de/releases/${PV}/i2psource_${PV}.tar.bz2"
11
12 LICENSE="public-domain"
13 SLOT="0"
14 KEYWORDS="~amd64 ~x86"
15 IUSE="test"
16 RESTRICT="!test? ( test )"
17
18 DEPEND="
19         dev-libs/gmp:0=
20         virtual/jdk:1.8
21 "
22 RDEPEND="${DEPEND}"
23
24 S="${WORKDIR}/i2p-${PV}/core"
25
26 PATCHES=(
27         "${FILESDIR}/${P}-asmfix.patch"
28 )
29
30 src_compile() {
31         local compile_lib
32         compile_lib() {
33                 local name="${1}"
34                 local file="${2}"
35                 shift 2
36
37                 "$(tc-getCC)" "${@}" ${CFLAGS} $(java-pkg_get-jni-cflags) \
38                         ${LDFLAGS} -shared -fPIC "-Wl,-soname,lib${name}.so" \
39                         "${file}" -o "lib${name}.so"
40         }
41
42         cd "${S}/c/jbigi/jbigi" || die "unable to cd to jbigi"
43         compile_lib jbigi src/jbigi.c -Iinclude -lgmp ||
44                 die "unable to build jbigi"
45
46         if use amd64 || use x86; then
47                 cd "${S}/c/jcpuid" || die "unable to cd to jcpuid"
48                 compile_lib jcpuid src/jcpuid.c -Iinclude ||
49                         die "unable to build jcpuid"
50         fi
51
52         if use test; then
53                 cd "${S}/java/src" || die "unable to cd to java/src"
54                 ejavac -encoding UTF-8 net/i2p/util/NativeBigInteger.java ||
55                         die "unable to build tests"
56         fi
57 }
58
59 src_test() {
60         cd "${S}/java/src" || die "unable to cd to java/src"
61         "$(java-config -J)" -Djava.library.path="${S}/c/jbigi/jbigi" net/i2p/util/NativeBigInteger ||
62                 die "unable to pass tests"
63 }
64
65 src_install() {
66         dolib.so c/jbigi/jbigi/libjbigi.so
67
68         if use amd64 || use x86; then
69                 dolib.so c/jcpuid/libjcpuid.so
70         fi
71 }