lol

vscode-extensions.ms-dotnettools.csdevkit: fix .NET patching (#404404)

authored by

Pol Dellaiera and committed by
GitHub
3ad376e6 4e5837cb

+54 -7
+54 -7
pkgs/applications/editors/vscode/extensions/ms-dotnettools.csdevkit/default.nix
··· 8 8 libz, 9 9 glibc, 10 10 libxml2, 11 + libkrb5, 12 + patchelf, 11 13 }: 12 14 let 13 15 extInfo = ( ··· 41 43 }; 42 44 sourceRoot = "extension"; # This has more than one folder. 43 45 44 - nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ]; 46 + nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ 47 + autoPatchelfHook 48 + patchelf 49 + ]; 45 50 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ 46 - (lib.getLib stdenv.cc.cc) # libstdc++.so.6 47 51 (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 52 52 (lib.getLib icu) # libicui18n.so libicuuc.so 53 + (lib.getLib libkrb5) # libgssapi_krb5.so 54 + (lib.getLib libxml2) # libxml2.so.2 53 55 (lib.getLib libz) # libz.so.1 56 + (lib.getLib openssl) # libopenssl.so.3 57 + (lib.getLib stdenv.cc.cc) # libstdc++.so.6 54 58 ]; 55 59 56 60 postPatch = '' ··· 64 68 65 69 preFixup = '' 66 70 ( 71 + set -euo pipefail 67 72 shopt -s globstar 68 73 shopt -s dotglob 74 + 75 + # Fix all binaries. 69 76 for file in "$out"/**/*; do 70 - if [[ ! -f "$file" || "$file" == *.so || "$file" == *.dylib ]] || 77 + if [[ ! -f "$file" || "$file" == *.so || "$file" == *.a || "$file" == *.dylib ]] || 71 78 (! isELF "$file" && ! isMachO "$file"); then 72 79 continue 73 80 fi 74 81 75 82 echo Making "$file" executable... 76 83 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 + ''} 77 97 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 + ''} 78 125 ) 79 126 ''; 80 127