@@ -44,7 +44,7 @@ let
4444 version = platform.version;
4545 name = "graalvm${javaVersion}-ce";
4646 sourcesFilename = "${name}-sources.json";
47− sources = builtins.fromJSON (builtins.readFile (./. + "/${sourcesFilename}"));
47+ sources = builtins.fromJSON (builtins.readFile (./${sourcesFilename}));
4848
4949 runtimeLibraryPath = lib.makeLibraryPath
5050 ([ cups ] ++ lib.optionals gtkSupport [ cairo glib gtk3 ]);
@@ -132,48 +132,40 @@ let
132132
133133 outputs = [ "out" "lib" ];
134134
135− installPhase =
136− let
137− copyClibrariesToOut = basepath: ''
138− # provide libraries needed for static compilation
139− ${
140− if useMusl then
141− "for f in ${musl.stdenv.cc.cc}/lib/* ${musl}/lib/* ${zlib.static}/lib/*; do"
142− else
143− "for f in ${glibc}/lib/* ${glibc.static}/lib/* ${zlib.static}/lib/*; do"
144− }
145− ln -s $f ${basepath}/${platform.arch}/$(basename $f)
146− done
147− '';
148− copyClibrariesToLib = ''
149− # add those libraries to $lib output too, so we can use them with
150− # `native-image -H:CLibraryPath=''${lib.getLib graalvm11-ce}/lib ...` and reduce
151− # closure size by not depending on GraalVM $out (that is much bigger)
152− mkdir -p $lib/lib
153− for f in ${glibc}/lib/*; do
154− ln -s $f $lib/lib/$(basename $f)
155− done
156− '';
157− in
158− ''
159− # ensure that $lib/lib exists to avoid breaking builds
160− mkdir -p $lib/lib
161− # jni.h expects jni_md.h to be in the header search path.
162− ln -s $out/include/linux/*_md.h $out/include/
163−
164− # copy-paste openjdk's preFixup
165− # Set JAVA_HOME automatically.
166− mkdir -p $out/nix-support
167− cat > $out/nix-support/setup-hook << EOF
168− if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
169− EOF
135+ installPhase = ''
136+ # ensure that $lib/lib exists to avoid breaking builds
137+ mkdir -p $lib/lib
138+ # jni.h expects jni_md.h to be in the header search path.
139+ ln -s $out/include/linux/*_md.h $out/include/
140+
141+ # copy-paste openjdk's preFixup
142+ # Set JAVA_HOME automatically.
143+ mkdir -p $out/nix-support
144+ cat > $out/nix-support/setup-hook << EOF
145+ if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
146+ EOF
147+ ${
148+ lib.optionalString (stdenv.isLinux) ''
149+ # provide libraries needed for static compilation
170150 ${
171− lib.optionalString (stdenv.isLinux) ''
172− ${copyClibrariesToOut "$out/lib/svm/clibraries"}
173− ${copyClibrariesToLib}
174− ''
151+ if useMusl then
152+ "for f in ${musl.stdenv.cc.cc}/lib/* ${musl}/lib/* ${zlib.static}/lib/*; do"
153+ else
154+ "for f in ${glibc}/lib/* ${glibc.static}/lib/* ${zlib.static}/lib/*; do"
175155 }
176− '';
156+ ln -s $f $out/lib/svm/clibraries/${platform.arch}/$(basename $f)
157+ done
158+
159+ # add those libraries to $lib output too, so we can use them with
160+ # `native-image -H:CLibraryPath=''${lib.getLib graalvmXX-ce}/lib ...` and reduce
161+ # closure size by not depending on GraalVM $out (that is much bigger)
162+ mkdir -p $lib/lib
163+ for f in ${glibc}/lib/*; do
164+ ln -s $f $lib/lib/$(basename $f)
165+ done
166+ ''
167+ }
168+ '';
177169
178170 dontStrip = true;
179171