summaryrefslogtreecommitdiffstats
path: root/meta/packages/gcc/gcc-4.3.1/debian/libjava-jnipath.dpatch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/gcc/gcc-4.3.1/debian/libjava-jnipath.dpatch')
-rw-r--r--meta/packages/gcc/gcc-4.3.1/debian/libjava-jnipath.dpatch94
1 files changed, 94 insertions, 0 deletions
diff --git a/meta/packages/gcc/gcc-4.3.1/debian/libjava-jnipath.dpatch b/meta/packages/gcc/gcc-4.3.1/debian/libjava-jnipath.dpatch
new file mode 100644
index 0000000000..a33888bf14
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.1/debian/libjava-jnipath.dpatch
@@ -0,0 +1,94 @@
1#! /bin/sh -e
2
3# DP: - Add /usr/lib/jni to java.library.path.
4# DP: - When running the i386 binaries on amd64, look in
5# DP: - /usr/lib32/gcj-x.y and /usr/lib32/jni instead.
6
7dir=
8if [ $# -eq 3 -a "$2" = '-d' ]; then
9 pdir="-d $3"
10 dir="$3/"
11elif [ $# -ne 1 ]; then
12 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
13 exit 1
14fi
15case "$1" in
16 -patch)
17 patch $pdir -f --no-backup-if-mismatch -p0 < $0
18 ;;
19 -unpatch)
20 patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
21 ;;
22 *)
23 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
24 exit 1
25esac
26exit 0
27
28--- libjava/gnu/classpath/natSystemProperties.cc~ 2006-08-02 00:53:40.000000000 +0200
29+++ libjava/gnu/classpath/natSystemProperties.cc 2006-08-19 00:41:50.063803000 +0200
30@@ -141,6 +141,34 @@
31 return retval;
32 }
33
34+static char*
35+AppendJniLibdir (char *path, struct utsname *u)
36+{
37+ char* retval;
38+ const char* jnilibdir = "/usr/lib/jni";
39+
40+#if defined(__linux__) && defined (__i386__)
41+ if (! strcmp ("x86_64", u->machine))
42+ jnilibdir = "/usr/lib32/jni";
43+#endif
44+
45+ if (path)
46+ {
47+ jsize total = strlen (path)
48+ + (sizeof (PATH_SEPARATOR) - 1) + strlen (jnilibdir) + 1;
49+ retval = (char*) _Jv_Malloc (total);
50+ strcpy (retval, path);
51+ strcat (retval, PATH_SEPARATOR);
52+ strcat (retval, jnilibdir);
53+ }
54+ else
55+ {
56+ retval = (char*) _Jv_Malloc (strlen (jnilibdir) + 1);
57+ strcpy (retval, jnilibdir);
58+ }
59+ return retval;
60+}
61+
62 void
63 gnu::classpath::SystemProperties::insertSystemProperties (java::util::Properties *newprops)
64 {
65@@ -370,8 +398,13 @@
66 // Prepend GCJ_VERSIONED_LIBDIR to the module load path so that
67 // libgcj will find its own JNI libraries, like libgtkpeer.so.
68 char* val = PrependVersionedLibdir (path);
69- _Jv_SetDLLSearchPath (val);
70+
71+ // Append jnilibdir
72+ char* val2 = AppendJniLibdir (val, &u);
73+
74+ _Jv_SetDLLSearchPath (val2);
75 _Jv_Free (val);
76+ _Jv_Free (val2);
77 }
78 else
79 {
80@@ -379,9 +412,12 @@
81 #ifdef USE_LTDL
82 char *libpath = getenv (LTDL_SHLIBPATH_VAR);
83 char* val = _Jv_PrependVersionedLibdir (libpath);
84- SET ("java.library.path", val);
85- _Jv_SetDLLSearchPath (val);
86+ // Append jnilibdir
87+ char* val2 = AppendJniLibdir (val, &u);
88+ SET ("java.library.path", val2);
89+ _Jv_SetDLLSearchPath (val2);
90 _Jv_Free (val);
91+ _Jv_Free (val2);
92 #else
93 SET ("java.library.path", "");
94 #endif