nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix

msbuild: always use shared library from dotnet-sdk

This changes the use of .so to use the more generic
stdenv.hostPlatform.extensions.sharedLibrary.
This also overrides mono/build/extract_and_copy_hostfxr.sh which uses
the internet and is x86 specific.

+10 -3
-1
pkgs/development/compilers/roslyn/default.nix
··· 62 62 description = ".NET C# and Visual Basic compiler"; 63 63 homepage = "https://github.com/dotnet/roslyn"; 64 64 mainProgram = "csc"; 65 - platforms = platforms.linux; 66 65 license = licenses.mit; 67 66 maintainers = with maintainers; [ corngood ]; 68 67 };
+10 -2
pkgs/development/tools/build-managers/msbuild/default.nix
··· 21 21 </configuration> 22 22 ''; 23 23 24 + inherit (stdenv.hostPlatform.extensions) sharedLibrary; 25 + 24 26 in 25 27 26 28 stdenv.mkDerivation rec { ··· 80 78 mv artifacts/msbuild artifacts/mono-msbuild 81 79 chmod +x artifacts/mono-msbuild/MSBuild.dll 82 80 83 - ln -s $(find ${dotnet-sdk} -name libhostfxr.so) artifacts/mono-msbuild/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/ 81 + # The provided libhostfxr.dylib is for x86_64-darwin, so we remove it 82 + rm artifacts/mono-msbuild/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/libhostfxr.dylib 83 + 84 + ln -s $(find ${dotnet-sdk} -name libhostfxr${sharedLibrary}) artifacts/mono-msbuild/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/ 84 85 85 86 # overwrite the file 86 87 echo "#!${stdenv.shell}" > eng/common/dotnet-install.sh 87 88 echo "#!${stdenv.shell}" > mono/build/get_sdk_files.sh 89 + 90 + # Prevent msbuild from downloading a new libhostfxr 91 + echo "#!${stdenv.shell}" > mono/build/extract_and_copy_hostfxr.sh 88 92 89 93 mkdir -p mono/dotnet-overlay/msbuild-bin 90 94 cp ${dotnet-sdk}/sdk/*/{Microsoft.NETCoreSdk.BundledVersions.props,RuntimeIdentifierGraph.json} mono/dotnet-overlay/msbuild-bin ··· 110 102 --set-default MONO_GC_PARAMS "nursery-size=64m" \ 111 103 --add-flags "$out/lib/mono/msbuild/15.0/bin/MSBuild.dll" 112 104 113 - ln -s $(find ${dotnet-sdk} -name libhostfxr.so) $out/lib/mono/msbuild/Current/bin/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/ 105 + ln -s $(find ${dotnet-sdk} -name libhostfxr${sharedLibrary}) $out/lib/mono/msbuild/Current/bin/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/ 114 106 ''; 115 107 116 108 doInstallCheck = true;