dev-java/freenet-ext: new package, add 29

Builds jbigi and jcpuid from sources collected in freenet-ext.

Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Volkmar W. Pogatzki 2023-04-14 21:22:46 +02:00 committed by Sam James
parent 7b562e1632
commit b72511e723
No known key found for this signature in database
GPG Key ID: 738409F520DF9190
4 changed files with 136 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST freenet-ext-29.tar.gz 4328779 BLAKE2B a9dc6dc34d6dbccc9f89c955f35b35024a7067aa8e89cf195492e77a8ebc92b73cc98e779c7f75ba6a430e994e856937be018a6505e1cda07eeea275925ee0e7 SHA512 11cf0942042483403cf526684a18c2b1766d3f6fb15c2ca4bdb59d95382ed86fcdb71a66d9f43a504abf3ca5c53f9da749086e462bbb56826beb95a2a7f1cbfa

View File

@ -0,0 +1,46 @@
Backported from:
From ec11ea4ca73646a790f20adf8ded2e48dedd96e5 Mon Sep 17 00:00:00 2001
From: scintilla <scintilla>
Date: Sun, 19 Dec 2004 06:25:27 +0000
Subject: [PATCH] * Convert native jcpuid code from C++ to C. This should
alleviate build problems experienced by some users.
--- /dev/null
+++ b/jcpuid/src/jcpuid.c
@@ -0,0 +1,35 @@
+#include "jcpuid.h"
+
+//Executes the indicated subfunction of the CPUID operation
+JNIEXPORT jobject JNICALL Java_freenet_support_CPUInformation_CPUID_doCPUID
+ (JNIEnv * env, jclass cls, jint iFunction)
+{
+ int a,b,c,d;
+ jclass clsResult = (*env)->FindClass(env, "freenet/support/CPUInformation/CPUID$CPUIDResult");
+ jmethodID constructor = (*env)->GetMethodID(env, clsResult,"<init>","(IIII)V" );
+ #ifdef _MSC_VER
+ //Use MSVC assembler notation
+ _asm
+ {
+ mov eax, iFunction
+ cpuid
+ mov a, eax
+ mov b, ebx
+ mov c, ecx
+ mov d, edx
+ }
+ #else
+ //Use GCC assembler notation
+ asm
+ (
+ "cpuid"
+ : "=a" (a),
+ "=b" (b),
+ "=c"(c),
+ "=d"(d)
+ :"a"(iFunction)
+ );
+ #endif
+ return (*env)->NewObject(env, clsResult,constructor,a,b,c,d);
+}
+

View File

@ -0,0 +1,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"
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
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>java@gentoo.org</email>
</maintainer>
<upstream>
<remote-id type="github">hyphanet/contrib</remote-id>
</upstream>
</pkgmetadata>