summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Werkmeister2019-11-25 00:02:33 +0100
committerLucas Werkmeister2019-11-25 00:02:33 +0100
commitda7f4613c098290a487127869aa814ace8a3ba61 (patch)
tree2513859f65181a8f6276692b5578e45bbc2807ce
downloadaur-da7f4613c098290a487127869aa814ace8a3ba61.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 (this package) and jdk11-graalvm-bin. 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. For backwards compatibility, if we detect the user’s default Java was java-8-graal, we set it to this package’s java-8-graalvm instead. 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. And finally, a .gitignore file never hurts.
-rw-r--r--.SRCINFO17
-rw-r--r--.gitignore9
-rw-r--r--PKGBUILD25
-rw-r--r--jdk8-graalvm-bin.install51
-rwxr-xr-xtest.sh52
5 files changed, 154 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..fabd319ca435
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,17 @@
+pkgbase = jdk8-graalvm-bin
+ pkgdesc = Universal virtual machine for running applications written in a variety of languages (JVM-based, LLVM-based, or other), Java 8 version
+ pkgver = 19.3.0
+ pkgrel = 1
+ url = https://www.graalvm.org/
+ install = jdk8-graalvm-bin.install
+ arch = x86_64
+ license = custom
+ depends = java-runtime-common
+ depends = java-environment-common
+ provides = java-runtime=8
+ provides = java-environment=8
+ source = https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-19.3.0/graalvm-ce-java8-linux-amd64-19.3.0.tar.gz
+ sha256sums = 4442d3dfade1175f6905106757929113f1e74bc5c50156dc6a70c04759ac2660
+
+pkgname = jdk8-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..6e8b7b0e1dff
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,25 @@
+# Maintainer: Lucas Werkmeister <mail@lucaswerkmeister.de>
+
+java_=8
+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=('4442d3dfade1175f6905106757929113f1e74bc5c50156dc6a70c04759ac2660')
+
+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/jdk8-graalvm-bin.install b/jdk8-graalvm-bin.install
new file mode 100644
index 000000000000..7087ce4cebe2
--- /dev/null
+++ b/jdk8-graalvm-bin.install
@@ -0,0 +1,51 @@
+THIS_JDK='java-8-graalvm'
+THIS_JDK_LEGACY='java-8-graal'
+
+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
+ "" | ${THIS_JDK}/jre | ${THIS_JDK_LEGACY})
+ /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}" -o "x${default}" = "x${THIS_JDK}/jre" ]; 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
+ if [ -x /usr/lib/jvm/${THIS_JDK}/jre/bin/java ]; then
+ /usr/bin/archlinux-java set ${THIS_JDK}/jre
+ fi
+ 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.'