michaellass/AUR

adoptopenjdk: allow to use openj9 JVM

milahu opened this issue · 3 comments

here is a patch to allow changing the default hotspot JVM
to the alternative openj9 JVM

edit: already exists as jdk14-openj9-bin

$ yay -Ss openj9-bin | grep ^aur | awk '{ print $1 }'
aur/jdk13-openj9-bin
aur/jdk14-openj9-bin
aur/jdk12-openj9-bin
aur/jdk10-openj9-bin
aur/jdk-openj9-bin
aur/jdk11-openj9-bin
aur/jdk9-openj9-bin
aur/jdk8-openj9-bin

see "help me choose" on https://adoptopenjdk.net/

in my case, the adopt compiler is two times slower
than the oracle compiler from java-jdk-14
but the runtime perf should be better

not sure if this is worth an extra AUR package

--- a/jdk-adoptopenjdk/PKGBUILD
+++ b/jdk-adoptopenjdk/PKGBUILD
@@ -14,8 +14,32 @@
 pkgver=${_completever}.u${_updatever}
 _tag_ver=${_completever}+${_updatever}
 
+#_jvm='hotspot'
+_jvm='openj9'
+# HotSpot is the VM from the OpenJDK community.
+#   It is the most widely used VM today and is used in Oracle’s JDK.
+#   It is suitable for all workloads.
+# Eclipse OpenJ9 is the VM from the Eclipse community.
+#   It is an enterprise-grade VM designed for low memory footprint and fast start-up
+#   and is used in IBM’s JDK. It is suitable for running all workloads.
+
+_tag_ver_jvm="${_tag_ver}"
+if [ "$_jvm" = 'openj9' ]; then
+  _tag_ver_jvm="${_tag_ver}_openj9-0.23.0"
+fi
+
 pkgname=jdk-adoptopenjdk
+if [ "$_jvm" = 'openj9' ]; then
+  pkgname="${pkgname}-openj9"
+fi
+
 pkgdesc="OpenJDK Java ${_majorver} development kit (AdoptOpenJDK build)"
+if [ "$_jvm" = 'openj9' ]; then
+  pkgdesc="${pkgdesc} (OpenJ9 JVM)"
+else
+  pkgdesc="${pkgdesc} (Hotspot JVM)"
+fi
+
 arch=('x86_64')
 url='https://adoptopenjdk.net/'
 license=('custom')
@@ -54,7 +78,7 @@
         etc/${pkgname}/sound.properties)
 install=install_jdk-adoptopenjdk.sh
 
-source=(https://github.com/AdoptOpenJDK/openjdk${_majorver}-binaries/releases/download/jdk-${_tag_ver/+/%2B}/OpenJDK${_majorver}U-jdk_x64_linux_hotspot_${_tag_ver/+/_}.tar.gz
+source=(https://github.com/AdoptOpenJDK/openjdk${_majorver}-binaries/releases/download/jdk-${_tag_ver_jvm/+/%2B}/OpenJDK${_majorver}U-jdk_x64_linux_${_jvm}_${_tag_ver_jvm/+/_}.tar.gz
         freedesktop-java.desktop
         freedesktop-jconsole.desktop
         freedesktop-jshell.desktop)
@@ -63,7 +87,16 @@
             'dafd84555287f16a59d4c7603167efc2a64a632780b6d8de109e75d6aa29782e'
             '4f05bf04f6397e9586881951116b3a12ae8336142e8be0caf196eaee1444c03f')
 
+if [ "$_jvm" = 'openj9' ]; then
+  # OpenJDK15U-jdk_x64_linux_openj9_15.0.1_9_openj9-0.23.0.tar.gz
+  sha256sums[0]='b1561f7a69c977bfc9991e61e96dcb200c39300dd9ad423254af117c189e4a8d'
+fi
+
 _jvmdir=/usr/lib/jvm/java-${_majorver}-adoptopenjdk
+if [ "$_jvm" = 'openj9' ]; then
+  _jvmdir="${_jvmdir}-openj9"
+fi
+
 _jdkdir=jdk-${_tag_ver}
 
 package() {

Hey, thanks for digging into this! I also thought about this option or alternatively a split package. However, we have all the .desktop files as well as the install script which would need to be changed for the openj9 variant. With all of those, I think it's simpler to generate an entirely separate package for the openj9 variant.

Would you be interested in maintaining such a package in AUR? I could do it but I probably would not use it myself, so maybe you are more qualified to maintain such a package.

edit: already exists as jdk14-openj9-bin

sorry for the ninja edit

Well hidden edit indeed 😄

Alright, jdk14-openj9-bin looks quite different to this package but it implements what has been requested (adoptopenjdk build with openj9 VM). So I'll close this issue for now.

If there's anything I missed, feel free to reopen or create your own AUR package based on this one.