diff --git a/internal/rosa/all.go b/internal/rosa/all.go index da1e365..c7d39b7 100644 --- a/internal/rosa/all.go +++ b/internal/rosa/all.go @@ -15,8 +15,12 @@ import ( type PArtifact int const ( + LLVMCompilerRT PArtifact = iota + LLVMRuntimes + LLVMClang + // ImageInitramfs is the Rosa OS initramfs archive. - ImageInitramfs PArtifact = iota + ImageInitramfs // Kernel is the generic Rosa OS Linux kernel. Kernel diff --git a/internal/rosa/llvm.go b/internal/rosa/llvm.go index 8154d17..105d77c 100644 --- a/internal/rosa/llvm.go +++ b/internal/rosa/llvm.go @@ -73,12 +73,12 @@ func llvmFlagName(flag int) string { } } +const llvmVersion = "21.1.8" + // newLLVMVariant returns a [pkg.Artifact] containing a LLVM variant. func (t Toolchain) newLLVMVariant(variant string, attr *llvmAttr) pkg.Artifact { - const ( - version = "21.1.8" - checksum = "8SUpqDkcgwOPsqHVtmf9kXfFeVmjVxl4LMn-qSE1AI_Xoeju-9HaoPNGtidyxyka" - ) + const checksum = "8SUpqDkcgwOPsqHVtmf9kXfFeVmjVxl4LMn-qSE1AI_Xoeju-9HaoPNGtidyxyka" + if attr == nil { panic("LLVM attr must be non-nil") } @@ -161,9 +161,9 @@ ln -s ld.lld /work/system/bin/ld ) } - return t.NewPackage("llvm", version, pkg.NewHTTPGetTar( + return t.NewPackage("llvm", llvmVersion, pkg.NewHTTPGetTar( nil, "https://github.com/llvm/llvm-project/archive/refs/tags/"+ - "llvmorg-"+version+".tar.gz", + "llvmorg-"+llvmVersion+".tar.gz", mustDecode(checksum), pkg.TarGzip, ), &PackageAttr{ @@ -489,6 +489,40 @@ index 64324a3f8b01..15ce70b68217 100644 return } +func init() { + artifactsM[LLVMCompilerRT] = Metadata{ + f: func(t Toolchain) (pkg.Artifact, string) { + _, compilerRT, _, _ := t.newLLVM() + return compilerRT, llvmVersion + }, + + Name: "llvm-compiler-rt", + Description: "LLVM runtime: compiler-rt", + Website: "https://llvm.org/", + } + + artifactsM[LLVMRuntimes] = Metadata{ + f: func(t Toolchain) (pkg.Artifact, string) { + _, _, runtimes, _ := t.newLLVM() + return runtimes, llvmVersion + }, + + Name: "llvm-runtimes", + Description: "LLVM runtimes: libunwind, libcxx, libcxxabi", + Website: "https://llvm.org/", + } + + artifactsM[LLVMClang] = Metadata{ + f: func(t Toolchain) (pkg.Artifact, string) { + _, _, _, clang := t.newLLVM() + return clang, llvmVersion + }, + + Name: "clang", + Description: `an "LLVM native" C/C++/Objective-C compiler`, + Website: "https://llvm.org/", + } +} var ( // llvm stores the result of Toolchain.newLLVM.