Cleanup patches

This commit is contained in:
Mikolaj Izdebski 2015-06-11 09:06:03 +02:00
parent a3ce466ca7
commit e7258e9df5
4 changed files with 28 additions and 93 deletions

View File

@ -1,13 +0,0 @@
diff -up ./build.xml.gcj-javadoc ./build.xml
--- ./build.xml.gcj-javadoc 2013-04-29 14:59:19.748042560 +0200
+++ ./build.xml 2013-04-29 15:00:00.678317442 +0200
@@ -916,8 +916,6 @@ osname=macosx;processor=x86;processor=x8
<group title="Java Native Access" packages="com.sun.jna,com.sun.jna.ptr,com.sun.jna.types,com.sun.jna.win32"/>
<group title="Platform Utilities" packages="com.sun.jna.platform,com.sun.jna.platform.dnd"/>
<group title="Platform Specific" packages="com.sun.jna.platform.*"/>
-
- <arg value="-notimestamp"/>
</javadoc>
<jar jarfile="${platform-javadoc-jar}">
<fileset dir="${javadoc}" />
diff -up ./src/com/sun/jna/Function.java.gcj-javadoc ./src/com/sun/jna/Function.java

View File

@ -1,8 +1,6 @@
diff --git a/src/com/sun/jna/Native.java b/src/com/sun/jna/Native.java --- jna-4.1.0/src/com/sun/jna/Native.java.loadlib 2014-03-06 17:06:40.000000000 +0100
index 6bdf0db..763d2ef 100644 +++ jna-4.1.0/src/com/sun/jna/Native.java 2015-06-11 09:38:51.017572762 +0200
--- a/src/com/sun/jna/Native.java @@ -642,102 +642,12 @@
+++ b/src/com/sun/jna/Native.java
@@ -642,8 +642,8 @@ public final class Native implements Version {
/** /**
* Loads the JNA stub library. * Loads the JNA stub library.
@ -12,11 +10,16 @@ index 6bdf0db..763d2ef 100644
+ * unnecessary when JNA is properly installed with the OS. + * unnecessary when JNA is properly installed with the OS.
*/ */
private static void loadNativeDispatchLibrary() { private static void loadNativeDispatchLibrary() {
-
@@ -656,88 +656,19 @@ public final class Native implements Version { - if (!Boolean.getBoolean("jna.nounpack")) {
} - try {
} - removeTemporaryFiles();
- }
- catch(IOException e) {
- System.err.println("JNA Warning: IOException removing temporary files: " + e.getMessage());
- }
- }
-
- String libName = System.getProperty("jna.boot.library.name", "jnidispatch"); - String libName = System.getProperty("jna.boot.library.name", "jnidispatch");
- String bootPath = System.getProperty("jna.boot.library.path"); - String bootPath = System.getProperty("jna.boot.library.path");
- if (bootPath != null) { - if (bootPath != null) {
@ -80,9 +83,7 @@ index 6bdf0db..763d2ef 100644
- } - }
- } - }
- if (!Boolean.getBoolean("jna.nosys")) { - if (!Boolean.getBoolean("jna.nosys")) {
+ String[] libdirs = {"/usr/lib64/jna/", "/usr/lib/jna/"}; - try {
+ for (String libdir: libdirs) {
try {
- if (DEBUG_JNA_LOAD) { - if (DEBUG_JNA_LOAD) {
- System.out.println("Trying (via loadLibrary) " + libName); - System.out.println("Trying (via loadLibrary) " + libName);
- } - }
@ -91,22 +92,18 @@ index 6bdf0db..763d2ef 100644
- System.out.println("Found jnidispatch on system path"); - System.out.println("Found jnidispatch on system path");
- } - }
- return; - return;
+ System.load(libdir + System.mapLibraryName("jnidispatch")); - }
+ jnidispatchPath = libdir + System.mapLibraryName("jnidispatch"); - catch(UnsatisfiedLinkError e) {
+ break; - }
} - }
catch(UnsatisfiedLinkError e) {
+ if (libdir.equals(libdirs[libdirs.length - 1])) {
+ throw new RuntimeException(e);
+ }
}
}
- if (!Boolean.getBoolean("jna.noclasspath")) { - if (!Boolean.getBoolean("jna.noclasspath")) {
- loadNativeDispatchLibraryFromClasspath(); - loadNativeDispatchLibraryFromClasspath();
- } - }
- else { - else {
- throw new UnsatisfiedLinkError("Unable to locate JNA native support library"); - throw new UnsatisfiedLinkError("Unable to locate JNA native support library");
- } - }
+ jnidispatchPath = "@LIBDIR@/" + System.mapLibraryName("jnidispatch");
+ System.load(jnidispatchPath);
} }
static final String JNA_TMPLIB_PREFIX = "jna"; static final String JNA_TMPLIB_PREFIX = "jna";

View File

@ -1,48 +0,0 @@
diff -up ./build.xml.junit ./build.xml
--- ./build.xml.junit 2014-03-07 12:52:05.899899902 +0100
+++ ./build.xml 2014-03-07 12:58:14.956255306 +0100
@@ -290,7 +290,7 @@
<target name="-setup" depends="-dynamic-properties">
<path id="compile-test.path">
<path id="test.libs">
- <fileset dir="lib">
+ <fileset dir="/usr/share/java">
<include name="junit.jar"/>
</fileset>
<fileset dir="lib/test"/>
@@ -486,7 +486,7 @@ osname=macosx;processor=x86;processor=x8
<subant target="jar" failonerror="true">
<property name="file.reference.jna.build" location="${build}"/>
<property name="file.reference.jna.jar" location="${build}/${jar}"/>
- <property name="libs.junit.classpath" location="lib/junit.jar"/>
+ <property name="libs.junit.classpath" location="/usr/share/java/junit.jar"/>
<property name="javac.source" value="${platform.compatibility}"/>
<property name="javac.target" value="${platform.compatibility}"/>
<!-- OSGi manifest properties -->
@@ -509,7 +509,7 @@ osname=macosx;processor=x86;processor=x8
<subant target="jar" failonerror="true">
<property name="file.reference.jna.build" location="${build}"/>
<property name="file.reference.jna.jar" location="${build}/${jar}"/>
- <property name="libs.junit.classpath" location="lib/junit.jar"/>
+ <property name="libs.junit.classpath" location="/usr/share/java/junit.jar"/>
<fileset dir="${contrib}" includes="*/build.xml" excludes="platform/build.xml"/>
</subant>
</target>
@@ -822,7 +822,7 @@ osname=macosx;processor=x86;processor=x8
<mkdir dir="${build}/jws"/>
<copy todir="${build}/jws" file="${build}/${jar}"/>
<copy todir="${build}/jws" file="${build}/${testjar}"/>
- <copy todir="${build}/jws" file="lib/junit.jar"/>
+ <copy todir="${build}/jws" file="/usr/share/java/junit.jar"/>
<copy todir="${build}/jws" file="lib/clover.jar"/>
<jar jarfile="${build}/jws/jnidispatch.jar">
<fileset dir="${build.native}" includes="*jnidispatch.*"/>
@@ -933,7 +933,7 @@ osname=macosx;processor=x86;processor=x8
<subant target="test" failonerror="true" inheritall="true" inheritrefs="true">
<property name="file.reference.jna.build" location="${build}"/>
<property name="file.reference.jna.jar" location="${build}/${jar}"/>
- <property name="libs.junit.classpath" location="lib/junit.jar"/>
+ <property name="libs.junit.classpath" location="/usr/share/java/junit.jar"/>
<property name="javac.source" value="${test.compatibility}"/>
<property name="javac.target" value="${test.compatibility}"/>
<fileset dir="${contrib}" includes="platform/build.xml"/>

View File

@ -20,10 +20,6 @@ Patch1: jna-4.0.0-loadlibrary.patch
# and using a complex API like X11 through JNA just increases the potential # and using a complex API like X11 through JNA just increases the potential
# for problems. # for problems.
Patch2: jna-4.0.0-tests-headless.patch Patch2: jna-4.0.0-tests-headless.patch
# Build using GCJ javadoc
Patch3: jna-3.5.2-gcj-javadoc.patch
# junit cames from rpm
Patch4: jna-4.1.0-junit.patch
Patch6: jna-4.0.0-ffi.patch Patch6: jna-4.0.0-ffi.patch
Patch7: jna-4.0.0-fix-native-test.patch Patch7: jna-4.0.0-fix-native-test.patch
@ -31,7 +27,7 @@ Patch7: jna-4.0.0-fix-native-test.patch
# inside jars. # inside jars.
Requires: java, jpackage-utils, libffi Requires: java, jpackage-utils, libffi
BuildRequires: java-devel, jpackage-utils, libffi-devel BuildRequires: java-devel, jpackage-utils, libffi-devel
BuildRequires: ant, ant-junit, junit BuildRequires: ant, ant-junit, junit, reflections
BuildRequires: libX11-devel, libXt-devel BuildRequires: libX11-devel, libXt-devel
@ -69,19 +65,22 @@ This package contains the contributed examples for %{name}.
cp %{SOURCE1} . cp %{SOURCE1} .
%patch0 -p1 -b .build %patch0 -p1 -b .build
%patch1 -p1 -b .loadlib %patch1 -p1 -b .loadlib
sed -i 's|@JNIPATH@|%{_libdir}/%{name}|' src/com/sun/jna/Native.java
%patch2 -p1 -b .tests-headless %patch2 -p1 -b .tests-headless
chmod -Rf a+rX,u+w,g-w,o-w .
%patch3 -p0 -b .gcj-javadoc
%patch4 -p1 -b .junit
%patch6 -p1 -b .ffi %patch6 -p1 -b .ffi
%patch7 -p1 %patch7 -p1
chmod -Rf a+rX,u+w,g-w,o-w .
sed -i 's|@LIBDIR@|%{_libdir}/%{name}|' src/com/sun/jna/Native.java
# clean LICENSE.txt # clean LICENSE.txt
sed -i 's/\r//' LICENSE sed -i 's/\r//' LICENSE
chmod -c 0644 LICENSE OTHERS CHANGES.md chmod -c 0644 LICENSE OTHERS CHANGES.md
sed s,'<include name="junit.jar"/>,&<include name="reflections.jar"/>,' -i build.xml
build-jar-repository -s -p lib junit reflections
cp lib/native/aix-ppc64.jar lib/clover.jar
%build %build
# We pass -Ddynlink.native which comes from our patch because # We pass -Ddynlink.native which comes from our patch because