Merge pull request #330165 from rowanG077/update-vscode-cpptools

vscode-extensions.ms-vscode-cpptools: 1.20.5 -> 1.21.4
This commit is contained in:
Masum Reza
2024-08-05 23:59:41 +05:30
committed by GitHub
@@ -38,24 +38,27 @@
let
gdbDefaultsTo = if gdbUseFixed then "${gdb}/bin/gdb" else "gdb";
isx86Linux = stdenv.hostPlatform.system == "x86_64-linux";
supported = {
x86_64-linux = {
hash = "sha256-arTBt3UWA5zoo0dL044Sx/NT1LUS76XfGIS96NOMvJk=";
hash = "sha256-jibImnpRtshbHu21JeS4VxL1jETm3Ein8S/M73UXc2w=";
arch = "linux-x64";
};
aarch64-linux = {
hash = "sha256-oVuDxx117bVd/jDqn9KivTwR5T2X5UZMHk/nZ/e/IOg=";
hash = "sha256-7UagRO7qHyT1JIvvTSx9+USYrnDRXJ2wnXPLaBHRc3k=";
arch = "linux-arm64";
};
};
base = supported.${stdenv.system} or (throw "unsupported platform ${stdenv.system}");
base =
supported.${stdenv.hostPlatform.system}
or (throw "unsupported platform ${stdenv.hostPlatform.system}");
in
vscode-utils.buildVscodeMarketplaceExtension {
mktplcRef = base // {
name = "cpptools";
publisher = "ms-vscode";
version = "1.20.5";
version = "1.21.4";
};
nativeBuildInputs = [
@@ -71,35 +74,40 @@ vscode-utils.buildVscodeMarketplaceExtension {
stdenv.cc.cc.lib
];
dontAutoPatchelf = true;
dontAutoPatchelf = isx86Linux;
postPatch = ''
mv ./package.json ./package_orig.json
# 1. Add activation events so that the extension is functional. This listing is empty when unpacking the extension but is filled at runtime.
# 2. Patch `package.json` so that nix's *gdb* is used as default value for `miDebuggerPath`.
cat ./package_orig.json | \
jq --slurpfile actEvts ${./package-activation-events.json} '(.activationEvents) = $actEvts[0]' | \
jq '(.contributes.debuggers[].configurationAttributes | .attach , .launch | .properties.miDebuggerPath | select(. != null) | select(.default == "/usr/bin/gdb") | .default) = "${gdbDefaultsTo}"' > \
./package.json
# Prevent download/install of extensions
touch "./install.lock"
# Clang-format from nix package.
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 bin/libc.so debugAdapters/bin/OpenDebugAD7
patchelf --replace-needed liblttng-ust.so.0 liblttng-ust.so.1 ./debugAdapters/bin/libcoreclrtraceptprovider.so
'';
postFixup =
postPatch =
''
autoPatchelf $out/share/vscode/extensions/ms-vscode.cpptools/debugAdapters
mv ./package.json ./package_orig.json
# 1. Add activation events so that the extension is functional. This listing is empty when unpacking the extension but is filled at runtime.
# 2. Patch `package.json` so that nix's *gdb* is used as default value for `miDebuggerPath`.
cat ./package_orig.json | \
jq --slurpfile actEvts ${./package-activation-events.json} '(.activationEvents) = $actEvts[0]' | \
jq '(.contributes.debuggers[].configurationAttributes | .attach , .launch | .properties.miDebuggerPath | select(. != null) | select(.default == "/usr/bin/gdb") | .default) = "${gdbDefaultsTo}"' > \
./package.json
# Prevent download/install of extensions
touch "./install.lock"
# Clang-format from nix package.
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
patchelf --replace-needed liblttng-ust.so.0 liblttng-ust.so.1 ./debugAdapters/bin/libcoreclrtraceptprovider.so
''
+ lib.optionalString isx86Linux ''
chmod +x bin/libc.so
'';
# On aarch64 the binaries are statically linked
# but on x86 they are not.
postFixup =
lib.optionalString isx86Linux ''
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