diff options
Diffstat (limited to 'pkgs/development/compilers/dotnet/vmr.nix')
-rw-r--r-- | pkgs/development/compilers/dotnet/vmr.nix | 70 |
1 files changed, 58 insertions, 12 deletions
diff --git a/pkgs/development/compilers/dotnet/vmr.nix b/pkgs/development/compilers/dotnet/vmr.nix index fe5880f54c1d9..32e10419d0b8b 100644 --- a/pkgs/development/compilers/dotnet/vmr.nix +++ b/pkgs/development/compilers/dotnet/vmr.nix @@ -224,7 +224,7 @@ in stdenv.mkDerivation rec { --inplace \ -s //Project -t elem -n Import \ -i \$prev -t attr -n Project -v "${./patch-npm-packages.proj}" \ - src/aspnetcore/eng/SourceBuild.props + src/aspnetcore/eng/DotNetBuild.props '' + lib.optionalString (lib.versionAtLeast version "9") '' # https://github.com/dotnet/source-build/issues/3131#issuecomment-2030215805 @@ -233,8 +233,34 @@ in stdenv.mkDerivation rec { --replace-fail \ "'\$(DotNetBuildSourceOnly)' == 'true'" \ "'\$(DotNetBuildSourceOnly)' == 'true' and \$(PortableBuild) == 'false'" + + # https://github.com/dotnet/source-build/issues/4325 + xmlstarlet ed \ + --inplace \ + -r '//Target[@Name="UnpackTarballs"]/Move' -v Copy \ + eng/init-source-only.proj + + # AOT is currently broken in binary SDKs, and the resulting executable is + # unable to find ICU + xmlstarlet ed \ + --inplace \ + -s //Project -t elem -n PropertyGroup \ + -s \$prev -t elem -n NativeAotSupported -v false \ + src/runtime/src/coreclr/tools/aot/ILCompiler/ILCompiler.props + + # error: _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror,-W#warnings] + substituteInPlace \ + src/runtime/src/coreclr/ilasm/CMakeLists.txt \ + --replace-fail 'set_source_files_properties( prebuilt/asmparse.cpp PROPERTIES COMPILE_FLAGS "-O0" )' "" + + # https://github.com/dotnet/source-build/issues/4444 + xmlstarlet ed \ + --inplace \ + -s '//Project/Target/MSBuild[@Targets="Restore"]' \ + -t attr -n Properties -v "NUGET_PACKAGES='\$(CurrentRepoSourceBuildPackageCache)'" \ + src/aspnetcore/eng/Tools.props '' - + lib.optionalString isLinux '' + + lib.optionalString isLinux ('' substituteInPlace \ src/runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.c \ --replace-fail '"libssl.so"' '"${openssl.out}/lib/libssl.so"' @@ -247,18 +273,20 @@ in stdenv.mkDerivation rec { src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \ --replace-fail '"libicui18n.so"' '"${icu}/lib/libicui18n.so"' \ --replace-fail '"libicuuc.so"' '"${icu}/lib/libicuuc.so"' - - # TODO: we should really make sure the first one (9.0) or the rest (8.0) - # works, but --replace-fail results in an empty file + '' + + lib.optionalString (lib.versionAtLeast version "9") '' + substituteInPlace \ + src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \ + --replace-fail '#define VERSIONED_LIB_NAME_LEN 64' '#define VERSIONED_LIB_NAME_LEN 256' + '' + + lib.optionalString (lib.versionOlder version "9") '' substituteInPlace \ src/runtime/src/native/libs/System.Globalization.Native/pal_icushim.c \ - --replace-warn '#define VERSIONED_LIB_NAME_LEN 64' '#define VERSIONED_LIB_NAME_LEN 256' \ --replace-warn 'libicuucName[64]' 'libicuucName[256]' \ --replace-warn 'libicui18nName[64]' 'libicui18nName[256]' - '' + '') + lib.optionalString isDarwin ('' substituteInPlace \ - src/runtime/src/mono/CMakeLists.txt \ src/runtime/src/native/libs/System.Globalization.Native/CMakeLists.txt \ --replace-fail '/usr/lib/libicucore.dylib' '${darwin.ICU}/lib/libicucore.dylib' @@ -284,6 +312,12 @@ in stdenv.mkDerivation rec { substituteInPlace \ src/runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets \ --replace-fail ' -no_code_signature_warning' "" + + # ld: library not found for -ld_classic + substituteInPlace \ + src/runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets \ + src/runtime/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj \ + --replace-fail 'Include="-ld_classic"' "" '' + lib.optionalString (lib.versionOlder version "9") '' # [...]/build.proj(123,5): error : Did not find PDBs for the following SDK files: @@ -294,14 +328,24 @@ in stdenv.mkDerivation rec { substituteInPlace \ build.proj \ --replace-fail 'FailOnMissingPDBs="true"' 'FailOnMissingPDBs="false"' + + substituteInPlace \ + src/runtime/src/mono/CMakeLists.txt \ + --replace-fail '/usr/lib/libicucore.dylib' '${darwin.ICU}/lib/libicucore.dylib' ''); prepFlags = [ "--no-artifacts" "--no-prebuilts" + "--with-packages" dotnetSdk.artifacts ]; - configurePhase = '' + configurePhase = let + prepScript = + if (lib.versionAtLeast version "9") + then "./prep-source-build.sh" + else "./prep.sh"; + in '' runHook preConfigure # The build process tries to overwrite some things in the sdk (e.g. @@ -309,7 +353,7 @@ in stdenv.mkDerivation rec { cp -Tr ${dotnetSdk} .dotnet chmod -R +w .dotnet - ./prep.sh $prepFlags + ${prepScript} $prepFlags runHook postConfigure ''; @@ -367,8 +411,10 @@ in stdenv.mkDerivation rec { mkdir "$out" pushd "artifacts/${assets}/Release" - for archive in *.tar.gz; do - target=$out/''${archive%.tar.gz} + find . -name \*.tar.gz | while read archive; do + target=$out/$(basename "$archive" .tar.gz) + # dotnet 9 currently has two copies of the sdk tarball + [[ ! -e "$target" ]] || continue mkdir "$target" tar -C "$target" -xzf "$PWD/$archive" done |