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/" - "**/node_modules/"
- .vscode/extensions.json - .vscode/extensions.json
- patches/*.patch - patches/*.patch
- "**/github_brechtsanders_winlibs_mingw.json"
words: words:
- aarch - aarch
- aminya - aminya

View File

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

View File

@ -1,4 +1,5 @@
import { isArch } from "../utils/env/isArch.js" 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. // 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). // 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 kcov: "42", // https://github.com/SimonKagstrom/kcov/releases
task: "3.38.0", // https://github.com/go-task/task/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/ 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 gcc: process.platform === "win32"
// 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/ ? "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 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 newer ubuntu versions use the first entry (e.g. v20),
// - the older ones use "" // - the older ones use ""
export const DefaultLinuxVersion: Record<string, Record<number, string> | undefined> = { export const DefaultLinuxVersion: Record<string, Record<number, string> | undefined> = {
gcc: { // https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=mingw-w64
24: "13",
22: "13",
20: "11",
18: "11",
16: "11",
14: "11",
},
mingw: { mingw: {
24: "8.0.0-1", 24: "8.0.0-1",
22: "8.0.0-1", 22: "8.0.0-1",