[oe] [meta-java][PATCH 1/2] openjdk-8: make jar repacking optional
Dan McGregor
danismostlikely at gmail.com
Wed Apr 20 20:09:52 UTC 2016
From: Daniel McGregor <daniel.mcgregor at vecima.com>
Repacking the runtime jar files takes a long time, and is only done
to save some space. Make it optional to speed up builds that don't
need it.
Signed-off-by: Daniel McGregor <daniel.mcgregor at vecima.com>
---
recipes-core/openjdk/openjdk-8-cross.inc | 21 ++++++++++++++++++++-
recipes-core/openjdk/openjdk-8_72b05.bb | 7 +------
recipes-core/openjdk/openjre-8_72b05.bb | 7 +------
3 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/recipes-core/openjdk/openjdk-8-cross.inc b/recipes-core/openjdk/openjdk-8-cross.inc
index 63572ad..c68ac42 100644
--- a/recipes-core/openjdk/openjdk-8-cross.inc
+++ b/recipes-core/openjdk/openjdk-8-cross.inc
@@ -6,7 +6,7 @@ DEPENDS = "\
jpeg libpng krb5 libffi fontconfig freetype \
"
-PACKAGECONFIG ??= ""
+PACKAGECONFIG ??= "repack"
PACKAGECONFIG[x11] = "--with-x,,libx11 xproto libxt libxext libxrender"
PACKAGECONFIG[cups] = "--with-cups,,cups"
PACKAGECONFIG[alsa] = "--with-alsa,,alsa-lib-native"
@@ -20,6 +20,8 @@ export WANT_LLVM_RELEASE = "3.5.2"
PACKAGECONFIG[zero] = "--with-jvm-variants=zero,,,"
PACKAGECONFIG[shark] = "--with-jvm-variants=zeroshark,,llvm3.5,"
+PACKAGECONFIG[repack] = ",,,"
+
require openjdk-8-common.inc
JAVA_HOME[unexport] = "1"
@@ -49,6 +51,23 @@ do_configure_append() {
sed -i -e 's,POST_STRIP_CMD:=.*,POST_STRIP_CMD:=,g' ${B}/spec.gmk
}
+do_install_append() {
+ if ${@bb.utils.contains('PACKAGECONFIG', 'repack', 'true', 'false', d)} ; then
+ if [ -d ${D}${JDK_HOME} ] ; then
+ find ${D}${JDK_HOME} -name "*.jar" -print0 | \
+ xargs -0 -n1 -P ${@get_jdk8_native_jobs(d)} sh -c ' \
+ echo "Repacking" "$0" ; \
+ pack200 --repack --effort=9 --segment-limit=-1 --modification-time=latest --strip-debug "$0"'
+ fi
+ if [ -d ${D}${JRE_HOME} ] ; then
+ find ${D}${JRE_HOME} -name "*.jar" -print0 | \
+ xargs -0 -n1 -P ${@get_jdk8_native_jobs(d)} sh -c ' \
+ echo "Repacking" "$0" ; \
+ pack200 --repack --effort=9 --segment-limit=-1 --modification-time=latest --strip-debug "$0"'
+ fi
+ fi
+}
+
export MAKE_VERBOSE = "y"
export MFLAGS="${@jdk_make_options(d)} MAKE_VERBOSE=y QUIETLY= VERBOSE=-s LOG_LEVEL=trace STRIP_POLICY=no_strip"
diff --git a/recipes-core/openjdk/openjdk-8_72b05.bb b/recipes-core/openjdk/openjdk-8_72b05.bb
index feaf227..f378b0a 100644
--- a/recipes-core/openjdk/openjdk-8_72b05.bb
+++ b/recipes-core/openjdk/openjdk-8_72b05.bb
@@ -13,14 +13,9 @@ PATCHES_URI_append = "\
file://openjdk8-fix-adlc-flags.patch;apply=no \
"
-do_compile_append() {
- find ${B}/images/j2sdk-image -name "*.jar" -print0 | \
- xargs -0 -n1 ${STAGING_LIBDIR_NATIVE}/jvm/openjdk-8-native/bin/pack200 --repack --effort=9 --segment-limit=-1 --modification-time=latest
-}
-
do_install() {
rm -rf ${D}${JDK_HOME}
- mkdir -p ${D}${JDK_HOME}
+ mkdir -p ${D}${JDK_HOME}
cp -rp ${B}/images/j2sdk-image/* ${D}${JDK_HOME}
chown -R root:root ${D}${JDK_HOME}
install -m644 ${WORKDIR}/jvm.cfg ${D}${JDK_HOME}/jre/lib/${JDK_ARCH}/
diff --git a/recipes-core/openjdk/openjre-8_72b05.bb b/recipes-core/openjdk/openjre-8_72b05.bb
index 6202498..6d29d12 100644
--- a/recipes-core/openjdk/openjre-8_72b05.bb
+++ b/recipes-core/openjdk/openjre-8_72b05.bb
@@ -11,14 +11,9 @@ PATCHES_URI_append = "\
file://openjdk8-use_builtin_frame_address_0_rather_than_returning_address_of_local_variable.patch;apply=no \
"
-do_compile_append() {
- find ${B}/images/j2re-image -name "*.jar" -print0 | \
- xargs -0 -n1 ${STAGING_LIBDIR_NATIVE}/jvm/openjdk-8-native/bin/pack200 --repack --effort=9 --segment-limit=-1 --modification-time=latest --strip-debug
-}
-
do_install() {
rm -rf ${D}${JRE_HOME}
- mkdir -p ${D}${JRE_HOME}
+ mkdir -p ${D}${JRE_HOME}
cp -rp ${B}/images/j2re-image/* ${D}${JRE_HOME}
chown -R root:root ${D}${JRE_HOME}
install -m644 ${WORKDIR}/jvm.cfg ${D}${JRE_HOME}/lib/${JDK_ARCH}/
--
2.8.1
More information about the Openembedded-devel
mailing list