Skip to content

Commit

Permalink
Support building on arm macs
Browse files Browse the repository at this point in the history
Attempts to pull down butler were failing, since there's no arm64
channel available. Instead, we force all macs to fetch the amd64
channel.
  • Loading branch information
alts committed Jan 17, 2024
1 parent 5859918 commit 4c22ed3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/broth/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import * as sf from "main/os/sf";
import { mkdir, readdir } from "main/os/sf";
import { delay } from "main/reactors/delay";
import formulas, { FormulaSpec } from "main/broth/formulas";
import { goarch, goos } from "main/broth/platform";
import { platformString } from "main/broth/platform";
import { unzip } from "main/broth/unzip";

const sanityCheckTimeout = 10000;
const platform = `${goos()}-${goarch()}`;
const platform = platformString();

const downloadStart = 0.0;
const downloadWeight = 0.3;
Expand Down
15 changes: 13 additions & 2 deletions src/main/broth/platform.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { arch } from "main/os/arch";

/** platform in go format */
export function goos(): string {
function goos(): string {
let result = process.platform;
if (result === "win32") {
return "windows";
Expand All @@ -10,7 +10,7 @@ export function goos(): string {
}

/** arch in go format */
export function goarch() {
function goarch() {
let result = arch();
if (result === "x64") {
return "amd64";
Expand All @@ -20,3 +20,14 @@ export function goarch() {
return "unknown";
}
}

export function platformString(): string {
const os = goos();
let arch: string;
if (os === "darwin") {
arch = "amd64";
} else {
arch = goarch();
}
return `${os}-${arch}`;
}

0 comments on commit 4c22ed3

Please sign in to comment.