commit
cb71ab28cf
150
jffi-1.2.12-no_javah.patch
Normal file
150
jffi-1.2.12-no_javah.patch
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
--- 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"/>
|
||||||
|
|
||||||
|
<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"/>
|
||||||
|
+ <javac srcdir="${src.dir}" destdir="${build.classes.dir}" nativeheaderdir="${build.native.dir}" includeantruntime="false"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="-compile-java" depends="-do-compile"/>
|
||||||
|
@@ -282,26 +283,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"/>
|
||||||
|
</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>
|
||||||
|
- <!--
|
||||||
|
- <exec executable="javah" failonerror="true">
|
||||||
|
- <arg line="-d ${build.native.dir}"/>
|
||||||
|
- <arg line="-classpath ${build.classes.dir}"/>
|
||||||
|
- <arg line="com.kenai.jffi.Foreign"/>
|
||||||
|
- <arg line="com.kenai.jffi.ObjectBuffer"/>
|
||||||
|
- </exec>
|
||||||
|
- -->
|
||||||
|
- </target>
|
||||||
|
+ <target name="-generate-native-headers" depends="-init-vars,-generate-version,-compile-java" />
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
|
||||||
BIN
jffi-1.2.13.tar.gz
Normal file
BIN
jffi-1.2.13.tar.gz
Normal file
Binary file not shown.
13
jffi-add-built-jar-to-test-classpath.patch
Normal file
13
jffi-add-built-jar-to-test-classpath.patch
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
--- 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 @@
|
||||||
|
<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}"/>
|
||||||
|
</classpath>
|
||||||
|
</javac>
|
||||||
|
</target>
|
||||||
43
jffi-fix-compilation-flags.patch
Normal file
43
jffi-fix-compilation-flags.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
--- 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
|
||||||
|
WERROR = -Werror
|
||||||
|
ifneq ($(OS),darwin)
|
||||||
|
- WFLAGS += -Wundef $(WERROR)
|
||||||
|
+ WFLAGS += -Wundef
|
||||||
|
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
|
||||||
|
FFI_CC = $(CCACHE) $(CC)
|
||||||
|
FFI_LD = $(LD)
|
||||||
|
FFI_CFLAGS = $(FFI_MMAP_EXEC) $(OFLAGS)
|
||||||
|
-STRIP ?= strip -S
|
||||||
|
+STRIP ?= /bin/true
|
||||||
|
+
|
||||||
|
+RPMFLAGS=$(shell rpm --eval %optflags)
|
||||||
|
|
||||||
|
JDK_INCLUDES = -I"$(JDK_HOME)/include" -I"$(JDK_HOME)/include/$(OS)"
|
||||||
|
IFLAGS = -I"$(BUILD_DIR)" -I"$(BUILD_DIR)"/jni -I$(SRC_DIR) -I"$(JFFI_SRC_DIR)"
|
||||||
|
-CFLAGS += $(OFLAGS) $(WFLAGS) $(IFLAGS) $(PICFLAGS) $(JDK_INCLUDES) $(LIBFFI_CFLAGS)
|
||||||
|
+CFLAGS += $(OFLAGS) $(WFLAGS) $(IFLAGS) $(PICFLAGS) $(JDK_INCLUDES) $(LIBFFI_CFLAGS) $(RPMFLAGS)
|
||||||
|
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 @@
|
||||||
|
<include name="**/*.jar" />
|
||||||
|
</fileset>
|
||||||
|
</unzip>
|
||||||
|
+ <exec executable="/bin/sh">
|
||||||
|
+ <arg value="-c"/>
|
||||||
|
+ <arg value="strip -s ${project.build.directory}/jni/*/*.so"/>
|
||||||
|
+ </exec>
|
||||||
|
</tasks>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
13
jffi-fix-dependencies-in-build-xml.patch
Normal file
13
jffi-fix-dependencies-in-build-xml.patch
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
--- 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 @@
|
||||||
|
<classpath>
|
||||||
|
<pathelement location="${build.classes.dir}"/>
|
||||||
|
<pathelement location="${build.test.dir}/classes"/>
|
||||||
|
- <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="lib/hamcrest_core.jar"/>
|
||||||
|
</classpath>
|
||||||
|
<sysproperty key="java.library.path" value="${build.native.dir}"/>
|
||||||
|
|
||||||
21
jffi-fix-system-ffi.patch
Normal file
21
jffi-fix-system-ffi.patch
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
--- jni/GNUmakefile 2016-04-29 23:23:51.000000000 +0200
|
||||||
|
+++ jni/GNUmakefile 2019-04-03 19:52:03.140582936 +0200
|
||||||
|
@@ -279,7 +279,7 @@
|
||||||
|
@echo "JFFI_BUILD_DIR=$(JFFI_BUILD_DIR)"
|
||||||
|
@echo "OBJS=$(OBJS)"
|
||||||
|
|
||||||
|
-$(LIBJFFI): $(OBJS) $(LIBFFI_LIBS)
|
||||||
|
+$(LIBJFFI): $(OBJS)
|
||||||
|
$(CC) -o $@ $(LDFLAGS) $(SOFLAGS) $(OBJS) $(LIBFFI_LIBS) $(LIBS)
|
||||||
|
$(STRIP) $@
|
||||||
|
|
||||||
|
@@ -291,7 +291,9 @@
|
||||||
|
@mkdir -p $(@D)
|
||||||
|
@$(CC) $(CFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
|
+ifneq ($(USE_SYSTEM_LIBFFI),1)
|
||||||
|
$(OBJS) : $(LIBFFI_LIBS)
|
||||||
|
+endif
|
||||||
|
|
||||||
|
ifeq ($(OS), darwin)
|
||||||
|
build_ffi = \
|
||||||
87
jffi.spec
Normal file
87
jffi.spec
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
%global cluster jnr
|
||||||
|
%global sover 1.2
|
||||||
|
Name: jffi
|
||||||
|
Version: 1.2.13
|
||||||
|
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
|
||||||
|
Source3: p2.inf
|
||||||
|
Patch0: jffi-fix-dependencies-in-build-xml.patch
|
||||||
|
Patch1: jffi-add-built-jar-to-test-classpath.patch
|
||||||
|
Patch2: jffi-fix-compilation-flags.patch
|
||||||
|
Patch3: jffi-1.2.12-no_javah.patch
|
||||||
|
Patch4: jffi-fix-system-ffi.patch
|
||||||
|
BuildRequires: ant ant-junit fdupes gcc libffi-devel make maven-local unzip mvn(junit:junit)
|
||||||
|
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
|
||||||
|
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:)
|
||||||
|
%description
|
||||||
|
An optimized Java interface to libffi.
|
||||||
|
|
||||||
|
%package native
|
||||||
|
Summary: The %{name} JAR with native bits
|
||||||
|
%description native
|
||||||
|
This package contains %{name} JAR with native bits.
|
||||||
|
|
||||||
|
%package javadoc
|
||||||
|
Summary: Javadoc for %{name}
|
||||||
|
BuildArch: noarch
|
||||||
|
%description javadoc
|
||||||
|
This package contains the API documentation for %{name}.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n %{name}-%{name}-%{version}
|
||||||
|
%patch0
|
||||||
|
%patch1
|
||||||
|
%patch2
|
||||||
|
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 1.8}%{!?pkg_vcmp:0}
|
||||||
|
%patch3 -p1
|
||||||
|
%endif
|
||||||
|
%patch4
|
||||||
|
sed -i.cpu -e '/m\$(MODEL)/d' jni/GNUmakefile libtest/GNUmakefile
|
||||||
|
rm -rf archive/* jni/libffi/ jni/win32/ lib/CopyLibs/ lib/junit*
|
||||||
|
find ./ -name '*.jar' -exec rm -f '{}' \;
|
||||||
|
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
|
||||||
|
|
||||||
|
%build
|
||||||
|
ant jar build-native -Duse.system.libffi=1
|
||||||
|
cp -p dist/jffi-*-Linux.jar archive/
|
||||||
|
%{mvn_build}
|
||||||
|
|
||||||
|
%install
|
||||||
|
%mvn_install
|
||||||
|
%fdupes -s %{buildroot}%{_javadocdir}
|
||||||
|
mkdir -p META-INF/
|
||||||
|
cp %{SOURCE3} META-INF/
|
||||||
|
jar uf %{buildroot}%{_jnidir}/%{name}/%{name}.jar META-INF/p2.inf
|
||||||
|
install -dm 755 %{buildroot}%{_libdir}/%{name}
|
||||||
|
unzip dist/jffi-*-Linux.jar
|
||||||
|
mv jni/*-Linux %{buildroot}%{_libdir}/%{name}/
|
||||||
|
pushd %{buildroot}%{_libdir}/%{name}/*
|
||||||
|
chmod +x lib%{name}-%{sover}.so
|
||||||
|
ln -s lib%{name}-%{sover}.so lib%{name}.so
|
||||||
|
popd
|
||||||
|
|
||||||
|
%check
|
||||||
|
sed -i 's|-Werror||' libtest/GNUmakefile
|
||||||
|
ant -Duse.system.libffi=1 test
|
||||||
|
|
||||||
|
%files -f .mfiles
|
||||||
|
%doc COPYING.GPL COPYING.LESSER LICENSE
|
||||||
|
|
||||||
|
%files native -f .mfiles-native
|
||||||
|
%{_libdir}/%{name}
|
||||||
|
%doc COPYING.GPL COPYING.LESSER LICENSE
|
||||||
|
|
||||||
|
%files javadoc -f .mfiles-javadoc
|
||||||
|
%doc COPYING.GPL COPYING.LESSER LICENSE
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Thu Jul 30 2020 Jeffery.Gao <gaojianxing@huawei.com> - 1.2.13-1
|
||||||
|
- Package init
|
||||||
5
jffi.yaml
Normal file
5
jffi.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
git_url: https://github.com/jnr/jffi
|
||||||
|
version_control: github
|
||||||
|
src_repo: jnr/jffi
|
||||||
|
tag_prefix: "jffi-"
|
||||||
|
seperator: "."
|
||||||
Loading…
x
Reference in New Issue
Block a user