dotnet: patch apphost as well as singlefilehost

This fixes library loading in self-contained builds.
This commit is contained in:
David McFarland 2024-04-17 09:41:51 -03:00
parent 81693c96ba
commit bd934093f4
1 changed files with 7 additions and 4 deletions

View File

@ -25,6 +25,7 @@ assert if type == "sdk" then packages != null else true;
, writeShellScript
, mkNugetDeps
, callPackage
, dotnetCorePackages
}:
let
@ -44,6 +45,8 @@ let
mkCommon = callPackage ./common.nix {};
targetRid = dotnetCorePackages.systemToDotnetRid stdenv.targetPlatform.system;
in
mkCommon type rec {
inherit pname version;
@ -88,21 +91,21 @@ mkCommon type rec {
# Tell autoPatchelf about runtime dependencies.
# (postFixup phase is run before autoPatchelfHook.)
postFixup = lib.optionalString stdenv.isLinux ''
postFixup = lib.optionalString stdenv.targetPlatform.isLinux ''
patchelf \
--add-needed libicui18n.so \
--add-needed libicuuc.so \
$out/shared/Microsoft.NETCore.App/*/libcoreclr.so \
$out/shared/Microsoft.NETCore.App/*/*System.Globalization.Native.so \
$out/packs/Microsoft.NETCore.App.Host.linux-x64/*/runtimes/linux-x64/native/singlefilehost
$out/packs/Microsoft.NETCore.App.Host.${targetRid}/*/runtimes/${targetRid}/native/*host
patchelf \
--add-needed libgssapi_krb5.so \
$out/shared/Microsoft.NETCore.App/*/*System.Net.Security.Native.so \
$out/packs/Microsoft.NETCore.App.Host.linux-x64/*/runtimes/linux-x64/native/singlefilehost
$out/packs/Microsoft.NETCore.App.Host.${targetRid}/*/runtimes/${targetRid}/native/*host
patchelf \
--add-needed libssl.so \
$out/shared/Microsoft.NETCore.App/*/*System.Security.Cryptography.Native.OpenSsl.so \
$out/packs/Microsoft.NETCore.App.Host.linux-x64/*/runtimes/linux-x64/native/singlefilehost
$out/packs/Microsoft.NETCore.App.Host.${targetRid}/*/runtimes/${targetRid}/native/*host
'';
passthru = {