/usr/src/gcc-4.4/debian/patches/libjava-jnipath.diff is in gcc-4.4-source 4.4.7-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | # DP: - Add /usr/lib/jni and /usr/lib/<multiarch>/jni to java.library.path.
# DP: - When running the i386 binaries on amd64, look in
# DP: - /usr/lib32/gcj-x.y and /usr/lib32/jni instead.
--- a/src/libjava/configure.ac
+++ b/src/libjava/configure.ac
@@ -1488,6 +1488,9 @@
AC_C_BIGENDIAN
+MULTIARCH_DIR=$(dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null || true)
+AC_SUBST(MULTIARCH_DIR)
+
ZLIBS=
SYS_ZLIBS=
ZINCS=
--- a/src/libjava/Makefile.am
+++ a/src/libjava/Makefile.am
@@ -324,6 +324,7 @@
$(WARNINGS) \
-D_GNU_SOURCE \
-DPREFIX="\"$(prefix)\"" \
+ -DMULTIARCH_DIR="\"$(MULTIARCH_DIR)\"" \
-DTOOLEXECLIBDIR="\"$(toolexeclibdir)\"" \
-DJAVA_HOME="\"$(JAVA_HOME_DIR)\"" \
-DBOOT_CLASS_PATH="\"$(BOOT_CLASS_PATH_DIR)\"" \
--- a/src/libjava/Makefile.in
+++ b/src/libjava/Makefile.in
@@ -632,6 +632,7 @@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
+MULTIARCH_DIR = @MULTIARCH_DIR@
NATIVE_FALSE = @NATIVE_FALSE@
NATIVE_TRUE = @NATIVE_TRUE@
NEEDS_DATA_START_FALSE = @NEEDS_DATA_START_FALSE@
@@ -1094,6 +1095,7 @@
$(WARNINGS) \
-D_GNU_SOURCE \
-DPREFIX="\"$(prefix)\"" \
+ -DMULTIARCH_DIR="\"$(MULTIARCH_DIR)\"" \
-DTOOLEXECLIBDIR="\"$(toolexeclibdir)\"" \
-DJAVA_HOME="\"$(JAVA_HOME_DIR)\"" \
-DBOOT_CLASS_PATH="\"$(BOOT_CLASS_PATH_DIR)\"" \
--- a/src/libjava/gnu/classpath/natSystemProperties.cc
+++ b/src/libjava/gnu/classpath/natSystemProperties.cc
@@ -141,6 +141,44 @@
return retval;
}
+static char*
+AppendJniLibdir (char *path, struct utsname *u)
+{
+ char* retval;
+ const char* jnilibdir = "/usr/lib/jni";
+#ifdef MULTIARCH_DIR
+ const char* jnilibdir2 = "/usr/lib/" MULTIARCH_DIR "/jni";
+ jsize len2 = strlen (jnilibdir2) + 2;
+#else
+ jsize len2 = 0;
+#endif
+
+#if defined(__linux__) && defined (__i386__)
+ if (! strcmp ("x86_64", u->machine))
+ jnilibdir = "/usr/lib32/jni";
+#endif
+
+ if (path)
+ {
+ jsize total = strlen (path)
+ + (sizeof (PATH_SEPARATOR) - 1) + strlen (jnilibdir) +len2 + 1;
+ retval = (char*) _Jv_Malloc (total);
+ strcpy (retval, path);
+ strcat (retval, PATH_SEPARATOR);
+ strcat (retval, jnilibdir);
+ }
+ else
+ {
+ retval = (char*) _Jv_Malloc (strlen (jnilibdir) + len2 + 1);
+ strcpy (retval, jnilibdir);
+ }
+#ifdef MULTIARCH_DIR
+ strcat (retval, PATH_SEPARATOR);
+ strcat (retval, jnilibdir2);
+#endif
+ return retval;
+}
+
void
gnu::classpath::SystemProperties::insertSystemProperties (::java::util::Properties *newprops)
{
@@ -373,8 +411,13 @@
// Prepend GCJ_VERSIONED_LIBDIR to the module load path so that
// libgcj will find its own JNI libraries, like libgtkpeer.so.
char* val = PrependVersionedLibdir (path);
- _Jv_SetDLLSearchPath (val);
+
+ // Append jnilibdir
+ char* val2 = AppendJniLibdir (val, &u);
+
+ _Jv_SetDLLSearchPath (val2);
_Jv_Free (val);
+ _Jv_Free (val2);
}
else
{
@@ -382,9 +425,12 @@
#ifdef USE_LTDL
char *libpath = getenv (LTDL_SHLIBPATH_VAR);
char* val = _Jv_PrependVersionedLibdir (libpath);
- SET ("java.library.path", val);
- _Jv_SetDLLSearchPath (val);
+ // Append jnilibdir
+ char* val2 = AppendJniLibdir (val, &u);
+ SET ("java.library.path", val2);
+ _Jv_SetDLLSearchPath (val2);
_Jv_Free (val);
+ _Jv_Free (val2);
#else
SET ("java.library.path", "");
#endif
|