summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Werkmeister2019-11-25 00:12:32 +0100
committerLucas Werkmeister2019-11-25 00:45:15 +0100
commit24af891d7edba14302f1b271acb5a92c3045a00d (patch)
tree25f750fa15069c09cef3ef23867332031ba6257d
downloadaur-24af891d7edba14302f1b271acb5a92c3045a00d.tar.gz
Initial commit
With the 19.3.0 release, GraalVM supports two Java versions: Java 8 and Java 11. Accordingly, the former graal-bin package is split into two: jdk8-graalvm-bin and jdk11-graalvm-bin (this package). We use this opportunity to make several other adjustments as well. The main product name seems to be “GraalVM”, not just “Graal”, so we reflect this in the package name and in the Java name. We no longer provide a version of the package name without the “-bin” suffix. It doesn’t seem likely that a built-from-source version will be added to the AUR soon, and other packages like jdk8-openj9-bin or jdk8-j9-bin don’t provide non-bin versions either. We no longer recommend a native-image package. The old package only did this because it used to include that functionality; this new package has never included native-image, so I don’t see the need to recommend it. People interested in it should be able to find it easily enough. A test script is included, which I’d been using locally for some time already. It assumes you’ve locally installed current versions of the GraalVM, FastR, TruffleRuby, GraalPython and native-image packages, and is typically run just before pushing the updated PKGBUILDs to the AUR. Note that the jdk11 version of native-image is not yet functional, so the script currently fails. And finally, a .gitignore file never hurts.
-rw-r--r--.SRCINFO17
-rw-r--r--.gitignore9
-rw-r--r--PKGBUILD25
-rw-r--r--jdk11-graalvm-bin.install47
-rwxr-xr-xtest.sh52
5 files changed, 150 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..a811cd5568d2
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,17 @@
+pkgbase = jdk11-graalvm-bin
+ pkgdesc = Universal virtual machine for running applications written in a variety of languages (JVM-based, LLVM-based, or other), Java 11 version
+ pkgver = 19.3.0
+ pkgrel = 1
+ url = https://www.graalvm.org/
+ install = jdk11-graalvm-bin.install
+ arch = x86_64
+ license = custom
+ depends = java-runtime-common
+ depends = java-environment-common
+ provides = java-runtime=11
+ provides = java-environment=11
+ source = https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-19.3.0/graalvm-ce-java11-linux-amd64-19.3.0.tar.gz
+ sha256sums = 238c5c21bb4aa292caf95b2aca592ce8c1be2f036d93af48cd865f67d558f907
+
+pkgname = jdk11-graalvm-bin
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..3372492e0b3b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+# source
+/*.tar.gz
+
+# build
+/src/
+/pkg/
+
+# package
+/*.pkg.tar*
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..d961ccde8c8e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,25 @@
+# Maintainer: Lucas Werkmeister <mail@lucaswerkmeister.de>
+
+java_=11
+pkgname="jdk${java_}-graalvm-bin"
+pkgver=19.3.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')
+url='https://www.graalvm.org/'
+license=('custom')
+depends=('java-runtime-common'
+ 'java-environment-common')
+makedepends=()
+provides=("java-runtime=${java_}"
+ "java-environment=${java_}")
+install="$pkgname.install"
+source=("https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${pkgver}/graalvm-ce-java${java_}-linux-amd64-${pkgver}.tar.gz")
+sha256sums=('238c5c21bb4aa292caf95b2aca592ce8c1be2f036d93af48cd865f67d558f907')
+
+package() {
+ cd "graalvm-ce-java${java_}-${pkgver}"
+ mkdir -p "$pkgdir/usr/lib/jvm/java-${java_}-graalvm/"
+ cp -a -t "$pkgdir/usr/lib/jvm/java-${java_}-graalvm/" *
+ install -DTm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
diff --git a/jdk11-graalvm-bin.install b/jdk11-graalvm-bin.install
new file mode 100644
index 000000000000..46860d630bbc
--- /dev/null
+++ b/jdk11-graalvm-bin.install
@@ -0,0 +1,47 @@
+THIS_JDK='java-11-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
+}
diff --git a/test.sh b/test.sh
new file mode 100755
index 000000000000..165308404931
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+java_=$(source PKGBUILD && echo $java_)
+
+if ! tmpdir=$(mktemp --directory --tmpdir graalvm-test.XXXX); then
+ exit
+fi
+cd -- "$tmpdir" || exit
+function cleanup {
+ cd / || exit
+ rm -rf -- "$tmpdir"
+}
+trap cleanup EXIT
+PATH=/usr/lib/jvm/java-${java_}-graalvm/bin/:$(systemd-path search-binaries-default)
+
+printf '%s\n' 'Testing polyglot R, JavaScript, Python, Ruby, and Java...'
+
+cat > test.R << 'EOF'
+jsPlus = eval.polyglot('js', '(function(s1, s2) { return s1 + s2; })')
+pythonPlus = eval.polyglot('python', 'lambda s1, s2: s1 + s2')
+rubyOne = eval.polyglot('ruby', '1')
+pythonOne = eval.polyglot('python', '1')
+rOne = 1
+jvmPrint = java.type("java.lang.System")$out$println
+jvmPrint(pythonPlus(jsPlus(rubyOne, pythonOne), rOne))
+EOF
+
+rThree=$(Rscript --polyglot --jvm test.R) || exit
+if [[ $rThree != 3 ]]; then
+ printf 'expected 3, got %q\n' "$rThree"
+ exit 1
+fi
+
+printf '%s\n' 'Testing native image...'
+
+cat > Test.java << 'EOF'
+public class Test {
+ public static void main(String[] args) {
+ System.out.println("Hello, world!");
+ }
+}
+EOF
+javac Test.java || exit
+native-image Test > /dev/null || exit
+
+helloWorld=$(./test) || exit
+if [[ $helloWorld != 'Hello, world!' ]]; then
+ printf 'expected "Hello, world!", got %q\n' "$helloWorld"
+ exit 1
+fi
+
+printf '%s\n' 'Done.'