Package: libjna-java
Version: 3.2.4-2
Severity: normal
Tags: patch
Ubuntu has moved over to multi-arch based system libraries; the code in
libjna-java
that generates the library search path does not support this directory
structure.
The attached patched fixes this for archs supported on Ubuntu.
I would like to expand this to support all archs for Debian as well.
I have also reported this upstream - http://java.net/jira/browse/JNA-184.
Index: libjna-java-multiarch-fix/src/com/sun/jna/Platform.java
===================================================================
--- libjna-java-multiarch-fix.orig/src/com/sun/jna/Platform.java 2011-03-22 13:28:10.273832461 +0000
+++ libjna-java-multiarch-fix/src/com/sun/jna/Platform.java 2011-03-24 19:07:21.747320193 +0000
@@ -99,4 +99,37 @@
}
return Native.POINTER_SIZE == 8;
}
+
+ public static final boolean isIntel() {
+ String arch =
+ System.getProperty("os.arch").toLowerCase().trim();
+ if (arch.equals("i386") ||
+ arch.equals("x86_64") ||
+ arch.equals("amd64")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static final boolean isPPC() {
+ String arch =
+ System.getProperty("os.arch").toLowerCase().trim();
+ if (arch.equals("ppc") ||
+ arch.equals("ppc64")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static final boolean isARM() {
+ String arch =
+ System.getProperty("os.arch").toLowerCase().trim();
+ if (arch.equals("arm")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
}
Index: libjna-java-multiarch-fix/src/com/sun/jna/NativeLibrary.java
===================================================================
--- libjna-java-multiarch-fix.orig/src/com/sun/jna/NativeLibrary.java 2011-03-22 13:28:10.253832255 +0000
+++ libjna-java-multiarch-fix/src/com/sun/jna/NativeLibrary.java 2011-03-24 19:08:51.348175680 +0000
@@ -625,11 +625,37 @@
"/usr/lib",
"/lib",
};
- // Linux 64-bit does not use /lib or /usr/lib
- if (Platform.isLinux() && Pointer.SIZE == 8) {
+ // Fix for multi-arch support on Ubuntu (and other
+ // multi-arch distributions)
+ // paths is scanned against real directory
+ // so for platforms which are not multi-arch
+ // this should continue to work.
+ if (Platform.isLinux()) {
+ // Defaults - overridden below
+ String cpu = "";
+ String kernel = "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";
+ }
+
+ String multiArchPath =
+ cpu + "-" + kernel + "-" + libc;
+
+ // Assemble path with all possible options
paths = new String[] {
+ "/usr/lib/" + multiArchPath,
+ "/lib/" + multiArchPath,
"/usr/lib" + archPath,
"/lib" + archPath,
+ "/usr/lib",
+ "/lib",
};
}
for (int i=0;i < paths.length;i++) {
__
This is the maintainer address of Debian's Java team
<http://lists.alioth.debian.org/mailman/listinfo/pkg-java-maintainers>. Please
use
[email protected] for discussions and questions.