graalvm-ce-20.2.0 -> 20.3.0 + darwin support. (#105815)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
wip/yesman
Stevan Andjelkovic 3 years ago committed by GitHub
parent e83ab2e04d
commit bf6df7187e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 142
      pkgs/development/compilers/graalvm/community-edition.nix
  2. 2
      pkgs/development/interpreters/clojure/babashka.nix
  3. 7
      pkgs/development/tools/clj-kondo/default.nix
  4. 6
      pkgs/top-level/all-packages.nix

@ -1,48 +1,60 @@
{ lib, stdenv, fetchurl, perl, unzip, glibc, zlib, setJavaClassPath }:
{ lib, stdenv, fetchurl, perl, unzip, glibc, zlib, setJavaClassPath, Foundation, openssl }:
let
platform = if stdenv.isDarwin then "darwin-amd64" else "linux-amd64";
common = javaVersion:
let
javaVersionPlatform = "${javaVersion}-${platform}";
graalvmXXX-ce = stdenv.mkDerivation rec {
pname = "graalvm${javaVersion}-ce";
version = "20.2.0";
version = "20.3.0";
srcs = [
(fetchurl {
sha256 = { "8" = "1s64zkkrns1ykh6dwpjrqy0hs9m1bb08cf7ss7msx33h9ivir5b0";
"11" = "0aaf0sjsnlckhgsh3j4lph0shahw6slf4yndqcm2swc8i1dlpdsx";
}.${javaVersion};
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/graalvm-ce-java${javaVersion}-linux-amd64-${version}.tar.gz";
sha256 = { "8-linux-amd64" = "195b20ivvv8ipjn3qq2313j8qf96ji93pqm99nvn20bq23wasp25";
"11-linux-amd64" = "1mdk1zhazvvh1fa01bzi5v5fxhvx592xmbakx0y1137vykbayyjm";
"8-darwin-amd64" = "1rrs471204p71knyxpjxymdi8ws98ph2kf5j0knk529g0d24rs01";
"11-darwin-amd64" = "008dl8dbf37mv4wahb9hbd6jp8svvmpy1rgsiqkn3i4hypxnkf12";
}.${javaVersionPlatform};
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/graalvm-ce-java${javaVersionPlatform}-${version}.tar.gz";
})
(fetchurl {
sha256 = { "8" = "1cisyyzab4pdvzavnivhy9w6dwn36ybaxw40w767m142fbi06m3b";
"11" = "0p4j6mxajmb0xl41c79154pk4vb8bffgg1nmwislahqjky9jkd4j";
}.${javaVersion};
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/native-image-installable-svm-java${javaVersion}-linux-amd64-${version}.jar";
sha256 = { "8-linux-amd64" = "1rzbhllz28x5ps8n304v998hykr4m8z1gfg53ybi6laxhkbx3i13";
"11-linux-amd64" = "09ipdl1489xnbckwl6sl9y7zy7kp5qf5fgf3kgz5d69jrk2z6rvf";
"8-darwin-amd64" = "1iy2943jbrarh8bm9wy15xk7prnskqwik2ham07a6ybp4j4b81xi";
"11-darwin-amd64" = "0vk2grlirghzc78kvwg66w0xriy5p8qkcp7qx83i62d7sj0kvwnf";
}.${javaVersionPlatform};
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/native-image-installable-svm-java${javaVersionPlatform}-${version}.jar";
})
(fetchurl {
sha256 = { "8" = "0rwwvk1mkfnl0b50xg7kh6015kjmsw2ra0ckrzmabl88z4bnzh2y";
"11" = "0lc9as2a00j74lp7jby4p10vn5bbkiydzvzk28zfcbsp28p4wvwn";
}.${javaVersion};
url = "https://github.com/oracle/truffleruby/releases/download/vm-${version}/ruby-installable-svm-java${javaVersion}-linux-amd64-${version}.jar";
sha256 = { "8-linux-amd64" = "0v98v44vblhyi3jhrngmvrkb3a6d607x4fpmrb4mrrsg75vbvc6d";
"11-linux-amd64" = "0kb9472ilwqg40gyw1c4lmzkd9s763raw560sw80ljm3p75k4sc7";
"8-darwin-amd64" = "192n9ckr4p8qirpxr67ji3wzxpng33yfr7kxynlrcp7b3ghfic6p";
"11-darwin-amd64" = "1wqdk8wphywa00kl3xikiskclb84rx3nw5a4vi5y2n060kclcp22";
}.${javaVersionPlatform};
url = "https://github.com/oracle/truffleruby/releases/download/vm-${version}/ruby-installable-svm-java${javaVersionPlatform}-${version}.jar";
})
(fetchurl {
sha256 = { "8" = "0mj8p72qgvvrwpsbk0bsqldynlz1wq07icf951wq5xdbr0whj1gz";
"11" = "1lkszqn4islsza011iabayv6riym0dwnkv83pkmk06b230qjfhzb";
}.${javaVersion};
url = "https://github.com/graalvm/graalpython/releases/download/vm-${version}/python-installable-svm-java${javaVersion}-linux-amd64-${version}.jar";
sha256 = { "8-linux-amd64" = "1iskmkhrrwlhcq92g1ljvsfi9q403xxkwgzn9m282z5llh2fxv74";
"11-linux-amd64" = "13bg2gs22rzbngnbw8j68jqgcknbiw30kpxac5jjcn55rf2ymvkz";
"8-darwin-amd64" = "08pib13q7s5wymnbykkyif66ll146vznxw4yz12qwhb419882jc7";
"11-darwin-amd64" = "0cb9lhc21yr2dnrm4kwa68laaczvsdnzpcbl2qix50d0v84xl602";
}.${javaVersionPlatform};
url = "https://github.com/graalvm/graalpython/releases/download/vm-${version}/python-installable-svm-java${javaVersionPlatform}-${version}.jar";
})
(fetchurl {
sha256 = { "8" = "1br7camk7y8ych43ws57096100f9kzjvqznh2flmws78ipcrrb66";
"11" = "10swxspjvzh0j82lbpy38dckk69lw1pawqkhnj1hxd05ls36fwq5";
}.${javaVersion};
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/wasm-installable-svm-java${javaVersion}-linux-amd64-${version}.jar";
sha256 = { "8-linux-amd64" = "12lvcl1vmc35wh3xw5dqca7yiijsd432x4lim3knzppipy7fmflq";
"11-linux-amd64" = "1s8zfgjyyw6w53974h9a2ig8a1bvc97aplyrdziywfrijgp6zkqk";
"8-darwin-amd64" = "06i1n42hkhcf1pfb2bly22ws4a09xgydsgh8b0kvjmb1fapd4paq";
"11-darwin-amd64" = "1r2bqhfxnw09izxlsc562znlp3m9c1isqzhlki083h3vp548vv9s";
}.${javaVersionPlatform};
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/wasm-installable-svm-java${javaVersionPlatform}-${version}.jar";
})
];
nativeBuildInputs = [ unzip perl ];
unpackPhase = ''
unpack_jar() {
jar=$1
unzip -o $jar -d $out
unzip -q -o $jar -d $out
perl -ne 'use File::Path qw(make_path);
use File::Basename qw(dirname);
if (/^(.+) = (.+)$/) {
@ -60,7 +72,27 @@ let
mkdir -p $out
arr=($srcs)
tar xf ''${arr[0]} -C $out --strip-components=1
# The tarball on Linux has the following directory structure:
#
# graalvm-ce-java11-20.3.0/*
#
# while on Darwin it looks like this:
#
# graalvm-ce-java11-20.3.0/Contents/Home/*
#
# We therefor use --strip-components=1 vs 3 depending on the platform.
tar xf ''${arr[0]} -C $out --strip-components=${if stdenv.isLinux then "1" else "3"}
# Sanity check
if [ ! -d $out/bin ]; then
echo "The `bin` is directory missing after extracting the graalvm"
echo "tarball, please compare the directory structure of the"
echo "tarball with what happens in the unpackPhase (in particular"
echo "with regards to the `--strip-components` flag)."
exit 1
fi
unpack_jar ''${arr[1]}
unpack_jar ''${arr[2]}
unpack_jar ''${arr[3]}
@ -68,7 +100,7 @@ let
'';
installPhase = {
"8" = ''
"8-linux-amd64" = ''
# BUG workaround http://mail.openjdk.java.net/pipermail/graal-dev/2017-December/005141.html
substituteInPlace $out/jre/lib/security/java.security \
--replace file:/dev/random file:/dev/./urandom \
@ -76,13 +108,13 @@ let
# provide libraries needed for static compilation
for f in ${glibc}/lib/* ${glibc.static}/lib/* ${zlib.static}/lib/*; do
ln -s $f $out/jre/lib/svm/clibraries/linux-amd64/$(basename $f)
ln -s $f $out/jre/lib/svm/clibraries/${platform}/$(basename $f)
done
# allow using external truffle-api.jar and languages not included in the distrubution
rm $out/jre/lib/jvmci/parentClassLoader.classpath
'';
"11" = ''
"11-linux-amd64" = ''
# BUG workaround http://mail.openjdk.java.net/pipermail/graal-dev/2017-December/005141.html
substituteInPlace $out/conf/security/java.security \
--replace file:/dev/random file:/dev/./urandom \
@ -90,10 +122,17 @@ let
# provide libraries needed for static compilation
for f in ${glibc}/lib/* ${glibc.static}/lib/* ${zlib.static}/lib/*; do
ln -s $f $out/lib/svm/clibraries/linux-amd64/$(basename $f)
ln -s $f $out/lib/svm/clibraries/${platform}/$(basename $f)
done
'';
}.${javaVersion};
'';
"8-darwin-amd64" = ''
# allow using external truffle-api.jar and languages not included in the distrubution
rm $out/jre/lib/jvmci/parentClassLoader.classpath
'';
"11-darwin-amd64" = ''
echo ""
'';
}.${javaVersionPlatform};
dontStrip = true;
@ -116,15 +155,22 @@ let
zlib # libz.so.1
]}"
${lib.optionalString stdenv.isLinux ''
for f in $(find $out -type f -perm -0100); do
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$f" || true
patchelf --set-rpath "$rpath" "$f" || true
if ldd "$f" | fgrep 'not found'; then echo "in file $f"; fi
done
''}
'';
propagatedBuildInputs = [ setJavaClassPath zlib ]; # $out/bin/native-image needs zlib to build native executables
# $out/bin/native-image needs zlib to build native executables.
propagatedBuildInputs = [ setJavaClassPath zlib ] ++
# On Darwin native-image calls clang and it
# tries to include <Foundation/Foundation.h>,
# and Interactive Ruby (irb) requires OpenSSL
# headers.
lib.optionals stdenv.hostPlatform.isDarwin [ Foundation openssl ];
doInstallCheck = true;
installCheckPhase = ''
@ -141,13 +187,33 @@ let
$out/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler HelloWorld | fgrep 'Hello World'
# Ahead-Of-Time compilation
$out/bin/native-image --no-server HelloWorld
$out/bin/native-image -H:-CheckToolchain -H:+ReportExceptionStackTraces --no-server HelloWorld
./helloworld | fgrep 'Hello World'
# Ahead-Of-Time compilation with --static
$out/bin/native-image --no-server --static HelloWorld
./helloworld | fgrep 'Hello World'
'';
${lib.optionalString stdenv.isLinux ''
# Ahead-Of-Time compilation with --static
# --static flag doesn't work for darwin
$out/bin/native-image --no-server --static HelloWorld
./helloworld | fgrep 'Hello World'
''}
echo "Testing interpreted languages"
$out/bin/graalpython -c 'print(1 + 1)'
$out/bin/ruby -e 'puts(1 + 1)'
$out/bin/node -e 'console.log(1 + 1)'
echo '1 + 1' | $out/bin/graalpython
# 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
# echo '1 + 1' | $out/bin/irb
echo '1 + 1' | $out/bin/node -i
${lib.optionalString (javaVersion == "11") ''
echo '1 + 1' | $out/bin/jshell
''}'';
passthru.home = graalvmXXX-ce;
@ -156,7 +222,7 @@ let
description = "High-Performance Polyglot VM";
license = with licenses; [ upl gpl2Classpath bsd3 ];
maintainers = with maintainers; [ bandresen volth hlolli glittershark ];
platforms = [ "x86_64-linux" ];
platforms = [ "x86_64-linux" "x86_64-darwin" ];
};
};
in

@ -25,13 +25,13 @@ stdenv.mkDerivation rec {
native-image \
-jar ${src} \
-H:Name=bb \
${optionalString stdenv.isDarwin ''-H:-CheckToolchain''} \
-H:+ReportExceptionStackTraces \
-J-Dclojure.spec.skip-macros=true \
-J-Dclojure.compiler.direct-linking=true \
"-H:IncludeResources=BABASHKA_VERSION" \
"-H:IncludeResources=SCI_VERSION" \
-H:ReflectionConfigurationFiles=${reflectionJson} \
--initialize-at-run-time=java.lang.Math\$RandomNumberGeneratorHolder \
--initialize-at-build-time \
-H:Log=registerResource: \
-H:EnableURLProtocols=http,https \

@ -2,17 +2,17 @@
stdenv.mkDerivation rec {
pname = "clj-kondo";
version = "2020.11.07";
version = "2020.12.12";
reflectionJson = fetchurl {
name = "reflection.json";
url = "https://raw.githubusercontent.com/borkdude/${pname}/v${version}/reflection.json";
sha256 = "0mwclqjh38alkddr5r7bfqn5lplx06h9gladi89kp06qdxc1hp7a";
sha256 = "ea5c18586fd8803b138a4dd197a0019d5e5a2c76ebe4925b9b54a10125a68c57";
};
src = fetchurl {
url = "https://github.com/borkdude/${pname}/releases/download/v${version}/${pname}-${version}-standalone.jar";
sha256 = "1xqryfcn82bp8wasqnllfgvhl5w9zm63yw8c2kgxz18dayhq4i31";
sha256 = "27b8a82fb613803ab9c712866b7cc89c40fcafc4ac3af178c11b4ed7549934dc";
};
dontUnpack = true;
@ -23,6 +23,7 @@ stdenv.mkDerivation rec {
native-image \
-jar ${src} \
-H:Name=clj-kondo \
${lib.optionalString stdenv.isDarwin ''-H:-CheckToolchain''} \
-H:+ReportExceptionStackTraces \
-J-Dclojure.spec.skip-macros=true \
-J-Dclojure.compiler.direct-linking=true \

@ -10285,9 +10285,9 @@ in
inherit (darwin) libiconv libobjc libresolv;
}) mx jvmci8 graalvm8;
inherit (callPackages ../development/compilers/graalvm/community-edition.nix { })
graalvm8-ce
graalvm11-ce;
inherit (callPackages ../development/compilers/graalvm/community-edition.nix {
inherit (darwin.apple_sdk.frameworks) Foundation;
}) graalvm8-ce graalvm11-ce;
inherit (callPackages ../development/compilers/graalvm/enterprise-edition.nix { })
graalvm8-ee

Loading…
Cancel
Save