[oe] [meta-java][PATCH] openjdk-8-native, icedtea7-native: use JAVA_TOOL_OPTIONS from environment

Bai, Haiqing Haiqing.Bai at windriver.com
Fri Nov 24 01:52:28 UTC 2017


Any feedback or comments of this?   thanks .

-----Original Message-----
From: openembedded-devel-bounces at lists.openembedded.org [mailto:openembedded-devel-bounces at lists.openembedded.org] On Behalf Of Haiqing Bai
Sent: 2017年11月2日 16:33
To: openembedded-devel at lists.openembedded.org
Subject: [oe] [meta-java][PATCH] openjdk-8-native, icedtea7-native: use JAVA_TOOL_OPTIONS from environment

Solution on how to be able to build openjdk for a build host that need the environment variable JAVA_TOOL_OPTIONS.
Use JAVA_TOOL_OPTIONS from environment. On some machines this is needed in order to start java when the amount of RAM is limited for the user.

Author: Peter Bergin <peter.bergin at windriver.com>
Signed-off-by: Haiqing Bai <Haiqing.Bai at windriver.com>
---
 recipes-core/icedtea/icedtea7-native.inc                |  4 ++++
 recipes-core/openjdk/openjdk-8-native.inc               | 10 ++++++++++
 .../openjdk/patches-openjdk-8/handle_extra_output.patch | 17 +++++++++++++++++
 3 files changed, 31 insertions(+)
 create mode 100644 recipes-core/openjdk/patches-openjdk-8/handle_extra_output.patch

diff --git a/recipes-core/icedtea/icedtea7-native.inc b/recipes-core/icedtea/icedtea7-native.inc
index 7d625eb..d4cf7ac 100644
--- a/recipes-core/icedtea/icedtea7-native.inc
+++ b/recipes-core/icedtea/icedtea7-native.inc
@@ -170,6 +170,10 @@ EXTRA_OEMAKE = ' \
                '
 
 do_compile() {
+	# Use JAVA_TOOL_OPTIONS from environment. On some machines this is needed
+	# in order to start java when the amount of RAM is limited for the user.
+	export JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS}"
+
 	# OpenJDK uses slightly different names for certain arches. We need to know
 	#	this to create some files which are expected by the build.
 	case "${TRANSLATED_TARGET_ARCH}" in
diff --git a/recipes-core/openjdk/openjdk-8-native.inc b/recipes-core/openjdk/openjdk-8-native.inc
index fd97eff..20e1743 100644
--- a/recipes-core/openjdk/openjdk-8-native.inc
+++ b/recipes-core/openjdk/openjdk-8-native.inc
@@ -9,6 +9,8 @@ DEPENDS = "\
     ca-certificates-native openssl-native coreutils-native \  "
 
+SRC_URI_append += "file://handle_extra_output.patch"
+
 PACKAGECONFIG ??= ""
 PACKAGECONFIG[x11] = "--with-x,,libx11-native xproto-native libxt-native libxext-native libxrender-native"
 PACKAGECONFIG[cups] = "--with-cups,,cups"
@@ -47,6 +49,14 @@ EXTRA_OEMAKE_append = ' \
     images \
 '
 
+do_configure_prepend() {
+    export JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS}"
+}
+
+do_compile_prepend() {
+    export JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS}"
+}
+
 do_compile_append() {
     set -x
     mkdir -p ${B}/certs
diff --git a/recipes-core/openjdk/patches-openjdk-8/handle_extra_output.patch b/recipes-core/openjdk/patches-openjdk-8/handle_extra_output.patch
new file mode 100644
index 0000000..52aad95
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/handle_extra_output.patch
@@ -0,0 +1,17 @@
+When adding the environment variable JAVA_TOOL_OPTIONS an extra line in 
+the output from 'java -version' is produced. As this output is parsed 
+by configure script the extra line has to be filtered out.
+
+Index: jdk8u-e8bed1496ff2/common/autoconf/boot-jdk.m4
+===================================================================
+--- jdk8u-e8bed1496ff2.orig/common/autoconf/boot-jdk.m4
++++ jdk8u-e8bed1496ff2/common/autoconf/boot-jdk.m4
+@@ -51,7 +51,7 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
+             BOOT_JDK_FOUND=no
+           else
+             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
++            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | 
++ grep -v JAVA_TOOL_OPTIONS | head -n 1`
+ 
+             # Extra M4 quote needed to protect [] in grep expression.
+             [FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  
+ '\"1\.[78]\.'`]
--
1.9.1

--
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel at lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel


More information about the Openembedded-devel mailing list