Unverified Commit 2f1f3736 authored by ners's avatar ners
Browse files

jetbrains: patch libxml2 dependency

parent af835939
Loading
Loading
Loading
Loading
+38 −66
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ let
        ++ lib.optionals (stdenv.hostPlatform.isLinux && forceWayland) [
          ''--add-flags "\''${WAYLAND_DISPLAY:+-Dawt.toolkit.name=WLToolkit}"''
        ];
      extraLdPath = extraLdPath ++ lib.optionals (stdenv.hostPlatform.isLinux) [ libGL ];
      extraLdPath = extraLdPath ++ lib.optionals stdenv.hostPlatform.isLinux [ libGL ];
      src =
        if fromSource then
          communitySources."${pname}"
@@ -160,6 +160,18 @@ let
      }
    );

  patchSharedLibs = lib.optionalString stdenv.hostPlatform.isLinux ''
    ls -d \
      $out/*/bin/*/linux/*/lib/liblldb.so \
      $out/*/bin/*/linux/*/lib/python3.8/lib-dynload/* \
      $out/*/plugins/*/bin/*/linux/*/lib/liblldb.so \
      $out/*/plugins/*/bin/*/linux/*/lib/python3.8/lib-dynload/* |
    xargs patchelf \
      --replace-needed libssl.so.10 libssl.so \
      --replace-needed libcrypto.so.10 libcrypto.so \
      --replace-needed libcrypt.so.1 libcrypt.so \
      ${lib.optionalString stdenv.hostPlatform.isAarch "--replace-needed libxml2.so.2 libxml2.so"}
  '';
in
rec {
  # Sorted alphabetically
@@ -176,7 +188,7 @@ rec {
    (mkJetBrainsProduct {
      pname = "clion";
      extraBuildInputs =
        lib.optionals (stdenv.hostPlatform.isLinux) [
        lib.optionals stdenv.hostPlatform.isLinux [
          fontconfig
          python3
          stdenv.cc.cc
@@ -185,7 +197,7 @@ rec {
          lttng-ust_2_12
          musl
        ]
        ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
        ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch) [
          expat
          libxml2
          xz
@@ -194,34 +206,16 @@ rec {
      (attrs: {
        postInstall =
          (attrs.postInstall or "")
          + lib.optionalString (stdenv.hostPlatform.isLinux) ''
            (
              cd $out/clion

              for dir in plugins/clion-radler/DotFiles/linux-*; do
          + lib.optionalString stdenv.hostPlatform.isLinux ''
            for dir in $out/clion/plugins/clion-radler/DotFiles/linux-*; do
              rm -rf $dir/dotnet
              ln -s ${dotnet-sdk}/share/dotnet $dir/dotnet
            done
            )
          '';

        postFixup =
          (attrs.postFixup or "")
          + lib.optionalString (stdenv.hostPlatform.isLinux) ''
            (
              cd $out/clion

              # I think the included gdb has a couple of patches, so we patch it instead of replacing
              ls -d $PWD/bin/gdb/linux/*/lib/python3.8/lib-dynload/* |
              xargs patchelf \
                --replace-needed libssl.so.10 libssl.so \
                --replace-needed libcrypto.so.10 libcrypto.so

              ls -d $PWD/bin/lldb/linux/*/lib/python3.8/lib-dynload/* |
              xargs patchelf \
                --replace-needed libssl.so.10 libssl.so \
                --replace-needed libcrypto.so.10 libcrypto.so
            )
        postFixup = ''
          ${attrs.postFixup or ""}
          ${patchSharedLibs}
        '';
      });

@@ -335,7 +329,7 @@ rec {
        lttng-ust_2_12
        musl
      ]
      ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
      ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch) [
        expat
        libxml2
        xz
@@ -350,21 +344,13 @@ rec {
      (attrs: {
        postInstall =
          (attrs.postInstall or "")
          + lib.optionalString (stdenv.hostPlatform.isLinux) ''
            (
              cd $out/rider

              ls -d $PWD/plugins/cidr-debugger-plugin/bin/lldb/linux/*/lib/python3.8/lib-dynload/* |
              xargs patchelf \
                --replace-needed libssl.so.10 libssl.so \
                --replace-needed libcrypto.so.10 libcrypto.so \
                --replace-needed libcrypt.so.1 libcrypt.so
          + lib.optionalString stdenv.hostPlatform.isLinux ''
            ${patchSharedLibs}

              for dir in lib/ReSharperHost/linux-*; do
            for dir in $out/rider/lib/ReSharperHost/linux-*; do
              rm -rf $dir/dotnet
              ln -s ${dotnet-sdk}/share/dotnet $dir/dotnet
            done
            )
          '';
      });

@@ -380,37 +366,23 @@ rec {
    (mkJetBrainsProduct {
      pname = "rust-rover";
      extraBuildInputs =
        lib.optionals (stdenv.hostPlatform.isLinux) [
        lib.optionals stdenv.hostPlatform.isLinux [
          python3
          openssl
          libxcrypt-legacy
          fontconfig
          xorg.libX11
        ]
        ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
        ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch) [
          expat
          libxml2
          xz
        ];
    }).overrideAttrs
      (attrs: {
        postFixup =
          (attrs.postFixup or "")
          + lib.optionalString (stdenv.hostPlatform.isLinux) ''
            (
              cd $out/rust-rover

              # Copied over from clion (gdb seems to have a couple of patches)
              ls -d $PWD/bin/gdb/linux/*/lib/python3.8/lib-dynload/* |
              xargs patchelf \
                --replace-needed libssl.so.10 libssl.so \
                --replace-needed libcrypto.so.10 libcrypto.so

              ls -d $PWD/bin/lldb/linux/*/lib/python3.8/lib-dynload/* |
              xargs patchelf \
                --replace-needed libssl.so.10 libssl.so \
                --replace-needed libcrypto.so.10 libcrypto.so
            )
        postFixup = ''
          ${attrs.postFixup or ""}
          ${patchSharedLibs}
        '';
      });