[libjna-java] 04/04: Load libjnidispatch.so from a multiarch path (required for the Oracle version of Java)

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Wed Oct 15 20:22:04 BST 2014


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository libjna-java.

commit dddfaf396150a4292e6248e7890a066849b65adb
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Wed Oct 15 21:21:03 2014 +0200

    Load libjnidispatch.so from a multiarch path (required for the Oracle version of Java)
---
 debian/patches/04-load-native-code-from-fs.patch | 35 ++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/debian/patches/04-load-native-code-from-fs.patch b/debian/patches/04-load-native-code-from-fs.patch
index afaaf2a..3845b98 100644
--- a/debian/patches/04-load-native-code-from-fs.patch
+++ b/debian/patches/04-load-native-code-from-fs.patch
@@ -3,12 +3,43 @@ Subject: try to load native library from /usr/lib/jni if system
 Author: Jan Dittberner <jandd at debian.org>
 --- a/src/com/sun/jna/Native.java
 +++ b/src/com/sun/jna/Native.java
-@@ -658,6 +658,9 @@
+@@ -641,6 +641,30 @@
+     }
+ 
+     /**
++     * Copied from the NativeLibrary class
++     */
++    private static String getMultiArchPath() {
++        String cpu = Platform.ARCH;
++        String kernel = Platform.iskFreeBSD()
++            ? "-kfreebsd"
++            : (Platform.isGNU() ? "" : "-linux");
++        String libc = "-gnu";
++
++        if (Platform.isIntel()) {
++            cpu = (Platform.is64Bit() ? "x86_64" : "i386");
++        }
++        else if (Platform.isPPC()) {
++            cpu = (Platform.is64Bit() ? "powerpc64" : "powerpc");
++        }
++        else if (Platform.isARM()) {
++            cpu = "arm";
++            libc = "-gnueabi";
++        }
++
++        return cpu + kernel + libc;
++    }
++
++    /**
+      * Loads the JNA stub library.
+      * First tries jna.boot.library.path, then the system path, then from the
+      * jar file.
+@@ -658,6 +682,9 @@
  
          String libName = System.getProperty("jna.boot.library.name", "jnidispatch");
          String bootPath = System.getProperty("jna.boot.library.path");
 +        if (bootPath == null) {
-+            bootPath = "/usr/lib/jni";
++            bootPath = "/usr/lib/jni" + File.pathSeparator + "/usr/lib/" + getMultiArchPath() + "/jni";
 +        }
          if (bootPath != null) {
              // String.split not available in 1.4

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libjna-java.git



More information about the pkg-java-commits mailing list