summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolkmar W. Pogatzki <gentoo@pogatzki.net>2023-04-14 21:22:46 +0200
committerSam James <sam@gentoo.org>2023-05-26 11:24:07 +0100
commitb72511e723b5d5622dc9131edf147b5bf0686fa4 (patch)
treeaaef326e27af96b49547d68853aadad9a10c2a2c /dev-java/freenet-ext
parentsci-mathematics/octave: add 8.2.0 (diff)
downloadgentoo-b72511e723b5d5622dc9131edf147b5bf0686fa4.tar.gz
gentoo-b72511e723b5d5622dc9131edf147b5bf0686fa4.tar.bz2
gentoo-b72511e723b5d5622dc9131edf147b5bf0686fa4.zip
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>
Diffstat (limited to 'dev-java/freenet-ext')
-rw-r--r--dev-java/freenet-ext/Manifest1
-rw-r--r--dev-java/freenet-ext/files/freenet-ext-29-convert-jcpuid.patch46
-rw-r--r--dev-java/freenet-ext/freenet-ext-29.ebuild79
-rw-r--r--dev-java/freenet-ext/metadata.xml10
4 files changed, 136 insertions, 0 deletions
diff --git a/dev-java/freenet-ext/Manifest b/dev-java/freenet-ext/Manifest
new file mode 100644
index 000000000000..196e8c487def
--- /dev/null
+++ b/dev-java/freenet-ext/Manifest
@@ -0,0 +1 @@
+DIST freenet-ext-29.tar.gz 4328779 BLAKE2B a9dc6dc34d6dbccc9f89c955f35b35024a7067aa8e89cf195492e77a8ebc92b73cc98e779c7f75ba6a430e994e856937be018a6505e1cda07eeea275925ee0e7 SHA512 11cf0942042483403cf526684a18c2b1766d3f6fb15c2ca4bdb59d95382ed86fcdb71a66d9f43a504abf3ca5c53f9da749086e462bbb56826beb95a2a7f1cbfa
diff --git a/dev-java/freenet-ext/files/freenet-ext-29-convert-jcpuid.patch b/dev-java/freenet-ext/files/freenet-ext-29-convert-jcpuid.patch
new file mode 100644
index 000000000000..e4c84b58ffee
--- /dev/null
+++ b/dev-java/freenet-ext/files/freenet-ext-29-convert-jcpuid.patch
@@ -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);
++}
++
diff --git a/dev-java/freenet-ext/freenet-ext-29.ebuild b/dev-java/freenet-ext/freenet-ext-29.ebuild
new file mode 100644
index 000000000000..b2818e3c7f56
--- /dev/null
+++ b/dev-java/freenet-ext/freenet-ext-29.ebuild
@@ -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
+}
diff --git a/dev-java/freenet-ext/metadata.xml b/dev-java/freenet-ext/metadata.xml
new file mode 100644
index 000000000000..f76b8843b198
--- /dev/null
+++ b/dev-java/freenet-ext/metadata.xml
@@ -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>