2022-05-03 12:53:40 +08:00
|
|
|
import { addPath } from "../utils/env/addEnv"
|
2022-01-31 06:40:11 +08:00
|
|
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
2022-06-30 00:06:35 +08:00
|
|
|
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
2022-01-31 06:40:11 +08:00
|
|
|
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
|
|
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
2022-06-30 00:06:35 +08:00
|
|
|
import which from "which"
|
2022-01-31 06:40:11 +08:00
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2022-05-13 03:55:00 +08:00
|
|
|
export async function setupMake(version: string, _setupDir: string, _arch: string) {
|
2022-01-31 06:40:11 +08:00
|
|
|
switch (process.platform) {
|
|
|
|
case "win32": {
|
|
|
|
return setupChocoPack("make", version)
|
|
|
|
}
|
|
|
|
case "darwin": {
|
2022-01-31 10:25:54 +08:00
|
|
|
setupBrewPack("make", version)
|
2022-05-13 03:55:00 +08:00
|
|
|
await addPath("/usr/local/opt/make/libexec/gnubin")
|
2022-01-31 10:25:54 +08:00
|
|
|
return { binDir: "/usr/local/opt/make/libexec/gnubin" }
|
2022-01-31 06:40:11 +08:00
|
|
|
}
|
|
|
|
case "linux": {
|
2022-06-30 00:06:35 +08:00
|
|
|
if (which.sync("pacman", { nothrow: true })) {
|
|
|
|
return setupPacmanPack("make", version)
|
|
|
|
}
|
2022-01-31 06:40:11 +08:00
|
|
|
return setupAptPack("make", version)
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
throw new Error(`Unsupported platform`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|