Commit bcdfa188 authored by nixdrin's avatar nixdrin
Browse files

jetbrains.rider: use autoPatchelf

Turns out Rider was previously relying on having libstdc++ in
LD_LIBRARY_PATH, because the binaries were not patched properly.

Rewrite the patching to use autoPatchelf similar to CLion so that the
RPATH of the binaries are adjusted. While at it also patch all the
binaries in the dotCommon and dotTrace plugins. Those seem to need zlib
and fontconfig which were completely missing before (they are probably
only called when using certain functionality of the IDE).

icu doesn't actually seem to be needed (autoPatchelf does not complain
that it's missing) and the IDE starts fine without it, so drop it for
now.
parent 7a8b1426
Loading
Loading
Loading
Loading
+23 −12
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
, gdb
, zlib
, python3
, icu
, lldb
, dotnet-sdk_7
, maven
@@ -17,6 +16,7 @@
, openssl
, expat
, libxcrypt-legacy
, fontconfig
, vmopts ? null
}:

@@ -252,8 +252,6 @@ let
    (mkJetBrainsProduct {
      inherit pname version src wmClass jdk buildNumber;
      product = "Rider";
      # icu is required by Rider.Backend
      extraLdPath = [ icu ];
      meta = with lib; {
        homepage = "https://www.jetbrains.com/rider/";
        inherit description license platforms;
@@ -268,15 +266,28 @@ let
        maintainers = with maintainers; [ raphaelr ];
      };
    }).overrideAttrs (attrs: {
      postPatch = lib.optionalString (!stdenv.isDarwin) (attrs.postPatch + ''
        interp="$(cat $NIX_CC/nix-support/dynamic-linker)"
        patchelf --set-interpreter $interp \
          lib/ReSharperHost/linux-x64/Rider.Backend \
          plugins/dotCommon/DotFiles/linux-x64/JetBrains.Profiler.PdbServer
      nativeBuildInputs = (attrs.nativeBuildInputs or [ ]) ++ lib.optionals (stdenv.isLinux) [
        autoPatchelfHook
      ];
      buildInputs = (attrs.buildInputs or [ ]) ++ lib.optionals (stdenv.isLinux) [
        stdenv.cc.cc
        zlib
        fontconfig  # plugins/dotTrace/DotFiles/linux-x64/libSkiaSharp.so
      ];
      dontAutoPatchelf = true;
      postFixup = (attrs.postFixup or "") + lib.optionalString (stdenv.isLinux) ''
        (
          cd $out/rider

          # Remove dotnet copy first so it's not considered by autoPatchElf
          rm -rf lib/ReSharperHost/linux-x64/dotnet
          autoPatchelf \
            lib/ReSharperHost/linux-x64/ \
            plugins/dotCommon/DotFiles/linux-x64/ \
            plugins/dotTrace/DotFiles/linux-x64/
          ln -s ${dotnet-sdk_7} lib/ReSharperHost/linux-x64/dotnet
      '');
        )
      '';
    });

  buildRubyMine = { pname, version, src, license, description, wmClass, buildNumber, ... }: