Skip to contentSkip to conversation

openjdk-8: make jar repacking optional

PATCH In review Dan McGregor 2 participants 3 messages Apr 20, 2016 – Apr 28, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 openjdk-8: make jar repacking optional

From: Daniel McGregor <[email protected]>

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.

---
 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(-)
recipes-core/openjdk/openjdk-8-cross.inc +20 -1
index 63572ad..c68ac42 100644
@@ -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"
 
recipes-core/openjdk/openjdk-8_72b05.bb +1 -6
index feaf227..f378b0a 100644
@@ -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}/
recipes-core/openjdk/openjre-8_72b05.bb +1 -6
index 6202498..6d29d12 100644
@@ -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}/
Signature · 1 line
2.8.1
#1 lore raw

PATCH 2/2 openjdk-8: use private libs

From: Daniel McGregor <[email protected]>

Prevent a non-deterministic run time dependency between openjdk-8 and openjre-8. Without PRIVATE_LIBS, if openjre is built before openjdk, openjdk might RDEPEND on openjre.

---
 recipes-core/openjdk/openjdk-8-cross.inc | 9 +++++++++
 1 file changed, 9 insertions(+)
recipes-core/openjdk/openjdk-8-cross.inc +9 -0
index c68ac42..3189764 100644
@@ -6,6 +6,15 @@ DEPENDS = "\
     jpeg libpng krb5 libffi fontconfig freetype \
 "
 
+PRIVATE_LIBS = "\
+    libattach.so libawt_headless.so libawt.so libawt_xawt.so libdt_socket.so \
+    libfontmanager.so libhprof.so libinstrument.so libj2gss.so libj2pcsc.so \
+    libj2pkcs11.so libjaas_unix.so libjava_crw_demo.so libjava.so libjawt.so \
+    libjdwp.so libjli.so libjpeg.so libjsdt.so libjsig.so libjvm.so liblcms.so \
+    libmanagement.so libmlib_image.so libnet.so libnio.so libnpt.so libsaproc.so \
+    libsctp.so libsplashscreen.so libsunec.so libunpack.so libverify.so libzip.so \
+"
+
 PACKAGECONFIG ??= "repack"
 PACKAGECONFIG[x11] = "--with-x,,libx11 xproto libxt libxext libxrender"
 PACKAGECONFIG[cups] = "--with-cups,,cups"
Signature · 1 line
2.8.1
#2 lore raw
In reply to Dan McGregor

Hi,

Quoted 6 lines · Dan McGregor

From: Daniel McGregor <[email protected]>

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.

Quoted 6 lines
---
 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(-)

Pushed these two patches. Thanks!

Best Regards,
Maxin