Skip to content

Commit 3ad376e

Browse files
authored
vscode-extensions.ms-dotnettools.csdevkit: fix .NET patching (#404404)
2 parents 4e5837c + d2f7caa commit 3ad376e

File tree

1 file changed

+54
-7
lines changed
  • pkgs/applications/editors/vscode/extensions/ms-dotnettools.csdevkit

1 file changed

+54
-7
lines changed

pkgs/applications/editors/vscode/extensions/ms-dotnettools.csdevkit/default.nix

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
libz,
99
glibc,
1010
libxml2,
11+
libkrb5,
12+
patchelf,
1113
}:
1214
let
1315
extInfo = (
@@ -41,16 +43,18 @@ vscode-utils.buildVscodeMarketplaceExtension {
4143
};
4244
sourceRoot = "extension"; # This has more than one folder.
4345

44-
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
46+
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
47+
autoPatchelfHook
48+
patchelf
49+
];
4550
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
46-
(lib.getLib stdenv.cc.cc) # libstdc++.so.6
4751
(lib.getLib glibc) # libgcc_s.so.1
48-
(lib.getLib libxml2) # libxml2.so.2
49-
];
50-
runtimeDependencies = lib.optionals stdenv.hostPlatform.isLinux [
51-
(lib.getLib openssl) # libopenssl.so.3
5252
(lib.getLib icu) # libicui18n.so libicuuc.so
53+
(lib.getLib libkrb5) # libgssapi_krb5.so
54+
(lib.getLib libxml2) # libxml2.so.2
5355
(lib.getLib libz) # libz.so.1
56+
(lib.getLib openssl) # libopenssl.so.3
57+
(lib.getLib stdenv.cc.cc) # libstdc++.so.6
5458
];
5559

5660
postPatch = ''
@@ -64,17 +68,60 @@ vscode-utils.buildVscodeMarketplaceExtension {
6468

6569
preFixup = ''
6670
(
71+
set -euo pipefail
6772
shopt -s globstar
6873
shopt -s dotglob
74+
75+
# Fix all binaries.
6976
for file in "$out"/**/*; do
70-
if [[ ! -f "$file" || "$file" == *.so || "$file" == *.dylib ]] ||
77+
if [[ ! -f "$file" || "$file" == *.so || "$file" == *.a || "$file" == *.dylib ]] ||
7178
(! isELF "$file" && ! isMachO "$file"); then
7279
continue
7380
fi
7481
7582
echo Making "$file" executable...
7683
chmod +x "$file"
84+
85+
${lib.optionalString stdenv.hostPlatform.isLinux ''
86+
# Add .NET deps if it is an apphost.
87+
if grep 'You must install .NET to run this application.' "$file" > /dev/null; then
88+
echo "Adding .NET needed libraries to: $file"
89+
patchelf \
90+
--add-needed libicui18n.so \
91+
--add-needed libicuuc.so \
92+
--add-needed libgssapi_krb5.so \
93+
--add-needed libssl.so \
94+
"$file"
95+
fi
96+
''}
7797
done
98+
99+
${lib.optionalString stdenv.hostPlatform.isLinux ''
100+
# Add the ICU libraries as needed to the globalization DLLs.
101+
for file in "$out"/**/{libcoreclr.so,*System.Globalization.Native.so}; do
102+
echo "Adding ICU libraries to: $file"
103+
patchelf \
104+
--add-needed libicui18n.so \
105+
--add-needed libicuuc.so \
106+
"$file"
107+
done
108+
109+
# Add the Kerberos libraries as needed to the native security DLL.
110+
for file in "$out"/**/*System.Net.Security.Native.so; do
111+
echo "Adding Kerberos libraries to: $file"
112+
patchelf \
113+
--add-needed libgssapi_krb5.so \
114+
"$file"
115+
done
116+
117+
# Add the OpenSSL libraries as needed to the OpenSSL native security DLL.
118+
for file in "$out"/**/*System.Security.Cryptography.Native.OpenSsl.so; do
119+
echo "Adding OpenSSL libraries to: $file"
120+
patchelf \
121+
--add-needed libssl.so \
122+
"$file"
123+
done
124+
''}
78125
)
79126
'';
80127

0 commit comments

Comments
 (0)