summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErkka Kääriä <erkka.kaaria@intel.com>2016-04-29 09:48:19 +0300
committerMaxin B. John <maxin.john@intel.com>2016-04-29 13:17:07 +0300
commit1b975523b8d0467b2e3a44097825c30cdc9e3944 (patch)
treea8b7c140356ed765a6f1455a94fabbf35ad8ec93
parent000a7f770faa7312b912937a585185334dec4caf (diff)
downloadmeta-java-1b975523b8d0467b2e3a44097825c30cdc9e3944.tar.gz
java-bootstrapping: Do not rely on hardcoded paths
Various paths to files are hardcoded in either helper scripts or the resulting binaries (like path to Java class libraries). While this works well when using the files on the build machine, things start breaking down when the sstate gets shared between multiple workers in CI, as the paths between workers can differ. Instead of using these hardcoded paths, form the paths at runtime and pass them as parameters when required. Signed-off-by: Erkka Kääriä <erkka.kaaria@intel.com> Signed-off-by: Maxin B. John <maxin.john@intel.com>
-rw-r--r--recipes-core/cacao/cacao-1.6.1/cacao-1.6.1-do-not-rely-on-absolute-paths.patch41
-rw-r--r--recipes-core/cacao/cacao-initial-native_0.98.bb1
-rw-r--r--recipes-core/cacao/cacao_1.6.1.bb21
-rw-r--r--recipes-core/cacao/files/cacao-0.9.8-do-not-rely-on-absolute-paths.patch33
-rw-r--r--recipes-core/ecj/ecj-bootstrap-native.bb8
-rw-r--r--recipes-core/ecj/ecj-initial-native.bb9
6 files changed, 96 insertions, 17 deletions
diff --git a/recipes-core/cacao/cacao-1.6.1/cacao-1.6.1-do-not-rely-on-absolute-paths.patch b/recipes-core/cacao/cacao-1.6.1/cacao-1.6.1-do-not-rely-on-absolute-paths.patch
new file mode 100644
index 0000000..2b046cf
--- /dev/null
+++ b/recipes-core/cacao/cacao-1.6.1/cacao-1.6.1-do-not-rely-on-absolute-paths.patch
@@ -0,0 +1,41 @@
1java.in: Do not use hardcode paths
2
3Cacao uses hardcoded paths to various files, if these paths are not
4provided. This causes issues when sharing sstate with otherwise
5identical workers, if build time paths are not identical.
6
7Signed-off-by: Erkka Kääriä <erkka.kaaria@intel.com>
8
9Upstream-Status: Inappropriate [Yocto-specific fixes]
10
11---
12 cacao-1.6.1/src/scripts/java.in | 16 ++++++++++++++--
13 1 file changed, 14 insertions(+), 2 deletions(-)
14
15diff --git cacao-1.6.1/src/scripts/java.in cacao-1.6.1/src/scripts/java.in
16index 0790f02..2118de7 100644
17--- cacao-1.6.1/src/scripts/java.in
18+++ cacao-1.6.1/src/scripts/java.in
19@@ -22,5 +22,17 @@
20 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 ## 02110-1301, USA.
22
23-IFS=""
24-exec $(dirname ${0})/cacao ${1+"$@"}
25+SH_DIR=`dirname "$0"`
26+CURRENT_DIR=`cd "${SH_DIR}" && pwd`
27+
28+# if this shell script is invoked through symlink, we get invalid paths. As getting the real path to this file is
29+# very painful using only /bin/sh, python is used instead.
30+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}\""
31+REAL_DIR=`python -c "${PYTHON_STR}"`
32+
33+PARENT_DIR=`dirname ${REAL_DIR}`
34+
35+export BOOTCLASSPATH="${PARENT_DIR}/share/cacao/vm.zip:${PARENT_DIR}/share/classpath/glibj.zip"
36+LIBRARY_PATH="-Djava.library.path=${PARENT_DIR}/lib/classpath"
37+exec ${REAL_DIR}/cacao ${LIBRARY_PATH} ${1+"$@"}
38+
39--
402.7.4
41
diff --git a/recipes-core/cacao/cacao-initial-native_0.98.bb b/recipes-core/cacao/cacao-initial-native_0.98.bb
index 2a8ced5..caaf53c 100644
--- a/recipes-core/cacao/cacao-initial-native_0.98.bb
+++ b/recipes-core/cacao/cacao-initial-native_0.98.bb
@@ -15,6 +15,7 @@ SRC_URI = "\
15 file://cacao-0.98-initial.patch \ 15 file://cacao-0.98-initial.patch \
16 file://disable_hw_exceptions.patch \ 16 file://disable_hw_exceptions.patch \
17 file://cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch \ 17 file://cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch \
18 file://cacao-0.9.8-do-not-rely-on-absolute-paths.patch \
18 " 19 "
19 20
20# libjvm disabled - it would conflict with cacao-native installations 21# libjvm disabled - it would conflict with cacao-native installations
diff --git a/recipes-core/cacao/cacao_1.6.1.bb b/recipes-core/cacao/cacao_1.6.1.bb
index 83f216c..ec13cc5 100644
--- a/recipes-core/cacao/cacao_1.6.1.bb
+++ b/recipes-core/cacao/cacao_1.6.1.bb
@@ -11,7 +11,10 @@ DEPENDS = "zlib libtool classpath virtual/javac-native bdwgc"
11RPROVIDES_${PN} = "java2-runtime" 11RPROVIDES_${PN} = "java2-runtime"
12 12
13SRC_URI = "http://www.complang.tuwien.ac.at/cacaojvm/download/cacao-${PV}/cacao-${PV}.tar.xz \ 13SRC_URI = "http://www.complang.tuwien.ac.at/cacaojvm/download/cacao-${PV}/cacao-${PV}.tar.xz \
14 file://system-boehm-gc.patch" 14 file://system-boehm-gc.patch \
15 file://cacao-1.6.1-do-not-rely-on-absolute-paths.patch \
16"
17
15SRC_URI[md5sum] = "2c18478404afd1cffdd15ad1e9d85a57" 18SRC_URI[md5sum] = "2c18478404afd1cffdd15ad1e9d85a57"
16SRC_URI[sha256sum] = "eecc8bd1b528a028f43d9d1d0c06b97855bbf1d40e03826d911ebbc0b6971e12" 19SRC_URI[sha256sum] = "eecc8bd1b528a028f43d9d1d0c06b97855bbf1d40e03826d911ebbc0b6971e12"
17 20
@@ -23,13 +26,12 @@ REQUIRED_DISTRO_FEATURES_class-native := ""
23EXTRA_OECONF_class-native = "\ 26EXTRA_OECONF_class-native = "\
24 --enable-debug \ 27 --enable-debug \
25 --with-vm-zip=${datadir}/cacao/vm.zip \ 28 --with-vm-zip=${datadir}/cacao/vm.zip \
26 --disable-libjvm \
27 \
28 --with-java-runtime-library-classes=${datadir}/classpath/glibj.zip \ 29 --with-java-runtime-library-classes=${datadir}/classpath/glibj.zip \
29 --with-java-runtime-library-libdir=${libdir_jni}:${libdir} \ 30 --with-java-runtime-library-libdir=${libdir_jni}:${libdir} \
30 --with-jni_md_h=${includedir}/classpath \ 31 --with-jni_md_h=${includedir}/classpath \
31 --with-jni_h=${includedir}/classpath \ 32 --with-jni_h=${includedir}/classpath \
32 --disable-test-dependency-checks \ 33 --disable-test-dependency-checks \
34 --disable-libjvm \
33" 35"
34 36
35CACHED_CONFIGUREVARS_class-native += "ac_cv_prog_JAVAC=${STAGING_BINDIR_NATIVE}/ecj-initial" 37CACHED_CONFIGUREVARS_class-native += "ac_cv_prog_JAVAC=${STAGING_BINDIR_NATIVE}/ecj-initial"
@@ -37,11 +39,9 @@ CACHED_CONFIGUREVARS_class-native += "ac_cv_prog_JAVAC=${STAGING_BINDIR_NATIVE}/
37EXTRA_OECONF = "\ 39EXTRA_OECONF = "\
38 --with-vm-zip=${datadir}/cacao/vm.zip \ 40 --with-vm-zip=${datadir}/cacao/vm.zip \
39 --disable-libjvm \ 41 --disable-libjvm \
40 \
41 --with-build-java-runtime-library-classes=${STAGING_DATADIR}/classpath/glibj.zip \ 42 --with-build-java-runtime-library-classes=${STAGING_DATADIR}/classpath/glibj.zip \
42 --with-jni_h=${STAGING_INCDIR}/classpath \ 43 --with-jni_h=${STAGING_INCDIR}/classpath \
43 --with-jni_md_h=${STAGING_INCDIR}/classpath \ 44 --with-jni_md_h=${STAGING_INCDIR}/classpath \
44 \
45 --with-java-runtime-library-classes=${datadir}/classpath/glibj.zip \ 45 --with-java-runtime-library-classes=${datadir}/classpath/glibj.zip \
46 --with-java-runtime-library-libdir=${libdir_jni}:${libdir} \ 46 --with-java-runtime-library-libdir=${libdir_jni}:${libdir} \
47 --disable-test-dependency-checks \ 47 --disable-test-dependency-checks \
@@ -54,21 +54,12 @@ do_configure_prepend () {
54 mkdir -p src/mm/boehm-gc/m4 54 mkdir -p src/mm/boehm-gc/m4
55} 55}
56 56
57do_install_append () { 57do_install_append_class-target() {
58 rm ${D}/${bindir}/java 58 rm ${D}/${bindir}/java
59} 59}
60 60
61do_install_append_class-native () {
62 ln -sf cacao ${D}/${bindir}/java
63}
64
65FILES_${PN} = "${bindir}/${PN} ${libdir}/cacao/lib*.so ${libdir}/lib*.so* ${datadir}/${PN}" 61FILES_${PN} = "${bindir}/${PN} ${libdir}/cacao/lib*.so ${libdir}/lib*.so* ${datadir}/${PN}"
66FILES_${PN}-dbg += "${bindir}/.debug ${libdir}/.debug/lib*.so*" 62FILES_${PN}-dbg += "${bindir}/.debug ${libdir}/.debug/lib*.so*"
67FILES_${PN}-doc += "${datadir}/gc" 63FILES_${PN}-doc += "${datadir}/gc"
68 64
69ALTERNATIVE_${PN} = "java"
70ALTERNATIVE_LINK = "${bindir}/java"
71ALTERNATIVE_TARGET = "${bindir}/cacao"
72ALTERNATIVE_PRIORITY = "10"
73
74BBCLASSEXTEND = "native" 65BBCLASSEXTEND = "native"
diff --git a/recipes-core/cacao/files/cacao-0.9.8-do-not-rely-on-absolute-paths.patch b/recipes-core/cacao/files/cacao-0.9.8-do-not-rely-on-absolute-paths.patch
new file mode 100644
index 0000000..93bcc3e
--- /dev/null
+++ b/recipes-core/cacao/files/cacao-0.9.8-do-not-rely-on-absolute-paths.patch
@@ -0,0 +1,33 @@
1java.in: Do not use hardcode paths
2
3Cacao uses hardcoded paths to various files, if these paths are not
4provided. This causes issues when sharing sstate with otherwise
5identical workers, if build time paths are not identical.
6
7Signed-off-by: Erkka Kääriä <erkka.kaaria@intel.com>
8
9Upstream-Status: Inappropriate [Yocto-specific fixes]
10
11---
12 cacao-0.98/src/scripts/java.in | 8 +++++++-
13 1 file changed, 7 insertions(+), 1 deletion(-)
14
15diff --git cacao-0.98/src/scripts/java.in cacao-0.98/src/scripts/java.in
16index 8a402e4..1738897 100644
17--- cacao-0.98/src/scripts/java.in
18+++ cacao-0.98/src/scripts/java.in
19@@ -32,4 +32,10 @@
20 ##
21 ## $Id: java.in 5659 2006-10-04 10:37:09Z twisti $
22
23-exec cacao ${1+"$@"}
24+SH_DIR=`dirname "$0"`
25+CURRENT_DIR=`cd "${SH_DIR}" && pwd`
26+PARENT_DIR=`dirname ${CURRENT_DIR}`
27+export BOOTCLASSPATH="${PARENT_DIR}/share/cacao-initial/vm.zip:${PARENT_DIR}/share/classpath-initial/glibj.zip"
28+
29+LIBRARY_PATH="-Djava.library.path=${PARENT_DIR}/lib/classpath-initial"
30+exec cacao ${LIBRARY_PATH} ${1+"$@"}
31+
32--
332.7.4
diff --git a/recipes-core/ecj/ecj-bootstrap-native.bb b/recipes-core/ecj/ecj-bootstrap-native.bb
index e159c9d..276a8f0 100644
--- a/recipes-core/ecj/ecj-bootstrap-native.bb
+++ b/recipes-core/ecj/ecj-bootstrap-native.bb
@@ -27,7 +27,13 @@ inherit native
27do_compile() { 27do_compile() {
28 # Create the start script 28 # Create the start script
29 echo "#!/bin/sh" > ecj-bootstrap 29 echo "#!/bin/sh" > ecj-bootstrap
30 echo "ECJ_JAR=${STAGING_DATADIR}/java/${JAR}" >> ecj-bootstrap 30
31 # get absolute path to parent directory, and use that as base path for the jar
32 echo "SH_DIR=\`dirname "\$0"\`" >> ecj-bootstrap
33 echo "CURRENT_DIR=\`cd "\${SH_DIR}" && pwd\`" >> ecj-bootstrap
34 echo "PARENT_DIR=\`dirname \${CURRENT_DIR}\`" >> ecj-bootstrap
35
36 echo "ECJ_JAR=\${PARENT_DIR}/share/java/${JAR}" >> ecj-bootstrap
31 echo "RUNTIME=java" >> ecj-bootstrap 37 echo "RUNTIME=java" >> ecj-bootstrap
32 cat ecj.in >> ecj-bootstrap 38 cat ecj.in >> ecj-bootstrap
33} 39}
diff --git a/recipes-core/ecj/ecj-initial-native.bb b/recipes-core/ecj/ecj-initial-native.bb
index ed334ed..1792390 100644
--- a/recipes-core/ecj/ecj-initial-native.bb
+++ b/recipes-core/ecj/ecj-initial-native.bb
@@ -21,11 +21,18 @@ JAR = "ecj-bootstrap.jar"
21do_compile() { 21do_compile() {
22 # Create the start script 22 # Create the start script
23 echo "#!/bin/sh" > ecj-initial 23 echo "#!/bin/sh" > ecj-initial
24 echo "ECJ_JAR=${STAGING_DATADIR}/java/${JAR}" >> ecj-initial 24
25 # get absolute path to parent directory, and use that as base path for the jar
26 echo "SH_DIR=\`dirname "\$0"\`" >> ecj-initial
27 echo "CURRENT_DIR=\`cd "\${SH_DIR}" && pwd\`" >> ecj-initial
28 echo "PARENT_DIR=\`dirname \${CURRENT_DIR}\`" >> ecj-initial
29
30 echo "ECJ_JAR=\${PARENT_DIR}/share/java/${JAR}" >> ecj-initial
25 echo "RUNTIME=java-initial" >> ecj-initial 31 echo "RUNTIME=java-initial" >> ecj-initial
26 cat ecj-initial.in >> ecj-initial 32 cat ecj-initial.in >> ecj-initial
27} 33}
28 34
35
29do_install() { 36do_install() {
30 install -d ${D}${bindir} 37 install -d ${D}${bindir}
31 install -m 755 ${S}/ecj-initial ${D}${bindir} 38 install -m 755 ${S}/ecj-initial ${D}${bindir}