Fix for 32-bit systems (Resolves: rhbz#1148349)

- Fix FTBFS (Resolves: rhbz#1106955)
This commit is contained in:
Michal Srb 2014-10-01 12:52:11 +02:00
parent 0ff6cbc18b
commit ead55372fe
2 changed files with 38 additions and 22 deletions

View File

@ -1,7 +1,8 @@
diff -up ./src/com/sun/jna/Native.java.loadlib ./src/com/sun/jna/Native.java diff --git a/src/com/sun/jna/Native.java b/src/com/sun/jna/Native.java
--- ./src/com/sun/jna/Native.java.loadlib 2013-07-04 20:42:30.000000000 +0200 index 6bdf0db..763d2ef 100644
+++ ./src/com/sun/jna/Native.java 2013-07-05 15:19:54.792284073 +0200 --- a/src/com/sun/jna/Native.java
@@ -642,8 +642,8 @@ public final class Native implements Ver +++ 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,7 +13,7 @@ diff -up ./src/com/sun/jna/Native.java.loadlib ./src/com/sun/jna/Native.java
*/ */
private static void loadNativeDispatchLibrary() { private static void loadNativeDispatchLibrary() {
@@ -656,87 +656,12 @@ public final class Native implements Ver @@ -656,88 +656,19 @@ public final class Native implements Version {
} }
} }
@ -79,7 +80,9 @@ diff -up ./src/com/sun/jna/Native.java.loadlib ./src/com/sun/jna/Native.java
- } - }
- } - }
- if (!Boolean.getBoolean("jna.nosys")) { - if (!Boolean.getBoolean("jna.nosys")) {
- try { + String[] libdirs = {"/usr/lib64/jna/", "/usr/lib/jna/"};
+ 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);
- } - }
@ -88,20 +91,22 @@ diff -up ./src/com/sun/jna/Native.java.loadlib ./src/com/sun/jna/Native.java
- System.out.println("Found jnidispatch on system path"); - System.out.println("Found jnidispatch on system path");
- } - }
- return; - return;
- } + System.load(libdir + System.mapLibraryName("jnidispatch"));
- catch(UnsatisfiedLinkError e) { + jnidispatchPath = libdir + System.mapLibraryName("jnidispatch");
- } + 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();
+ try { - }
+ System.load("/usr/lib64/jna/" + System.mapLibraryName("jnidispatch"));
+ jnidispatchPath = "/usr/lib64/jna/" + System.mapLibraryName("jnidispatch");
}
- else { - else {
- throw new UnsatisfiedLinkError("Unable to locate JNA native support library"); - throw new UnsatisfiedLinkError("Unable to locate JNA native support library");
+ catch(UnsatisfiedLinkError e) { - }
+ throw new RuntimeException(e);
}
} }
static final String JNA_TMPLIB_PREFIX = "jna";

View File

@ -1,6 +1,6 @@
Name: jna Name: jna
Version: 4.1.0 Version: 4.1.0
Release: 6%{?dist} Release: 7%{?dist}
Summary: Pure Java access to native libraries Summary: Pure Java access to native libraries
Group: Development/Libraries Group: Development/Libraries
@ -180,13 +180,16 @@ rm -rf %{buildroot}
%update_maven_depmap %update_maven_depmap
%endif %endif
%if 0%{?fedora} >= 21
%files -f .mfiles
%else
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_javadir}/%{name}.jar
%endif
%doc LICENSE OTHERS README.md CHANGES.md TODO %doc LICENSE OTHERS README.md CHANGES.md TODO
%{_libdir}/%{name} %{_libdir}/%{name}
%{_javadir}/%{name}.jar %if 0%{?fedora} <= 20 || 0%{?rhel} > 5
%if 0%{?fedora} >= 9 || 0%{?rhel} > 5
%{_mavenpomdir}/JPP-%{name}.pom %{_mavenpomdir}/JPP-%{name}.pom
%{_mavendepmapfragdir}/%{name} %{_mavendepmapfragdir}/%{name}
%endif %endif
@ -198,16 +201,24 @@ rm -rf %{buildroot}
%{_javadocdir}/%{name} %{_javadocdir}/%{name}
%if 0%{?fedora} >= 21
%files contrib -f .mfiles-platform
%else
%files contrib %files contrib
%defattr(-,root,root,-) %defattr(-,root,root,-)
%endif
%{_javadir}/%{name} %{_javadir}/%{name}
%if 0%{?fedora} >= 9 || 0%{?rhel} > 5 %if 0%{?fedora} <= 20 || 0%{?rhel} > 5
%{_mavenpomdir}/JPP.%{name}-%{name}-platform.pom %{_mavenpomdir}/JPP.%{name}-%{name}-platform.pom
%{_mavendepmapfragdir}/%{name}-platform %{_mavendepmapfragdir}/%{name}-platform
%endif %endif
%changelog %changelog
* Wed Oct 01 2014 Michal Srb <msrb@redhat.com> - 4.1.0-7
- Fix for 32-bit systems (Resolves: rhbz#1148349)
- Fix FTBFS (Resolves: rhbz#1106955)
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.1.0-6 * Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.1.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild