mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-22 12:53:54 +00:00
Merge pull request #216532 from thiagokokada/add-nodejs-to-graalvm-ce
graalvmCEPackages.nodejs-installable-svm: init at 22.3.1
This commit is contained in:
commit
ec32e05671
@ -120,8 +120,7 @@ let
|
||||
'' + concatProducts "postInstall";
|
||||
|
||||
preFixup = lib.optionalString (stdenv.isLinux) ''
|
||||
# Find all executables in any directory that contains '/bin/'
|
||||
for bin in $(find "$out" -executable -type f -wholename '*/bin/*'); do
|
||||
for bin in $(find "$out/bin" -executable -type f); do
|
||||
wrapProgram "$bin" --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}"
|
||||
done
|
||||
'' + concatProducts "preFixup";
|
||||
|
@ -74,6 +74,17 @@ stdenv.mkDerivation ({
|
||||
runHook postUnpack
|
||||
'';
|
||||
|
||||
# Allow autoPatchelf to automatically fix lib references between products
|
||||
fixupPhase = ''
|
||||
runHook preFixup
|
||||
|
||||
mkdir -p $out/lib
|
||||
shopt -s globstar
|
||||
ln -s $out/languages/**/lib/*.so $out/lib
|
||||
|
||||
runHook postFixup
|
||||
'';
|
||||
|
||||
dontInstall = true;
|
||||
dontBuild = true;
|
||||
dontStrip = true;
|
||||
|
@ -22,20 +22,28 @@ in
|
||||
rec {
|
||||
inherit buildGraalvm buildGraalvmProduct;
|
||||
|
||||
graalvm11-ce = buildGraalvm rec {
|
||||
### Java 11 ###
|
||||
|
||||
# Mostly available for build purposes, not to be exposed at the top level
|
||||
graalvm11-ce-bare = buildGraalvm rec {
|
||||
version = "22.3.1";
|
||||
javaVersion = "11";
|
||||
src = fetchurl (source "graalvm-ce" javaVersion);
|
||||
meta.platforms = builtins.attrNames javaPlatform;
|
||||
products = [ ];
|
||||
};
|
||||
|
||||
graalvm11-ce = graalvm11-ce-bare.override {
|
||||
products = [ native-image-installable-svm-java11 ];
|
||||
};
|
||||
|
||||
# Mostly available for testing, not to be exposed at the top level
|
||||
graalvm11-ce-full = graalvm11-ce.override {
|
||||
graalvm11-ce-full = graalvm11-ce-bare.override {
|
||||
products = [
|
||||
js-installable-svm-java11
|
||||
llvm-installable-svm-java11
|
||||
native-image-installable-svm-java11
|
||||
nodejs-installable-svm-java11
|
||||
python-installable-svm-java11
|
||||
ruby-installable-svm-java11
|
||||
wasm-installable-svm-java11
|
||||
@ -60,6 +68,13 @@ rec {
|
||||
src = fetchurl (source "native-image-installable-svm" javaVersion);
|
||||
};
|
||||
|
||||
nodejs-installable-svm-java11 = callPackage ./nodejs-installable-svm.nix rec {
|
||||
javaVersion = "11";
|
||||
version = "22.3.1";
|
||||
src = fetchurl (source "nodejs-installable-svm" javaVersion);
|
||||
graalvm-ce = graalvm11-ce-bare;
|
||||
};
|
||||
|
||||
python-installable-svm-java11 = callPackage ./python-installable-svm.nix rec {
|
||||
javaVersion = "11";
|
||||
version = "22.3.1";
|
||||
@ -79,20 +94,28 @@ rec {
|
||||
src = fetchurl (source "wasm-installable-svm" javaVersion);
|
||||
};
|
||||
|
||||
graalvm17-ce = buildGraalvm rec {
|
||||
### Java 17 ###
|
||||
|
||||
# Mostly available for build purposes, not to be exposed at the top level
|
||||
graalvm17-ce-bare = buildGraalvm rec {
|
||||
version = "22.3.1";
|
||||
javaVersion = "17";
|
||||
src = fetchurl (source "graalvm-ce" javaVersion);
|
||||
meta.platforms = builtins.attrNames javaPlatform;
|
||||
products = [ ];
|
||||
};
|
||||
|
||||
graalvm17-ce = graalvm17-ce-bare.override {
|
||||
products = [ native-image-installable-svm-java17 ];
|
||||
};
|
||||
|
||||
# Mostly available for testing, not to be exposed at the top level
|
||||
graalvm17-ce-full = graalvm17-ce.override {
|
||||
graalvm17-ce-full = graalvm17-ce-bare.override {
|
||||
products = [
|
||||
js-installable-svm-java17
|
||||
llvm-installable-svm-java17
|
||||
native-image-installable-svm-java17
|
||||
nodejs-installable-svm-java17
|
||||
python-installable-svm-java17
|
||||
ruby-installable-svm-java17
|
||||
wasm-installable-svm-java17
|
||||
@ -117,6 +140,13 @@ rec {
|
||||
src = fetchurl (source "native-image-installable-svm" javaVersion);
|
||||
};
|
||||
|
||||
nodejs-installable-svm-java17 = callPackage ./nodejs-installable-svm.nix rec {
|
||||
javaVersion = "17";
|
||||
version = "22.3.1";
|
||||
src = fetchurl (source "nodejs-installable-svm" javaVersion);
|
||||
graalvm-ce = graalvm17-ce-bare;
|
||||
};
|
||||
|
||||
python-installable-svm-java17 = callPackage ./python-installable-svm.nix rec {
|
||||
javaVersion = "17";
|
||||
version = "22.3.1";
|
||||
|
@ -34,6 +34,40 @@
|
||||
url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java17-darwin-amd64-22.3.1.jar";
|
||||
};
|
||||
};
|
||||
"nodejs-installable-svm" = {
|
||||
"11-linux-aarch64" = {
|
||||
sha256 = "0slzvbmxwa4a6m9c0hbdp8ryh9crfq7mv6y2j4hik5m457jq98cp";
|
||||
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java11-linux-aarch64-22.3.1.jar";
|
||||
};
|
||||
"17-linux-aarch64" = {
|
||||
sha256 = "1ldivy5hmq2mxmzh40hglzngylahnzyqh9rav73nicl5mz8hk4l2";
|
||||
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java17-linux-aarch64-22.3.1.jar";
|
||||
};
|
||||
"11-linux-amd64" = {
|
||||
sha256 = "1p1y52b4lky2fbkml5vqy7dn9vqzj19jq5f3c90mgsfk4c7xhi66";
|
||||
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java11-linux-amd64-22.3.1.jar";
|
||||
};
|
||||
"17-linux-amd64" = {
|
||||
sha256 = "0j1gkpszklzm069bccm6wgq8iq0k41bcrca0kf8pbl2y11hwywpc";
|
||||
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java17-linux-amd64-22.3.1.jar";
|
||||
};
|
||||
"11-darwin-aarch64" = {
|
||||
sha256 = "1fbqc3a7i91as1sbwg2yr1zx0wz4jsaxcz9pfqy8a0z88m8vivbs";
|
||||
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java11-darwin-aarch64-22.3.1.jar";
|
||||
};
|
||||
"17-darwin-aarch64" = {
|
||||
sha256 = "1swzkp0imcv30fxfwblgad57fvpsvhfpv93s8zj1lwrbarggl2y3";
|
||||
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java17-darwin-aarch64-22.3.1.jar";
|
||||
};
|
||||
"11-darwin-amd64" = {
|
||||
sha256 = "0n3hm8dd0ya86hxbxv07sfp22y02vhhzahkxk2j2162n9hcdmkwk";
|
||||
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java11-darwin-amd64-22.3.1.jar";
|
||||
};
|
||||
"17-darwin-amd64" = {
|
||||
sha256 = "0xkjqcch22bm32mczj6xs8rzsl2n6vy9hmzwfy9a71w1kpkbjn3a";
|
||||
url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/nodejs-installable-svm-java17-darwin-amd64-22.3.1.jar";
|
||||
};
|
||||
};
|
||||
"wasm-installable-svm" = {
|
||||
"11-linux-aarch64" = {
|
||||
sha256 = "1d67jm41psypkhpy77cb2l00smhni3pgkybwx79z7dzcyid7p2l1";
|
||||
|
@ -1,6 +1,5 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, graalvm-ce
|
||||
, graalvmCEPackages
|
||||
, javaVersion
|
||||
, src
|
||||
|
@ -10,10 +10,6 @@ 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"
|
||||
|
@ -0,0 +1,21 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, graalvmCEPackages
|
||||
, graalvm-ce
|
||||
, javaVersion
|
||||
, src
|
||||
, version
|
||||
}:
|
||||
|
||||
graalvmCEPackages.buildGraalvmProduct rec {
|
||||
inherit src javaVersion version;
|
||||
product = "nodejs-installable-svm";
|
||||
|
||||
extraNativeBuildInputs = [ graalvm-ce ];
|
||||
|
||||
# TODO: improve test
|
||||
graalvmPhases.installCheckPhase = ''
|
||||
echo "Testing NodeJS"
|
||||
$out/bin/npx --help
|
||||
'';
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, graalvmCEPackages
|
||||
, llvm-installable-svm
|
||||
, openssl
|
||||
, javaVersion
|
||||
, musl
|
||||
, src
|
||||
, version
|
||||
, llvm-installable-svm
|
||||
}:
|
||||
|
||||
graalvmCEPackages.buildGraalvmProduct rec {
|
||||
|
@ -6,6 +6,8 @@ set -eou pipefail
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
tmpfile="$(mktemp --suffix=.nix)"
|
||||
|
||||
trap 'rm -rf "$tmpfile"' EXIT
|
||||
|
||||
info() { echo "[INFO] $*"; }
|
||||
|
||||
echo_file() { echo "$@" >> "$tmpfile"; }
|
||||
@ -43,6 +45,7 @@ declare -r -A products_urls=(
|
||||
[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"
|
||||
[nodejs-installable-svm]="https://github.com/graalvm/graaljs/releases/download/vm-${new_version}/nodejs-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"
|
||||
@ -59,7 +62,7 @@ readonly platforms=(
|
||||
"17-darwin-amd64"
|
||||
)
|
||||
|
||||
info "Generating hashes.nix file for 'graalvm-ce' $new_version. This will take a while..."
|
||||
info "Generating '$hashes_nix' file for 'graalvm-ce' $new_version. This will take a while..."
|
||||
|
||||
# Indentation of `echo_file` function is on purpose to make it easier to visualize the output
|
||||
echo_file "# Generated by $0 script"
|
||||
@ -68,14 +71,16 @@ for product in "${!products_urls[@]}"; do
|
||||
url="${products_urls["${product}"]}"
|
||||
echo_file " \"$product\" = {"
|
||||
for platform in "${platforms[@]}"; do
|
||||
# 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)"
|
||||
args=("${url//@platform@/$platform}")
|
||||
# Get current hashes to skip derivations already in /nix/store to reuse cache when the version is the same
|
||||
# e.g.: when adding a new product and running this script with FORCE=1
|
||||
if [[ "$current_version" == "$new_version" ]] && \
|
||||
previous_hash="$(nix-instantiate --eval "$hashes_nix" -A "$product.$platform.sha256" --json | jq -r)"; then
|
||||
args+=("$previous_hash" "--type" "sha256")
|
||||
else
|
||||
previous_hash=""
|
||||
info "Hash in '$product' for '$platform' not found. Re-downloading it..."
|
||||
fi
|
||||
# Lack of quoting in $previous_hash is proposital
|
||||
if hash="$(nix-prefetch-url "${url//@platform@/$platform}" $previous_hash)"; then
|
||||
if hash="$(nix-prefetch-url "${args[@]}")"; then
|
||||
echo_file " \"$platform\" = {"
|
||||
echo_file " sha256 = \"$hash\";"
|
||||
echo_file " url = \"${url//@platform@/${platform}}\";"
|
||||
|
Loading…
Reference in New Issue
Block a user