Simplifies duplicated implementation across multiple recipes that all
inherited from java.bbclass.
Previously implementation was not flexible in supporting other make
job-limiting flags (like -l for load) that are typically passed in
through PARALLEL_MAKE. (OpenJDK doesn't know about these other flags
that might have gotten tagged on after the value for -j.)
Signed-off-by: Kyle Russell
---
classes/java.bbclass | 17
recipes-core/icedtea/icedtea7-native.inc | 23 +-
recipes-core/openjdk/openjdk-7-common.inc | 32 +--
recipes-core/openjdk/openjdk-8-common.inc | 21
recipes-core/openjdk/openjdk-8-cross.inc | 6 +++---
recipes-core/openjdk/openjdk-8-native.inc | 2 +-
6 files changed, 23 insertions(+), 78 deletions(-)
diff --git a/classes/java.bbclass b/classes/java.bbclass
index fc97295..aa012ab 100644
--- a/classes/java.bbclass
+++ b/classes/java.bbclass
@@ -21,6 +21,23 @@ STAGING_DATADIR_JAVA_NATIVE ?=
"${STAGING_DATADIR_NATIVE}/java"
STAGING_LIBDIR_JNI_NATIVE ?= "${STAGING_LIBDIR_NATIVE}/jni"
STAGING_LIBDIR_JVM_NATIVE ?= "${STAGING_LIBDIR_NATIVE}/jvm"
+# Icedtea's makefile is not compatible to parallelization so we cannot allow
+# passing a valid ${PARALLEL_MAKE} to it. OTOH OpenJDK's makefiles are
+# parallelizable and we need ${PARALLEL_MAKE} to derive the proper value.
+# The base for this quirk is that GNU Make only considers the last "-j" option.
+EXTRA_OEMAKE_remove_task-compile = "${PARALLEL_MAKE}"
+EXTRA_OEMAKE_remove_task-install = "${PARALLEL_MAKEINST}"
+
+# OpenJDK supports parallel compilation but uses a plain number for this.
+# In OE we have PARALLEL_MAKE which is the actual option passed to make,
+# e.g. "-j 4".
+def java_get_parallel_make(d):
+pm = d.getVar('PARALLEL_MAKE', True);
+if not pm or '-j' not in pm:
+return 1
+
+return pm.partition('-j')[2].strip().split(' ')[0]
+
oe_jarinstall() {
# Purpose: Install a jar file and create all the given symlinks to it.
# Example:
diff --git a/recipes-core/icedtea/icedtea7-native.inc
b/recipes-core/icedtea/icedtea7-native.inc
index 3344acb..d4c5c29 100644
--- a/recipes-core/icedtea/icedtea7-native.inc
+++ b/recipes-core/icedtea/icedtea7-native.inc
@@ -54,27 +54,8 @@ export ALT_FREETYPE_LIB_PATH = "${STAGING_LIBDIR}"
# which is already stripped.
INSANE_SKIP_${PN} = "already-stripped"
-# OpenJDK supports parallel compilation but uses a plain number for this.
-# In OE we have PARALLEL_MAKE which is the actual option passed to make,
-# e.g. "-j 4".
-ICEDTEA_PARALLEL_MAKE := "${PARALLEL_MAKE}"
-PARALLEL_MAKE = ""
-def get_jdk7_native_jobs(d):
-import bb
-
-pm = bb.data.getVar('ICEDTEA_PARALLEL_MAKE', d, 1);
-if not pm:
-return "1"
-
-pm = pm.split("j");
-if (len(pm) == 2):
-return pm[1].strip()
-
-# Whatever found in PARALLEL_MAKE was not suitable.
-return "1"
-
EXTRA_OECONF = "\
- --with-parallel-jobs=${@get_jdk7_native_jobs(d)} \
+ --with-parallel-jobs=${@java_get_parallel_make(d)} \
\
--disable-tests \
--disable-hotspot-tests \
@@ -273,5 +254,3 @@ do_install() {
# Fix missing write permissions on the files.
chmod ug+w -R ${JDK_INSTALL_DIR}
}
-
-get_jdk7_native_jobs[vardepsexclude] += "ICEDTEA_PARALLEL_MAKE"
diff --git a/recipes-core/openjdk/openjdk-7-common.inc
b/recipes-core/openjdk/openjdk-7-common.inc
index 759b426..ba738cf 100644
--- a/recipes-core/openjdk/openjdk-7-common.inc
+++ b/recipes-core/openjdk/openjdk-7-common.inc
@@ -59,30 +59,6 @@ export CACAO_CONFIGURE_ARGS = " \
JAVA_HOME[unexport] = "1"
-# OpenJDK supports parallel compilation but uses a plain number for this.
-# In OE we have PARALLEL_MAKE which is the actual option passed to make,
-# e.g. "-j 4".
-
-OPENJDK_PARALLEL_MAKE := "${PARALLEL_MAKE}"
-PARALLEL_MAKE = ""
-
-def get_jdk7_jobs(d):
-import bb
-
-pm = bb.data.getVar('OPENJDK_PARALLEL_MAKE', d, 1);
-if not pm:
-return "1"
-
-pm = pm.split("j");
-if (len(pm) == 2):
-return pm[1].strip()
-
-# Whatever found in PARALLEL_MAKE was not suitable.
-return "1"
-
-get_jdk7_jobs[vardepsexclude] += "OPENJDK_PARALLEL_MAKE"
-JDK_JOBS = "${@get_jdk7_jobs(d)}"
-
EXTRA_OECONF = " \
--disable-tests \
--disable-hotspot-tests \
@@ -106,7 +82,7 @@ EXTRA_OECONF = " \
--with-jdk-src-zip=${WORKDIR}/${JDK_FILE} \
--with-langtools-src-zip=${WORKDIR}/${LANGTOOLS_FILE} \
\
---with-parallel-jobs=${JDK_JOBS} \
+--with-parallel-jobs=${@java_get_parallel_make(d)} \
\
--with-pkgversion=${PV} \
--with-cc-for-build=${BUILD_CC} \
@@ -121,8 +97,6 @@ EXTRA_OECONF += " \
"
do_configure_prepend() {
-echo "Configure with parallel-jobs: ${JDK_JOBS}"
-
# Automatically copy everything that starts with "icedtea" (or "cacao")
and ends with
# ".patch" into the patches directory.