2024-09-08 20:22:10 +08:00
|
|
|
import { join } from "path"
|
2024-08-16 17:52:11 +08:00
|
|
|
import { addPath } from "envosman"
|
2025-03-23 17:55:38 +08:00
|
|
|
import { hasApk, installApkPack } from "setup-alpine"
|
2024-08-16 16:50:32 +08:00
|
|
|
import { installAptPack } from "setup-apt"
|
2024-09-08 20:22:10 +08:00
|
|
|
import { getBrewDir, installBrewPack } from "setup-brew"
|
2024-08-16 06:22:07 +08:00
|
|
|
import { rcOptions } from "../cli-options.js"
|
|
|
|
|
import { hasDnf } from "../utils/env/hasDnf.js"
|
|
|
|
|
import { isArch } from "../utils/env/isArch.js"
|
|
|
|
|
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
|
|
|
|
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
|
|
|
|
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
|
|
|
|
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
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": {
|
2024-08-24 06:20:37 +08:00
|
|
|
await installBrewPack("make", version)
|
2024-09-08 20:22:10 +08:00
|
|
|
|
|
|
|
|
const gnuBinDir = join(getBrewDir(), "opt/make/libexec/gnubin")
|
|
|
|
|
await addPath(gnuBinDir, rcOptions)
|
|
|
|
|
return { binDir: gnuBinDir }
|
2022-01-31 06:40:11 +08:00
|
|
|
}
|
|
|
|
|
case "linux": {
|
2022-06-30 10:06:33 +08:00
|
|
|
if (isArch()) {
|
2022-06-30 00:06:35 +08:00
|
|
|
return setupPacmanPack("make", version)
|
2022-07-11 07:34:56 +08:00
|
|
|
} else if (hasDnf()) {
|
2023-07-16 18:12:24 +08:00
|
|
|
return setupDnfPack([{ name: "make", version }])
|
2022-07-11 08:39:21 +08:00
|
|
|
} else if (isUbuntu()) {
|
2024-08-16 16:50:32 +08:00
|
|
|
return installAptPack([{ name: "make", version }])
|
2025-03-23 16:18:33 +08:00
|
|
|
} else if (await hasApk()) {
|
2025-03-23 17:55:38 +08:00
|
|
|
return installApkPack([{ name: "make", version }])
|
2022-06-30 00:06:35 +08:00
|
|
|
}
|
2024-08-07 14:44:32 +08:00
|
|
|
throw new Error("Unsupported linux distribution")
|
2022-01-31 06:40:11 +08:00
|
|
|
}
|
|
|
|
|
default: {
|
2024-08-07 14:44:32 +08:00
|
|
|
throw new Error("Unsupported platform")
|
2022-01-31 06:40:11 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|