Unverified Commit 282bea96 authored by Thiago Kenji Okada's avatar Thiago Kenji Okada Committed by GitHub
Browse files

Merge pull request #299203 from thiagokokada/fix-graalvm-x86_64-darwin

buildGraalvm: fix build in x86_64-darwin
parents 31543384 e1a7ec55
Loading
Loading
Loading
Loading
+6 −12
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ let
      ++ lib.optional stdenv.isLinux autoPatchelfHook;

    propagatedBuildInputs = [ setJavaClassPath zlib ]
      ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Foundation;
      ++ lib.optional stdenv.isDarwin darwin.apple_sdk_11_0.frameworks.Foundation;

    buildInputs = lib.optionals stdenv.isLinux [
      alsa-lib # libasound.so wanted by lib/libjsound.so
@@ -165,33 +165,27 @@ let
      echo "Testing GraalVM"
      $out/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler HelloWorld | fgrep 'Hello World'

      # Workaround GraalVM issue where the builder does not have access to the
      # environment variables since 21.0.0
      # Only needed for native-image tests
      # https://github.com/oracle/graal/pull/6095
      # https://github.com/oracle/graal/pull/6095
      # https://github.com/oracle/graal/issues/7502
      export NATIVE_IMAGE_DEPRECATED_BUILDER_SANITATION="true";
      extraNativeImageArgs="$(export -p | sed -n 's/^declare -x \([^=]\+\)=.*$/ -E\1/p' | tr -d \\n)"

      echo "Ahead-Of-Time compilation"
      $out/bin/native-image -H:+UnlockExperimentalVMOptions -H:-CheckToolchain -H:+ReportExceptionStackTraces HelloWorld
      $out/bin/native-image -H:+UnlockExperimentalVMOptions -H:-CheckToolchain -H:+ReportExceptionStackTraces -march=compatibility $extraNativeImageArgs HelloWorld
      ./helloworld | fgrep 'Hello World'

      ${# --static is only available in Linux
      lib.optionalString (stdenv.isLinux && !useMusl) ''
        echo "Ahead-Of-Time compilation with -H:+StaticExecutableWithDynamicLibC"
        $out/bin/native-image -H:+UnlockExperimentalVMOptions -H:+StaticExecutableWithDynamicLibC HelloWorld
        $out/bin/native-image -H:+UnlockExperimentalVMOptions -H:+StaticExecutableWithDynamicLibC -march=compatibility $extraNativeImageArgs HelloWorld
        ./helloworld | fgrep 'Hello World'

        echo "Ahead-Of-Time compilation with --static"
        $out/bin/native-image --static HelloWorld
        $out/bin/native-image $extraNativeImageArgs -march=compatibility --static HelloWorld
        ./helloworld | fgrep 'Hello World'
      ''}

      ${# --static is only available in Linux
      lib.optionalString (stdenv.isLinux && useMusl) ''
        echo "Ahead-Of-Time compilation with --static and --libc=musl"
        $out/bin/native-image --static HelloWorld --libc=musl
        $out/bin/native-image $extraNativeImageArgs -march=compatibility --libc=musl --static HelloWorld
        ./helloworld | fgrep 'Hello World'
      ''}

+17 −12
Original line number Diff line number Diff line
{ lib
, stdenv
, callPackage
, fetchurl
, pkgs
}:

lib.makeScope pkgs.newScope (self:
{
  buildGraalvm = callPackage ./buildGraalvm.nix;
  stdenv =
    if pkgs.stdenv.isDarwin then
      pkgs.darwin.apple_sdk_11_0.stdenv
    else
      pkgs.stdenv;

  buildGraalvmProduct = callPackage ./buildGraalvmProduct.nix;
  buildGraalvm = self.callPackage ./buildGraalvm.nix;

  graalvm-ce = callPackage ./graalvm-ce { };
  buildGraalvmProduct = self.callPackage ./buildGraalvmProduct.nix;

  graalvm-ce-musl = callPackage ./graalvm-ce { useMusl = true; };
  graalvm-ce = self.callPackage ./graalvm-ce { };

  graaljs = callPackage ./graaljs { };
  graalvm-ce-musl = self.callPackage ./graalvm-ce { useMusl = true; };

  graalnodejs = callPackage ./graalnodejs { };
  graaljs = self.callPackage ./graaljs { };

  graalpy = callPackage ./graalpy { };
  graalnodejs = self.callPackage ./graalnodejs { };

  truffleruby = callPackage ./truffleruby { };
}
  graalpy = self.callPackage ./graalpy { };

  truffleruby = self.callPackage ./truffleruby { };
})