feat: set apt alternatives when gcc is installed

This commit is contained in:
Amin Yahyaabadi 2022-04-18 23:34:18 -07:00
parent dc320cd781
commit dea371a1d9
3 changed files with 13 additions and 3 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
import { addPath, addEnv } from "../utils/env/addEnv"
import { existsSync } from "fs"
import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
import semverMajor from "semver/functions/major"
@ -96,9 +96,19 @@ async function activateGcc(version: string, binDir: string) {
if (majorVersion >= 5) {
addEnv("CC", `${binDir}/gcc-${majorVersion}`)
addEnv("CXX", `${binDir}/g++-${majorVersion}`)
if (process.platform === "linux") {
await updateAptAlternatives("cc", `${binDir}/gcc-${majorVersion}`)
await updateAptAlternatives("cxx", `${binDir}/g++-${majorVersion}`)
}
} else {
addEnv("CC", `${binDir}/gcc-${version}`)
addEnv("CXX", `${binDir}/g++-${version}`)
if (process.platform === "linux") {
await updateAptAlternatives("cc", `${binDir}/gcc-${version}`)
await updateAptAlternatives("cxx", `${binDir}/g++-${version}`)
}
}
}