summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Russell <bkylerussell@gmail.com>2016-08-24 09:28:40 -0400
committerMaxin B. John <maxin.john@intel.com>2016-08-30 16:49:09 +0300
commit8c663efa4f8efccf50d094dbc61c7b78031b3b7d (patch)
treed002a12d3fc2167d960fdf85dcb196847ed1c370
parentb2827bf00734331fa6776909e2bfee8f94790fda (diff)
downloadmeta-java-8c663efa4f8efccf50d094dbc61c7b78031b3b7d.tar.gz
Reimplement helper method for parallelizing JDK builds
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 <bkylerussell@gmail.com> Signed-off-by: Maxin B. John <maxin.john@intel.com>
-rw-r--r--classes/java.bbclass17
-rw-r--r--recipes-core/icedtea/icedtea7-native.inc23
-rw-r--r--recipes-core/openjdk/openjdk-7-common.inc32
-rw-r--r--recipes-core/openjdk/openjdk-8-common.inc21
-rw-r--r--recipes-core/openjdk/openjdk-8-cross.inc6
-rw-r--r--recipes-core/openjdk/openjdk-8-native.inc2
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"
21STAGING_LIBDIR_JNI_NATIVE ?= "${STAGING_LIBDIR_NATIVE}/jni" 21STAGING_LIBDIR_JNI_NATIVE ?= "${STAGING_LIBDIR_NATIVE}/jni"
22STAGING_LIBDIR_JVM_NATIVE ?= "${STAGING_LIBDIR_NATIVE}/jvm" 22STAGING_LIBDIR_JVM_NATIVE ?= "${STAGING_LIBDIR_NATIVE}/jvm"
23 23
24# Icedtea's makefile is not compatible to parallelization so we cannot allow
25# passing a valid ${PARALLEL_MAKE} to it. OTOH OpenJDK's makefiles are
26# parallelizable and we need ${PARALLEL_MAKE} to derive the proper value.
27# The base for this quirk is that GNU Make only considers the last "-j" option.
28EXTRA_OEMAKE_remove_task-compile = "${PARALLEL_MAKE}"
29EXTRA_OEMAKE_remove_task-install = "${PARALLEL_MAKEINST}"
30
31# OpenJDK supports parallel compilation but uses a plain number for this.
32# In OE we have PARALLEL_MAKE which is the actual option passed to make,
33# e.g. "-j 4".
34def java_get_parallel_make(d):
35 pm = d.getVar('PARALLEL_MAKE', True);
36 if not pm or '-j' not in pm:
37 return 1
38
39 return pm.partition('-j')[2].strip().split(' ')[0]
40
24oe_jarinstall() { 41oe_jarinstall() {
25 # Purpose: Install a jar file and create all the given symlinks to it. 42 # Purpose: Install a jar file and create all the given symlinks to it.
26 # Example: 43 # 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}"
54# which is already stripped. 54# which is already stripped.
55INSANE_SKIP_${PN} = "already-stripped" 55INSANE_SKIP_${PN} = "already-stripped"
56 56
57# OpenJDK supports parallel compilation but uses a plain number for this.
58# In OE we have PARALLEL_MAKE which is the actual option passed to make,
59# e.g. "-j 4".
60ICEDTEA_PARALLEL_MAKE := "${PARALLEL_MAKE}"
61PARALLEL_MAKE = ""
62def get_jdk7_native_jobs(d):
63 import bb
64
65 pm = bb.data.getVar('ICEDTEA_PARALLEL_MAKE', d, 1);
66 if not pm:
67 return "1"
68
69 pm = pm.split("j");
70 if (len(pm) == 2):
71 return pm[1].strip()
72
73 # Whatever found in PARALLEL_MAKE was not suitable.
74 return "1"
75
76EXTRA_OECONF = "\ 57EXTRA_OECONF = "\
77 --with-parallel-jobs=${@get_jdk7_native_jobs(d)} \ 58 --with-parallel-jobs=${@java_get_parallel_make(d)} \
78 \ 59 \
79 --disable-tests \ 60 --disable-tests \
80 --disable-hotspot-tests \ 61 --disable-hotspot-tests \
@@ -273,5 +254,3 @@ do_install() {
273 # Fix missing write permissions on the files. 254 # Fix missing write permissions on the files.
274 chmod ug+w -R ${JDK_INSTALL_DIR} 255 chmod ug+w -R ${JDK_INSTALL_DIR}
275} 256}
276
277get_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 f848a06..c491195 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 = " \
59 59
60JAVA_HOME[unexport] = "1" 60JAVA_HOME[unexport] = "1"
61 61
62# OpenJDK supports parallel compilation but uses a plain number for this.
63# In OE we have PARALLEL_MAKE which is the actual option passed to make,
64# e.g. "-j 4".
65
66OPENJDK_PARALLEL_MAKE := "${PARALLEL_MAKE}"
67PARALLEL_MAKE = ""
68
69def get_jdk7_jobs(d):
70 import bb
71
72 pm = bb.data.getVar('OPENJDK_PARALLEL_MAKE', d, 1);
73 if not pm:
74 return "1"
75
76 pm = pm.split("j");
77 if (len(pm) == 2):
78 return pm[1].strip()
79
80 # Whatever found in PARALLEL_MAKE was not suitable.
81 return "1"
82
83get_jdk7_jobs[vardepsexclude] += "OPENJDK_PARALLEL_MAKE"
84JDK_JOBS = "${@get_jdk7_jobs(d)}"
85
86EXTRA_OECONF = " \ 62EXTRA_OECONF = " \
87 --enable-downloading=no \ 63 --enable-downloading=no \
88 \ 64 \
@@ -108,7 +84,7 @@ EXTRA_OECONF = " \
108 --with-jdk-src-zip=${WORKDIR}/${JDK_FILE} \ 84 --with-jdk-src-zip=${WORKDIR}/${JDK_FILE} \
109 --with-langtools-src-zip=${WORKDIR}/${LANGTOOLS_FILE} \ 85 --with-langtools-src-zip=${WORKDIR}/${LANGTOOLS_FILE} \
110 \ 86 \
111 --with-parallel-jobs=${JDK_JOBS} \ 87 --with-parallel-jobs=${@java_get_parallel_make(d)} \
112 \ 88 \
113 --with-pkgversion=${PV} \ 89 --with-pkgversion=${PV} \
114 --with-cc-for-build=${BUILD_CC} \ 90 --with-cc-for-build=${BUILD_CC} \
@@ -123,8 +99,6 @@ EXTRA_OECONF += " \
123" 99"
124 100
125do_configure_prepend() { 101do_configure_prepend() {
126 echo "Configure with parallel-jobs: ${JDK_JOBS}"
127
128 # Automatically copy everything that starts with "icedtea" (or "cacao") and ends with 102 # Automatically copy everything that starts with "icedtea" (or "cacao") and ends with
129 # ".patch" into the patches directory. 103 # ".patch" into the patches directory.
130 find ${WORKDIR} -maxdepth 1 -name "icedtea*.patch" -exec cp {} ${S}/patches \; 104 find ${WORKDIR} -maxdepth 1 -name "icedtea*.patch" -exec cp {} ${S}/patches \;
@@ -138,10 +112,6 @@ do_configure_append() {
138# Work around broken variable quoting in oe-stable 2009 and provide the variable 112# Work around broken variable quoting in oe-stable 2009 and provide the variable
139# via the environment which then overrides the erroneous value that was written 113# via the environment which then overrides the erroneous value that was written
140# into '${ICETDEA}/Makefile'. 114# into '${ICETDEA}/Makefile'.
141# Icedtea's makefile is not compatible to parallelization so we cannot allow
142# passing a valid ${PARALLEL_MAKE} to it. OTOH OpenJDK's makefiles are
143# parallelizable and we need ${PARALLEL_MAKE} to derive the proper value.
144# The base for this quirk is that GNU Make only considers the last "-j" option.
145EXTRA_OEMAKE += 'CC="${CC}" CCC="${CXX}" CPP="${CPP}" CXX="${CXX}" CC_FOR_BUILD="${BUILD_CC}"' 115EXTRA_OEMAKE += 'CC="${CC}" CCC="${CXX}" CPP="${CPP}" CXX="${CXX}" CC_FOR_BUILD="${BUILD_CC}"'
146 116
147EXTRA_OEMAKE += ' \ 117EXTRA_OEMAKE += ' \
diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc
index c2f9eb4..c339985 100644
--- a/recipes-core/openjdk/openjdk-8-common.inc
+++ b/recipes-core/openjdk/openjdk-8-common.inc
@@ -167,27 +167,6 @@ do_configure_prepend() {
167 export ${@jdk_environment_options(d)} 167 export ${@jdk_environment_options(d)}
168} 168}
169 169
170# OpenJDK supports parallel compilation but uses a plain number for this.
171# In OE we have PARALLEL_MAKE which is the actual option passed to make,
172# e.g. "-j 4".
173OPENJDK8_PARALLEL_MAKE := "${PARALLEL_MAKE}"
174PARALLEL_MAKE = ""
175def get_jdk8_native_jobs(d):
176 import bb
177
178 pm = bb.data.getVar('OPENJDK8_PARALLEL_MAKE', d, 1);
179 if not pm:
180 return "1"
181
182 pm = pm.split("j");
183 if (len(pm) == 2):
184 return pm[1].strip()
185
186 # Whatever found in PARALLEL_MAKE was not suitable.
187 return "1"
188
189get_jdk8_native_jobs[vardepsexclude] += "OPENJDK8_PARALLEL_MAKE"
190
191# A function that is needed in the Shark builds. 170# A function that is needed in the Shark builds.
192def get_llvm_configure_arch(d): 171def get_llvm_configure_arch(d):
193 import bb; 172 import bb;
diff --git a/recipes-core/openjdk/openjdk-8-cross.inc b/recipes-core/openjdk/openjdk-8-cross.inc
index 11e94ce..47fe35d 100644
--- a/recipes-core/openjdk/openjdk-8-cross.inc
+++ b/recipes-core/openjdk/openjdk-8-cross.inc
@@ -40,7 +40,7 @@ SRC_URI_append = "\
40" 40"
41 41
42EXTRA_OECONF_append = "\ 42EXTRA_OECONF_append = "\
43 --with-jobs=${@get_jdk8_native_jobs(d)} \ 43 --with-jobs=${@java_get_parallel_make(d)} \
44 \ 44 \
45 --with-sys-root=${STAGING_DIR} \ 45 --with-sys-root=${STAGING_DIR} \
46 --with-tools-dir=${STAGING_DIR_NATIVE} \ 46 --with-tools-dir=${STAGING_DIR_NATIVE} \
@@ -65,13 +65,13 @@ do_install_append() {
65 if ${@bb.utils.contains('PACKAGECONFIG', 'repack', 'true', 'false', d)} ; then 65 if ${@bb.utils.contains('PACKAGECONFIG', 'repack', 'true', 'false', d)} ; then
66 if [ -d ${D}${JDK_HOME} ] ; then 66 if [ -d ${D}${JDK_HOME} ] ; then
67 find ${D}${JDK_HOME} -name "*.jar" -print0 | \ 67 find ${D}${JDK_HOME} -name "*.jar" -print0 | \
68 xargs -0 -n1 -P ${@get_jdk8_native_jobs(d)} sh -c ' \ 68 xargs -0 -n1 -P ${@java_get_parallel_make(d)} sh -c ' \
69 echo "Repacking" "$0" ; \ 69 echo "Repacking" "$0" ; \
70 pack200 --repack --effort=9 --segment-limit=-1 --modification-time=latest --strip-debug "$0"' 70 pack200 --repack --effort=9 --segment-limit=-1 --modification-time=latest --strip-debug "$0"'
71 fi 71 fi
72 if [ -d ${D}${JRE_HOME} ] ; then 72 if [ -d ${D}${JRE_HOME} ] ; then
73 find ${D}${JRE_HOME} -name "*.jar" -print0 | \ 73 find ${D}${JRE_HOME} -name "*.jar" -print0 | \
74 xargs -0 -n1 -P ${@get_jdk8_native_jobs(d)} sh -c ' \ 74 xargs -0 -n1 -P ${@java_get_parallel_make(d)} sh -c ' \
75 echo "Repacking" "$0" ; \ 75 echo "Repacking" "$0" ; \
76 pack200 --repack --effort=9 --segment-limit=-1 --modification-time=latest --strip-debug "$0"' 76 pack200 --repack --effort=9 --segment-limit=-1 --modification-time=latest --strip-debug "$0"'
77 fi 77 fi
diff --git a/recipes-core/openjdk/openjdk-8-native.inc b/recipes-core/openjdk/openjdk-8-native.inc
index 91080d2..c7d3992 100644
--- a/recipes-core/openjdk/openjdk-8-native.inc
+++ b/recipes-core/openjdk/openjdk-8-native.inc
@@ -16,7 +16,7 @@ PACKAGECONFIG[alsa] = "--with-alsa,,alsa-lib-native"
16PACKAGECONFIG[jce] = "--enable-unlimited-crypto,," 16PACKAGECONFIG[jce] = "--enable-unlimited-crypto,,"
17 17
18EXTRA_OECONF_append = "\ 18EXTRA_OECONF_append = "\
19 --with-jobs=${@get_jdk8_native_jobs(d)} \ 19 --with-jobs=${@java_get_parallel_make(d)} \
20 \ 20 \
21 --with-sys-root=${STAGING_DIR_NATIVE} \ 21 --with-sys-root=${STAGING_DIR_NATIVE} \
22 --with-tools-dir=${STAGING_DIR_NATIVE} \ 22 --with-tools-dir=${STAGING_DIR_NATIVE} \