Compare commits
10 Commits
71d41d39b0
...
f8e630aec3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8e630aec3 | ||
|
|
72bf51ab51 | ||
|
|
478ab2d094 | ||
|
|
8123c1197a | ||
|
|
bebd1bc5de | ||
|
|
5766d3ef15 | ||
|
|
b0f3a6bd69 | ||
|
|
30ae40d9a5 | ||
|
|
fd7c833a9d | ||
|
|
fd5a91dfd5 |
124
0001-Support-for-LoongArch64.patch
Normal file
124
0001-Support-for-LoongArch64.patch
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
From 261fa25d2f878a63febd883cb82f68033f227f58 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jingyun Hua <huajingyun@loongson.cn>
|
||||||
|
Date: Wed, 17 May 2023 03:09:55 +0000
|
||||||
|
Subject: [PATCH] Support for LoongArch64
|
||||||
|
|
||||||
|
---
|
||||||
|
src/main/java/jnr/ffi/Platform.java | 6 ++++++
|
||||||
|
.../loongarch64/linux/TypeAliases.java | 72 +++++++++++++++++++
|
||||||
|
2 files changed, 78 insertions(+)
|
||||||
|
create mode 100644 src/main/java/jnr/ffi/provider/jffi/platform/loongarch64/linux/TypeAliases.java
|
||||||
|
|
||||||
|
diff --git a/src/main/java/jnr/ffi/Platform.java b/src/main/java/jnr/ffi/Platform.java
|
||||||
|
index 11caeab..f0712fc 100644
|
||||||
|
--- a/src/main/java/jnr/ffi/Platform.java
|
||||||
|
+++ b/src/main/java/jnr/ffi/Platform.java
|
||||||
|
@@ -121,6 +121,9 @@ public abstract class Platform {
|
||||||
|
/** 64 bit MIPS */
|
||||||
|
MIPS64EL,
|
||||||
|
|
||||||
|
+ /** 64 bit LOONGARCH */
|
||||||
|
+ LOONGARCH64,
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Unknown CPU architecture. A best effort will be made to infer architecture
|
||||||
|
* specific values such as address and long size.
|
||||||
|
@@ -227,6 +230,8 @@ public abstract class Platform {
|
||||||
|
return CPU.ARM;
|
||||||
|
} else if (equalsIgnoreCase("mips64", archString) || equalsIgnoreCase("mips64el", archString)) {
|
||||||
|
return CPU.MIPS64EL;
|
||||||
|
+ } else if (equalsIgnoreCase("loongarch64", archString)) {
|
||||||
|
+ return CPU.LOONGARCH64;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to find by lookup up in the CPU list
|
||||||
|
@@ -285,6 +290,7 @@ public abstract class Platform {
|
||||||
|
case S390X:
|
||||||
|
case AARCH64:
|
||||||
|
case MIPS64EL:
|
||||||
|
+ case LOONGARCH64:
|
||||||
|
dataModel = 64;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
diff --git
|
||||||
|
a/src/main/java/jnr/ffi/provider/jffi/platform/loongarch64/linux/TypeAliases.java b/src/main/java/jnr/ffi/provider/jffi/platform/loongarch64/linux/TypeAliases.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..de700f3
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/jnr/ffi/provider/jffi/platform/loongarch64/linux/TypeAliases.java
|
||||||
|
@@ -0,0 +1,72 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (C) 2022 Wayne Meissner
|
||||||
|
+ *
|
||||||
|
+ * This file is part of the JNR project.
|
||||||
|
+ *
|
||||||
|
+ * Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
+ * you may not use this file except in compliance with the License.
|
||||||
|
+ * You may obtain a copy of the License at
|
||||||
|
+ *
|
||||||
|
+ * http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
+ *
|
||||||
|
+ * Unless required by applicable law or agreed to in writing, software
|
||||||
|
+ * distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
+ * See the License for the specific language governing permissions and
|
||||||
|
+ * limitations under the License.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+package jnr.ffi.provider.jffi.platform.loongarch64.linux;
|
||||||
|
+
|
||||||
|
+import jnr.ffi.NativeType;
|
||||||
|
+import jnr.ffi.TypeAlias;
|
||||||
|
+
|
||||||
|
+import java.util.EnumMap;
|
||||||
|
+import java.util.Map;
|
||||||
|
+
|
||||||
|
+public final class TypeAliases {
|
||||||
|
+ public static final Map<TypeAlias, jnr.ffi.NativeType> ALIASES = buildTypeMap();
|
||||||
|
+ private static Map<TypeAlias, jnr.ffi.NativeType> buildTypeMap() {
|
||||||
|
+ Map<TypeAlias, jnr.ffi.NativeType> m = new EnumMap<TypeAlias, jnr.ffi.NativeType>(TypeAlias.class);
|
||||||
|
+ m.put(TypeAlias.int8_t, NativeType.SCHAR);
|
||||||
|
+ m.put(TypeAlias.u_int8_t, NativeType.UCHAR);
|
||||||
|
+ m.put(TypeAlias.int16_t, NativeType.SSHORT);
|
||||||
|
+ m.put(TypeAlias.u_int16_t, NativeType.USHORT);
|
||||||
|
+ m.put(TypeAlias.int32_t, NativeType.SINT);
|
||||||
|
+ m.put(TypeAlias.u_int32_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.int64_t, NativeType.SLONGLONG);
|
||||||
|
+ m.put(TypeAlias.u_int64_t, NativeType.ULONGLONG);
|
||||||
|
+ m.put(TypeAlias.intptr_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.uintptr_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.caddr_t, NativeType.ADDRESS);
|
||||||
|
+ m.put(TypeAlias.dev_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.blkcnt_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.blksize_t, NativeType.SINT);
|
||||||
|
+ m.put(TypeAlias.gid_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.in_addr_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.in_port_t, NativeType.USHORT);
|
||||||
|
+ m.put(TypeAlias.ino_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.ino64_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.key_t, NativeType.SINT);
|
||||||
|
+ m.put(TypeAlias.mode_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.nlink_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.id_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.pid_t, NativeType.SINT);
|
||||||
|
+ m.put(TypeAlias.off_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.swblk_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.uid_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.clock_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.size_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.ssize_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.time_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.fsblkcnt_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.fsfilcnt_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.sa_family_t, NativeType.USHORT);
|
||||||
|
+ m.put(TypeAlias.socklen_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.rlim_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.cc_t, NativeType.UCHAR);
|
||||||
|
+ m.put(TypeAlias.speed_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.tcflag_t, NativeType.UINT);
|
||||||
|
+ return m;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
124
0002-Add-riscv64-support.patch
Normal file
124
0002-Add-riscv64-support.patch
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
From 153c25fb9df915880cbc5b1500bfed0f11ccb388 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kai Zhang <zhangkai@iscas.ac.cn>
|
||||||
|
Date: Thu, 16 Mar 2023 11:45:59 +0800
|
||||||
|
Subject: [PATCH] Add riscv64 support
|
||||||
|
|
||||||
|
Signed-off-by: Kai Zhang <zhangkai@iscas.ac.cn>
|
||||||
|
---
|
||||||
|
src/main/java/jnr/ffi/Platform.java | 6 ++
|
||||||
|
.../platform/riscv64/linux/TypeAliases.java | 72 +++++++++++++++++++
|
||||||
|
2 files changed, 78 insertions(+)
|
||||||
|
create mode 100644 src/main/java/jnr/ffi/provider/jffi/platform/riscv64/linux/TypeAliases.java
|
||||||
|
|
||||||
|
diff --git a/src/main/java/jnr/ffi/Platform.java b/src/main/java/jnr/ffi/Platform.java
|
||||||
|
index ce247abd..ebb6422e 100644
|
||||||
|
--- a/src/main/java/jnr/ffi/Platform.java
|
||||||
|
+++ b/src/main/java/jnr/ffi/Platform.java
|
||||||
|
@@ -130,6 +130,9 @@ public abstract class Platform {
|
||||||
|
/** 64 bit LOONGARCH */
|
||||||
|
LOONGARCH64,
|
||||||
|
|
||||||
|
+ /** 64 bit RISC-V */
|
||||||
|
+ RISCV64,
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Unknown CPU architecture. A best effort will be made to infer architecture
|
||||||
|
* specific values such as address and long size.
|
||||||
|
@@ -246,6 +249,8 @@ public abstract class Platform {
|
||||||
|
return CPU.MIPS64EL;
|
||||||
|
} else if (equalsIgnoreCase("loongarch64", archString)) {
|
||||||
|
return CPU.LOONGARCH64;
|
||||||
|
+ } else if (equalsIgnoreCase("riscv64", archString)) {
|
||||||
|
+ return CPU.RISCV64;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to find by lookup up in the CPU list
|
||||||
|
@@ -308,6 +313,7 @@ public abstract class Platform {
|
||||||
|
case AARCH64:
|
||||||
|
case MIPS64EL:
|
||||||
|
case LOONGARCH64:
|
||||||
|
+ case RISCV64:
|
||||||
|
dataModel = 64;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
diff --git a/src/main/java/jnr/ffi/provider/jffi/platform/riscv64/linux/TypeAliases.java b/src/main/java/jnr/ffi/provider/jffi/platform/riscv64/linux/TypeAliases.java
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..db837ca2
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/jnr/ffi/provider/jffi/platform/riscv64/linux/TypeAliases.java
|
||||||
|
@@ -0,0 +1,72 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (C) 2016 Wayne Meissner
|
||||||
|
+ *
|
||||||
|
+ * This file is part of the JNR project.
|
||||||
|
+ *
|
||||||
|
+ * Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
+ * you may not use this file except in compliance with the License.
|
||||||
|
+ * You may obtain a copy of the License at
|
||||||
|
+ *
|
||||||
|
+ * http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
+ *
|
||||||
|
+ * Unless required by applicable law or agreed to in writing, software
|
||||||
|
+ * distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
+ * See the License for the specific language governing permissions and
|
||||||
|
+ * limitations under the License.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+package jnr.ffi.provider.jffi.platform.riscv64.linux;
|
||||||
|
+
|
||||||
|
+import jnr.ffi.NativeType;
|
||||||
|
+import jnr.ffi.TypeAlias;
|
||||||
|
+
|
||||||
|
+import java.util.EnumMap;
|
||||||
|
+import java.util.Map;
|
||||||
|
+
|
||||||
|
+public final class TypeAliases {
|
||||||
|
+ public static final Map<TypeAlias, jnr.ffi.NativeType> ALIASES = buildTypeMap();
|
||||||
|
+ private static Map<TypeAlias, jnr.ffi.NativeType> buildTypeMap() {
|
||||||
|
+ Map<TypeAlias, jnr.ffi.NativeType> m = new EnumMap<TypeAlias, jnr.ffi.NativeType>(TypeAlias.class);
|
||||||
|
+ m.put(TypeAlias.int8_t, NativeType.SCHAR);
|
||||||
|
+ m.put(TypeAlias.u_int8_t, NativeType.UCHAR);
|
||||||
|
+ m.put(TypeAlias.int16_t, NativeType.SSHORT);
|
||||||
|
+ m.put(TypeAlias.u_int16_t, NativeType.USHORT);
|
||||||
|
+ m.put(TypeAlias.int32_t, NativeType.SINT);
|
||||||
|
+ m.put(TypeAlias.u_int32_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.int64_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.u_int64_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.intptr_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.uintptr_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.caddr_t, NativeType.ADDRESS);
|
||||||
|
+ m.put(TypeAlias.dev_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.blkcnt_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.blksize_t, NativeType.SINT);
|
||||||
|
+ m.put(TypeAlias.gid_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.in_addr_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.in_port_t, NativeType.USHORT);
|
||||||
|
+ m.put(TypeAlias.ino_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.ino64_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.key_t, NativeType.SINT);
|
||||||
|
+ m.put(TypeAlias.mode_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.nlink_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.id_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.pid_t, NativeType.SINT);
|
||||||
|
+ m.put(TypeAlias.off_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.swblk_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.uid_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.clock_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.size_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.ssize_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.time_t, NativeType.SLONG);
|
||||||
|
+ m.put(TypeAlias.fsblkcnt_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.fsfilcnt_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.sa_family_t, NativeType.USHORT);
|
||||||
|
+ m.put(TypeAlias.socklen_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.rlim_t, NativeType.ULONG);
|
||||||
|
+ m.put(TypeAlias.cc_t, NativeType.UCHAR);
|
||||||
|
+ m.put(TypeAlias.speed_t, NativeType.UINT);
|
||||||
|
+ m.put(TypeAlias.tcflag_t, NativeType.UINT);
|
||||||
|
+ return m;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
||||||
Binary file not shown.
BIN
jnr-ffi-2.2.0.tar.gz
Normal file
BIN
jnr-ffi-2.2.0.tar.gz
Normal file
Binary file not shown.
37
jnr-ffi.spec
37
jnr-ffi.spec
@ -1,10 +1,12 @@
|
|||||||
Name: jnr-ffi
|
Name: jnr-ffi
|
||||||
Version: 2.1.8
|
Version: 2.2.0
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: Java Abstracted Foreign Function Layer
|
Summary: Java Abstracted Foreign Function Layer
|
||||||
License: Apache-2.0
|
License: Apache-2.0
|
||||||
URL: http://github.com/jnr/%{name}/
|
URL: http://github.com/jnr/%{name}/
|
||||||
Source0: https://github.com/jnr/%{name}/archive/%{name}-%{version}.tar.gz
|
Source0: https://github.com/jnr/jnr-ffi/archive/refs/tags/%{name}-%{version}.tar.gz
|
||||||
|
Patch0: 0001-Support-for-LoongArch64.patch
|
||||||
|
Patch1: 0002-Add-riscv64-support.patch
|
||||||
BuildRequires: fdupes gcc make maven-local mvn(com.github.jnr:jffi)
|
BuildRequires: fdupes gcc make maven-local mvn(com.github.jnr:jffi)
|
||||||
BuildRequires: mvn(com.github.jnr:jffi::native:) mvn(com.github.jnr:jnr-x86asm)
|
BuildRequires: mvn(com.github.jnr:jffi::native:) mvn(com.github.jnr:jnr-x86asm)
|
||||||
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
|
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
|
||||||
@ -13,6 +15,10 @@ BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin) mvn(org.o
|
|||||||
BuildRequires: mvn(org.ow2.asm:asm-analysis) mvn(org.ow2.asm:asm-commons)
|
BuildRequires: mvn(org.ow2.asm:asm-analysis) mvn(org.ow2.asm:asm-commons)
|
||||||
BuildRequires: mvn(org.ow2.asm:asm-tree) mvn(org.ow2.asm:asm-util)
|
BuildRequires: mvn(org.ow2.asm:asm-tree) mvn(org.ow2.asm:asm-util)
|
||||||
BuildRequires: mvn(org.sonatype.oss:oss-parent:pom:)
|
BuildRequires: mvn(org.sonatype.oss:oss-parent:pom:)
|
||||||
|
BuildRequires: mvn(org.eclipse.aether:aether-connector-basic)
|
||||||
|
BuildRequires: mvn(org.eclipse.aether:aether-transport-wagon)
|
||||||
|
BuildRequires: mvn(org.apache.maven.wagon:wagon-http)
|
||||||
|
BuildRequires: mvn(org.apache.maven.wagon:wagon-provider-api)
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%description
|
%description
|
||||||
An abstracted interface to invoking native functions from java
|
An abstracted interface to invoking native functions from java
|
||||||
@ -24,16 +30,17 @@ This package contains the API documentation for %{name}.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{name}-%{name}-%{version}
|
%setup -q -n %{name}-%{name}-%{version}
|
||||||
|
%patch0 -p1
|
||||||
|
%patch1 -p1
|
||||||
find -name '*.jar' -o -name '*.class' -exec rm -f '{}' \;
|
find -name '*.jar' -o -name '*.class' -exec rm -f '{}' \;
|
||||||
%pom_remove_plugin ":maven-javadoc-plugin"
|
%pom_remove_plugin ":maven-javadoc-plugin"
|
||||||
sed -i 's|-Werror||' libtest/GNUmakefile
|
sed -i 's|-Werror||' libtest/GNUmakefile
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{mvn_build} -f -- \
|
%{mvn_build} -b -f -- -Dasm.version=7.0
|
||||||
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 9}%{!?pkg_vcmp:0}
|
sed -i '/jnr-a64asm/,+2d;:go;1,2!{P;N;D};N;bgo' .xmvn-reactor
|
||||||
-Dmaven.compiler.release=6 \
|
sed -i '160,161d' .xmvn-reactor
|
||||||
%endif
|
sed -i '104,105d' .xmvn-reactor
|
||||||
-Dasm.version=7.0
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%mvn_install
|
%mvn_install
|
||||||
@ -46,5 +53,17 @@ sed -i 's|-Werror||' libtest/GNUmakefile
|
|||||||
%license LICENSE
|
%license LICENSE
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Sep 28 2023 laokz <zhangkai@iscas.ac.cn> - 2.2.0-2
|
||||||
|
- Backport riscv64 support patch from 2.2.15
|
||||||
|
|
||||||
|
* Wed Sep 27 2023 Ge Wang <wang__ge@126.com> - 2.2.0-1
|
||||||
|
- Update to version 2.2.0
|
||||||
|
|
||||||
|
* Thu May 18 2023 huajingyun <huajingyun@loongson.cn> - 2.1.8-3
|
||||||
|
- Add loongarch64 support
|
||||||
|
|
||||||
|
* Thu May 18 2023 chenchen <chen_aka_jan@163.com> - 2.1.8-2
|
||||||
|
- remove redundant macro pkg_vcmp
|
||||||
|
|
||||||
* Fri Jul 31 2020 Jeffery.Gao <gaojianxing@huawei.com> - 2.1.8-1
|
* Fri Jul 31 2020 Jeffery.Gao <gaojianxing@huawei.com> - 2.1.8-1
|
||||||
- Package init
|
- Package init
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user