public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-java/freenet-ext/files/, dev-java/freenet-ext/
@ 2023-05-26 10:24 Sam James
  0 siblings, 0 replies; only message in thread
From: Sam James @ 2023-05-26 10:24 UTC (permalink / raw
  To: gentoo-commits

commit:     b72511e723b5d5622dc9131edf147b5bf0686fa4
Author:     Volkmar W. Pogatzki <gentoo <AT> pogatzki <DOT> net>
AuthorDate: Fri Apr 14 19:22:46 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 26 10:24:07 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b72511e7

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 <AT> pogatzki.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-java/freenet-ext/Manifest                      |  1 +
 .../files/freenet-ext-29-convert-jcpuid.patch      | 46 +++++++++++++
 dev-java/freenet-ext/freenet-ext-29.ebuild         | 79 ++++++++++++++++++++++
 dev-java/freenet-ext/metadata.xml                  | 10 +++
 4 files changed, 136 insertions(+)

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>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-26 10:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-26 10:24 [gentoo-commits] repo/gentoo:master commit in: dev-java/freenet-ext/files/, dev-java/freenet-ext/ Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox