mirror of https://github.com/aminya/setup-cpp
fix: support activation of old gcc
This commit is contained in:
parent
fa01e81c02
commit
9d3670c0fb
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -34,20 +34,30 @@ export async function setupGcc(version: string, _setupDir: string, arch: string)
|
|||
}
|
||||
case "linux": {
|
||||
if (arch === "x64") {
|
||||
binDir = (
|
||||
await setupAptPack("g++", version, [
|
||||
"ppa:ubuntu-toolchain-r/test",
|
||||
await setupAptPack("gcc", version, [
|
||||
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai'",
|
||||
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe'",
|
||||
"ppa:ubuntu-toolchain-r/test",
|
||||
])
|
||||
binDir = (
|
||||
await setupAptPack("g++", version, [
|
||||
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai'",
|
||||
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe'",
|
||||
"ppa:ubuntu-toolchain-r/test",
|
||||
])
|
||||
).binDir
|
||||
} else {
|
||||
info(`Install g++-multilib because gcc for ${arch} was requested`)
|
||||
binDir = (
|
||||
await setupAptPack("g++-multilib", version, [
|
||||
"ppa:ubuntu-toolchain-r/test",
|
||||
await setupAptPack("gcc-multilib", version, [
|
||||
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai'",
|
||||
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe'",
|
||||
"ppa:ubuntu-toolchain-r/test",
|
||||
])
|
||||
binDir = (
|
||||
await setupAptPack("g++-multilib", version, [
|
||||
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai'",
|
||||
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe'",
|
||||
"ppa:ubuntu-toolchain-r/test",
|
||||
])
|
||||
).binDir
|
||||
}
|
||||
|
@ -58,9 +68,9 @@ export async function setupGcc(version: string, _setupDir: string, arch: string)
|
|||
// case "none": {
|
||||
// if (arch === "arm" || arch === "arm64") {
|
||||
// return setupAptPack("gcc-arm-none-eabi", version, [
|
||||
// "ppa:ubuntu-toolchain-r/test",
|
||||
// "'deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai'",
|
||||
// "'deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe'",
|
||||
// "ppa:ubuntu-toolchain-r/test",
|
||||
// ])
|
||||
// } else {
|
||||
// throw new Error(`Unsupported platform for ${arch}`)
|
||||
|
@ -78,8 +88,6 @@ export async function setupGcc(version: string, _setupDir: string, arch: string)
|
|||
}
|
||||
|
||||
async function activateGcc(version: string, binDir: string) {
|
||||
const majorVersion = semverMajor(semverCoerce(version) ?? version)
|
||||
|
||||
// TODO
|
||||
// const ld = process.env.LD_LIBRARY_PATH ?? ""
|
||||
// const dyld = process.env.DYLD_LIBRARY_PATH ?? ""
|
||||
|
@ -93,8 +101,14 @@ async function activateGcc(version: string, binDir: string) {
|
|||
exportVariable("CC", `${binDir}/gcc`)
|
||||
exportVariable("CXX", `${binDir}/g++`)
|
||||
} else {
|
||||
const majorVersion = semverMajor(semverCoerce(version) ?? version)
|
||||
if (majorVersion >= 5) {
|
||||
exportVariable("CC", `${binDir}/gcc-${majorVersion}`)
|
||||
exportVariable("CXX", `${binDir}/g++-${majorVersion}`)
|
||||
} else {
|
||||
exportVariable("CC", `${binDir}/gcc-${version}`)
|
||||
exportVariable("CXX", `${binDir}/g++-${version}`)
|
||||
}
|
||||
}
|
||||
|
||||
await setupMacOSSDK()
|
||||
|
|
Loading…
Reference in New Issue