diff options
author | Thiago Kenji Okada <thiagokokada@gmail.com> | 2021-10-19 14:03:00 -0300 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2021-10-20 09:56:47 +0200 |
commit | 8abb6e72c91ef08847dca4f1f35d0e76d1b7c338 (patch) | |
tree | ce8f4e13923c6ffd0b93109ad66b90dbbec5ae8f /pkgs/development/compilers/graalvm | |
parent | f00a3308d124f7d91f968437b50863932115e0d0 (diff) |
graalvm-ce: 21.2.0 -> 21.3.0
- Drop graalvm8 since it was removed by upstream - Add update.sh script to make it easier to generate hashes for all platforms - Fix GraalPython, broken since #141825 (sorry) - Small refactorings and fixes
Diffstat (limited to 'pkgs/development/compilers/graalvm')
-rw-r--r-- | pkgs/development/compilers/graalvm/community-edition/default.nix | 19 | ||||
-rw-r--r-- | pkgs/development/compilers/graalvm/community-edition/hashes.nix | 43 | ||||
-rw-r--r-- | pkgs/development/compilers/graalvm/community-edition/mkGraal.nix (renamed from pkgs/development/compilers/graalvm/community-edition/repository.nix) | 108 | ||||
-rwxr-xr-x | pkgs/development/compilers/graalvm/community-edition/update.sh | 59 | ||||
-rw-r--r-- | pkgs/development/compilers/graalvm/community-edition/version | 1 |
5 files changed, 147 insertions, 83 deletions
diff --git a/pkgs/development/compilers/graalvm/community-edition/default.nix b/pkgs/development/compilers/graalvm/community-edition/default.nix index 1aa1fbc117758..1921b1c4f58d2 100644 --- a/pkgs/development/compilers/graalvm/community-edition/default.nix +++ b/pkgs/development/compilers/graalvm/community-edition/default.nix @@ -1,21 +1,18 @@ -{ callPackage, Foundation }: +{ lib, callPackage, Foundation }: let - mkGraal = opts: callPackage (import ./repository.nix opts) { + mkGraal = opts: callPackage (import ./mkGraal.nix opts) { inherit Foundation; }; -in { +in +{ inherit mkGraal; - graalvm8-ce = mkGraal rec { - version = "21.2.0"; - javaVersion = "8"; - platforms = ["x86_64-linux"]; - }; - graalvm11-ce = mkGraal rec { - version = "21.2.0"; + version = lib.fileContents ./version; javaVersion = "11"; - platforms = ["x86_64-linux" "aarch64-linux" "x86_64-darwin"]; + platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ]; }; + + # TODO: added graalvm17-ce } diff --git a/pkgs/development/compilers/graalvm/community-edition/hashes.nix b/pkgs/development/compilers/graalvm/community-edition/hashes.nix new file mode 100644 index 0000000000000..2f59a40f9c9ac --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/hashes.nix @@ -0,0 +1,43 @@ +# Generated by ./update.sh script +{ javaVersionPlatform, ... }: +[ + { + sha256 = { + "11-linux-aarch64" = "0hsjxp6ly7jsn9k94fddcl7afc5gda66jyppcnfvslishbizqd0i"; + "11-linux-amd64" = "1ylk5l933z813k0k1xlayiv8fa0f1gmpr66bma51532iy3mch6rs"; + "11-darwin-amd64" = "0qpqnnmqxvxzj3mwz05acpg4n8ffqsz0sji8lbl03fgswpvgfavc"; + }.${javaVersionPlatform} or null; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.3.0/graalvm-ce-java${javaVersionPlatform}-21.3.0.tar.gz"; + } + { + sha256 = { + "11-linux-aarch64" = "0qlmg5fwvqsb5ab3irj2hrcd5jc94mibnlz1gvzpnq85rw1zcb6h"; + "11-linux-amd64" = "0kvnjr55rizy53vn0ff9w27z1qh9d1vp3s7r1kdl0wyhrbhd8n49"; + "11-darwin-amd64" = "1mg8c8hh8wmbwsisgarmp35jd0dall1fwdv49mggp74hicbc32h3"; + }.${javaVersionPlatform} or null; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.3.0/native-image-installable-svm-java${javaVersionPlatform}-21.3.0.jar"; + } + { + sha256 = { + "11-linux-aarch64" = "02rvwl1nng8d3qn226rjx5yq2blxs4yz009ab928qanhmb4vhv8b"; + "11-linux-amd64" = "0zz62zr7imjaw9a3j5m66xs7c72cqb1i74ab3rnlh0dgs1mdpljg"; + "11-darwin-amd64" = "1wiv0299b2xrc229alczmjfj1bsn90p0wdm64rr39xnyyhbqrr80"; + }.${javaVersionPlatform} or null; + url = "https://github.com/oracle/truffleruby/releases/download/vm-21.3.0/ruby-installable-svm-java${javaVersionPlatform}-21.3.0.jar"; + } + { + sha256 = { + "11-linux-aarch64" = "1ck4c1z98h1zn4i6xhh1hb6w2jab6n17ddykb72xxw4vig9nhlc7"; + "11-linux-amd64" = "0gy8jj9d9msmj0i44sysiwq3j2k2w2g47fhq6y1aq47n3kmwj9kv"; + "11-darwin-amd64" = "0agw6k3jn2jh8wyc9h8rvzlgs96qh4nlj0y8nyzsmidvwq2ahl00"; + }.${javaVersionPlatform} or null; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.3.0/wasm-installable-svm-java${javaVersionPlatform}-21.3.0.jar"; + } + { + sha256 = { + "11-linux-amd64" = "1l5av2v459q88zfl83877h7b3426z3d86kp6wqjvz2441brvidi0"; + "11-darwin-amd64" = "06694n74dzsfwlli1sjdsrfbj9ngw7bhrcayvy4sgy2va5qpdjs0"; + }.${javaVersionPlatform} or null; + url = "https://github.com/graalvm/graalpython/releases/download/vm-21.3.0/python-installable-svm-java${javaVersionPlatform}-21.3.0.jar"; + } +] diff --git a/pkgs/development/compilers/graalvm/community-edition/repository.nix b/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix index 5b3cdf75bc5b5..8b0ff22af0a1a 100644 --- a/pkgs/development/compilers/graalvm/community-edition/repository.nix +++ b/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix @@ -24,55 +24,20 @@ let javaVersionPlatform = "${javaVersion}-${platform}"; graalvmXXX-ce = stdenv.mkDerivation rec { + inherit version; name = "graalvm${javaVersion}-ce"; - srcs = [ - (fetchurl { - sha256 = { - "8-linux-amd64" = "01gyxjmfp7wpcyn7x8b184fn0lp3xryfw619bqch120pzvr6z88f"; - "11-linux-aarch64" = "sha256-u9841eaHH347JHCrm5u3YGZ9RSTuKiDq368TY2otAYw="; - "11-linux-amd64" = "0w7lhvxm4nggqdcl4xrhdd3y6dqw9jhyca9adjkp508n4lqf1lxv"; - "11-darwin-amd64" = "0dnahicdl0vhrbiml9z9nbb7k75hbsjj8rs246i1lwril12dqb7n"; - }.${javaVersionPlatform}; - url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/graalvm-ce-java${javaVersionPlatform}-${version}.tar.gz"; - }) - (fetchurl { - sha256 = { - "8-linux-amd64" = "1jlvrxdlbsmlk3ia43h9m29kmmdn83h6zdlnf8qb7bm38c84nhsc"; - "11-linux-aarch64" = "sha256-7W5gkhj2kON2ocrGpyH/OL/phOyHkjNDId2CtyUAEWY="; - "11-linux-amd64" = "1ybd7a6ii6582skr0nkxx7bccsa7gkg0yriql2h1lcz0rfzcdi3g"; - "11-darwin-amd64" = "1jdy845vanmz05zx5b9227gb1msh9wdrz2kf3fx9z54ssd9qgdhm"; - }.${javaVersionPlatform}; - url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/native-image-installable-svm-java${javaVersionPlatform}-${version}.jar"; - }) - (fetchurl { - sha256 = { - "8-linux-amd64" = "18ip0ay06q1pryqs8ja988mvk9vw475c0nfjcznnsd1zp296p6jc"; - "11-linux-aarch64" = "sha256-i9ysgqbI52PiXofZQ5AnPSzs2TeR8An5CIYzcwhx28o="; - "11-linux-amd64" = "1jszz97mkqavxzyhx5jxhi43kqjxk9c36j5l5hy3kn8sdfmbplm4"; - "11-darwin-amd64" = "1767ryhv2cn5anlys63ysax1p8ag79bykac1xfrjfan8yv6d8ybl"; - }.${javaVersionPlatform}; - url = "https://github.com/oracle/truffleruby/releases/download/vm-${version}/ruby-installable-svm-java${javaVersionPlatform}-${version}.jar"; - }) - (fetchurl { - sha256 = { - "8-linux-amd64" = "08s36rjy5irg25b7lqx0m4v2wpywin3cqyhdrywhvq14f7zshsd5"; - "11-linux-aarch64" = "sha256-Lkc/mq1w18+PQ5McvLGyQBSOz/TMSUgwioRZ0Dtyhm4="; - "11-linux-amd64" = "1ybjaknmbsdg8qzb986x39fq0h7fyiymdcigc7y86swk8dd916hv"; - "11-darwin-amd64" = "02dwlb62kqr4rjjmvkhn2xk9l1p47ahg9xyyfkw7im1jwlqmqnzf"; - }.${javaVersionPlatform}; - url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/wasm-installable-svm-java${javaVersionPlatform}-${version}.jar"; - }) - ] ++ lib.optionals (platform == "amd64") [ - # graalpython is not available on aarch64 platforms yet - (fetchurl { - sha256 = { - "8-linux-amd64" = "0il15438qnikqsxdsl7fcdg0c8zs3cbm4ry7pys7fxxr1ckd8szq"; - "11-linux-amd64" = "07759sr8nijvqm8aqn69x9vq7lyppns7a6l6xribv43jvfmwpfkl"; - "11-darwin-amd64" = "01l3as8dihc7xqy5sdkrpxmpzrqbcvvg84m2s6j1j8y2db1khf2s"; - }.${javaVersionPlatform}; - url = "https://github.com/graalvm/graalpython/releases/download/vm-${version}/python-installable-svm-java${javaVersionPlatform}-${version}.jar"; - }) - ]; + srcs = + let + # Some platforms doesn't have all GraalVM features + # e.g.: GraalPython on aarch64-linux + # When the platform doesn't have a feature, sha256 is null on hashes.nix + # To update hashes.nix file, run `./update.sh <graalvm-ce-version>` + maybeFetchUrl = url: if url.sha256 != null then (fetchurl url) else null; + in + (lib.remove null + (map + maybeFetchUrl + (import ./hashes.nix { inherit javaVersionPlatform; }))); buildInputs = lib.optionals stdenv.isLinux [ alsa-lib # libasound.so wanted by lib/libjsound.so @@ -168,16 +133,6 @@ let done ''; in { - "8-linux-amd64" = '' - ${nativePRNGWorkaround "$out/jre/lib/security/java.security"} - - ${copyClibrariesToOut "$out/jre/lib/svm/clibraries"} - - ${copyClibrariesToLib} - - # allow using external truffle-api.jar and languages not included in the distrubution - rm $out/jre/lib/jvmci/parentClassLoader.classpath - ''; "11-linux-amd64" = '' ${nativePRNGWorkaround "$out/conf/security/java.security"} @@ -265,37 +220,47 @@ let '' } + ${# TODO: Doesn't work on MacOS, we have this error: + # "Launching JShell execution engine threw: Operation not permitted (Bind failed)" + lib.optionalString (stdenv.isLinux) '' + echo "Testing Jshell" + echo '1 + 1' | $out/bin/jshell + '' + } + ${ - lib.optionalString (platform == "amd64") '' - echo "Testing interpreted languages" + lib.optionalString (platform != "linux-aarch64") '' + echo "Testing GraalPython" $out/bin/graalpython -c 'print(1 + 1)' - $out/bin/ruby -e 'puts(1 + 1)' - echo '1 + 1' | $out/bin/graalpython '' } + echo "Testing TruffleRuby" + $out/bin/ruby -e 'puts(1 + 1)' + ${# TODO: `irb` on MacOS gives an error saying "Could not find OpenSSL # headers, install via Homebrew or MacPorts or set OPENSSL_PREFIX", even # though `openssl` is in `propagatedBuildInputs`. For more details see: # https://github.com/NixOS/nixpkgs/pull/105815 # TODO: "truffleruby: an internal exception escaped out of the interpreter" # error on linux-aarch64 - lib.optionalString (platform == "linux-amd64") '' + # TODO: "core/kernel.rb:234:in `gem_original_require': + # /nix/store/wlc5xalzj2ip1l83siqw8ac5fjd52ngm-graalvm11-ce/languages/llvm/native/lib: + # cannot read file data: Is a directory (RuntimeError)" error on linux-amd64 + lib.optionalString false '' echo '1 + 1' | $out/bin/irb '' } + ''; - ${# TODO: Doesn't work on MacOS, we have this error: - # "Launching JShell execution engine threw: Operation not permitted (Bind failed)" - lib.optionalString (javaVersion == "11" && stdenv.isLinux) '' - echo '1 + 1' | $out/bin/jshell - '' - }''; - - passthru.home = graalvmXXX-ce; + passthru = { + home = graalvmXXX-ce; + updateScript = ./update.sh; + }; meta = with lib; { + inherit platforms; homepage = "https://www.graalvm.org/"; description = "High-Performance Polyglot VM"; license = with licenses; [ upl gpl2Classpath bsd3 ]; @@ -308,7 +273,6 @@ let ericdallo thiagokokada ]; - platforms = platforms; }; }; in graalvmXXX-ce diff --git a/pkgs/development/compilers/graalvm/community-edition/update.sh b/pkgs/development/compilers/graalvm/community-edition/update.sh new file mode 100755 index 0000000000000..df213d1bcb286 --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/update.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env nix-shell +#!nix-shell -p curl -i bash coreutils nix common-updater-scripts curl jq + +set -eou pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")" + +info() { echo "[INFO] $*"; } + +echo_file() { echo "$@" >> hashes.nix; } + +if [[ -z "${1:-}" ]]; then + readonly gh_version="$(curl -s https://api.github.com/repos/graalvm/graalvm-ce-builds/releases/latest | jq --raw-output .tag_name)" + readonly version="${gh_version//vm-/}" +else + readonly version="$1" +fi + +readonly urls=( + "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/graalvm-ce-java@platform@-${version}.tar.gz" + "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/native-image-installable-svm-java@platform@-${version}.jar" + "https://github.com/oracle/truffleruby/releases/download/vm-${version}/ruby-installable-svm-java@platform@-${version}.jar" + "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/wasm-installable-svm-java@platform@-${version}.jar" + "https://github.com/graalvm/graalpython/releases/download/vm-${version}/python-installable-svm-java@platform@-${version}.jar" +) + +readonly platforms=( + "11-linux-aarch64" + "11-linux-amd64" + "11-darwin-amd64" +) + +info "Deleting old hashes.nix file..." +rm -f hashes.nix +info "Generating hashes.nix file for 'graalvm-ce' v$version. This will take a while..." + +echo_file "# Generated by $0 script" +echo_file "{ javaVersionPlatform, ... }:" +echo_file "[" + +for url in "${urls[@]}"; do + echo_file " {" + echo_file " sha256 = {" + for platform in "${platforms[@]}"; do + if hash="$(nix-prefetch-url "${url//@platform@/$platform}")"; then + echo_file " \"$platform\" = \"$hash\";" + fi + done + echo_file ' }.${javaVersionPlatform} or null;' + echo_file " url = \"${url//@platform@/\$\{javaVersionPlatform\}}\";" + echo_file " }" +done + +echo_file "]" + +info "Updating 'version' file..." +echo "$version" > version + +info "Done!" diff --git a/pkgs/development/compilers/graalvm/community-edition/version b/pkgs/development/compilers/graalvm/community-edition/version new file mode 100644 index 0000000000000..54d3ad73646dd --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/version @@ -0,0 +1 @@ +21.3.0 |