/usr/src/gcc-5/debian/patches/libjava-jnipath.diff is in gcc-5-source 5.5.0-12ubuntu1.
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 122 123 124 125 126 127 128 129 | # 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.
Index: b/src/libjava/configure.ac
===================================================================
--- a/src/libjava/configure.ac
+++ b/src/libjava/configure.ac
@@ -1520,6 +1520,9 @@ AC_CHECK_SIZEOF(void *)
AC_C_BIGENDIAN
+MULTIARCH_DIR=$(dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null || true)
+AC_SUBST(MULTIARCH_DIR)
+
ZLIBS=
SYS_ZLIBS=
ZINCS=
Index: b/src/libjava/Makefile.am
===================================================================
--- a/src/libjava/Makefile.am
+++ b/src/libjava/Makefile.am
@@ -364,6 +364,7 @@ AM_CXXFLAGS = \
$(WARNINGS) \
-D_GNU_SOURCE \
-DPREFIX="\"$(prefix)\"" \
+ -DMULTIARCH_DIR="\"$(MULTIARCH_DIR)\"" \
-DTOOLEXECLIBDIR="\"$(toolexeclibdir)\"" \
-DJAVA_HOME="\"$(JAVA_HOME_DIR)\"" \
-DBOOT_CLASS_PATH="\"$(BOOT_CLASS_PATH_DIR)\"" \
Index: b/src/libjava/Makefile.in
===================================================================
--- a/src/libjava/Makefile.in
+++ b/src/libjava/Makefile.in
@@ -639,6 +639,7 @@ MAINT = @MAINT@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MULTIARCH_DIR = @MULTIARCH_DIR@
NM = nm
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
@@ -1022,6 +1023,7 @@ AM_CXXFLAGS = \
$(WARNINGS) \
-D_GNU_SOURCE \
-DPREFIX="\"$(prefix)\"" \
+ -DMULTIARCH_DIR="\"$(MULTIARCH_DIR)\"" \
-DTOOLEXECLIBDIR="\"$(toolexeclibdir)\"" \
-DJAVA_HOME="\"$(JAVA_HOME_DIR)\"" \
-DBOOT_CLASS_PATH="\"$(BOOT_CLASS_PATH_DIR)\"" \
Index: b/src/libjava/gnu/classpath/natSystemProperties.cc
===================================================================
--- a/src/libjava/gnu/classpath/natSystemProperties.cc
+++ b/src/libjava/gnu/classpath/natSystemProperties.cc
@@ -141,6 +141,44 @@ PrependVersionedLibdir (::java::lang::St
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 @@ gnu::classpath::SystemProperties::insert
// 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 @@ gnu::classpath::SystemProperties::insert
#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
|