update to version 1.3.0

This commit is contained in:
wang--ge 2023-09-26 17:31:16 +08:00
parent bd2e8f17ca
commit 3c06b2f3d3
9 changed files with 120 additions and 175 deletions

View File

@ -1,71 +1,69 @@
From 958aeee20de0c41aa90e54592550445d8f3af850 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: Tue, 16 May 2023 12:29:01 +0000
Subject: [PATCH] add loongarch64 support for jffi
---
jni/GNUmakefile | 2 +-
src/main/java/com/kenai/jffi/Platform.java | 4 ++++
src/main/java/com/kenai/jffi/Platform.java | 7 ++++++-
src/main/java/com/kenai/jffi/internal/StubLoader.java | 4 ++++
3 files changed, 9 insertions(+), 1 deletion(-)
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/jni/GNUmakefile b/jni/GNUmakefile
index 65b7655..b3a1f4d 100755
index 40f5275..3be8d08 100755
--- a/jni/GNUmakefile
+++ b/jni/GNUmakefile
@@ -245,7 +245,7 @@ ifeq ($(CPU), sparcv9)
@@ -238,7 +238,7 @@ ifeq ($(CPU), sparcv9)
MODEL=64
endif
-ifneq ($(findstring $(CPU), x86_64 amd64 ppc64 ppc64le powerpc64 s390x aarch64),)
+ifneq ($(findstring $(CPU), x86_64 amd64 ppc64 ppc64le powerpc64 s390x aarch64 loongarch64),)
-ifneq ($(findstring $(CPU), x86_64 amd64 ppc64 ppc64le powerpc64 s390x aarch64 mips64 mips64el),)
+ifneq ($(findstring $(CPU), x86_64 amd64 ppc64 ppc64le powerpc64 s390x aarch64 mips64 mips64el loongarch64),)
MODEL = 64
endif
diff --git a/src/main/java/com/kenai/jffi/Platform.java b/src/main/java/com/kenai/jffi/Platform.java
index 8447369..7a7de25 100644
index 8850426..4900194 100644
--- a/src/main/java/com/kenai/jffi/Platform.java
+++ b/src/main/java/com/kenai/jffi/Platform.java
@@ -100,6 +100,8 @@ public abstract class Platform {
@@ -102,7 +102,9 @@ public abstract class Platform {
ARM(32),
/** AARCH64 */
AARCH64(64),
+ /** LOONGARCH64*/
- /** MIPS64EL */
+ /** LOONGARCH64*/
+ LOONGARCH64(64),
+ /** MIPS64EL */
MIPS64EL(64),
/** Unknown CPU */
UNKNOWN(64);
@@ -230,6 +232,8 @@ public abstract class Platform {
@@ -238,6 +240,9 @@ public abstract class Platform {
} else if (Util.equalsIgnoreCase("aarch64", archString, LOCALE)) {
return CPU.AARCH64;
+ } else if (Util.equalsIgnoreCase("loongarch64", archString, LOCALE)) {
+ return CPU.LOONGARCH64;
+
} else if (Util.equalsIgnoreCase("mips64", archString, LOCALE) || Util.equalsIgnoreCase("mips64el", archString, LOCALE)) {
return CPU.MIPS64EL;
}
diff --git a/src/main/java/com/kenai/jffi/internal/StubLoader.java b/src/main/java/com/kenai/jffi/internal/StubLoader.java
index 9b81e83..8d0eaaf 100644
index 77da24d..d8af032 100644
--- a/src/main/java/com/kenai/jffi/internal/StubLoader.java
+++ b/src/main/java/com/kenai/jffi/internal/StubLoader.java
@@ -122,6 +122,8 @@ public class StubLoader {
@@ -142,6 +142,8 @@ public class StubLoader {
ARM,
/** AArch64 */
AARCH64,
+ /** LoongArch64 */
+ LOONGARCH64,
+ /** LoongArch64 */
+ LOONGARCH64,
/** MIPS 64-bit little endian */
MIPS64EL,
/** Unknown CPU */
UNKNOWN;
@@ -184,6 +186,8 @@ public class StubLoader {
@@ -208,6 +210,8 @@ public class StubLoader {
return CPU.ARM;
} else if (Util.equalsIgnoreCase("aarch64", archString, LOCALE)) {
return CPU.AARCH64;
+ } else if (Util.equalsIgnoreCase("loongarch64", archString, LOCALE)) {
+ return CPU.LOONGARCH64;
}
} else if (Util.equalsIgnoreCase("mips64", archString, LOCALE) || Util.equalsIgnoreCase("mips64el", archString, LOCALE)) {
return CPU.MIPS64EL;
// Try to find by lookup up in the CPU list
--
2.33.0

View File

@ -1,10 +1,13 @@
--- jffi-jffi-1.2.12/build.xml 2016-04-29 23:23:51.000000000 +0200
+++ jffi-jffi-1.2.12/build.xml 2019-04-03 20:08:43.577425168 +0200
@@ -151,9 +151,10 @@
<target name="-post-jar" depends="-assemble-final-jar"/>
---
build.xml | 24 +++---------------------
1 file changed, 3 insertions(+), 21 deletions(-)
diff --git a/build.xml b/build.xml
index 3fe9f5a..89ced77 100644
--- a/build.xml
+++ b/build.xml
@@ -147,7 +147,7 @@
<target name="-do-compile" depends="-init">
+ <mkdir dir="${build.native.dir}"/>
<mkdir dir="${build.classes.dir}"/>
<!-- Compile the java code from ${src} into ${build} -->
- <javac srcdir="${src.dir}" destdir="${build.classes.dir}" includeantruntime="false"/>
@ -12,22 +15,24 @@
</target>
<target name="-compile-java" depends="-do-compile"/>
@@ -282,26 +283,10 @@
@@ -275,28 +275,10 @@
<target name="-generate-version" depends="-init,-init-vars,-generate-version-source">
- <javac target="1.6" destdir="${build.classes.dir}" srcdir="${build.dir}/java" includeantruntime="false"/>
+ <javac target="1.6" destdir="${build.classes.dir}" srcdir="${build.dir}/java" nativeheaderdir="${build.native.dir}" includeantruntime="false"/>
- <javac target="${ant.build.javac.target}" destdir="${build.classes.dir}" srcdir="${build.dir}/java" includeantruntime="false"/>
+ <javac target="1.6" destdir="${build.classes.dir}" srcdir="${build.dir}/java" nativeheaderdir="${build.native.dir}" includeantruntime="false"/>
</target>
- <target name="-generate-native-headers" depends="-init-vars,-generate-version,-compile-java">
- <mkdir dir="${build.native.dir}"/>
- <mkdir dir="${build.classes.dir}"/>
- <javah classpath="${build.classes.dir}" destdir="${build.native.dir}" force="yes">
- <class name="com.kenai.jffi.Foreign"/>
- <class name="com.kenai.jffi.ObjectBuffer"/>
- <class name="com.kenai.jffi.Version"/>
- </javah>
- <javac destdir="${build.native.dir}" nativeheaderdir="${build.native.dir}">
- <src path="${src.dir}"/>
- <src path="${build.dir}/java"/>
- <include name="com/kenai/jffi/Foreign.java"/>
- <include name="com/kenai/jffi/ObjectBuffer.java"/>
- <include name="com/kenai/jffi/Version.java"/>
- </javac>
- <!--
- <exec executable="javah" failonerror="true">
- <arg line="-d ${build.native.dir}"/>
@ -41,110 +46,6 @@
<target name="-build-native-library" depends="-init-vars, -generate-native-headers, -generate-version">
<mkdir dir="${build.native.dir}"/>
--- jffi-jffi-1.2.12/src/main/java/com/kenai/jffi/ObjectBuffer.java 2016-04-29 23:23:51.000000000 +0200
+++ jffi-jffi-1.2.12/src/main/java/com/kenai/jffi/ObjectBuffer.java 2019-04-03 20:00:13.598956759 +0200
@@ -32,55 +32,57 @@
package com.kenai.jffi;
+import java.lang.annotation.Native;
+
/**
* Holds objects the native code must handle - such as primitive arrays
*/
final class ObjectBuffer {
/** Copy the array contents to native memory before calling the function */
- public static final int IN = 0x1;
+ @Native public static final int IN = 0x1;
/** After calling the function, reload the array contents from native memory */
- public static final int OUT = 0x2;
+ @Native public static final int OUT = 0x2;
/** Append a NUL byte to the array contents after copying to native memory */
- public static final int ZERO_TERMINATE = 0x4;
+ @Native public static final int ZERO_TERMINATE = 0x4;
/** Pin the array memory and pass the JVM memory pointer directly to the function */
- public static final int PINNED = 0x8;
+ @Native public static final int PINNED = 0x8;
/** For OUT arrays, clear the temporary native memory area */
- public static final int CLEAR = 0x10;
+ @Native public static final int CLEAR = 0x10;
/*
* WARNING: The following flags cannot be altered without recompiling the native code
*/
- static final int INDEX_SHIFT = 16;
- static final int INDEX_MASK = 0x00ff0000;
- static final int TYPE_SHIFT = 24;
- static final int TYPE_MASK = 0xff << TYPE_SHIFT;
- static final int PRIM_MASK = 0x0f << TYPE_SHIFT;
- static final int FLAGS_SHIFT = 0;
- static final int FLAGS_MASK = 0xff;
-
- static final int ARRAY = 0x10 << TYPE_SHIFT;
- static final int BUFFER = 0x20 << TYPE_SHIFT;
- static final int JNI = 0x40 << TYPE_SHIFT;
-
- static final int BYTE = 0x1 << TYPE_SHIFT;
- static final int SHORT = 0x2 << TYPE_SHIFT;
- static final int INT = 0x3 << TYPE_SHIFT;
- static final int LONG = 0x4 << TYPE_SHIFT;
- static final int FLOAT = 0x5 << TYPE_SHIFT;
- static final int DOUBLE = 0x6 << TYPE_SHIFT;
- static final int BOOLEAN = 0x7 << TYPE_SHIFT;
- static final int CHAR = 0x8 << TYPE_SHIFT;
+ @Native static final int INDEX_SHIFT = 16;
+ @Native static final int INDEX_MASK = 0x00ff0000;
+ @Native static final int TYPE_SHIFT = 24;
+ @Native static final int TYPE_MASK = 0xff << TYPE_SHIFT;
+ @Native static final int PRIM_MASK = 0x0f << TYPE_SHIFT;
+ @Native static final int FLAGS_SHIFT = 0;
+ @Native static final int FLAGS_MASK = 0xff;
+
+ @Native static final int ARRAY = 0x10 << TYPE_SHIFT;
+ @Native static final int BUFFER = 0x20 << TYPE_SHIFT;
+ @Native static final int JNI = 0x40 << TYPE_SHIFT;
+
+ @Native static final int BYTE = 0x1 << TYPE_SHIFT;
+ @Native static final int SHORT = 0x2 << TYPE_SHIFT;
+ @Native static final int INT = 0x3 << TYPE_SHIFT;
+ @Native static final int LONG = 0x4 << TYPE_SHIFT;
+ @Native static final int FLOAT = 0x5 << TYPE_SHIFT;
+ @Native static final int DOUBLE = 0x6 << TYPE_SHIFT;
+ @Native static final int BOOLEAN = 0x7 << TYPE_SHIFT;
+ @Native static final int CHAR = 0x8 << TYPE_SHIFT;
/* NOTE: The JNI types can overlap the primitive type, since they are mutually exclusive */
/** The JNIEnv address */
- public static final int JNIENV = 0x1 << TYPE_SHIFT;
+ @Native public static final int JNIENV = 0x1 << TYPE_SHIFT;
/** The jobject handle */
- public static final int JNIOBJECT = 0x2 << TYPE_SHIFT;
+ @Native public static final int JNIOBJECT = 0x2 << TYPE_SHIFT;
/** The objects stored in this buffer */
private Object[] objects;
--- jffi-jffi-1.2.12/version.xml 2016-04-29 23:23:51.000000000 +0200
+++ jffi-jffi-1.2.12/version.xml 2019-04-03 20:04:11.168106751 +0200
@@ -8,11 +8,12 @@
<mkdir dir="${build.dir}/java/com/kenai/jffi"/>
<echo file="${build.dir}/java/com/kenai/jffi/Version.java" append="false">
package com.kenai.jffi;
+ import java.lang.annotation.Native;
public final class Version {
private Version() {}
- public static final int MAJOR = ${jffi.version.major};
- public static final int MINOR = ${jffi.version.minor};
- public static final int MICRO = ${jffi.version.micro};
+ @Native public static final int MAJOR = ${jffi.version.major};
+ @Native public static final int MINOR = ${jffi.version.minor};
+ @Native public static final int MICRO = ${jffi.version.micro};
}
</echo>
</target>
--
2.33.0

Binary file not shown.

View File

@ -1,13 +1,22 @@
--- build.xml.sav 2015-04-30 18:23:37.609686947 +0300
+++ build.xml 2015-04-30 18:23:50.621619907 +0300
@@ -219,8 +219,8 @@
---
build.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/build.xml b/build.xml
index 7ac3bae..3fe9f5a 100644
--- a/build.xml
+++ b/build.xml
@@ -213,8 +213,8 @@
<javac srcdir="${src.test.dir}" destdir="${build.test.dir}/classes" includeantruntime="false" classpathref="classpath.test">
<classpath>
<pathelement location="${build.classes.dir}"/>
- <pathelement location="lib/junit_4/junit-4.11.jar"/>
- <pathelement location="lib/junit_4/hamcrest-core-1.3.jar"/>
+ <pathelement location="lib/junit.jar"/>
+ <pathelement location="${complete.jar}"/>
+ <pathelement location="lib/junit.jar"/>
+ <pathelement location="${complete.jar}"/>
</classpath>
</javac>
</target>
--
2.33.0

View File

@ -1,18 +1,26 @@
--- jni/GNUmakefile.orig 2015-03-02 23:35:21.000000000 +0200
+++ jni/GNUmakefile 2015-04-30 18:16:46.270806239 +0300
@@ -66,9 +66,9 @@ OFLAGS = -O2 $(JFLAGS)
# MacOS headers aren't completely warning free, so turn them off
---
jni/GNUmakefile | 10 ++++++----
pom.xml | 4 ++++
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/jni/GNUmakefile b/jni/GNUmakefile
index 5eeb2da..d7b2369 100755
--- a/jni/GNUmakefile
+++ b/jni/GNUmakefile
@@ -67,10 +67,10 @@ OFLAGS = -O2 $(JFLAGS)
WERROR = -Werror
ifneq ($(OS),darwin)
ifneq ($(OS),aix)
- WFLAGS += -Wundef $(WERROR)
+ WFLAGS += -Wundef
endif
endif
-WFLAGS += -W -Wall -Wno-unused -Wno-parentheses -Wno-unused-parameter
+WFLAGS += -W -Wall -Wno-parentheses -Wno-unused-parameter
PICFLAGS = -fPIC
SOFLAGS = # Filled in for each OS specifically
FFI_MMAP_EXEC = -DFFI_MMAP_EXEC_WRIT
@@ -76,11 +76,13 @@ FFI_MMAP_EXEC = -DFFI_MMAP_EXEC_WRIT
@@ -78,11 +78,13 @@ FFI_MMAP_EXEC = -DFFI_MMAP_EXEC_WRIT
FFI_CC = $(CCACHE) $(CC)
FFI_LD = $(LD)
FFI_CFLAGS = $(FFI_MMAP_EXEC) $(OFLAGS)
@ -28,9 +36,11 @@
CFLAGS += -D_REENTRANT -D_LARGEFILE64_SOURCE -D_GNU_SOURCE
ifeq ($(OS), win64)
--- pom.xml.orig 2017-07-18 13:13:49.051730126 +0100
+++ pom.xml 2017-07-18 13:27:54.899479303 +0100
@@ -201,6 +201,10 @@
diff --git a/pom.xml b/pom.xml
index ce61b79..c0fd9a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -263,6 +263,10 @@
<include name="**/*.jar" />
</fileset>
</unzip>
@ -41,3 +51,6 @@
</tasks>
</configuration>
</execution>
--
2.33.0

View File

@ -1,6 +1,12 @@
--- build.xml.orig 2015-04-30 18:11:44.075363204 +0300
+++ build.xml 2015-04-30 18:12:37.964085560 +0300
@@ -172,8 +172,8 @@
---
build.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/build.xml b/build.xml
index 82f33e2..7ac3bae 100644
--- a/build.xml
+++ b/build.xml
@@ -166,8 +166,8 @@
<classpath>
<pathelement location="${build.classes.dir}"/>
<pathelement location="${build.test.dir}/classes"/>
@ -11,3 +17,6 @@
</classpath>
<sysproperty key="java.library.path" value="${build.native.dir}"/>
--
2.33.0

View File

@ -1,6 +1,12 @@
--- jni/GNUmakefile 2016-04-29 23:23:51.000000000 +0200
+++ jni/GNUmakefile 2019-04-03 19:52:03.140582936 +0200
@@ -279,7 +279,7 @@
---
jni/GNUmakefile | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/jni/GNUmakefile b/jni/GNUmakefile
index d7b2369..40f5275 100755
--- a/jni/GNUmakefile
+++ b/jni/GNUmakefile
@@ -274,7 +274,7 @@ debug:
@echo "JFFI_BUILD_DIR=$(JFFI_BUILD_DIR)"
@echo "OBJS=$(OBJS)"
@ -9,7 +15,7 @@
$(CC) -o $@ $(LDFLAGS) $(SOFLAGS) $(OBJS) $(LIBFFI_LIBS) $(LIBS)
$(STRIP) $@
@@ -291,7 +291,9 @@
@@ -286,7 +286,9 @@ $(BUILD_DIR)/%.o : $(SRC_DIR)/%.S $(wildcard $(JFFI_SRC_DIR)/*.h)
@mkdir -p $(@D)
@$(CC) $(CFLAGS) -o $@ -c $<
@ -19,3 +25,6 @@
ifeq ($(OS), darwin)
build_ffi = \
--
2.33.0

BIN
jffi-jffi-1.3.0.tar.gz Normal file

Binary file not shown.

View File

@ -1,12 +1,12 @@
%global cluster jnr
%global sover 1.2
Name: jffi
Version: 1.2.13
Release: 4
Version: 1.3.0
Release: 1
Summary: Java Foreign Function Interface
License: LGPL-3.0-or-later OR Apache-2.0
URL: http://github.com/jnr/jffi
Source0: https://github.com/%{cluster}/%{name}/archive/%{name}-%{version}.tar.gz
Source0: https://github.com/%{cluster}/%{name}/archive/refs/tags/jffi-jffi-1.3.0.tar.gz
Source3: p2.inf
Patch0: jffi-fix-dependencies-in-build-xml.patch
Patch1: jffi-add-built-jar-to-test-classpath.patch
@ -20,6 +20,8 @@ BuildRequires: mvn(org.apache.maven.plugins:maven-antrun-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-assembly-plugin)
BuildRequires: mvn(org.sonatype.oss:oss-parent:pom:)
Provides: osgi(com.github.jnr.jffi) = %{version}
%description
An optimized Java interface to libffi.
@ -36,11 +38,11 @@ This package contains the API documentation for %{name}.
%prep
%setup -q -n %{name}-%{name}-%{version}
%patch0
%patch1
%patch2
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4
%patch4 -p1
%ifarch loongarch64
%patch5 -p1
%endif
@ -51,6 +53,7 @@ find ./ -name '*.class' -exec rm -f '{}' \;
build-jar-repository -s -p lib/ junit hamcrest/core
%{mvn_package} 'com.github.jnr:jffi::native:' native
%{mvn_file} ':{*}' %{name}/@1 @1
sed -i 's/1.6/1.8/g' build.xml
%build
ant jar build-native -Duse.system.libffi=1
@ -86,6 +89,9 @@ ant -Duse.system.libffi=1 test
%doc COPYING.GPL COPYING.LESSER LICENSE
%changelog
* Tue Sep 26 2023 Ge Wang <wang__ge@126.com> - 1.3.0-1
- update to version 1.3.0
* Mon Jun 12 2023 hutianxue <hutianxue@xfusion.com> - 1.2.13-4
- remove redundant macros %pkg_vcmp