diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/compilers/graalvm')
-rw-r--r-- | infra/libkookie/nixpkgs/pkgs/development/compilers/graalvm/community-edition.nix | 167 | ||||
-rw-r--r-- | infra/libkookie/nixpkgs/pkgs/development/compilers/graalvm/enterprise-edition.nix | 36 |
2 files changed, 189 insertions, 14 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/graalvm/community-edition.nix b/infra/libkookie/nixpkgs/pkgs/development/compilers/graalvm/community-edition.nix new file mode 100644 index 000000000000..71f3b1560c67 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/graalvm/community-edition.nix @@ -0,0 +1,167 @@ +{ stdenv, fetchurl, perl, unzip, glibc, zlib, setJavaClassPath }: + +let + common = javaVersion: + let + graalvmXXX-ce = stdenv.mkDerivation rec { + pname = "graalvm${javaVersion}-ce"; + version = "20.2.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"; + }) + (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"; + }) + (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"; + }) + (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"; + }) + (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"; + }) + ]; + nativeBuildInputs = [ unzip perl ]; + unpackPhase = '' + unpack_jar() { + jar=$1 + unzip -o $jar -d $out + perl -ne 'use File::Path qw(make_path); + use File::Basename qw(dirname); + if (/^(.+) = (.+)$/) { + make_path dirname("$ENV{out}/$1"); + system "ln -s $2 $ENV{out}/$1"; + }' $out/META-INF/symlinks + perl -ne 'if (/^(.+) = ([r-])([w-])([x-])([r-])([w-])([x-])([r-])([w-])([x-])$/) { + my $mode = ($2 eq 'r' ? 0400 : 0) + ($3 eq 'w' ? 0200 : 0) + ($4 eq 'x' ? 0100 : 0) + + ($5 eq 'r' ? 0040 : 0) + ($6 eq 'w' ? 0020 : 0) + ($7 eq 'x' ? 0010 : 0) + + ($8 eq 'r' ? 0004 : 0) + ($9 eq 'w' ? 0002 : 0) + ($10 eq 'x' ? 0001 : 0); + chmod $mode, "$ENV{out}/$1"; + }' $out/META-INF/permissions + rm -rf $out/META-INF + } + + mkdir -p $out + arr=($srcs) + tar xf ''${arr[0]} -C $out --strip-components=1 + unpack_jar ''${arr[1]} + unpack_jar ''${arr[2]} + unpack_jar ''${arr[3]} + unpack_jar ''${arr[4]} + ''; + + installPhase = { + "8" = '' + # 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 \ + --replace NativePRNGBlocking SHA1PRNG + + # 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) + done + + # allow using external truffle-api.jar and languages not included in the distrubution + rm $out/jre/lib/jvmci/parentClassLoader.classpath + ''; + "11" = '' + # 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 \ + --replace NativePRNGBlocking SHA1PRNG + + # 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) + done + ''; + }.${javaVersion}; + + dontStrip = true; + + # copy-paste openjdk's preFixup + preFixup = '' + # Set JAVA_HOME automatically. + mkdir -p $out/nix-support + cat <<EOF > $out/nix-support/setup-hook + if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi + EOF + ''; + + postFixup = '' + rpath="${ { "8" = "$out/jre/lib/amd64/jli:$out/jre/lib/amd64/server:$out/jre/lib/amd64"; + "11" = "$out/lib/jli:$out/lib/server:$out/lib"; + }.${javaVersion} + }:${ + stdenv.lib.makeLibraryPath [ + stdenv.cc.cc.lib # libstdc++.so.6 + zlib # libz.so.1 + ]}" + + 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 + + doInstallCheck = true; + installCheckPhase = '' + echo ${stdenv.lib.escapeShellArg '' + public class HelloWorld { + public static void main(String[] args) { + System.out.println("Hello World"); + } + } + ''} > HelloWorld.java + $out/bin/javac HelloWorld.java + + # run on JVM with Graal Compiler + $out/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler HelloWorld | fgrep 'Hello World' + + # Ahead-Of-Time compilation + $out/bin/native-image --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' + ''; + + passthru.home = graalvmXXX-ce; + + meta = with stdenv.lib; { + homepage = "https://www.graalvm.org/"; + description = "High-Performance Polyglot VM"; + license = with licenses; [ upl gpl2Classpath bsd3 ]; + maintainers = with maintainers; [ bandresen volth hlolli glittershark ]; + platforms = [ "x86_64-linux" ]; + }; + }; + in + graalvmXXX-ce; +in { + graalvm8-ce = common "8"; + graalvm11-ce = common "11"; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/graalvm/enterprise-edition.nix b/infra/libkookie/nixpkgs/pkgs/development/compilers/graalvm/enterprise-edition.nix index 89896c556efa..690bfdb425cf 100644 --- a/infra/libkookie/nixpkgs/pkgs/development/compilers/graalvm/enterprise-edition.nix +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/graalvm/enterprise-edition.nix @@ -1,44 +1,51 @@ -{ stdenv, requireFile, perl, unzip, glibc, zlib, bzip2, gdk-pixbuf, xorg, glib, fontconfig, freetype, cairo, pango, gtk3, gtk2, ffmpeg_3, libGL, atk, alsaLib, libav_0_8, setJavaClassPath }: +{ stdenv, requireFile, perl, unzip, glibc, zlib, bzip2, gdk-pixbuf, xorg, glib, fontconfig, freetype, cairo, pango, gtk3, gtk2, ffmpeg, libGL, atk, alsaLib, libav_0_8, setJavaClassPath }: let common = javaVersion: let graalvmXXX-ee = stdenv.mkDerivation rec { pname = "graalvm${javaVersion}-ee"; - version = "20.0.0"; + version = "20.2.1"; srcs = [ (requireFile { name = "graalvm-ee-java${javaVersion}-linux-amd64-${version}.tar.gz"; - sha256 = { "8" = "2df9b31b96f7a24b6a2fe3ecea0b5e819d5d058fde6320016dba1787ce59e99e"; - "11" = "b704fd27b5993584a1ad659b41f42ff0ae8893c066b64a6f6a1719fbee382536"; + sha256 = { "8" = "e0bb182146283a43824dd2c2ceeb89b6ff7a93f9a85da889f8663ce1c2bd3002"; + "11" = "e5d92d361e7859fe5f88c92d7bb466e285e07f1e4e2d9944948f85fa0e3aee2b"; }.${javaVersion}; url = "https://www.oracle.com/technetwork/graalvm/downloads/index.html"; }) (requireFile { name = "native-image-installable-svm-svmee-java${javaVersion}-linux-amd64-${version}.jar"; - sha256 = { "8" = "a9f3f86d880d133bd24ad3b1d95129a96e80ea1d8fbc865d09e9410b921e6897"; - "11" = "57086123a95f1e9d4e67b92f830bad9325431908c69a40ef10f28ed586d8bd35"; + sha256 = { "8" = "37ac6a62f68adad513057a60513ba75749adf98cc73999b3918afe159900428d"; + "11" = "f62df715ad529f8b84854644ac99e0a9a349232c7f03985d20a2a8be20edaa44"; + }.${javaVersion}; + url = "https://www.oracle.com/technetwork/graalvm/downloads/index.html"; + }) + (requireFile { + name = "llvm-toolchain-installable-java${javaVersion}-linux-amd64-${version}.jar"; + sha256 = { "8" = "da98a8c17b0c724b41d1596b57e282a1ecfcbf9140404dfb04b0d4d9fb159d8a"; + "11" = "fc442c396e92f59d034a69175104cb3565c3d128426bd939cc94c6ceccbb720f"; }.${javaVersion}; url = "https://www.oracle.com/technetwork/graalvm/downloads/index.html"; }) (requireFile { name = "ruby-installable-svm-svmee-java${javaVersion}-linux-amd64-${version}.jar"; - sha256 = { "8" = "28b2910736f41070c84b97f1b1a3c5fa43ebdcd926ec92c8f145550b5b975b3c"; - "11" = "27ff1befa67fe5cc9eb0216b6b1105876f44d13eff6137f36f29f13377ea687b"; + sha256 = { "8" = "44f6887249f2eb54cba98dd4d9de019da5463d92982e03bf655fffe4bb520daf"; + "11" = "941f3752ccb097958f49250586f04c305092ded3ea4c1b7d9a0f7632e47fa335"; }.${javaVersion}; url = "https://www.oracle.com/technetwork/graalvm/downloads/index.html"; }) (requireFile { name = "python-installable-svm-svmee-java${javaVersion}-linux-amd64-${version}.jar"; - sha256 = { "8" = "9c83bcd71e316805c2914c9002ce348ae44829606adc2375d9188b1eaaaf82f9"; - "11" = "5ca51478bcb5ea5bd9be35856dd7fb2ef03b888cd1b7284a8c15531979025fb4"; + sha256 = { "8" = "5c3993c701bd09c6064dcf4a6d9c7489620d0654b03c74682398c788c0211c09"; + "11" = "de3ebf35ce47dc399d7976cbd09fde0e85f2c10f85bc3fe8f32bb9e2b500ab70"; }.${javaVersion}; url = "https://www.oracle.com/technetwork/graalvm/downloads/index.html"; }) (requireFile { name = "wasm-installable-svm-svmee-java${javaVersion}-linux-amd64-${version}.jar"; - sha256 = { "8" = "e8bd14d3f9bf652104e4346e0899a0351afaecae030a9c0ce0f91b1f93d9e660"; - "11" = "d24eeb84625bb7a5e330b897fd6dde7fc579a687997b64625199c33fa83c40b4"; + sha256 = { "8" = "c0a334b271fd32c098bb3c42eada7eafb9f536becaa756097eebe4682915b067"; + "11" = "9e801071992a0ff976bc40b640a8b9368fd8ea890ba986543658fcbaa3a7fd68"; }.${javaVersion}; url = "https://www.oracle.com/technetwork/graalvm/downloads/index.html"; }) @@ -47,7 +54,7 @@ let unpackPhase = '' unpack_jar() { jar=$1 - unzip $jar -d $out + unzip -o $jar -d $out perl -ne 'use File::Path qw(make_path); use File::Basename qw(dirname); if (/^(.+) = (.+)$/) { @@ -70,6 +77,7 @@ let unpack_jar ''${arr[2]} unpack_jar ''${arr[3]} unpack_jar ''${arr[4]} + unpack_jar ''${arr[5]} ''; installPhase = { @@ -117,7 +125,7 @@ let }.${javaVersion} }:${ stdenv.lib.strings.makeLibraryPath [ glibc xorg.libXxf86vm xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXrender - glib zlib bzip2 alsaLib fontconfig freetype pango gtk3 gtk2 cairo gdk-pixbuf atk ffmpeg_3 libGL ]}" + glib zlib bzip2 alsaLib fontconfig freetype pango gtk3 gtk2 cairo gdk-pixbuf atk ffmpeg libGL ]}" for f in $(find $out -type f -perm -0100); do patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$f" || true |