Skip to content

Commit

Permalink
dotnet@6 6.0.135
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m committed Nov 3, 2024
1 parent f028adb commit 38463a6
Showing 1 changed file with 96 additions and 18 deletions.
114 changes: 96 additions & 18 deletions Formula/d/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ class DotnetAT6 < Formula
homepage "https://dotnet.microsoft.com/"
# Source-build tag announced at https://github.com/dotnet/source-build/discussions
url "https://github.com/dotnet/installer.git",
tag: "v6.0.133",
revision: "48ad8f7176f00900ff49df9fb936bc7c8c79d345"
tag: "v6.0.135",
revision: "9b2a203ee661f837f50486a8caedc688e05dedc4"
license "MIT"
revision 1

bottle do
sha256 cellar: :any, arm64_sonoma: "3eb824051504d2753ab5cca847f0b943bc4dc05fb403558d18fe18c5532c3845"
Expand All @@ -22,7 +21,7 @@ class DotnetAT6 < Formula
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "[email protected]" => :build
depends_on "icu4c@75"
depends_on "icu4c@76"
depends_on "openssl@3"

uses_from_macos "llvm" => :build
Expand All @@ -41,15 +40,13 @@ class DotnetAT6 < Formula
# Apple Silicon build fails due to latest dotnet-install.sh downloading x64 dotnet-runtime.
# We work around the issue by using an older working copy of dotnet-install.sh script.
# Bug introduced with https://github.com/dotnet/install-scripts/pull/314
# TODO: Remove once script is fixed.
# Issue ref: https://github.com/dotnet/install-scripts/issues/318
resource "dotnet-install.sh" do
url "https://raw.githubusercontent.com/dotnet/install-scripts/dac53157fcb7e02638507144bf5f8f019c1d23a8/src/dotnet-install.sh"
sha256 "e96eabccea61bbbef3402e23f1889d385a6ae7ad84fe1d8f53f2507519ad86f7"
end

# Fixes race condition in MSBuild.
# TODO: Remove with 6.0.3xx or later.
resource "homebrew-msbuild-patch" do
url "https://github.com/dotnet/msbuild/commit/64edb33a278d1334bd6efc35fecd23bd3af4ed48.patch?full_index=1"
sha256 "5870bcdd12164668472094a2f9f1b73a4124e72ac99bbbe43028370be3648ccd"
Expand All @@ -63,7 +60,7 @@ class DotnetAT6 < Formula
# Backport fix to build with Clang 19
# Ref: https://github.com/dotnet/runtime/commit/043ae8c50dbe1c7377cf5ad436c5ac1c226aef79
def clang19_patch
<<~EOS
<<~PATCH
diff --git a/src/coreclr/vm/comreflectioncache.hpp b/src/coreclr/vm/comreflectioncache.hpp
index 08d173e61648c6ebb98a4d7323b30d40ec351d94..12db55251d80d24e3765a8fbe6e3b2d24a12f767 100644
--- a/src/coreclr/vm/comreflectioncache.hpp
Expand Down Expand Up @@ -100,7 +97,89 @@ def clang19_patch
void UpdateHashTable(SIZE_T hash, int slot)
{
EOS
PATCH
end

# Backport fix to build with Xcode 16 (copying unixasmmacrosarm64.inc to unixasmmacrosamd64.inc for Intel macOS)
# Ref: https://github.com/dotnet/runtime/commit/562efd6824762dd0c1826cc99e006ad34a7e9e85
def xcode16_patch
<<~'PATCH'
diff --git a/src/coreclr/pal/inc/unixasmmacrosamd64.inc b/src/coreclr/pal/inc/unixasmmacrosamd64.inc
index 976cc825f2eb4..4997e18b39858 100644
--- a/src/coreclr/pal/inc/unixasmmacrosamd64.inc
+++ b/src/coreclr/pal/inc/unixasmmacrosamd64.inc
@@ -17,7 +17,12 @@
.endm
.macro PATCH_LABEL Name
+#if defined(__APPLE__)
+ .alt_entry C_FUNC(\Name)
+ .private_extern C_FUNC(\Name)
+#else
.global C_FUNC(\Name)
+#endif
C_FUNC(\Name):
.endm
diff --git a/src/coreclr/pal/inc/unixasmmacrosarm64.inc b/src/coreclr/pal/inc/unixasmmacrosarm64.inc
index 976cc825f2eb4..4997e18b39858 100644
--- a/src/coreclr/pal/inc/unixasmmacrosarm64.inc
+++ b/src/coreclr/pal/inc/unixasmmacrosarm64.inc
@@ -17,7 +17,12 @@
.endm
.macro PATCH_LABEL Name
+#if defined(__APPLE__)
+ .alt_entry C_FUNC(\Name)
+ .private_extern C_FUNC(\Name)
+#else
.global C_FUNC(\Name)
+#endif
C_FUNC(\Name):
.endm
diff --git a/src/coreclr/vm/arm64/asmhelpers.S b/src/coreclr/vm/arm64/asmhelpers.S
index ebfefd693f074..48c91e65a098d 100644
--- a/src/coreclr/vm/arm64/asmhelpers.S
+++ b/src/coreclr/vm/arm64/asmhelpers.S
@@ -176,8 +176,7 @@ NESTED_END ThePreStub, _TEXT
LEAF_ENTRY ThePreStubPatch, _TEXT
nop
-.globl C_FUNC(ThePreStubPatchLabel)
-C_FUNC(ThePreStubPatchLabel):
+PATCH_LABEL ThePreStubPatchLabel
ret lr
LEAF_END ThePreStubPatch, _TEXT
@@ -607,8 +606,12 @@ NESTED_END ResolveWorkerAsmStub, _TEXT
#ifdef FEATURE_READYTORUN
NESTED_ENTRY DelayLoad_MethodCall_FakeProlog, _TEXT, NoHandler
-C_FUNC(DelayLoad_MethodCall):
+#if defined(__APPLE__)
+ .alt_entry C_FUNC(DelayLoad_MethodCall)
+#endif
.global C_FUNC(DelayLoad_MethodCall)
+C_FUNC(DelayLoad_MethodCall):
+
PROLOG_WITH_TRANSITION_BLOCK
add x0, sp, #__PWTB_TransitionBlock // pTransitionBlock
@@ -627,8 +630,11 @@ NESTED_END DelayLoad_MethodCall_FakeProlog, _TEXT
.macro DynamicHelper frameFlags, suffix
NESTED_ENTRY DelayLoad_Helper\suffix\()_FakeProlog, _TEXT, NoHandler
-C_FUNC(DelayLoad_Helper\suffix):
+#if defined(__APPLE__)
+ .alt_entry C_FUNC(DelayLoad_Helper\suffix)
+#endif
.global C_FUNC(DelayLoad_Helper\suffix)
+C_FUNC(DelayLoad_Helper\suffix):
PROLOG_WITH_TRANSITION_BLOCK
PATCH
end

def install
Expand All @@ -114,6 +193,7 @@ def install
(buildpath/".dotnet").install resource("dotnet-install.sh")
(buildpath/"src/SourceBuild/tarball/patches/msbuild").install resource("homebrew-msbuild-patch")
(buildpath/"src/SourceBuild/tarball/patches/runtime/clang19.patch").write clang19_patch
(buildpath/"src/SourceBuild/tarball/patches/runtime/xcode16.patch").write xcode16_patch if OS.mac?

# The source directory needs to be outside the installer directory
(buildpath/"installer").install buildpath.children
Expand All @@ -128,26 +208,22 @@ def install
"\\0 --cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=ON"

# Fix Clang 15 error: definition of builtin function '__cpuid'.
# Remove if following fix is backported to .NET 6.0.1xx
# Ref: https://github.com/dotnet/runtime/commit/992cf8c97cc71d4ca9a0a11e6604a6716ed4cefc
inreplace "src/runtime/src/coreclr/vm/amd64/unixstubs.cpp",
/^ *void (__cpuid|__cpuidex)\([^}]*}$/,
"#if !__has_builtin(\\1)\n\\0\n#endif"

# Fix missing macOS conditional for system unwind searching.
# Remove if following fix is backported to .NET 6.0.1xx
# Ref: https://github.com/dotnet/runtime/commit/97c9a11e3e6ca68adf0c60155fa82ab3aae953a5
inreplace "src/runtime/src/native/corehost/apphost/static/CMakeLists.txt",
"if(CLR_CMAKE_USE_SYSTEM_LIBUNWIND)",
"if(CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_OSX)"

# Work around arcade build failure with BSD `sed` due to non-compatible `-i`.
# Remove if following fix is backported to .NET 6.0.1xx
# Ref: https://github.com/dotnet/arcade/commit/b8007eed82adabd50c604a9849277a6e7be5c971
inreplace "src/arcade/eng/SourceBuild.props", "\"sed -i ", "\"sed -i.bak " if OS.mac?

# Rename patch fails on case-insensitive systems like macOS
# TODO: Remove whenever patch is no longer used
rename_patch = "0001-Rename-NuGet.Config-to-NuGet.config-to-account-for-a.patch"
(Pathname("src/nuget-client/eng/source-build-patches")/rename_patch).unlink if OS.mac?

Expand All @@ -169,15 +245,15 @@ def install
end

def caveats
<<~EOS
<<~TEXT
For other software to find dotnet you may need to set:
export DOTNET_ROOT="#{opt_libexec}"
EOS
TEXT
end

test do

Check warning on line 254 in Formula/d/[email protected]

View workflow job for this annotation

GitHub Actions / macOS 13-arm64

`brew test --verbose dotnet@6` failed on macOS Ventura (13) on Apple Silicon!

/opt/homebrew/Library/Homebrew/test.rb:54:in `<main>'

Check warning on line 254 in Formula/d/[email protected]

View workflow job for this annotation

GitHub Actions / macOS 13-x86_64

`brew test --verbose dotnet@6` failed on macOS Ventura (13)!

/usr/local/Homebrew/Library/Homebrew/test.rb:54:in `<main>'
target_framework = "net#{version.major_minor}"
(testpath/"test.cs").write <<~EOS
(testpath/"test.cs").write <<~CSHARP
using System;
namespace Homebrew
Expand All @@ -191,8 +267,9 @@ def caveats
}
}
}
EOS
(testpath/"test.csproj").write <<~EOS
CSHARP

(testpath/"test.csproj").write <<~XML
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -208,7 +285,8 @@ def caveats
<Compile Include="test.cs" />
</ItemGroup>
</Project>
EOS
XML

system bin/"dotnet", "build", "--framework", target_framework, "--output", testpath, testpath/"test.csproj"
assert_equal "#{testpath}/test.dll,a,b,c\n",
shell_output("#{bin}/dotnet run --framework #{target_framework} #{testpath}/test.dll a b c")
Expand Down

0 comments on commit 38463a6

Please sign in to comment.