From 104e4028712414d8d18700491e038d8daa5f9721 Mon Sep 17 00:00:00 2001 From: Leo Ufimtsev Date: Thu, 12 Apr 2018 11:31:09 -0400 Subject: Bug 533496 – Add mechanism to find 32 bit java in GTK build.sh Dynamically find JAVA_HOME for 32bit java on a system that also has 64bit java installed. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=53349632 Change-Id: I84cd5b44078f22da3226971122dfcb38ac060895 Signed-off-by: Leo Ufimtsev --- .../org.eclipse.swt/Eclipse SWT PI/gtk/library/build.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/gtk') diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.sh b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.sh index 9ce186fd45..55381f3177 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.sh +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.sh @@ -127,8 +127,20 @@ case $SWT_OS.$SWT_ARCH in export CC=gcc fi if [ "${JAVA_HOME}" = "" ]; then - export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.el7_4.i386" - export AWT_LIB_PATH=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.el7_4.i386/jre/lib/i386 + + # Dynamically find JAVA_HOME for 32bit java on a system that also has 64bit java installed. + # We cannot use `readlink $(which java)` or related methods as they point to the 64 bit java. + # So instead we find the path manually and assume java.i386 is installed in the default /ur/lib/jvm path. + # This matches folders such as: + # java-1.8.0-openjdk-........i386 + # java-9-openjdk....i386 + JAVA_FOLDER=$(ls /usr/lib/jvm | grep java | grep -i openjdk | grep i386 | sort | tail -n 1) + if [ "${JAVA_FOLDER}" == "" ]; then + func_echo_error "ERROR: Could not find JAVA_HOME/AWT_LIB_PATH on 32bit build system automatically. Expecting it to be in /usr/lib/jvm/ but none was found. See also Bug 533496" + fi + + export JAVA_HOME=/usr/lib/jvm/${JAVA_FOLDER} + export AWT_LIB_PATH=$(JAVA_HOME)/jre/lib/i386 fi if [ "${PKG_CONFIG_PATH}" = "" ]; then export PKG_CONFIG_PATH="/usr/lib/pkgconfig:/bluebird/teamswt/swt-builddir/cairo_1.0.2/linux_x86/lib/pkgconfig" -- cgit v1.2.1