graalVMPackages.graalvm-ce-musl: init at 21.0.0

Exposing this derivation so it is easier to test and use.
This commit is contained in:
Thiago Kenji Okada 2023-09-27 22:50:34 +01:00
parent 7457b3cec3
commit cfeeda0704
3 changed files with 14 additions and 8 deletions

View file

@ -14,7 +14,6 @@
, runCommandCC
, setJavaClassPath
, unzip
, writeShellScriptBin
, xorg
, zlib
# extra params
@ -43,7 +42,6 @@ let
"runCommandCC"
"setJavaClassPath"
"unzip"
"writeShellScriptBin"
"xorg"
"zlib"
"extraCLibs"
@ -61,21 +59,25 @@ let
);
# GraalVM 21.3.0+ expects musl-gcc as <system>-musl-gcc
musl-gcc = (writeShellScriptBin "${stdenv.hostPlatform.system}-musl-gcc" ''${lib.getDev musl}/bin/musl-gcc "$@"'');
musl-gcc = (runCommandCC "musl-gcc" { } ''
mkdir -p $out/bin
ln -s ${lib.getDev musl}/bin/musl-gcc $out/bin/${stdenv.hostPlatform.system}-musl-gcc
'');
# GraalVM 23.0.0+ (i.e.: JDK 21.0.0+) clean-up the environment inside darwin
# So we need to re-added some env vars to make everything work correctly again
darwin-cc = (runCommandCC "darwin-cc" {
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ darwin.apple_sdk.frameworks.Foundation zlib ];
} ''
darwin-cc = (runCommandCC "darwin-cc"
{
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ darwin.apple_sdk.frameworks.Foundation zlib ];
} ''
makeWrapper ${stdenv.cc}/bin/cc $out/bin/cc \
--prefix NIX_CFLAGS_COMPILE_${stdenv.cc.suffixSalt} : "$NIX_CFLAGS_COMPILE" \
--prefix NIX_LDFLAGS_${stdenv.cc.suffixSalt} : "$NIX_LDFLAGS"
'');
binPath = lib.makeBinPath (
lib.optionals stdenv.isDarwin [ darwin-cc ]
++ [ stdenv.cc ]
++ lib.optionals useMusl [ musl-gcc ]
++ [ stdenv.cc ]
);
runtimeLibraryPath = lib.makeLibraryPath

View file

@ -11,6 +11,8 @@
graalvm-ce = callPackage ./graalvm-ce { };
graalvm-ce-musl = callPackage ./graalvm-ce { useMusl = true; };
graaljs = callPackage ./graaljs { };
graalnodejs = callPackage ./graalnodejs { };

View file

@ -1,9 +1,11 @@
{ stdenv
, fetchurl
, graalvmCEPackages
, useMusl ? false
}:
graalvmCEPackages.buildGraalvm {
inherit useMusl;
src = fetchurl (import ./hashes.nix).hashes.${stdenv.system};
version = (import ./hashes.nix).version;
meta.platforms = builtins.attrNames (import ./hashes.nix).hashes;