fix: update the alternatives only on ubuntu

This commit is contained in:
Amin Yahyaabadi 2022-06-29 20:52:25 -07:00
parent 85e2f07bbe
commit cefca0b72e
4 changed files with 7 additions and 5 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

@ -14,6 +14,7 @@ import { addBinExtension } from "../utils/extension/extension"
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin" import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
import { extract7Zip } from "../utils/setup/extract" import { extract7Zip } from "../utils/setup/extract"
import { isArch } from "../utils/env/isArch" import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu"
interface MingwInfo { interface MingwInfo {
releaseName: string releaseName: string
@ -159,7 +160,7 @@ async function activateGcc(version: string, binDir: string) {
if (majorVersion >= 5) { if (majorVersion >= 5) {
promises.push(addEnv("CC", `${binDir}/gcc-${majorVersion}`), addEnv("CXX", `${binDir}/g++-${majorVersion}`)) promises.push(addEnv("CC", `${binDir}/gcc-${majorVersion}`), addEnv("CXX", `${binDir}/g++-${majorVersion}`))
if (process.platform === "linux") { if (isUbuntu()) {
updateAptAlternatives("cc", `${binDir}/gcc-${majorVersion}`) updateAptAlternatives("cc", `${binDir}/gcc-${majorVersion}`)
updateAptAlternatives("cxx", `${binDir}/g++-${majorVersion}`) updateAptAlternatives("cxx", `${binDir}/g++-${majorVersion}`)
updateAptAlternatives("gcc", `${binDir}/gcc-${majorVersion}`) updateAptAlternatives("gcc", `${binDir}/gcc-${majorVersion}`)
@ -168,7 +169,7 @@ async function activateGcc(version: string, binDir: string) {
} else { } else {
promises.push(addEnv("CC", `${binDir}/gcc-${version}`), addEnv("CXX", `${binDir}/g++-${version}`)) promises.push(addEnv("CC", `${binDir}/gcc-${version}`), addEnv("CXX", `${binDir}/g++-${version}`))
if (process.platform === "linux") { if (isUbuntu()) {
updateAptAlternatives("cc", `${binDir}/gcc-${version}`) updateAptAlternatives("cc", `${binDir}/gcc-${version}`)
updateAptAlternatives("cxx", `${binDir}/g++-${version}`) updateAptAlternatives("cxx", `${binDir}/g++-${version}`)
updateAptAlternatives("gcc", `${binDir}/gcc-${version}`) updateAptAlternatives("gcc", `${binDir}/gcc-${version}`)

View File

@ -21,6 +21,7 @@ import { isGitHubCI } from "../utils/env/isci"
import { setupGcc } from "../gcc/gcc" import { setupGcc } from "../gcc/gcc"
import { getVersion } from "../default_versions" import { getVersion } from "../default_versions"
import { isArch } from "../utils/env/isArch" import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu"
//================================================ //================================================
// Version // Version
@ -339,7 +340,7 @@ export async function activateLLVM(directory: string, versionGiven: string) {
} }
} }
if (process.platform === "linux") { if (isUbuntu()) {
updateAptAlternatives("cc", `${directory}/bin/clang`) updateAptAlternatives("cc", `${directory}/bin/clang`)
updateAptAlternatives("cxx", `${directory}/bin/clang++`) updateAptAlternatives("cxx", `${directory}/bin/clang++`)
updateAptAlternatives("clang", `${directory}/bin/clang`) updateAptAlternatives("clang", `${directory}/bin/clang`)