anchor.diff:      x86_64-darwin = "darwin-amd64";
     }.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
   
  -  runtimeDependencies = [ cups ]
  -    ++ lib.optionals gtkSupport [ cairo glib gtk3 ];
  -
  -  runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies;
  +  runtimeLibraryPath = lib.makeLibraryPath
  +    ([ cups ] ++ lib.optionals gtkSupport [ cairo glib gtk3 ]);
  +
  +  runtimeDependencies = lib.makeBinPath ([
  +    binutils
  +    stdenv.cc
  +  ] ++ lib.optionals useMusl [
  +    (lib.getDev musl)
  +    # GraalVM 21.3.0+ expects musl-gcc as <system>-musl-gcc
  +    (writeShellScriptBin "${stdenv.system}-musl-gcc" ''${lib.getDev musl}/bin/musl-gcc "$@"'')
  +  ]);
   
     javaVersionPlatform = "${javaVersion}-${platform}";
   
  
positive.code:       for bin in $( find "$out" -executable -type f -not -path '*/languages/ruby/lib/gems/*' -not -name jspawnhelper ); do
          if patchelf --print-interpreter "$bin" &> /dev/null || head -n 1 "$bin" | grep '^#!' -q; then
            wrapProgram "$bin" \
              --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}"
          fi
        done
  
        # copy-paste openjdk's preFixup
        # Set JAVA_HOME automatically.
        mkdir -p $out/nix-support
        cat <<EOF > $out/nix-support/setup-hook
          if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
        EOF
  
        find "$out" -name libfontmanager.so -exec \
          patchelf --add-needed libfontconfig.so {} \;
      '';
  
      # $out/bin/native-image needs zlib to build native executables.
  
negative.code: 
      outputs = [ "out" "lib" ];
  
      installPhase =
        let
          copyClibrariesToOut = basepath: ''
            # provide libraries needed for static compilation
            ${
              if useMusl then
                "for f in ${musl.stdenv.cc.cc}/lib/* ${musl}/lib/* ${zlib.static}/lib/*; do"
              else
                "for f in ${glibc}/lib/* ${glibc.static}/lib/* ${zlib.static}/lib/*; do"
            }
              ln -s $f ${basepath}/${platform}/$(basename $f)
            done
          '';
          copyClibrariesToLib = ''
            # add those libraries to $lib output too, so we can use them with
            # `native-image -H:CLibraryPath=''${lib.getLib graalvm11-ce}/lib ...` and reduce
            # closure size by not depending on GraalVM $out (that is much bigger)
            mkdir -p $lib/lib
            for f in ${glibc}/lib/*; do
              ln -s $f $lib/lib/$(basename $f)
            done
          '';
        in
        {
          "11-linux-amd64" = ''
            ${copyClibrariesToOut "$out/lib/svm/clibraries"}
  
            ${copyClibrariesToLib}
          '';
          "17-linux-amd64" = ''
            ${copyClibrariesToOut "$out/lib/svm/clibraries"}
  
            ${copyClibrariesToLib}
          '';
          "11-linux-aarch64" = ''
            ${copyClibrariesToOut "$out/lib/svm/clibraries"}
  
            ${copyClibrariesToLib}
          '';
          "17-linux-aarch64" = ''
            ${copyClibrariesToOut "$out/lib/svm/clibraries"}
  
            ${copyClibrariesToLib}
          '';
          "11-darwin-amd64" = "";
          "17-darwin-amd64" = "";
        }.${javaVersionPlatform} + ''
          # ensure that $lib/lib exists to avoid breaking builds
          mkdir -p $lib/lib
          # jni.h expects jni_md.h to be in the header search path.
          ln -s $out/include/linux/*_md.h $out/include/
  
          # copy-paste openjdk's preFixup
          # Set JAVA_HOME automatically.
          mkdir -p $out/nix-support
          cat <<EOF > $out/nix-support/setup-hook
            if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
          EOF
        '';
  
      dontStrip = true;
  
      # Workaround for libssl.so.10 wanted by TruffleRuby
      # Resulting TruffleRuby cannot use `openssl` library.
      autoPatchelfIgnoreMissingDeps = stdenv.isDarwin;
  
      preFixup = lib.optionalString (stdenv.isLinux) ''
        # We cannot use -exec since wrapProgram is a function but not a
        # command.
        #
  