mirror of https://github.com/aminya/setup-cpp
fix: fix make gnubin directory on MacOS ARM
This commit is contained in:
parent
2e807b3c46
commit
6294c32d20
|
@ -1,5 +1,5 @@
|
|||
import { tmpdir } from "os"
|
||||
import { dirname } from "path"
|
||||
import { dirname, join } from "path"
|
||||
import { type AddPathOptions, addPath } from "envosman"
|
||||
import { execaSync } from "execa"
|
||||
import { DownloaderHelper } from "node-downloader-helper"
|
||||
|
@ -64,23 +64,33 @@ export async function setupBrew(options: SetupBrewOptions = {}): Promise<Install
|
|||
return { binDir }
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the bin directory of brew
|
||||
* @returns {string} The path where brew binary is installed
|
||||
*
|
||||
* Based on the installation script from https://brew.sh
|
||||
*/
|
||||
export function getBrewBinDir() {
|
||||
return join(getBrewDir(), "bin")
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path where brew is installed
|
||||
* @returns {string} The path where brew is installed
|
||||
*
|
||||
* Based on the installation script from https://brew.sh
|
||||
*/
|
||||
export function getBrewBinDir() {
|
||||
export function getBrewDir() {
|
||||
if (process.platform === "darwin") {
|
||||
if (process.arch === "arm64") {
|
||||
return "/opt/homebrew/bin/"
|
||||
return "/opt/homebrew"
|
||||
} else {
|
||||
return "/usr/local/bin/"
|
||||
return "/usr/local"
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === "linux") {
|
||||
return "/home/linuxbrew/.linuxbrew/bin/"
|
||||
return "/home/linuxbrew/.linuxbrew"
|
||||
}
|
||||
|
||||
throw new Error("Unsupported platform for brew")
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { join } from "path"
|
||||
import { addPath } from "envosman"
|
||||
import { installAptPack } from "setup-apt"
|
||||
import { installBrewPack } from "setup-brew"
|
||||
import { getBrewDir, installBrewPack } from "setup-brew"
|
||||
import { rcOptions } from "../cli-options.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
|
@ -17,8 +18,10 @@ export async function setupMake(version: string, _setupDir: string, _arch: strin
|
|||
}
|
||||
case "darwin": {
|
||||
await installBrewPack("make", version)
|
||||
await addPath("/usr/local/opt/make/libexec/gnubin", rcOptions)
|
||||
return { binDir: "/usr/local/opt/make/libexec/gnubin" }
|
||||
|
||||
const gnuBinDir = join(getBrewDir(), "opt/make/libexec/gnubin")
|
||||
await addPath(gnuBinDir, rcOptions)
|
||||
return { binDir: gnuBinDir }
|
||||
}
|
||||
case "linux": {
|
||||
if (isArch()) {
|
||||
|
|
Loading…
Reference in New Issue