From ead55372fe44ad7607e2bcede1dd11c6efd1b518 Mon Sep 17 00:00:00 2001 From: Michal Srb Date: Wed, 1 Oct 2014 12:52:11 +0200 Subject: [PATCH] Fix for 32-bit systems (Resolves: rhbz#1148349) - Fix FTBFS (Resolves: rhbz#1106955) --- jna-4.0.0-loadlibrary.patch | 39 +++++++++++++++++++++---------------- jna.spec | 21 +++++++++++++++----- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/jna-4.0.0-loadlibrary.patch b/jna-4.0.0-loadlibrary.patch index 43f19c4..959bc3a 100644 --- a/jna-4.0.0-loadlibrary.patch +++ b/jna-4.0.0-loadlibrary.patch @@ -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"; diff --git a/jna.spec b/jna.spec index ec9cf5b..d237164 100644 --- a/jna.spec +++ b/jna.spec @@ -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 - 4.1.0-7 +- Fix for 32-bit systems (Resolves: rhbz#1148349) +- Fix FTBFS (Resolves: rhbz#1106955) + * Sat Aug 16 2014 Fedora Release Engineering - 4.1.0-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild