fix: add dk.archive.ubuntu.com/ubuntu/ xenia ppas for gcc

This commit is contained in:
Amin Yahyaabadi 2021-12-07 02:53:22 -06:00
parent 6b9b57b9a8
commit dd4a80b89b
4 changed files with 29 additions and 10 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

@ -34,18 +34,34 @@ 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")).binDir
binDir = (
await setupAptPack("g++", version, [
"ppa:ubuntu-toolchain-r/test",
"deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai",
"deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe",
])
).binDir
} else {
info(`Install g++-multilib because gcc for ${arch} was requested`)
binDir = (await setupAptPack("g++-multilib", version, "ppa:ubuntu-toolchain-r/test")).binDir
binDir = (
await setupAptPack("g++-multilib", version, [
"ppa:ubuntu-toolchain-r/test",
"deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai",
"deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe",
])
).binDir
}
break
}
// TODO support bare-metal
// TODO support bare-metal (need to support passing it as the input)
// TODO support abi
// case "none": {
// if (arch === "arm" || arch === "arm64") {
// return setupAptPack("gcc-arm-none-eabi", version, "ppa:ubuntu-toolchain-r/test")
// 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",
// ])
// } else {
// throw new Error(`Unsupported platform for ${arch}`)
// }

View File

@ -8,15 +8,18 @@ let didUpdate: boolean = false
export async function setupAptPack(
name: string,
version?: string,
repository: boolean | string = true
repositories: boolean | string[] = true
): Promise<InstallationInfo> {
const apt = "apt-get"
if (typeof repository === "string") {
await execaSudo("add-apt-repository", ["--update", "-y", repository])
if (Array.isArray(repositories)) {
for (const repo of repositories) {
// eslint-disable-next-line no-await-in-loop
await execaSudo("add-apt-repository", ["--update", "-y", repo])
}
}
if (!didUpdate || repository === true) {
if (!didUpdate || repositories === true) {
await execaSudo(apt, ["update", "-y"])
didUpdate = true
}