diff --git a/cspell.config.yaml b/cspell.config.yaml index e25efb82..48c9e118 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -11,6 +11,7 @@ ignorePaths: - "**/node_modules/" - .vscode/extensions.json - patches/*.patch + - "**/github_brechtsanders_winlibs_mingw.json" words: - aarch - aminya diff --git a/src/gcc/gcc.ts b/src/gcc/gcc.ts index dd627dc3..10b3c293 100644 --- a/src/gcc/gcc.ts +++ b/src/gcc/gcc.ts @@ -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 diff --git a/src/versions/default_versions.ts b/src/versions/default_versions.ts index 137bd03d..f9c80913 100644 --- a/src/versions/default_versions.ts +++ b/src/versions/default_versions.ts @@ -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 = { 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 = { // - the newer ubuntu versions use the first entry (e.g. v20), // - the older ones use "" export const DefaultLinuxVersion: Record | 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",