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
--- ./src/com/sun/jna/Native.java.loadlib 2013-07-04 20:42:30.000000000 +0200
+++ ./src/com/sun/jna/Native.java 2013-07-05 15:19:54.792284073 +0200
@@ -642,8 +642,8 @@ public final class Native implements Ver
diff --git a/src/com/sun/jna/Native.java b/src/com/sun/jna/Native.java
index 6bdf0db..763d2ef 100644
--- a/src/com/sun/jna/Native.java
+++ b/src/com/sun/jna/Native.java
@@ -642,8 +642,8 @@ public final class Native implements Version {
/**
* 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() {
@@ -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")) {
- try {
+ String[] libdirs = {"/usr/lib64/jna/", "/usr/lib/jna/"};
+ for (String libdir: libdirs) {
try {
- if (DEBUG_JNA_LOAD) {
- 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");
- }
- return;
- }
- catch(UnsatisfiedLinkError e) {
- }
- }
+ System.load(libdir + System.mapLibraryName("jnidispatch"));
+ 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")) {
- loadNativeDispatchLibraryFromClasspath();
+ try {
+ System.load("/usr/lib64/jna/" + System.mapLibraryName("jnidispatch"));
+ jnidispatchPath = "/usr/lib64/jna/" + System.mapLibraryName("jnidispatch");
}
- }
- else {
- 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
Version: 4.1.0
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Pure Java access to native libraries
Group: Development/Libraries
@ -180,13 +180,16 @@ rm -rf %{buildroot}
%update_maven_depmap
%endif
%if 0%{?fedora} >= 21
%files -f .mfiles
%else
%files
%defattr(-,root,root,-)
%{_javadir}/%{name}.jar
%endif
%doc LICENSE OTHERS README.md CHANGES.md TODO
%{_libdir}/%{name}
%{_javadir}/%{name}.jar
%if 0%{?fedora} >= 9 || 0%{?rhel} > 5
%if 0%{?fedora} <= 20 || 0%{?rhel} > 5
%{_mavenpomdir}/JPP-%{name}.pom
%{_mavendepmapfragdir}/%{name}
%endif
@ -198,16 +201,24 @@ rm -rf %{buildroot}
%{_javadocdir}/%{name}
%if 0%{?fedora} >= 21
%files contrib -f .mfiles-platform
%else
%files contrib
%defattr(-,root,root,-)
%endif
%{_javadir}/%{name}
%if 0%{?fedora} >= 9 || 0%{?rhel} > 5
%if 0%{?fedora} <= 20 || 0%{?rhel} > 5
%{_mavenpomdir}/JPP.%{name}-%{name}-platform.pom
%{_mavendepmapfragdir}/%{name}-platform
%endif
%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
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild