Skip to content

Commit 7f83eaa

Browse files
committed
Enable building PowerShell for Apple M1 runtime
1 parent 631e96a commit 7f83eaa

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

build.psm1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ function Start-PSBuild {
289289
"linux-arm",
290290
"linux-arm64",
291291
"linux-x64",
292+
"osx-arm64",
292293
"osx-x64",
293294
"win-arm",
294295
"win-arm64",
@@ -765,6 +766,7 @@ function New-PSOptions {
765766
"linux-arm",
766767
"linux-arm64",
767768
"linux-x64",
769+
"osx-arm64",
768770
"osx-x64",
769771
"win-arm",
770772
"win-arm64",
@@ -799,7 +801,12 @@ function New-PSOptions {
799801
if ($environment.IsLinux) {
800802
$Runtime = "linux-x64"
801803
} elseif ($environment.IsMacOS) {
802-
$Runtime = "osx-x64"
804+
if ($PSVersionTable.OS.Contains('ARM64')) {
805+
$Runtime = "osx-arm64"
806+
}
807+
else {
808+
$Runtime = "osx-x64"
809+
}
803810
} else {
804811
$RID = dotnet --info | ForEach-Object {
805812
if ($_ -match "RID") {
@@ -2263,6 +2270,7 @@ function Start-CrossGen {
22632270
"linux-arm",
22642271
"linux-arm64",
22652272
"linux-x64",
2273+
"osx-arm64",
22662274
"osx-x64",
22672275
"win-arm",
22682276
"win-arm64",
@@ -2386,6 +2394,7 @@ function Start-CrossGen {
23862394
$crossGenPath = Get-ChildItem $script:Environment.nugetPackagesRoot $crossGenExe -Recurse | `
23872395
Where-Object { $_.FullName -match $crossGenRuntime } | `
23882396
Where-Object { $_.FullName -match $dotnetRuntimeVersion } | `
2397+
Where-Object { (Split-Path $_.FullName -Parent).EndsWith('tools') } | `
23892398
Sort-Object -Property FullName -Descending | `
23902399
Select-Object -First 1 | `
23912400
ForEach-Object { $_.FullName }

0 commit comments

Comments
 (0)