3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #216228 from thiagokokada/graalvm-ce-add-more-products

graalvmCEPackages.{js,python,wasm,ruby,llvm}-installable-svm: init at 22.3.1
This commit is contained in:
Thiago Kenji Okada 2023-02-15 10:18:18 +00:00 committed by GitHub
commit 3a1c146eb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 472 additions and 44 deletions

View file

@ -4,29 +4,51 @@
, autoPatchelfHook
, cairo
, cups
, darwin
, fontconfig
, Foundation
, glib
, gtk3
, gtkSupport ? stdenv.isLinux
, makeWrapper
, setJavaClassPath
, unzip
, xorg
, zlib
}:
{ javaVersion
# extra params
, javaVersion
, meta ? { }
, products ? [ ]
, ... } @ args:
, gtkSupport ? stdenv.isLinux
, ...
} @ args:
let
extraArgs = builtins.removeAttrs args [
"lib"
"stdenv"
"alsa-lib"
"autoPatchelfHook"
"cairo"
"cups"
"darwin"
"fontconfig"
"glib"
"gtk3"
"makeWrapper"
"setJavaClassPath"
"unzip"
"xorg"
"zlib"
"javaVersion"
"meta"
"products"
"gtkSupport"
];
runtimeLibraryPath = lib.makeLibraryPath
([ cups ] ++ lib.optionals gtkSupport [ cairo glib gtk3 ]);
mapProducts = key: default: (map (p: p.${key} or default) products);
mapProducts = key: default: (map (p: p.graalvmPhases.${key} or default) products);
concatProducts = key: lib.concatStringsSep "\n" (mapProducts key "");
graalvmXXX-ce = stdenv.mkDerivation (args // {
graalvmXXX-ce = stdenv.mkDerivation ({
pname = "graalvm${javaVersion}-ce";
unpackPhase = ''
@ -71,7 +93,7 @@ let
++ lib.optional stdenv.isLinux autoPatchelfHook;
propagatedBuildInputs = [ setJavaClassPath zlib ]
++ lib.optional stdenv.isDarwin Foundation;
++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Foundation;
buildInputs = lib.optionals stdenv.isLinux [
alsa-lib # libasound.so wanted by lib/libjsound.so
@ -109,6 +131,12 @@ let
installCheckPhase = ''
runHook preInstallCheck
${# broken in darwin
lib.optionalString stdenv.isLinux ''
echo "Testing Jshell"
echo '1 + 1' | $out/bin/jshell
''}
echo ${
lib.escapeShellArg ''
public class HelloWorld {
@ -136,7 +164,6 @@ let
};
meta = with lib; ({
inherit platforms;
homepage = "https://www.graalvm.org/";
description = "High-Performance Polyglot VM";
license = with licenses; [ upl gpl2Classpath bsd3 ];
@ -144,5 +171,6 @@ let
mainProgram = "java";
maintainers = with maintainers; teams.graalvm-ce.members ++ [ ];
} // meta);
});
in graalvmXXX-ce
} // extraArgs);
in
graalvmXXX-ce

View file

@ -1,20 +1,42 @@
{ lib
, stdenv
, autoPatchelfHook
, graalvm-ce
, makeWrapper
, perl
, unzip
, zlib
}:
{ product
# extra params
, product
, javaVersion
, extraNativeBuildInputs ? [ ]
, extraBuildInputs ? [ ]
, extraNativeBuildInputs ? [ ]
, graalvmPhases ? { }
, meta ? { }
, passthru ? { }
, ... } @ args:
, ...
} @ args:
stdenv.mkDerivation (args // {
let
extraArgs = builtins.removeAttrs args [
"lib"
"stdenv"
"autoPatchelfHook"
"graalvm-ce"
"makeWrapper"
"perl"
"unzip"
"zlib"
"product"
"javaVersion"
"extraBuildInputs"
"extraNativeBuildInputs"
"graalvmPhases"
"meta"
"passthru"
];
in
stdenv.mkDerivation ({
pname = "${product}-java${javaVersion}";
nativeBuildInputs = [ perl unzip makeWrapper ]
@ -55,19 +77,19 @@ stdenv.mkDerivation (args // {
dontInstall = true;
dontBuild = true;
dontStrip = true;
# installCheckPhase is going to run in GraalVM main derivation (see buildGraalvm.nix)
# to make sure that it has everything it needs to run correctly.
# Other hooks like fixupPhase/installPhase are also going to run there for the
# same reason.
doInstallCheck = false;
passthru = { inherit product; } // passthru;
passthru = {
inherit product javaVersion;
# build phases that are going to run during GraalVM derivation build,
# since they depend in having the fully setup GraalVM environment
# e.g.: graalvmPhases.installCheckPhase will run the checks only after
# GraalVM+products is build
# see buildGraalvm.nix file for the available phases
inherit graalvmPhases;
} // passthru;
meta = with lib; ({
homepage = "https://www.graalvm.org/";
inherit (graalvm-ce.meta) homepage license sourceProvenance maintainers platforms;
description = "High-Performance Polyglot VM (Product: ${product})";
license = with licenses; [ upl gpl2Classpath bsd3 ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
maintainers = with maintainers; teams.graalvm-ce.members ++ [ ];
} // meta);
})
} // extraArgs)

View file

@ -2,12 +2,11 @@
, stdenv
, callPackage
, fetchurl
, Foundation
}:
let
buildGraalvm = callPackage ./buildGraalvm.nix { inherit Foundation; };
buildGraalvmProduct = callPackage ./buildGraalvmProduct.nix { };
buildGraalvm = callPackage ./buildGraalvm.nix;
buildGraalvmProduct = callPackage ./buildGraalvmProduct.nix;
javaPlatform = {
"aarch64-linux" = "linux-aarch64";
"x86_64-linux" = "linux-amd64";
@ -16,7 +15,8 @@ let
};
javaPlatformVersion = javaVersion:
"${javaVersion}-${javaPlatform.${stdenv.system} or (throw "Unsupported platform: ${stdenv.system}")}";
source = product: javaVersion: (import ./hashes.nix).${product}.${javaPlatformVersion javaVersion};
source = product: javaVersion: (import ./hashes.nix).${product}.${javaPlatformVersion javaVersion}
or (throw "Unsupported product combination: product=${product} java=${javaVersion} system=${stdenv.system}");
in
rec {
@ -30,12 +30,55 @@ rec {
products = [ native-image-installable-svm-java11 ];
};
# Mostly available for testing, not to be exposed at the top level
graalvm11-ce-full = graalvm11-ce.override {
products = [
js-installable-svm-java11
llvm-installable-svm-java11
native-image-installable-svm-java11
python-installable-svm-java11
ruby-installable-svm-java11
wasm-installable-svm-java11
];
};
js-installable-svm-java11 = callPackage ./js-installable-svm.nix rec {
javaVersion = "11";
version = "22.3.1";
src = fetchurl (source "js-installable-svm" javaVersion);
};
llvm-installable-svm-java11 = callPackage ./llvm-installable-svm.nix rec {
javaVersion = "11";
version = "22.3.1";
src = fetchurl (source "llvm-installable-svm" javaVersion);
};
native-image-installable-svm-java11 = callPackage ./native-image-installable-svm.nix rec {
javaVersion = "11";
version = "22.3.1";
src = fetchurl (source "native-image-installable-svm" javaVersion);
};
python-installable-svm-java11 = callPackage ./python-installable-svm.nix rec {
javaVersion = "11";
version = "22.3.1";
src = fetchurl (source "python-installable-svm" javaVersion);
};
ruby-installable-svm-java11 = callPackage ./ruby-installable-svm.nix rec {
javaVersion = "11";
version = "22.3.1";
src = fetchurl (source "ruby-installable-svm" javaVersion);
llvm-installable-svm = llvm-installable-svm-java11;
};
wasm-installable-svm-java11 = callPackage ./wasm-installable-svm.nix rec {
javaVersion = "11";
version = "22.3.1";
src = fetchurl (source "wasm-installable-svm" javaVersion);
};
graalvm17-ce = buildGraalvm rec {
version = "22.3.1";
javaVersion = "17";
@ -44,9 +87,52 @@ rec {
products = [ native-image-installable-svm-java17 ];
};
# Mostly available for testing, not to be exposed at the top level
graalvm17-ce-full = graalvm17-ce.override {
products = [
js-installable-svm-java17
llvm-installable-svm-java17
native-image-installable-svm-java17
python-installable-svm-java17
ruby-installable-svm-java17
wasm-installable-svm-java17
];
};
js-installable-svm-java17 = callPackage ./js-installable-svm.nix rec {
javaVersion = "17";
version = "22.3.1";
src = fetchurl (source "js-installable-svm" javaVersion);
};
llvm-installable-svm-java17 = callPackage ./llvm-installable-svm.nix rec {
javaVersion = "17";
version = "22.3.1";
src = fetchurl (source "llvm-installable-svm" javaVersion);
};
native-image-installable-svm-java17 = callPackage ./native-image-installable-svm.nix rec {
javaVersion = "17";
version = "22.3.1";
src = fetchurl (source "native-image-installable-svm" javaVersion);
};
python-installable-svm-java17 = callPackage ./python-installable-svm.nix rec {
javaVersion = "17";
version = "22.3.1";
src = fetchurl (source "python-installable-svm" javaVersion);
};
ruby-installable-svm-java17 = callPackage ./ruby-installable-svm.nix rec {
javaVersion = "17";
version = "22.3.1";
src = fetchurl (source "ruby-installable-svm" javaVersion);
llvm-installable-svm = llvm-installable-svm-java17;
};
wasm-installable-svm-java17 = callPackage ./wasm-installable-svm.nix rec {
javaVersion = "17";
version = "22.3.1";
src = fetchurl (source "wasm-installable-svm" javaVersion);
};
}

View file

@ -1,5 +1,133 @@
# Generated by pkgs/development/compilers/graalvm/community-edition/update.sh script
{
"llvm-installable-svm" = {
"11-linux-aarch64" = {
sha256 = "0h8xkvsixcwak5dymkj3jgjv11w3ivnd6d45v5pdbymd0m2ifia8";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java11-linux-aarch64-22.3.1.jar";
};
"17-linux-aarch64" = {
sha256 = "1zww45z7m3mvzg47fwc3jgqz3hkra220isf4ih8sv6kjg1jc4y14";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java17-linux-aarch64-22.3.1.jar";
};
"11-linux-amd64" = {
sha256 = "133m9vg9rlp2xkndh3d6b8ybq8vwch99rj1b50xr6bz8r6306ara";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java11-linux-amd64-22.3.1.jar";
};
"17-linux-amd64" = {
sha256 = "0nz09idp8wawm3yinsplzvxhld8yav06l1nqj02gxrc1kxd5nsr1";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java17-linux-amd64-22.3.1.jar";
};
"11-darwin-aarch64" = {
sha256 = "0ngcm3ara7g1xz4kh515igpyrjhr1k5z9nf4vsaw4lpa5sqljv7z";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java11-darwin-aarch64-22.3.1.jar";
};
"17-darwin-aarch64" = {
sha256 = "1lr8kk82c3l9hx7wc5hqmpqfgvpk72xg1h07b6cgibry1bm6baj6";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java17-darwin-aarch64-22.3.1.jar";
};
"11-darwin-amd64" = {
sha256 = "058pzrd90xx4yi7mm2fvs2npqcdkb2nzhqfwfz5v202038igi61g";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java11-darwin-amd64-22.3.1.jar";
};
"17-darwin-amd64" = {
sha256 = "10rfz8ddq82zpf6cy2y0gx1bx0zhjzm3gwwdb1j7mll0hvwp84sg";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java17-darwin-amd64-22.3.1.jar";
};
};
"wasm-installable-svm" = {
"11-linux-aarch64" = {
sha256 = "1d67jm41psypkhpy77cb2l00smhni3pgkybwx79z7dzcyid7p2l1";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java11-linux-aarch64-22.3.1.jar";
};
"17-linux-aarch64" = {
sha256 = "1cg9zxyjirfl0afr9cppg2h17j8qdidi4llbal2g5w1p2v9zq78b";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java17-linux-aarch64-22.3.1.jar";
};
"11-linux-amd64" = {
sha256 = "19v7jqhvijmzzb0i9q6hbvrmqnmmzbyvai3il9f357qvv6r6lylb";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java11-linux-amd64-22.3.1.jar";
};
"17-linux-amd64" = {
sha256 = "0sfnsy0r4qf7ni9mh437dad1d8sidajcra2azsmy5qdmh091zhj5";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java17-linux-amd64-22.3.1.jar";
};
"11-darwin-amd64" = {
sha256 = "0764d97mla5cii4iyvyb43v62dk8ff3plqjmdc69qqxx8mdzpwqv";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java11-darwin-amd64-22.3.1.jar";
};
"17-darwin-amd64" = {
sha256 = "1ip6ybm7p28bs2lifxqhq6fyvfm3wmacv6dqziyl2v7v7yl0iw4i";
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java17-darwin-amd64-22.3.1.jar";
};
};
"js-installable-svm" = {
"11-linux-aarch64" = {
sha256 = "1b8vnjjsa548c6j3dycxp57i9xmyvndiz2xhv7fm10izcplyspxq";
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java11-linux-aarch64-22.3.1.jar";
};
"17-linux-aarch64" = {
sha256 = "1kcy3mjk908zs7f3k95awp6294cwr06hand4cbw1lsnfvp0qwhk7";
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java17-linux-aarch64-22.3.1.jar";
};
"11-linux-amd64" = {
sha256 = "0sq80a4nnvik560whgv5vwlsszi8z02idvpd92p0caf03bra9x2b";
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java11-linux-amd64-22.3.1.jar";
};
"17-linux-amd64" = {
sha256 = "0fd160yxsi09m97z7vqh5kwf1g0p0hn4niy48glj9jhirfqzzw0c";
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java17-linux-amd64-22.3.1.jar";
};
"11-darwin-aarch64" = {
sha256 = "18g0xixzk45yrxv3zfs7qrdyj0b3ksp59jhbcis0vwy9gx8094wq";
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java11-darwin-aarch64-22.3.1.jar";
};
"17-darwin-aarch64" = {
sha256 = "0cf4iivkniilvbqyniqxcz1qf49cs4lxi0axjsk9sz1zmxcq0bnk";
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java17-darwin-aarch64-22.3.1.jar";
};
"11-darwin-amd64" = {
sha256 = "0ibcz6ivx068ndf45j9pghm8qwq287glqxf0xx08kjxnhms67p52";
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java11-darwin-amd64-22.3.1.jar";
};
"17-darwin-amd64" = {
sha256 = "16q7whnvdrk8lb4fp96qr3p567kggyk9q5iqcn081qk8xjkbx0zv";
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java17-darwin-amd64-22.3.1.jar";
};
};
"python-installable-svm" = {
"11-linux-aarch64" = {
sha256 = "1yl36x5svld7qnm3m6vmacm2n4d6l9vhdxhaypvlv2bbfbnym3c5";
url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java11-linux-aarch64-22.3.1.jar";
};
"17-linux-aarch64" = {
sha256 = "0ggx5rwz3qnnxgz407r8yx12556pcbirhnc44972l77r320rdmqc";
url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java17-linux-aarch64-22.3.1.jar";
};
"11-linux-amd64" = {
sha256 = "11c19a20v3ff83dxzs9hf1z89kh0qich41b03gx8mancf12jfwnl";
url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java11-linux-amd64-22.3.1.jar";
};
"17-linux-amd64" = {
sha256 = "0pga44whhvm98d8j2v2bpl9rkbvr9bv947rc4imlbf01cyxjwl71";
url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java17-linux-amd64-22.3.1.jar";
};
"11-darwin-aarch64" = {
sha256 = "0qnh8i9nazrv25jhn13wp7qqm9wwhcz4kpp2ygvsdmf9s3d2f5lf";
url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java11-darwin-aarch64-22.3.1.jar";
};
"17-darwin-aarch64" = {
sha256 = "0j13xvy9d19glipz4wdma2y02g0cnksg1iij4247fjhpqh0axkdz";
url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java17-darwin-aarch64-22.3.1.jar";
};
"11-darwin-amd64" = {
sha256 = "1ny5664h7pibvskmm51mlxrxkbbj2dvxsv2yqbq6v51a57wm1yzn";
url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java11-darwin-amd64-22.3.1.jar";
};
"17-darwin-amd64" = {
sha256 = "01jjncx8jm1yrps2nj217vgcmjaqclmpb27rdp3qn7k64w5wzipg";
url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java17-darwin-amd64-22.3.1.jar";
};
};
"native-image-installable-svm" = {
"11-linux-aarch64" = {
sha256 = "0z9rbmci6yz7f7mqd3xzsxc5ih4hq72lyzqfchan7fr6mh38d6gw";
@ -68,4 +196,38 @@
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java17-darwin-amd64-22.3.1.tar.gz";
};
};
"ruby-installable-svm" = {
"11-linux-aarch64" = {
sha256 = "10wm1sq7smywy63mzlsbn21kzd65yaqj8yismpq8bz19h9skas7w";
url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java11-linux-aarch64-22.3.1.jar";
};
"17-linux-aarch64" = {
sha256 = "0kh1w49yp3kpfvhqw19bbx51ay1wgzq80gsrfqax4zm5ixz4wsbz";
url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java17-linux-aarch64-22.3.1.jar";
};
"11-linux-amd64" = {
sha256 = "0avsawgfkqbgqc2hm8zmz37qg9ag3ddni3my8g73kvzfkghsdabh";
url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java11-linux-amd64-22.3.1.jar";
};
"17-linux-amd64" = {
sha256 = "1ib00pqdhzl24y97j16mm86qwrijqjnmhjmk3g5vdhyhh099vjp1";
url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java17-linux-amd64-22.3.1.jar";
};
"11-darwin-aarch64" = {
sha256 = "1im75qad89xa2nbl80csnwn56k6n11zv5g91xlkqq4xk300v1saj";
url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java11-darwin-aarch64-22.3.1.jar";
};
"17-darwin-aarch64" = {
sha256 = "1pfzsisf4sgzxmk3r1p4apzqkwipjpf8naly3v94i5v3b5gbnczx";
url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java17-darwin-aarch64-22.3.1.jar";
};
"11-darwin-amd64" = {
sha256 = "1jfls71y92hw09s869v2qw8pypgl1fciqz3m9zcd2602hikysq6c";
url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java11-darwin-amd64-22.3.1.jar";
};
"17-darwin-amd64" = {
sha256 = "03x2h4sw72l05xxg73xj9mzzkxffbjpv8hdi59rgxxljnz0ai6rx";
url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java17-darwin-amd64-22.3.1.jar";
};
};
}

View file

@ -0,0 +1,18 @@
{ lib
, stdenv
, graalvm-ce
, graalvmCEPackages
, javaVersion
, src
, version
}:
graalvmCEPackages.buildGraalvmProduct rec {
inherit src javaVersion version;
product = "js-installable-svm";
graalvmPhases.installCheckPhase = ''
echo "Testing GraalJS"
echo '1 + 1' | $out/bin/js
'';
}

View file

@ -0,0 +1,22 @@
{ lib
, stdenv
, graalvmCEPackages
, javaVersion
, src
, version
}:
graalvmCEPackages.buildGraalvmProduct rec {
inherit src javaVersion version;
product = "llvm-installable-svm";
postUnpack = ''
ln -s $out/languages/llvm/native/lib/*.so $out/lib
'';
# TODO: improve this test
graalvmPhases.installCheckPhase = ''
echo "Testing llvm"
$out/bin/lli --help
'';
}

View file

@ -27,19 +27,20 @@ graalvmCEPackages.buildGraalvmProduct rec {
inherit src javaVersion version;
product = "native-image-installable-svm";
postInstall = lib.optionalString stdenv.isLinux ''
graalvmPhases.postInstall = lib.optionalString stdenv.isLinux ''
wrapProgram $out/bin/native-image \
--prefix PATH : ${binPath} \
${lib.concatStringsSep " "
(map (l: "--add-flags '-H:CLibraryPath=${l}/lib'") cLibs)}
'';
installCheckPhase = ''
graalvmPhases.installCheckPhase = ''
echo "Ahead-Of-Time compilation"
$out/bin/native-image -H:-CheckToolchain -H:+ReportExceptionStackTraces HelloWorld
./helloworld | fgrep 'Hello World'
${lib.optionalString (stdenv.isLinux && !useMusl) ''
${# --static is only available in Linux
lib.optionalString (stdenv.isLinux && !useMusl) ''
echo "Ahead-Of-Time compilation with -H:+StaticExecutableWithDynamicLibC"
$out/bin/native-image -H:+StaticExecutableWithDynamicLibC HelloWorld
./helloworld | fgrep 'Hello World'
@ -49,7 +50,8 @@ graalvmCEPackages.buildGraalvmProduct rec {
./helloworld | fgrep 'Hello World'
''}
${lib.optionalString (stdenv.isLinux && useMusl) ''
${# --static is only available in Linux
lib.optionalString (stdenv.isLinux && useMusl) ''
echo "Ahead-Of-Time compilation with --static and --libc=musl"
$out/bin/native-image --static HelloWorld --libc=musl
./helloworld | fgrep 'Hello World'

View file

@ -0,0 +1,18 @@
{ lib
, stdenv
, graalvmCEPackages
, javaVersion
, src
, version
}:
graalvmCEPackages.buildGraalvmProduct rec {
inherit src javaVersion version;
product = "python-installable-svm";
graalvmPhases.installCheckPhase = ''
echo "Testing GraalPython"
$out/bin/graalpy -c 'print(1 + 1)'
echo '1 + 1' | $out/bin/graalpy
'';
}

View file

@ -0,0 +1,38 @@
{ lib
, stdenv
, graalvmCEPackages
, openssl
, javaVersion
, musl
, src
, version
, llvm-installable-svm
}:
graalvmCEPackages.buildGraalvmProduct rec {
inherit src javaVersion version;
product = "ruby-installable-svm";
extraBuildInputs = [
llvm-installable-svm
openssl
];
preFixup = lib.optionalString stdenv.isLinux ''
patchelf $out/languages/ruby/lib/mri/openssl.so \
--replace-needed libssl.so.10 libssl.so \
--replace-needed libcrypto.so.10 libcrypto.so
'';
graalvmPhases.installCheckPhase = ''
echo "Testing TruffleRuby"
# Fixup/silence warnings about wrong locale
export LANG=C
export LC_ALL=C
$out/bin/ruby -e 'puts(1 + 1)'
${# broken in darwin with sandbox enabled
lib.optionalString stdenv.isLinux ''
echo '1 + 1' | $out/bin/irb
''}
'';
}

View file

@ -14,9 +14,10 @@ verlte() {
[ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ]
}
readonly hashes_nix="hashes.nix"
readonly nixpkgs=../../../../..
readonly current_version="$(nix-instantiate "$nixpkgs" --eval --strict -A graalvm-ce.version | tr -d \")"
readonly current_version="$(nix-instantiate "$nixpkgs" --eval --strict -A graalvm-ce.version --json | jq -r)"
if [[ -z "${1:-}" ]]; then
readonly gh_version="$(curl \
@ -39,10 +40,12 @@ fi
declare -r -A products_urls=(
[graalvm-ce]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/graalvm-ce-java@platform@-${new_version}.tar.gz"
[js-installable-svm]="https://github.com/graalvm/graaljs/releases/download/vm-${new_version}/js-installable-svm-java@platform@-${new_version}.jar"
[llvm-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/llvm-installable-svm-java@platform@-${new_version}.jar"
[native-image-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/native-image-installable-svm-java@platform@-${new_version}.jar"
# [ruby-installable-svm]="https://github.com/oracle/truffleruby/releases/download/vm-${new_version}/ruby-installable-svm-java@platform@-${new_version}.jar"
# [wasm-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/wasm-installable-svm-java@platform@-${new_version}.jar"
# [python-installable-svm]="https://github.com/graalvm/graalpython/releases/download/vm-${new_version}/python-installable-svm-java@platform@-${new_version}.jar"
[python-installable-svm]="https://github.com/graalvm/graalpython/releases/download/vm-${new_version}/python-installable-svm-java@platform@-${new_version}.jar"
[ruby-installable-svm]="https://github.com/oracle/truffleruby/releases/download/vm-${new_version}/ruby-installable-svm-java@platform@-${new_version}.jar"
[wasm-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/wasm-installable-svm-java@platform@-${new_version}.jar"
)
readonly platforms=(
@ -65,11 +68,20 @@ for product in "${!products_urls[@]}"; do
url="${products_urls["${product}"]}"
echo_file " \"$product\" = {"
for platform in "${platforms[@]}"; do
if hash="$(nix-prefetch-url "${url//@platform@/$platform}")"; then
# Reuse cache as long the version is the same
if [[ "$current_version" == "$new_version" ]]; then
previous_hash="$(nix-instantiate --eval "$hashes_nix" -A "$product.$platform.sha256" --json | jq -r || true)"
else
previous_hash=""
fi
# Lack of quoting in $previous_hash is proposital
if hash="$(nix-prefetch-url "${url//@platform@/$platform}" $previous_hash)"; then
echo_file " \"$platform\" = {"
echo_file " sha256 = \"$hash\";"
echo_file " url = \"${url//@platform@/${platform}}\";"
echo_file " };"
else
info "Error while downloading '$product' for '$platform'. Skipping it..."
fi
done
echo_file " };"
@ -81,6 +93,6 @@ info "Updating graalvm-ce version..."
sed "s|$current_version|$new_version|" -i default.nix
info "Moving the temporary file to hashes.nix"
mv "$tmpfile" hashes.nix
mv "$tmpfile" "$hashes_nix"
info "Done!"

View file

@ -0,0 +1,22 @@
{ lib
, stdenv
, graalvm-ce
, graalvmCEPackages
, javaVersion
, src
, version
}:
graalvmCEPackages.buildGraalvmProduct rec {
inherit src javaVersion version;
product = "wasm-installable-svm";
# TODO: improve this test
graalvmPhases.installCheckPhase = ''
echo "Testing wasm"
$out/bin/wasm --help
'';
# Not supported in aarch64-darwin yet as GraalVM 22.3.1 release
meta.platforms = builtins.filter (p: p != "aarch64-darwin") graalvm-ce.meta.platforms;
}

View file

@ -15017,9 +15017,7 @@ with pkgs;
openjdk_headless = jdk_headless;
graalvmCEPackages =
recurseIntoAttrs (callPackage ../development/compilers/graalvm/community-edition {
inherit (darwin.apple_sdk.frameworks) Foundation;
});
recurseIntoAttrs (callPackage ../development/compilers/graalvm/community-edition { });
graalvm-ce = graalvm11-ce;
graalvm11-ce = graalvmCEPackages.graalvm11-ce;
graalvm17-ce = graalvmCEPackages.graalvm17-ce;