git.iko.soy/typeable/nixpkgs
on master help sign in
graalvm8-ee: init at 19.1.1
commitc46b8ba57233323c8885aa43bf10dfd1e81c23d4 authorvolth <volth@volth.com> dateMon 29 Jul 2019, 08:31 (7 years ago) parent577150f
2 files changed+141
pkgs/development/compilers/graalvm/enterprise-edition.nix+139 pkgs/top-level/all-packages.nix+2
pkgs/development/compilers/graalvm/enterprise-edition.nixnew file+139
@@ -0,0 +1,139 @@
1+{ stdenv, requireFile, perl, unzip, glibc, zlib, gdk_pixbuf, xorg, glib, fontconfig, freetype, cairo, pango, gtk3, gtk2, ffmpeg, libGL, atk, alsaLib, libav_0_8, setJavaClassPath }:
2+
3+let
4+ graalvm8-ee = stdenv.mkDerivation rec {
5+ pname = "graalvm8-ee";
6+ version = "19.1.1";
7+ srcs = [
8+ (requireFile {
9+ name = "graalvm-ee-linux-amd64-${version}.tar.gz";
10+ sha256 = "1ayg4chiw08jbrivmsylh6275sn0ygzc0iaic28fk7hhw5dc6r2f";
11+ url = "https://www.oracle.com/technetwork/graalvm/downloads/index.html";
12+ })
13+ (requireFile {
14+ name = "native-image-installable-svm-svmee-linux-amd64-${version}.jar";
15+ sha256 = "1mvc4id193gl482fnjcgh4dz29ifqwigqq68ib0i1p3ks1nnj717";
16+ url = "https://www.oracle.com/technetwork/graalvm/downloads/index.html";
17+ })
18+ (requireFile {
19+ name = "python-installable-svm-svmee-linux-amd64-${version}.jar";
20+ sha256 = "0q7sggqk5myad053dsfw2i1n8v4wspahg1ac7zr3y3srqvdb0xfp";
21+ url = "https://www.oracle.com/technetwork/graalvm/downloads/index.html";
22+ })
23+ (requireFile {
24+ name = "ruby-installable-svm-svmee-linux-amd64-${version}.jar";
25+ sha256 = "1xax1bg155d74jhv7h0qb7vbc95jy4wm4bvbpvr76ivzn7qaml6j";
26+ url = "https://www.oracle.com/technetwork/graalvm/downloads/index.html";
27+ })
28+ ];
29+ nativeBuildInputs = [ unzip perl ];
30+ unpackPhase = ''
31+ unpack_jar() {
32+ jar=$1
33+ unzip $jar -d $out
34+ perl -ne 'use File::Path qw(make_path);
35+ use File::Basename qw(dirname);
36+ if (/^(.+) = (.+)$/) {
37+ make_path dirname("$ENV{out}/$1");
38+ system "ln -s $2 $ENV{out}/$1";
39+ }' $out/META-INF/symlinks
40+ perl -ne 'if (/^(.+) = ([r-])([w-])([x-])([r-])([w-])([x-])([r-])([w-])([x-])$/) {
41+ my $mode = ($2 eq 'r' ? 0400 : 0) + ($3 eq 'w' ? 0200 : 0) + ($4 eq 'x' ? 0100 : 0) +
42+ ($5 eq 'r' ? 0040 : 0) + ($6 eq 'w' ? 0020 : 0) + ($7 eq 'x' ? 0010 : 0) +
43+ ($8 eq 'r' ? 0004 : 0) + ($9 eq 'w' ? 0002 : 0) + ($10 eq 'x' ? 0001 : 0);
44+ chmod $mode, "$ENV{out}/$1";
45+ }' $out/META-INF/permissions
46+ rm -rf $out/META-INF
47+ }
48+
49+ mkdir -p $out
50+ arr=($srcs)
51+ tar xf ''${arr[0]} -C $out --strip-components=1
52+ unpack_jar ''${arr[1]}
53+ unpack_jar ''${arr[2]}
54+ unpack_jar ''${arr[3]}
55+ '';
56+
57+ installPhase = ''
58+ # BUG workaround http://mail.openjdk.java.net/pipermail/graal-dev/2017-December/005141.html
59+ substituteInPlace $out/jre/lib/security/java.security \
60+ --replace file:/dev/random file:/dev/./urandom \
61+ --replace NativePRNGBlocking SHA1PRNG
62+
63+ # provide libraries needed for static compilation
64+ for f in ${glibc}/lib/* ${glibc.static}/lib/* ${zlib.static}/lib/*; do
65+ ln -s $f $out/jre/lib/svm/clibraries/linux-amd64/$(basename $f)
66+ done
67+ '';
68+
69+ dontStrip = true;
70+
71+ # copy-paste openjdk's preFixup
72+ preFixup = ''
73+ # Propagate the setJavaClassPath setup hook from the JRE so that
74+ # any package that depends on the JRE has $CLASSPATH set up
75+ # properly.
76+ mkdir -p $out/nix-support
77+ printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
78+
79+ # Set JAVA_HOME automatically.
80+ mkdir -p $out/nix-support
81+ cat <<EOF > $out/nix-support/setup-hook
82+ if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
83+ EOF
84+ '';
85+
86+ postFixup = ''
87+ rpath="$out/jre/lib/amd64/jli:$out/jre/lib/amd64/server:$out/jre/lib/amd64:${
88+ stdenv.lib.strings.makeLibraryPath [ glibc xorg.libXxf86vm xorg.libX11 xorg.libXext xorg.libXtst xorg.libXi xorg.libXrender
89+ glib zlib alsaLib fontconfig freetype pango gtk3 gtk2 cairo gdk_pixbuf atk ffmpeg libGL ]}"
90+
91+ for f in $(find $out -type f -perm -0100); do
92+ patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$f" || true
93+ patchelf --set-rpath "$rpath" "$f" || true
94+ done
95+
96+ for f in $(find $out -type f -perm -0100); do
97+ if ldd "$f" | fgrep 'not found'; then echo "in file $f"; fi
98+ done
99+ '';
100+
101+ doInstallCheck = true;
102+ buildInputs = [ zlib ]; # actually "installCheckInputs", native-image needs <zlib.h>
103+ installCheckPhase = ''
104+ echo ${stdenv.lib.escapeShellArg ''
105+ public class HelloWorld {
106+ public static void main(String[] args) {
107+ System.out.println("Hello World");
108+ }
109+ }
110+ ''} > HelloWorld.java
111+ $out/bin/javac HelloWorld.java
112+
113+ # run on JVM with Graal Compiler
114+ $out/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler HelloWorld
115+ $out/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler HelloWorld | fgrep 'Hello World'
116+
117+ # Ahead-Of-Time compilation
118+ $out/bin/native-image --no-server HelloWorld
119+ ./helloworld
120+ ./helloworld | fgrep 'Hello World'
121+
122+ # Ahead-Of-Time compilation with --static
123+ $out/bin/native-image --no-server --static HelloWorld
124+ ./helloworld
125+ ./helloworld | fgrep 'Hello World'
126+ '';
127+
128+ passthru.home = graalvm8-ee;
129+
130+ meta = with stdenv.lib; {
131+ homepage = https://www.graalvm.org/;
132+ description = "High-Performance Polyglot VM";
133+ license = licenses.unfree;
134+ maintainers = with maintainers; [ volth hlolli ];
135+ platforms = [ "x86_64-linux" ];
136+ };
137+ };
138+in
139+ graalvm8-ee
pkgs/top-level/all-packages.nix+2
@@ -7823,6 +7823,8 @@ in
78237823
78247824 inherit (callPackages ../development/compilers/graalvm { }) mx jvmci8 graalvm8;
78257825
7826+ graalvm8-ee = callPackages ../development/compilers/graalvm/enterprise-edition.nix { };
7827+
78267828 openshot-qt = libsForQt5.callPackage ../applications/video/openshot-qt { };
78277829
78287830 openspin = callPackage ../development/compilers/openspin { };