Skip to contentSkip to conversation

openjdk include cleanup

PATCH In review Richard Leitner 2 participants 11 messages Aug 20, 2018 – Aug 22, 2018

lore
Share & tools
lore
#0 lore raw

cover openjdk include cleanup

Remove duplicated code in openjdk includes by moving it to the openjdk-build-helper class. Furthermore make the naming of files in recipes-core/openjdk/ consistent again.

Richard Leitner (7):
openjdk-build-helper: add get_*_arch functions
openjdk-8: use openjdk_build_helper's ARCH translation functions
openjdk-7: use openjdk_build_helper's ARCH translation functions
icedtea7-native: use openjdk_build_helper's ARCH translation functions
openjdk-7: remove version dependent stuff from openjdk-common
openjdk-8: use openjdk-common
openjdk-7: merge postinst into openjdk-7-common

 classes/openjdk-build-helper.bbclass      |  51 +++++++++++
 recipes-core/icedtea/icedtea7-native.inc  |  42 +--------
 recipes-core/openjdk/openjdk-7-common.inc | 141 +++++++++++++++++++++++++++++-
 recipes-core/openjdk/openjdk-8-common.inc |  44 +---------
 recipes-core/openjdk/openjdk-common.inc   |  77 +---------------
 recipes-core/openjdk/openjdk-postinst.inc | 100 ---------------------
 6 files changed, 194 insertions(+), 261 deletions(-)
 delete mode 100644 recipes-core/openjdk/openjdk-postinst.inc
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/7 openjdk-build-helper: add get_*_arch functions

As different parts of OpenJDK use sightly different names for ARCH'es we provide those translations functions centrally in our openjdk-build-helper class.

---
 classes/openjdk-build-helper.bbclass | 51 ++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
classes/openjdk-build-helper.bbclass +51 -0
index 78906b0..01ed591 100644
@@ -49,3 +49,54 @@ def openjdk_build_helper_get_target_cflags(d):
     if match:
         version = version[match.start():]
     return openjdk_build_helper_get_cflags_by_cc_version(d, version)
+
+# OpenJDK uses slightly different names for certain arches. We need to know
+# this to create some files which are expected by the build.
+def openjdk_build_helper_get_jdk_arch(d):
+    import bb
+
+    jdk_arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
+    if jdk_arch == "x86-64":
+        jdk_arch = "amd64"
+    elif jdk_arch == "powerpc":
+        jdk_arch = "ppc"
+    elif jdk_arch == "powerpc64":
+        jdk_arch = "ppc64"
+    elif jdk_arch in ['i486', 'i586', 'i686']:
+        jdk_arch = "i386"
+
+    return jdk_arch
+
+# Shark also needs slightly different names for certain arches. Due to the fact
+# these differ from the "normal" OpenJDK arch names we have a separate function
+# for Shark here. Furthermore we warn if we think Shark doesn't support the arch
+def openjdk_build_helper_get_llvm_configure_arch(d):
+    import bb;
+
+    arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
+    if arch in ['i386', 'i486', 'i586', 'i686', 'x86-64']:
+        arch = "x86"
+    elif arch in ['mipsel', 'mips']:
+        arch = "mips"
+    elif arch in ['powerpc', 'powerpc64']:
+        arch = "powerpc"
+    elif arch == "arm":
+        arch = "arm"
+    else:
+        if 'shark' in d.getVar('PACKAGECONFIG').split():
+            bb.warn("%s does not support %s in Shark builds yet" % (d.getVar('PN', True), arch) );
+
+    return arch
+
+# Again it seems IcedTea native also needs slightly different names for certain
+# arches. Therefore provide the translation.
+def openjdk_build_helper_get_icedtea_arch(d):
+    import bb;
+
+    arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
+    if arch == "x86-64":
+        arch = "amd64"
+    elif arch in ['i386', 'i486', 'i586', 'i686']:
+        arch = "x86"
+
+    return arch
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/7 openjdk-8: use openjdk_build_helper's ARCH translation functions

In reply to Richard Leitner

As the openjdk_build_helper now provides the ARCH translation function use those and drop the local ones.

---
 recipes-core/openjdk/openjdk-8-common.inc | 43 +++----------------------------
 1 file changed, 3 insertions(+), 40 deletions(-)
recipes-core/openjdk/openjdk-8-common.inc +3 -40
index 7348657..e45bcf4 100644
@@ -160,46 +160,9 @@ do_configure_prepend() {
         export ${@jdk_environment_options(d)}
 }
 
-# A function that is needed in the Shark builds.
-def get_llvm_configure_arch(d):
-    import bb;
-
-    arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
-    if arch == "x86-64" or arch == "i486" or arch == "i586" or arch == "i686":
-        arch = "x86"
-    elif arch == "arm":
-        arch = "arm"
-    elif arch == "mipsel" or arch == "mips":
-        arch = "mips"
-    elif arch == "powerpc" or arch == "powerpc64":
-        arch = "powerpc"
-    else:
-        if 'shark' in d.getVar('PACKAGECONFIG').split():
-            bb.warn("%s does not support %s in Shark builds yet" % (d.getVar('PN', True), arch) );
-
-    return arch
-
-# Provides the target architecture to the configure script.
-export LLVM_CONFIGURE_ARCH="${@get_llvm_configure_arch(d)}"
-
-# OpenJDK uses slightly different names for certain arches. We need to know
-# this to create some files which are expected by the build.
-def get_jdk_arch(d):
-    import bb
-
-    jdk_arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
-    if jdk_arch == "x86-64":
-        jdk_arch = "amd64"
-    elif jdk_arch == "powerpc":
-        jdk_arch = "ppc"
-    elif jdk_arch == "powerpc64":
-        jdk_arch = "ppc64"
-    elif (jdk_arch == "i486" or jdk_arch == "i586" or jdk_arch == "i686"):
-        jdk_arch = "i386"
-
-    return jdk_arch
-
-JDK_ARCH = "${@get_jdk_arch(d)}"
+# Provide the translated target architectures
+export LLVM_CONFIGURE_ARCH="${@openjdk_build_helper_get_llvm_configure_arch(d)}"
+JDK_ARCH = "${@openjdk_build_helper_get_jdk_arch(d)}"
 
 export DEBUG_BINARIES = "true"
 
Signature · 1 line
2.11.0
#3 lore raw

PATCH 3/7 openjdk-7: use openjdk_build_helper's ARCH translation functions

In reply to Richard Leitner

As the openjdk_build_helper now provides the ARCH translation function use those and drop the local ones.

Furthermore remove the duplicated LLVM_CONFIGURE_ARCH export.

---
 recipes-core/openjdk/openjdk-7-common.inc |  3 ---
 recipes-core/openjdk/openjdk-common.inc   | 40 ++-----------------------------
 2 files changed, 2 insertions(+), 41 deletions(-)
recipes-core/openjdk/openjdk-7-common.inc +0 -3
index 0ef6758..6b02a4f 100644
@@ -126,9 +126,6 @@ EXTRA_OEMAKE += ' \
     UNZIP_BIN="${STAGING_BINDIR_NATIVE}/unzip" \
 '
 
-# Provides the target architecture to the configure script.
-export LLVM_CONFIGURE_ARCH="${@get_llvm_configure_arch(d)}"
-
 OE_LAUNCHER_LDFLAGS = "-Wl,-rpath-link,${STAGING_LIBDIR}/llvm${WANT_LLVM_RELEASE} -Wl,-rpath,${libdir}/llvm${WANT_LLVM_RELEASE}"
 
 OE_LAUNCHER_LDFLAGS_arm = ""
recipes-core/openjdk/openjdk-common.inc +2 -38
index 4e2eb94..ce3e39e 100644
@@ -21,46 +21,10 @@ inherit openjdk-build-helper
 
 B = "${S}/build"
 
-# OpenJDK uses slightly different names for certain arches. We need to know
-#	this to create some files which are expected by the build.
-def get_jdk_arch(d):
-    import bb
-
-    jdk_arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
-    if jdk_arch == "x86-64":
-        jdk_arch = "amd64"
-    elif jdk_arch == "powerpc":
-        jdk_arch = "ppc"
-    elif jdk_arch == "powerpc64":
-        jdk_arch = "ppc64"
-    elif (jdk_arch == "i486" or jdk_arch == "i586" or jdk_arch == "i686"):
-        jdk_arch = "i386"
-
-    return jdk_arch
-
-JDK_ARCH = "${@get_jdk_arch(d)}"
+JDK_ARCH = "${@openjdk_build_helper_get_jdk_arch(d)}"
 JDK_HOME = "${libdir_jvm}/${JDK_DIR}"
 JDK_FAKE = "${WORKDIR}/fake-jdk"
 
-# A function that is needed in the Shark builds.
-def get_llvm_configure_arch(d):
-    import bb;
-
-    arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
-    if arch == "x86-64" or arch == "i486" or arch == "i586" or arch == "i686":
-        arch = "x86"
-    elif arch == "arm":
-        arch = "arm"
-    elif arch == "mipsel" or arch == "mips":
-        arch = "mips"
-    elif arch == "powerpc" or arch == "powerpc64":
-        arch = "powerpc"
-    else:
-        if 'shark' in d.getVar('PACKAGECONFIG').split():
-            bb.warn("%s does not support %s in Shark builds yet" % (d.getVar('PN', True), arch) );
-
-    return arch
-
 # Puts an OE specific string into the binary making it possible for the user
 # to know where it comes from (and blame the right people ...).
 DIST_ID = "Built for ${DISTRO}"
@@ -72,7 +36,7 @@ EXTRA_OEMAKE = 'DIST_NAME="${DIST_NAME}" DIST_ID="${DIST_ID}"'
 export WANT_LLVM_RELEASE = "2.8"
 
 # Provides the target architecture to the configure script.
-export LLVM_CONFIGURE_ARCH="${@get_llvm_configure_arch(d)}"
+export LLVM_CONFIGURE_ARCH="${@openjdk_build_helper_get_llvm_configure_arch(d)}"
 
 # Large stack is required at least on x86_64 host, otherwise random segfaults appear:
 QEMU = "${@qemu_target_binary(d)} ${QEMU_OPTIONS} -s 2097152"
Signature · 1 line
2.11.0
#4 lore raw

PATCH 4/7 icedtea7-native: use openjdk_build_helper's ARCH translation functions

In reply to Richard Leitner

As the openjdk_build_helper now provides the ARCH translation function use those and drop the local ones.

---
 recipes-core/icedtea/icedtea7-native.inc | 42 +++-----------------------------
 1 file changed, 3 insertions(+), 39 deletions(-)
recipes-core/icedtea/icedtea7-native.inc +3 -39
index 30fb24a..69f5d25 100644
@@ -175,22 +175,8 @@ do_compile() {
 	# in order to start java when the amount of RAM is limited for the user.
 	export JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS}"
 
-	# OpenJDK uses slightly different names for certain arches. We need to know
-	#	this to create some files which are expected by the build.
-	case "${TRANSLATED_TARGET_ARCH}" in
-		x86-64)
-			arch=amd64
-			libarch=amd64
-		;;
-		i386|i486|i586|i686)
-			arch=x86
-			libarch=x86
-		;;
-		*)
-			arch=${TARGET_ARCH}
-			libarch=${TARGET_ARCH}
-		;;
-	esac
+	arch="${@openjdk_build_helper_get_icedtea_arch(d)}"
+	libarch="${@openjdk_build_helper_get_icedtea_arch(d)}"
 
         install -d openjdk-boot/control/build/linux-$arch/hotspot/import/jre/lib
         if [ $libarch != $arch ]; then
@@ -217,30 +203,8 @@ do_compile() {
         oe_runmake icedtea
 }
 
-def jdk_arch(d):
-        import bb
-
-        target_arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
-
-        if target_arch in ['i386', 'i486', 'i586', 'i686']:
-            return "x86"
-        elif target_arch in ['x86-64']:
-            return "amd64"
-
-        return target_arch
-
 do_install() {
-	case "${TRANSLATED_TARGET_ARCH}" in
-		x86-64)
-			JDK_ARCH=amd64
-		;;
-		i386|i486|i586|i686)
-			JDK_ARCH=x86
-		;;
-		*)
-			JDK_ARCH=${TARGET_ARCH}
-		;;
-	esac
+	JDK_ARCH="${@openjdk_build_helper_get_icedtea_arch(d)}"
 
 	install -d ${JDK_INSTALL_DIR}
 
Signature · 1 line
2.11.0
#5 lore raw

PATCH 5/7 openjdk-7: remove version dependent stuff from openjdk-common

In reply to Richard Leitner

openjdk-common.inc should not contain any OpenJDK-7 dependet stuff. Therefore move it to the openjdk-7-common.inc.

Furhtermore this is a preparation for having openjdk-common.inc for all OpenJDK versions.

---
 recipes-core/openjdk/openjdk-7-common.inc | 38 +++++++++++++++++++++++++++++++
 recipes-core/openjdk/openjdk-common.inc   | 37 ------------------------------
 2 files changed, 38 insertions(+), 37 deletions(-)
recipes-core/openjdk/openjdk-7-common.inc +38 -0
index 6b02a4f..6005394 100644
@@ -1,4 +1,42 @@
+SUMMARY = "Java runtime based upon the OpenJDK- and Icedtea Project"
+HOMEPAGE = "http://icedtea.classpath.org"
+LICENSE  = "GPL-2.0-with-classpath-exception"
+PRIORITY = "optional"
+SECTION  = "libs"
+
+ICEDTEA_VERSION = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[1].split("-")[1] or '1.0'}"
+
+S = "${WORKDIR}/${ICEDTEA}"
+
+DEPENDS_append_libc-uclibc = " virtual/libiconv "
+
+# The OpenJDK build with interpreter optimizations for ARM depends on a binary
+# that generates constants for an assembler source file. There is no other
+# way than to generate this on a pseudo machine. Cross-compiling would not help
+# because structure sizes and/or alignment may differ.
+DEPENDS_append = " qemu-native "
+
+B = "${S}/build"
+
+JDK_HOME = "${libdir_jvm}/${JDK_DIR}"
+JDK_FAKE = "${WORKDIR}/fake-jdk"
+
+# Puts an OE specific string into the binary making it possible for the user
+# to know where it comes from (and blame the right people ...).
+DIST_ID = "Built for ${DISTRO}"
+DIST_NAME = "${DISTRO}"
+EXTRA_OEMAKE = 'DIST_NAME="${DIST_NAME}" DIST_ID="${DIST_ID}"'
+
+# llvm configure and compiles stuff
+export WANT_LLVM_RELEASE = "2.8"
+
+# Large stack is required at least on x86_64 host, otherwise random segfaults appear:
+QEMU = "${@qemu_target_binary(d)} ${QEMU_OPTIONS} -s 2097152"
+
+EXTRA_OEMAKE += 'QEMU="${QEMU}"'
+
 require openjdk-common.inc
+
 ICEDTEA = "icedtea-${ICEDTEA_VERSION}"
 
 INC_PR = "r6"
recipes-core/openjdk/openjdk-common.inc +0 -37
index ce3e39e..01a0a2a 100644
@@ -1,44 +1,7 @@
-SUMMARY = "Java runtime based upon the OpenJDK- and Icedtea Project"
-HOMEPAGE = "http://icedtea.classpath.org"
-LICENSE  = "GPL-2.0-with-classpath-exception"
-PRIORITY = "optional"
-SECTION  = "libs"
-
-ICEDTEA_VERSION = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[1].split("-")[1] or '1.0'}"
-
-S = "${WORKDIR}/${ICEDTEA}"
-
-DEPENDS_append_libc-uclibc = " virtual/libiconv "
-
-# The OpenJDK build with interpreter optimizations for ARM depends on a binary
-# that generates constants for an assembler source file. There is no other
-# way than to generate this on a pseudo machine. Cross-compiling would not help
-# because structure sizes and/or alignment may differ.
-DEPENDS_append = " qemu-native "
-
 inherit java autotools gettext qemu pkgconfig
 inherit openjdk-build-helper
 
-B = "${S}/build"
-
 JDK_ARCH = "${@openjdk_build_helper_get_jdk_arch(d)}"
-JDK_HOME = "${libdir_jvm}/${JDK_DIR}"
-JDK_FAKE = "${WORKDIR}/fake-jdk"
-
-# Puts an OE specific string into the binary making it possible for the user
-# to know where it comes from (and blame the right people ...).
-DIST_ID = "Built for ${DISTRO}"
-DIST_NAME = "${DISTRO}"
-EXTRA_OEMAKE = 'DIST_NAME="${DIST_NAME}" DIST_ID="${DIST_ID}"'
-
-# llvm configure and compiles stuff
-
-export WANT_LLVM_RELEASE = "2.8"
 
 # Provides the target architecture to the configure script.
 export LLVM_CONFIGURE_ARCH="${@openjdk_build_helper_get_llvm_configure_arch(d)}"
-
-# Large stack is required at least on x86_64 host, otherwise random segfaults appear:
-QEMU = "${@qemu_target_binary(d)} ${QEMU_OPTIONS} -s 2097152"
-
-EXTRA_OEMAKE += 'QEMU="${QEMU}"'
Signature · 1 line
2.11.0
#6 lore raw

PATCH 6/7 openjdk-8: use openjdk-common

As openjdk-common.inc now serves all OpenJDK version let openjdk-8-common require it. Furthermore remove the now duplicated lines.

---
 recipes-core/openjdk/openjdk-8-common.inc | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
recipes-core/openjdk/openjdk-8-common.inc +1 -6
index e45bcf4..4d8f935 100644
@@ -4,8 +4,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
+require openjdk-common.inc
 
 AUTOTOOLS_SCRIPT_PATH = "${S}/common/autoconf/"
 export AUTOCONF_DIR="${AUTOTOOLS_SCRIPT_PATH}"
@@ -160,10 +159,6 @@ do_configure_prepend() {
         export ${@jdk_environment_options(d)}
 }
 
-# Provide the translated target architectures
-export LLVM_CONFIGURE_ARCH="${@openjdk_build_helper_get_llvm_configure_arch(d)}"
-JDK_ARCH = "${@openjdk_build_helper_get_jdk_arch(d)}"
-
 export DEBUG_BINARIES = "true"
 
 ALTERNATIVE_PRIORITY = "50"
Signature · 1 line
2.11.0
#7 lore raw

PATCH 7/7 openjdk-7: merge postinst into openjdk-7-common

In reply to Richard Leitner

As openjdk-7-common was the only consumer of openjdk-postinst.inc move it's content and remove openjdk-postinst.inc.

Now all files in recipes-core/openjdk are named correctly according to their versions again.

---
 recipes-core/openjdk/openjdk-7-common.inc | 100 +++++++++++++++++++++++++++++-
 recipes-core/openjdk/openjdk-postinst.inc | 100 ------------------------------
 2 files changed, 99 insertions(+), 101 deletions(-)
 delete mode 100644 recipes-core/openjdk/openjdk-postinst.inc
recipes-core/openjdk/openjdk-7-common.inc +99 -1
index 6005394..56180e2 100644
@@ -356,6 +356,104 @@ JDK_URI = "${ICEDTEA_DROP_URL}/${JDK_FILE};name=jdk;unpack=false"
 LANGTOOLS_FILE = "langtools.tar.bz2"
 LANGTOOLS_URI = "${ICEDTEA_DROP_URL}/${LANGTOOLS_FILE};name=langtools;unpack=false"
 
-require openjdk-postinst.inc
+# handles all postinst action for openjdk
+# some of the former results in a build error because "ERR" is in the first line.
+
+pkg_postinst_${JDKPN}-vm-shark () {
+    true
+    if grep -q "\-server ERROR" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg && ! grep -q "KNOWN" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
+        sed -i -e "/\-shark.*/d" -e "s|\(^\-server*\)|\-shark KNOWN\n\1|" -e "/^$/d" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    else
+        sed -i -e "s/\-shark.*/\-shark KNOWN/" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    fi
+}
+
+pkg_prerm_${JDKPN}-vm-shark () {
+    true
+    sed -i -e "/^\-shark.*/d" -e "/^$/d" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    if grep -q "KNOWN" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg && grep -q "\-server ERROR" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
+        FIRST_KNOWN=`grep "KNOWN" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -n 1`
+        sed -i -e "/${FIRST_KNOWN}/d" -e  "s|\(^\-server*\)|${FIRST_KNOWN}\n\1|" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    fi
+
+    echo "-shark ERROR" >> ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+}
+
+pkg_postinst_${JDKPN}-vm-cacao () {
+    true
+    if grep -q "\-server ERROR" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg && ! grep -q "KNOWN" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
+        sed -i -e "/\-cacao.*/d" -e "s|\(^\-server*\)|\-cacao KNOWN\n\1|" -e "/^$/d" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    else
+        sed -i -e "s/\-cacao.*/\-cacao KNOWN/" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    fi
+}
+
+pkg_prerm_${JDKPN}-vm-cacao () {
+    true
+    sed -i -e "/^\-cacao.*/d" -e "/^$/d" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    if grep -q "KNOWN" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg && grep -q "\-server ERROR" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
+        FIRST_KNOWN=`grep "KNOWN" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -n 1`
+        sed -i -e "/${FIRST_KNOWN}/d" -e  "s|\(^\-server*\)|${FIRST_KNOWN}\n\1|" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    fi
+
+    echo "-cacao ERROR" >> ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+}
+
+pkg_postinst_${JDKPN}-vm-jamvm () {
+    true
+    if grep -q "\-server ERROR" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg && ! grep -q "KNOWN" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
+        sed -i -e "/\-jamvm.*/d" -e "s|\(^\-server*\)|\-jamvm KNOWN\n\1|" -e "/^$/d" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    else
+        sed -i -e "s/\-jamvm.*/\-jamvm KNOWN/" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    fi
+}
+
+pkg_prerm_${JDKPN}-vm-jamvm () {
+    true
+    sed -i -e "/^\-jamvm.*/d" -e "/^$/d" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    if grep -q "KNOWN" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg && grep -q "\-server ERROR" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
+        FIRST_KNOWN=`grep "KNOWN" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -n 1`
+        sed -i -e "/${FIRST_KNOWN}/d" -e  "s|\(^\-server*\)|${FIRST_KNOWN}\n\1|" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    fi
+
+    echo "-jamvm ERROR" >> ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+}
+
+pkg_postinst_${JDKPN}-vm-zero () {
+    true
+    if grep -q "KNOWN" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg && grep -q "\-server ERROR" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
+        FIRST_KNOWN=`grep "KNOWN" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -n 1`
+        sed -i -e "/${FIRST_KNOWN}/d" -e "/^$/d" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+        echo ${FIRST_KNOWN} >> $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    fi
+
+    sed -i -e "s|^\-server.*|\-server KNOWN|" -e "/^$/d" $D/${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+}
+
+pkg_prerm_${JDKPN}-vm-zero () {
+    true
+    sed -i -e "/^\-server.*/\-server ERROR" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    if grep -q "KNOWN" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
+        FIRST_KNOWN=`grep "KNOWN" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg | head -n 1`
+        sed -i -e "/${FIRST_KNOWN}/d" -e  "s|\(^\-server*\)|${FIRST_KNOWN}\n\1|" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
+    fi
+}
+
+pkg_postinst_${JDKPN}-jre () {
+    ln -s ${JDK_HOME}/jre  $D/${libdir}/jvm/jre
+}
+
+inherit update-alternatives
+
+ALTERNATIVE_${JDKPN}-jre = "java keytool"
+ALTERNATIVE_${JDKPN}-jdk = "javac"
+
+ALTERNATIVE_TARGET[java] = "${JDK_HOME}/jre/bin/java"
+ALTERNATIVE_TARGET[javac] = "${JDK_HOME}/bin/javac"
+ALTERNATIVE_TARGET[keytool] = "${JDK_HOME}/jre/bin/keytool"
+
+ALTERNATIVE_LINK_NAME[java] = "${bindir}/java"
+ALTERNATIVE_LINK_NAME[javac] = "${bindir}/javac"
+ALTERNATIVE_LINK_NAME[keytool] = "${bindir}/keytool"
 
 ALTERNATIVE_PRIORITY = "50"
recipes-core/openjdk/openjdk-postinst.inc deleted +0 -100

100 lines not on this page · raw message

Signature · 1 line
2.11.0
#8 lore raw

Re: [meta-java][PATCH 5/7] openjdk-7: remove version dependent stuff from openjdk-common

In reply to Richard Leitner
Quoted 2 lines · Richard Leitner

openjdk-common.inc should not contain any OpenJDK-7 dependet stuff. Therefore move it to the openjdk-7-common.inc.

Hi,

besides the typo, how about the following phrase

"Move the OpenJDK-7 specific parts from openjdk-common.inc to openjdk-7-common.inc."

Bye Henning

#9 lore raw

Re: [meta-java][PATCH 5/7] openjdk-7: remove version dependent stuff from openjdk-common

Quoted 10 lines · Henning Heinold
Quoted 2 lines · Richard Leitner

openjdk-common.inc should not contain any OpenJDK-7 dependet stuff. Therefore move it to the openjdk-7-common.inc.

Hi,

besides the typo, how about the following phrase

"Move the OpenJDK-7 specific parts from openjdk-common.inc to openjdk-7-common.inc."

Your right... That definitely sounds better... Thanks ;-)

regards;Richard.L

#10 lore raw
In reply to Richard Leitner

Hi,
this is a note to let you know that I've just added this series to the master-next branch of the meta-java repository at
git://git.yoctoproject.org/meta-java

As soon as it has gone through some more testing it will likely be merged to the master branch.

If you have any questions, please let me know.

regards;Richard.L

Quoted 22 lines · Richard Leitner

Remove duplicated code in openjdk includes by moving it to the openjdk-build-helper class. Furthermore make the naming of files in recipes-core/openjdk/ consistent again.

Richard Leitner (7):
openjdk-build-helper: add get_*_arch functions
openjdk-8: use openjdk_build_helper's ARCH translation functions
openjdk-7: use openjdk_build_helper's ARCH translation functions
icedtea7-native: use openjdk_build_helper's ARCH translation functions
openjdk-7: remove version dependent stuff from openjdk-common
openjdk-8: use openjdk-common
openjdk-7: merge postinst into openjdk-7-common

 classes/openjdk-build-helper.bbclass      |  51 +++++++++++
 recipes-core/icedtea/icedtea7-native.inc  |  42 +--------
 recipes-core/openjdk/openjdk-7-common.inc | 141 +++++++++++++++++++++++++++++-
 recipes-core/openjdk/openjdk-8-common.inc |  44 +---------
 recipes-core/openjdk/openjdk-common.inc   |  77 +---------------
 recipes-core/openjdk/openjdk-postinst.inc | 100 ---------------------
 6 files changed, 194 insertions(+), 261 deletions(-)
 delete mode 100644 recipes-core/openjdk/openjdk-postinst.inc