fix: use the default version on Ubuntu, Fedora, Arch, macOS, etc.

This commit is contained in:
Amin Yahyaabadi 2024-09-03 02:41:54 -07:00
parent 324effb605
commit 81c10d4abc
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
3 changed files with 39 additions and 30 deletions

View File

@ -11,6 +11,7 @@ ignorePaths:
- "**/node_modules/"
- .vscode/extensions.json
- patches/*.patch
- "**/github_brechtsanders_winlibs_mingw.json"
words:
- aarch
- aminya

View File

@ -110,32 +110,44 @@ export async function setupGcc(version: string, setupDir: string, arch: string,
{ name: "libstdc++-devel" },
])
} else if (isUbuntu()) {
installationInfo = await installAptPack([
{
name: "gcc",
version,
repository: "ppa:ubuntu-toolchain-r/test",
key: { key: "1E9377A2BA9EF27F", fileName: "ubuntu-toolchain-r-test.gpg" },
},
{
name: "g++",
version,
repository: "ppa:ubuntu-toolchain-r/test",
key: { key: "1E9377A2BA9EF27F", fileName: "ubuntu-toolchain-r-test.gpg" },
},
])
if (version === undefined) {
// the default version
installationInfo = await installAptPack([{ name: "gcc" }, { name: "g++" }])
} else {
// add the PPA for access to more versions
installationInfo = await installAptPack([
{
name: "gcc",
version,
repository: "ppa:ubuntu-toolchain-r/test",
key: { key: "1E9377A2BA9EF27F", fileName: "ubuntu-toolchain-r-test.gpg" },
},
{
name: "g++",
version,
repository: "ppa:ubuntu-toolchain-r/test",
key: { key: "1E9377A2BA9EF27F", fileName: "ubuntu-toolchain-r-test.gpg" },
},
])
}
}
} else {
info(`Install g++-multilib because gcc for ${arch} was requested`)
if (isArch()) {
await setupPacmanPack("gcc-multilib", version)
} else if (isUbuntu()) {
await installAptPack([{
name: "gcc-multilib",
version,
repository: "ppa:ubuntu-toolchain-r/test",
key: { key: "1E9377A2BA9EF27F", fileName: "ubuntu-toolchain-r-test.gpg" },
}])
if (version === undefined) {
// the default version
await installAptPack([{ name: "gcc-multilib" }])
} else {
// add the PPA for access to more versions
await installAptPack([{
name: "gcc-multilib",
version,
repository: "ppa:ubuntu-toolchain-r/test",
key: { key: "1E9377A2BA9EF27F", fileName: "ubuntu-toolchain-r-test.gpg" },
}])
}
}
}
break

View File

@ -1,4 +1,5 @@
import { isArch } from "../utils/env/isArch.js"
import { isUbuntu } from "../utils/env/isUbuntu.js"
// passing "" to a tool installed by a package manager (apt, brew, choco) will result in the default version of that package manager.
// the directly downloaded tools require a given version ("" doesn't work).
@ -30,8 +31,10 @@ export const DefaultVersions: Record<string, string | undefined> = {
kcov: "42", // https://github.com/SimonKagstrom/kcov/releases
task: "3.38.0", // https://github.com/go-task/task/releases
doxygen: isArch() ? "1.11.0-4" : "1.11.0", // https://www.doxygen.nl/download.html // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=doxygen // https://formulae.brew.sh/formula/doxygen // https://archlinux.org/packages/extra/x86_64/doxygen/
gcc: isArch() ? "13.2.1-3" : "13", // https://github.com/brechtsanders/winlibs_mingw/releases and // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=gcc
// mingw: isArch() ? "12.2.0-1" : "8", // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=mingw-w64 // https://archlinux.org/packages/extra/x86_64/mingw-w64-gcc/
gcc: process.platform === "win32"
? "13"
: undefined, // use the default version on Ubuntu, Fedora, Arch, macOS, etc.
// mingw: isArch() ? "12.2.0-1" : "8", // https://archlinux.org/packages/extra/x86_64/mingw-w64-gcc/
powershell: "7.4.5", // https://github.com/PowerShell/PowerShell/releases/tag/v7.4.5
}
@ -44,14 +47,7 @@ export const MinVersions: Record<string, string | undefined> = {
// - the newer ubuntu versions use the first entry (e.g. v20),
// - the older ones use ""
export const DefaultLinuxVersion: Record<string, Record<number, string> | undefined> = {
gcc: {
24: "13",
22: "13",
20: "11",
18: "11",
16: "11",
14: "11",
},
// https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=mingw-w64
mingw: {
24: "8.0.0-1",
22: "8.0.0-1",