diff options
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix')
-rw-r--r-- | nixpkgs/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix | 78 |
1 files changed, 23 insertions, 55 deletions
diff --git a/nixpkgs/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix b/nixpkgs/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix index a9eb04cdb3c9..579e40580802 100644 --- a/nixpkgs/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix +++ b/nixpkgs/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix @@ -1,20 +1,15 @@ { lib , stdenv , autoPatchelfHook +, darwin , graalvm-ce , makeWrapper -, perl -, unzip , zlib , libxcrypt-legacy # extra params , product -, javaVersion , extraBuildInputs ? [ ] , extraNativeBuildInputs ? [ ] -, graalvmPhases ? { } -, meta ? { } -, passthru ? { } , ... } @ args: @@ -23,24 +18,21 @@ let "lib" "stdenv" "autoPatchelfHook" + "darwin" "graalvm-ce" + "libxcrypt-legacy" "makeWrapper" - "perl" - "unzip" "zlib" "product" - "javaVersion" "extraBuildInputs" "extraNativeBuildInputs" - "graalvmPhases" "meta" - "passthru" ]; in stdenv.mkDerivation ({ - pname = "${product}-java${javaVersion}"; + pname = product; - nativeBuildInputs = [ perl unzip makeWrapper ] + nativeBuildInputs = [ makeWrapper ] ++ lib.optional stdenv.isLinux autoPatchelfHook ++ extraNativeBuildInputs; @@ -48,61 +40,37 @@ stdenv.mkDerivation ({ stdenv.cc.cc.lib # libstdc++.so.6 zlib libxcrypt-legacy # libcrypt.so.1 (default is .2 now) - ] ++ extraBuildInputs; + ] + ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Foundation + ++ extraBuildInputs; unpackPhase = '' runHook preUnpack - unpack_jar() { - local jar="$1" - unzip -q -o "$jar" -d "$out" - perl -ne 'use File::Path qw(make_path); - use File::Basename qw(dirname); - if (/^(.+) = (.+)$/) { - make_path dirname("$ENV{out}/$1"); - symlink $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" - unpack_jar "$src" + tar xf "$src" -C "$out" --strip-components=1 - runHook postUnpack - ''; - - # Allow autoPatchelf to automatically fix lib references between products - fixupPhase = '' - runHook preFixup + # Sanity check + if [ ! -d "$out/bin" ]; then + echo "The `bin` is directory missing after extracting the graalvm" + echo "tarball, please compare the directory structure of the" + echo "tarball with what happens in the unpackPhase (in particular" + echo "with regards to the `--strip-components` flag)." + exit 1 + fi - mkdir -p $out/lib - shopt -s globstar - ln -s $out/languages/**/lib/*.so $out/lib - - runHook postFixup + runHook postUnpack ''; - dontInstall = true; - dontBuild = true; dontStrip = true; passthru = { - inherit product javaVersion; - # build phases that are going to run during GraalVM derivation build, - # since they depend in having the fully setup GraalVM environment - # e.g.: graalvmPhases.installCheckPhase will run the checks only after - # GraalVM+products is build - # see buildGraalvm.nix file for the available phases - inherit graalvmPhases; - } // passthru; + updateScript = [ ./update.sh product ]; + } // (args.passhtru or { }); - meta = with lib; ({ + meta = ({ inherit (graalvm-ce.meta) homepage license sourceProvenance maintainers platforms; description = "High-Performance Polyglot VM (Product: ${product})"; - } // meta); + } // (args.meta or { })); } // extraArgs) |