summaryrefslogtreecommitdiff
blob: 9cac638d5835d570e14ad15aa822be7d65da890d (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

JAVA_PKG_IUSE="doc source"
MAVEN_ID="" # Empty since we only pick what's not packaged

inherit java-pkg-2 java-pkg-simple toolchain-funcs

DESCRIPTION="Freenet REference Daemon"
HOMEPAGE="https://github.com/hyphanet/contrib/"
SRC_URI="https://github.com/hyphanet/contrib/archive/v${PV}.tar.gz -> freenet-ext-${PV}.tar.gz"
S="${WORKDIR}/contrib-${PV}"

LICENSE="public-domain"
SLOT="29"
KEYWORDS="amd64 ~arm ~arm64 ~x86"

DEPEND="
	dev-libs/gmp:0=
	>=virtual/jdk-1.8:*
"
RDEPEND=">=virtual/jre-1.8:*"

PATCHES=(
	"${FILESDIR}/freenet-ext-29-convert-jcpuid.patch"
)

JAVA_SRC_DIR=(
	"freenet"
	"freenet_ext"
	"i2p"
)

src_prepare() {
	default
	java-pkg-2_src_prepare
	mkdir -p i2p/net freenet || die
	# From the java directory we need "java/net/i2p"
	mv {java,i2p}/net/i2p || die
	# and "java/freenet".
	mv {java,freenet}/freenet || die
}

src_compile() {
	java-pkg-simple_src_compile

	local compile_lib
	compile_lib() {
		local name="${1}"
		local file="${2}"
		shift 2

		"$(tc-getCC)" "${@}" ${CFLAGS} $(java-pkg_get-jni-cflags) \
			${LDFLAGS} -shared -fPIC "-Wl,-soname,lib${name}.so" \
			"${file}" -o "lib${name}.so"
	}

	cd "${S}/NativeBigInteger/jbigi" || die "unable to cd to jbigi"
	compile_lib jbigi src/jbigi.c -Iinclude -lgmp ||
		die "unable to build jbigi"

	if use amd64 || use x86; then
		cd "${S}/jcpuid" || die "unable to cd to jcpuid"
		compile_lib jcpuid src/jcpuid.c -Iinclude ||
			die "unable to build jcpuid"
	fi
}

src_install() {
	java-pkg-simple_src_install

	java-pkg_doso NativeBigInteger/jbigi/libjbigi.so

	if use amd64 || use x86; then
		java-pkg_doso jcpuid/libjcpuid.so
	fi
}