aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-core/cacao/cacao/0001-java.in-Do-not-use-hardcode-paths.patch
blob: 54b937c8b9e3d28734ed64fce75848b4de9972cb (plain)
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
From 51a63cdac93caf69d1b6ace40f73f6147ba37de5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Erkka=20K=C3=A4=C3=A4ri=C3=A4?= <erkka.kaaria@intel.com>
Date: Thu, 20 Aug 2020 13:48:38 +0200
Subject: [PATCH 1/2] java.in: Do not use hardcode paths
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Cacao uses hardcoded paths to various files, if these paths are not
provided. This causes issues when sharing sstate with otherwise
identical workers, if build time paths are not identical.

Upstream-Status: Inappropriate [Yocto-specific fixes]

Signed-off-by: Erkka Kääriä <erkka.kaaria@intel.com>
Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
---
 src/scripts/java.in | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/scripts/java.in b/src/scripts/java.in
index 0790f0255..a4f16ecdc 100644
--- a/src/scripts/java.in
+++ b/src/scripts/java.in
@@ -22,5 +22,16 @@
 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 ## 02110-1301, USA.
 
-IFS=""
-exec $(dirname ${0})/cacao ${1+"$@"}
+SH_DIR=`dirname "$0"`
+CURRENT_DIR=`cd "${SH_DIR}" && pwd`
+
+# if this shell script is invoked through symlink, we get invalid paths. As getting the real path to this file is
+# very painful using only /bin/sh, python is used instead.
+PYTHON_STR="import os; print os.path.dirname(os.path.realpath(os.readlink(\"${CURRENT_DIR}/java\"))) if os.path.islink(\"${CURRENT_DIR}/java\") else \"${CURRENT_DIR}\""
+REAL_DIR=`python -c "${PYTHON_STR}"`
+
+PARENT_DIR=`dirname ${REAL_DIR}`
+
+export BOOTCLASSPATH="${PARENT_DIR}/share/cacao/vm.zip:${PARENT_DIR}/share/classpath/glibj.zip"
+LIBRARY_PATH="-Djava.library.path=${PARENT_DIR}/lib/classpath"
+exec ${REAL_DIR}/cacao ${LIBRARY_PATH} ${1+"$@"}
-- 
2.28.0