From 75c085f6c22aac3d29a279f908b08be51b61a174 Mon Sep 17 00:00:00 2001 From: David McFarland Date: Sat, 9 Mar 2024 17:32:31 -0400 Subject: [PATCH] dotnet: strip native symbols from runtime This reduces the output size of dotnet_9.vmr from 4.2GiB to 1.9GiB. --- pkgs/development/compilers/dotnet/vmr.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/compilers/dotnet/vmr.nix b/pkgs/development/compilers/dotnet/vmr.nix index 36b75c40e6c8..c51791e32484 100644 --- a/pkgs/development/compilers/dotnet/vmr.nix +++ b/pkgs/development/compilers/dotnet/vmr.nix @@ -187,6 +187,14 @@ in stdenv.mkDerivation rec { substituteInPlace \ src/runtime/src/native/libs/CMakeLists.txt \ --replace-fail 'add_compile_options(-Weverything)' 'add_compile_options(-Wall)' + + # strip native symbols in runtime + # see: https://github.com/dotnet/source-build/issues/2543 + xmlstarlet ed \ + --inplace \ + -s //Project -t elem -n PropertyGroup \ + -s \$prev -t elem -n KeepNativeSymbols -v false \ + src/runtime/Directory.Build.props '' + lib.optionalString isLinux '' substituteInPlace \