[oe] [meta-java][PATCH v2 1/2] java.bbclass: move openjdk/icedtea specific code into new class

André Draszik git at andred.net
Mon Aug 13 15:09:17 UTC 2018


From: André Draszik <andre.draszik at jci.com>

The code moved is not relevant to anything using java, just for
compiling java itself. It doesn't make sense to have here.

Move it into openjdk-build-helper

Signed-off-by: André Draszik <andre.draszik at jci.com>
---
 classes/java.bbclass                      | 17 -----------------
 classes/openjdk-build-helper.bbclass      | 16 ++++++++++++++++
 recipes-core/icedtea/icedtea7-native.inc  |  3 ++-
 recipes-core/openjdk/openjdk-7-common.inc |  2 +-
 recipes-core/openjdk/openjdk-8-common.inc |  1 +
 recipes-core/openjdk/openjdk-8-cross.inc  |  2 +-
 recipes-core/openjdk/openjdk-8-native.inc |  2 +-
 recipes-core/openjdk/openjdk-common.inc   |  1 +
 8 files changed, 23 insertions(+), 21 deletions(-)
 create mode 100644 classes/openjdk-build-helper.bbclass

diff --git a/classes/java.bbclass b/classes/java.bbclass
index aa012ab..fc97295 100644
--- a/classes/java.bbclass
+++ b/classes/java.bbclass
@@ -21,23 +21,6 @@ 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/classes/openjdk-build-helper.bbclass b/classes/openjdk-build-helper.bbclass
new file mode 100644
index 0000000..785ddf0
--- /dev/null
+++ b/classes/openjdk-build-helper.bbclass
@@ -0,0 +1,16 @@
+# 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 openjdk_build_helper_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]
diff --git a/recipes-core/icedtea/icedtea7-native.inc b/recipes-core/icedtea/icedtea7-native.inc
index 93463be..30fb24a 100644
--- a/recipes-core/icedtea/icedtea7-native.inc
+++ b/recipes-core/icedtea/icedtea7-native.inc
@@ -25,6 +25,7 @@ CXXFLAGS_append = " -fno-tree-dse"
 CXX_append = " -std=gnu++98"
 
 inherit native java autotools pkgconfig
+inherit openjdk-build-helper
 
 JAVA_HOME[unexport] = "1"
 
@@ -58,7 +59,7 @@ export ALT_FREETYPE_LIB_PATH = "${STAGING_LIBDIR}"
 INSANE_SKIP_${PN} = "already-stripped"
 
 EXTRA_OECONF = "\
-	--with-parallel-jobs=${@java_get_parallel_make(d)} \
+	--with-parallel-jobs=${@openjdk_build_helper_get_parallel_make(d)} \
 	\
         --disable-tests \
         --disable-hotspot-tests \
diff --git a/recipes-core/openjdk/openjdk-7-common.inc b/recipes-core/openjdk/openjdk-7-common.inc
index 1ac3154..0ef6758 100644
--- a/recipes-core/openjdk/openjdk-7-common.inc
+++ b/recipes-core/openjdk/openjdk-7-common.inc
@@ -84,7 +84,7 @@ EXTRA_OECONF = " \
     --with-jdk-src-zip=${WORKDIR}/${JDK_FILE} \
     --with-langtools-src-zip=${WORKDIR}/${LANGTOOLS_FILE} \
     \
-    --with-parallel-jobs=${@java_get_parallel_make(d)} \
+    --with-parallel-jobs=${@openjdk_build_helper_get_parallel_make(d)} \
     \
     --with-pkgversion=${PV} \
     --with-cc-for-build=${BUILD_CC} \
diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc
index aaa4483..97bf6e1 100644
--- a/recipes-core/openjdk/openjdk-8-common.inc
+++ b/recipes-core/openjdk/openjdk-8-common.inc
@@ -5,6 +5,7 @@ LICENSE  = "GPL-2.0-with-classpath-exception"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=3e0b59f8fac05c3c03d4a26bbda13f8f"
 
 inherit java autotools gettext qemu pkgconfig
+inherit openjdk-build-helper
 
 AUTOTOOLS_SCRIPT_PATH = "${S}/common/autoconf/"
 export AUTOCONF_DIR="${AUTOTOOLS_SCRIPT_PATH}"
diff --git a/recipes-core/openjdk/openjdk-8-cross.inc b/recipes-core/openjdk/openjdk-8-cross.inc
index d0b2ec8..939155b 100644
--- a/recipes-core/openjdk/openjdk-8-cross.inc
+++ b/recipes-core/openjdk/openjdk-8-cross.inc
@@ -52,7 +52,7 @@ SRC_URI_append = "\
 "
 
 EXTRA_OECONF_append = "\
-    --with-jobs=${@java_get_parallel_make(d)} \
+    --with-jobs=${@openjdk_build_helper_get_parallel_make(d)} \
     \
     --with-sys-root=${STAGING_DIR_HOST} \
     --with-tools-dir=${STAGING_DIR_NATIVE} \
diff --git a/recipes-core/openjdk/openjdk-8-native.inc b/recipes-core/openjdk/openjdk-8-native.inc
index b782c32..e6f7933 100644
--- a/recipes-core/openjdk/openjdk-8-native.inc
+++ b/recipes-core/openjdk/openjdk-8-native.inc
@@ -20,7 +20,7 @@ PACKAGECONFIG[png] = "--with-libpng=system,--with-libpng=bundled,libpng-native"
 PACKAGECONFIG[zlib] = "--with-zlib=system,--with-zlib=bundled,zlib-native"
 
 EXTRA_OECONF_append = "\
-    --with-jobs=${@java_get_parallel_make(d)} \
+    --with-jobs=${@openjdk_build_helper_get_parallel_make(d)} \
     \
     --with-sys-root=${STAGING_DIR_NATIVE} \
     --with-tools-dir=${STAGING_DIR_NATIVE} \
diff --git a/recipes-core/openjdk/openjdk-common.inc b/recipes-core/openjdk/openjdk-common.inc
index 816b463..8aa04f5 100644
--- a/recipes-core/openjdk/openjdk-common.inc
+++ b/recipes-core/openjdk/openjdk-common.inc
@@ -17,6 +17,7 @@ DEPENDS_append_libc-uclibc = " virtual/libiconv "
 DEPENDS_append = " qemu-native "
 
 inherit java autotools gettext qemu pkgconfig
+inherit openjdk-build-helper
 
 B = "${S}/build"
 
-- 
2.18.0




More information about the Openembedded-devel mailing list