Skip to content

Commit

Permalink
Update mac x64 installer script arch detection (dotnet#7913)
Browse files Browse the repository at this point in the history
* Update mac x64 installer script arch detection

* Add comments to x64 machine detection script
  • Loading branch information
sfoslund authored and ericstj committed Sep 17, 2021
1 parent fe23bc1 commit 3abbdb8
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,19 @@ public override bool Execute()

var archScriptContent = @"<![CDATA[
function IsX64Machine() {
var machine = system.sysctl(""hw.machine"");
system.log(""Machine type: "" + machine);
var result = machine == ""x64"" || machine.endsWith(""_x64"");
system.log(""IsX64Machine: "" + result);
return result;
var machine = system.sysctl(""hw.foo"");
var cputype = system.sysctl(""hw.cputype"");
var cpu64 = system.sysctl(""hw.cpu64bit_capable"");
system.log(""Machine type: "" + machine);
system.log(""Cpu type: "" + cputype);
system.log(""64-bit: "" + cpu64);
// From machine.h
// CPU_TYPE_X86_64 = CPU_TYPE_X86 | CPU_ARCH_ABI64 = 0x010000007 = 16777223
// CPU_TYPE_X86 = 7
var result = machine == ""amd64"" || machine == ""x86_64"" || cputype == ""16777223"" || (cputype == ""7"" && cpu64 == ""1"");
system.log(""IsX64Machine: "" + result);
return result;
}
]]>";
var scriptElement = new XElement("script", new XText(archScriptContent));
Expand Down

0 comments on commit 3abbdb8

Please sign in to comment.