Unverified Commit 5c7f1045 authored by superherointj's avatar superherointj Committed by GitHub
Browse files

Merge pull request #314009 from kjeremy/fix-cpptools

vscode-extensions.ms-vscode.cpptools: Use the bundled interpreter for cpptools* 
parents cdc6c00c 5b636353
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -73,6 +73,8 @@ vscode-utils.buildVscodeMarketplaceExtension {
    stdenv.cc.cc.lib
  ];

  dontAutoPatchelf = true;

  postPatch = ''
    mv ./package.json ./package_orig.json

@@ -87,16 +89,25 @@ vscode-utils.buildVscodeMarketplaceExtension {
    touch "./install.lock"

    # Clang-format from nix package.
    mv ./LLVM/ ./LLVM_orig
    rm -rf ./LLVM
    mkdir "./LLVM/"
    find "${clang-tools}" -mindepth 1 -maxdepth 1 | xargs ln -s -t "./LLVM"

    # Patching binaries
    chmod +x bin/cpptools bin/cpptools-srv bin/cpptools-wordexp debugAdapters/bin/OpenDebugAD7
    chmod +x bin/cpptools bin/cpptools-srv bin/cpptools-wordexp bin/libc.so debugAdapters/bin/OpenDebugAD7
    patchelf --replace-needed liblttng-ust.so.0 liblttng-ust.so.1 ./debugAdapters/bin/libcoreclrtraceptprovider.so
  '';

  postFixup = lib.optionalString gdbUseFixed ''
  postFixup =
    ''
      autoPatchelf $out/share/vscode/extensions/ms-vscode.cpptools/debugAdapters

      # cpptools* are distributed by the extension and need to be run through the distributed musl interpretter
      patchelf --set-interpreter $out/share/vscode/extensions/ms-vscode.cpptools/bin/libc.so $out/share/vscode/extensions/ms-vscode.cpptools/bin/cpptools
      patchelf --set-interpreter $out/share/vscode/extensions/ms-vscode.cpptools/bin/libc.so $out/share/vscode/extensions/ms-vscode.cpptools/bin/cpptools-srv
      patchelf --set-interpreter $out/share/vscode/extensions/ms-vscode.cpptools/bin/libc.so $out/share/vscode/extensions/ms-vscode.cpptools/bin/cpptools-wordexp
    ''
    + lib.optionalString gdbUseFixed ''
      wrapProgram $out/share/vscode/extensions/ms-vscode.cpptools/debugAdapters/bin/OpenDebugAD7 --prefix PATH : ${lib.makeBinPath [ gdb ]}
    '';