From f469bee72849968c46aad1f13001e2a611603f91 Mon Sep 17 00:00:00 2001 From: nyyu Date: Fri, 22 Sep 2023 19:03:06 +0200 Subject: [PATCH] add jdk21-graalvm-bin --- jdk21-graalvm-bin/.SRCINFO | 25 ++++++++++ jdk21-graalvm-bin/PKGBUILD | 35 ++++++++++++++ .../graalvm-rebuild-libpolyglot.hook | 11 +++++ jdk21-graalvm-bin/jdk21-graalvm-bin.install | 47 +++++++++++++++++++ 4 files changed, 118 insertions(+) create mode 100644 jdk21-graalvm-bin/.SRCINFO create mode 100644 jdk21-graalvm-bin/PKGBUILD create mode 100644 jdk21-graalvm-bin/graalvm-rebuild-libpolyglot.hook create mode 100644 jdk21-graalvm-bin/jdk21-graalvm-bin.install diff --git a/jdk21-graalvm-bin/.SRCINFO b/jdk21-graalvm-bin/.SRCINFO new file mode 100644 index 0000000..22b697d --- /dev/null +++ b/jdk21-graalvm-bin/.SRCINFO @@ -0,0 +1,25 @@ +pkgbase = jdk21-graalvm-bin + pkgdesc = Universal virtual machine for running applications written in a variety of languages (JVM-based, LLVM-based, or other), Java 21 version + pkgver = 21.0.0 + pkgrel = 1 + url = https://www.graalvm.org/ + install = jdk21-graalvm-bin.install + arch = x86_64 + arch = aarch64 + license = custom + depends = java-runtime-common + depends = java-environment-common + optdepends = graaljs-jdk21-bin: JavaScript component (used to be bundled with this package before the 22.2.0 release) + optdepends = graal-llvm-jdk21-bin: LLVM component (used to be bundled with this package before the 22.2.0 release) + optdepends = graal-visualvm-jdk21-bin: VisualVM component (used to be bundled with this package before the 22.2.0 release) + provides = java-runtime=21 + provides = java-environment=21 + options = staticlibs + source = graalvm-rebuild-libpolyglot.hook + sha256sums = eae72b5a2a2826eed7e4be5710d33f82934622a390ab6a9f009ed7753359e02e + source_x86_64 = https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.0/graalvm-community-jdk-21.0.0_linux-x64_bin.tar.gz + sha256sums_x86_64 = 6c422941ccc58be5b891bb6499feeb72cd2b74d6729a29bf1fb8cc1a7d58b319 + source_aarch64 = https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.0/graalvm-community-jdk-21.0.0_linux-aarch64_bin.tar.gz + sha256sums_aarch64 = bb4e92cf7eae91e474061aeae5ae75053a65cd558dbee76947827bf54d1b30a5 + +pkgname = jdk21-graalvm-bin diff --git a/jdk21-graalvm-bin/PKGBUILD b/jdk21-graalvm-bin/PKGBUILD new file mode 100644 index 0000000..6726add --- /dev/null +++ b/jdk21-graalvm-bin/PKGBUILD @@ -0,0 +1,35 @@ +graal_=21.0.0 +jdk_=${graal_%%+*} +java_=${jdk_%%.*} +pkgname="jdk${java_}-graalvm-bin" +pkgver=21.0.0 +pkgrel=1 +pkgdesc="Universal virtual machine for running applications written in a variety of languages (JVM-based, LLVM-based, or other), Java ${java_} version" +arch=('x86_64' + 'aarch64') +url='https://www.graalvm.org/' +license=('custom') +depends=('java-runtime-common' + 'java-environment-common') +makedepends=() +optdepends=("graaljs-jdk${java_}-bin: JavaScript component (used to be bundled with this package before the 22.2.0 release)" + "graal-llvm-jdk${java_}-bin: LLVM component (used to be bundled with this package before the 22.2.0 release)" + "graal-visualvm-jdk${java_}-bin: VisualVM component (used to be bundled with this package before the 22.2.0 release)") +provides=("java-runtime=${java_}" + "java-environment=${java_}") +options=('staticlibs') +install="$pkgname.install" +source=('graalvm-rebuild-libpolyglot.hook') +sha256sums=('eae72b5a2a2826eed7e4be5710d33f82934622a390ab6a9f009ed7753359e02e') +sha256sums_x86_64=('6c422941ccc58be5b891bb6499feeb72cd2b74d6729a29bf1fb8cc1a7d58b319') +sha256sums_aarch64=('bb4e92cf7eae91e474061aeae5ae75053a65cd558dbee76947827bf54d1b30a5') +source_x86_64=("https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${jdk_}/graalvm-community-jdk-${jdk_}_linux-x64_bin.tar.gz") +source_aarch64=("https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${jdk_}/graalvm-community-jdk-${jdk_}_linux-aarch64_bin.tar.gz") + +package() { + cd "graalvm-community-openjdk-21+35.1" + mkdir -p "$pkgdir/usr/lib/jvm/java-${java_}-graalvm/" + cp -a -t "$pkgdir/usr/lib/jvm/java-${java_}-graalvm/" * + sed "s/JAVA/${java_}/g" < "../graalvm-rebuild-libpolyglot.hook" > "graalvm-jdk${java_}-rebuild-libpolyglot.hook" + install -DTm644 "graalvm-jdk${java_}-rebuild-libpolyglot.hook" "$pkgdir/usr/share/libalpm/hooks/graalvm-jdk${java_}-rebuild-libpolyglot.hook" +} diff --git a/jdk21-graalvm-bin/graalvm-rebuild-libpolyglot.hook b/jdk21-graalvm-bin/graalvm-rebuild-libpolyglot.hook new file mode 100644 index 0000000..9f35151 --- /dev/null +++ b/jdk21-graalvm-bin/graalvm-rebuild-libpolyglot.hook @@ -0,0 +1,11 @@ +[Trigger] +Type = Path +Operation = Install +Operation = Upgrade +Operation = Remove +Target = usr/lib/jvm/java-JAVA-graalvm/* + +[Action] +Description = Suggest rebuilding GraalVM libpolyglot component +When = PostTransaction +Exec = /usr/bin/printf '%s\n' 'Changes to GraalVM detected.' 'You may need to rebuild libpolyglot (and possibly other components) with the following command:' ' /usr/lib/jvm/java-JAVA-graalvm/bin/gu rebuild libpolyglot' "Note that this will take a while (which is why it's not done automatically):" 'the package maintainer has experienced CPU times upwards of _four hours_.' '(However, it parallelizes fairly well, so wall-clock time will depend on your CPU.)' "If you don't rebuild libpolyglot, then --polyglot without --jvm probably won't work right." diff --git a/jdk21-graalvm-bin/jdk21-graalvm-bin.install b/jdk21-graalvm-bin/jdk21-graalvm-bin.install new file mode 100644 index 0000000..7755460 --- /dev/null +++ b/jdk21-graalvm-bin/jdk21-graalvm-bin.install @@ -0,0 +1,47 @@ +THIS_JDK='java-21-graalvm' + +fix_default() { + if [ ! -x /usr/bin/java ]; then + /usr/bin/archlinux-java unset + echo "" + else + /usr/bin/archlinux-java get + fi +} + +post_install() { + default=$(fix_default) + case ${default} in + "") + /usr/bin/archlinux-java set ${THIS_JDK} + ;; + ${THIS_JDK}) + # Nothing + ;; + *) + echo "Default Java environment is already set to '${default}'" + echo "See 'archlinux-java help' to change it" + ;; + esac + + if [ ! -f /etc/ssl/certs/java/cacerts ]; then + /usr/bin/update-ca-trust + fi +} + +post_upgrade() { + default=$(fix_default) + if [ -z "${default}" ]; then + /usr/bin/archlinux-java set ${THIS_JDK} + fi + + if [ ! -f /etc/ssl/certs/java/cacerts ]; then + /usr/bin/update-ca-trust + fi +} + +pre_remove() { + if [ "x$(fix_default)" = "x${THIS_JDK}" ]; then + /usr/bin/archlinux-java unset + fi +}