fix: install ncurses for LLVM on Arch/Fedora

This commit is contained in:
Amin Yahyaabadi 2024-09-08 03:15:02 -07:00
parent dcadbb8407
commit e714af79eb
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
6 changed files with 20 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
import { parseArgs } from "../cli-options.js" import { parseArgs } from "../cli-options.js"
import { getCompilerInfo } from "../compilers.js" import { getCompilerInfo } from "../compilers.js"
import type { Inputs } from "../tool.js" import type { Inputs } from "../tool.js"
import { DefaultUbuntuVersion } from "../versions/default_versions.js" import { DefaultUbuntuVersion, DefaultVersions } from "../versions/default_versions.js"
import { getVersion, syncVersions } from "../versions/versions.js" import { getVersion, syncVersions } from "../versions/versions.js"
jest.setTimeout(300000) jest.setTimeout(300000)
@ -64,9 +64,9 @@ describe("getVersion", () => {
it("llvm", () => { it("llvm", () => {
expect(getVersion("llvm", "13.0.0")).toBe("13.0.0") expect(getVersion("llvm", "13.0.0")).toBe("13.0.0")
if (process.platform === "linux") { if (process.platform === "linux") {
expect(getVersion("llvm", "true", [20, 4])).toBe(DefaultUbuntuVersion.llvm![20]) expect(getVersion("llvm", "true", [20, 4])).toBe(DefaultVersions.llvm)
expect(getVersion("llvm", "true", [18, 4])).toBe(DefaultUbuntuVersion.llvm![18]) expect(getVersion("llvm", "true", [18, 4])).toBe(DefaultVersions.llvm)
expect(getVersion("llvm", "true", [16, 4])).toBe(DefaultUbuntuVersion.llvm![16]) expect(getVersion("llvm", "true", [16, 4])).toBe(DefaultVersions.llvm)
} }
}) })
}) })

View File

@ -10,9 +10,13 @@ import { addUpdateAlternativesToRc, installAptPack } from "setup-apt"
import { rcOptions } from "../cli-options.js" import { rcOptions } from "../cli-options.js"
import { setupGcc } from "../gcc/gcc.js" import { setupGcc } from "../gcc/gcc.js"
import { setupMacOSSDK } from "../macos-sdk/macos-sdk.js" import { setupMacOSSDK } from "../macos-sdk/macos-sdk.js"
import { hasDnf } from "../utils/env/hasDnf.js"
import { isArch } from "../utils/env/isArch.js"
import { isUbuntu } from "../utils/env/isUbuntu.js" import { isUbuntu } from "../utils/env/isUbuntu.js"
import { ubuntuVersion } from "../utils/env/ubuntu_version.js" import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
import { type InstallationInfo, setupBin } from "../utils/setup/setupBin.js" import { type InstallationInfo, setupBin } from "../utils/setup/setupBin.js"
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
import { semverCoerceIfInvalid } from "../utils/setup/version.js" import { semverCoerceIfInvalid } from "../utils/setup/version.js"
import { getVersion } from "../versions/versions.js" import { getVersion } from "../versions/versions.js"
import { LLVMPackages, setupLLVMApt } from "./llvm_installer.js" import { LLVMPackages, setupLLVMApt } from "./llvm_installer.js"
@ -82,6 +86,14 @@ async function llvmBinaryDeps_raw(majorVersion: number) {
} else { } else {
await installAptPack([{ name: "libtinfo-dev" }]) await installAptPack([{ name: "libtinfo-dev" }])
} }
} else if (isArch()) {
// https://aur.archlinux.org/packages/ncurses5-compat-libs
await setupPacmanPack("ncurses5-compat-libs")
} else if (hasDnf()) {
// https://packages.fedoraproject.org/pkgs/ncurses/ncurses-compat-libs/index.html
await setupDnfPack([
{ name: "ncurses-compat-libs" },
])
} }
} }
const llvmBinaryDeps = memoize(llvmBinaryDeps_raw, { promise: true }) const llvmBinaryDeps = memoize(llvmBinaryDeps_raw, { promise: true })