From 7cd4aa838cd32ecac793d36768a49582dae27008 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Wed, 21 Jan 2026 07:36:39 +0900 Subject: [PATCH] internal/rosa/llvm: patch source tree A few patches are required for disabling broken tests and changing default search paths. Signed-off-by: Ophestra --- internal/rosa/llvm.go | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/internal/rosa/llvm.go b/internal/rosa/llvm.go index 15fcdc2..e3cb1a1 100644 --- a/internal/rosa/llvm.go +++ b/internal/rosa/llvm.go @@ -27,6 +27,9 @@ type llvmAttr struct { script string // Passed through to CMakeAttr.Prefix. prefix *check.Absolute + + // Patch name and body pairs. + patches [][2]string } const ( @@ -172,12 +175,32 @@ cp -r /system/include /usr/include && rm -rf /system/include ) } - return t.NewViaCMake("llvm", version, variant, pkg.NewHTTPGetTar( + source := pkg.NewHTTPGetTar( nil, "https://github.com/llvm/llvm-project/archive/refs/tags/"+ "llvmorg-"+version+".tar.gz", mustDecode(checksum), pkg.TarGzip, - ), &CMakeAttr{ + ) + + patches := make([]pkg.ExecPath, len(attr.patches)+1) + for i, p := range attr.patches { + patches[i+1] = pkg.Path( + AbsUsrSrc.Append("llvm-patches", p[0]+".patch"), false, + pkg.NewFile(p[0], []byte(p[1])), + ) + } + patches[0] = pkg.Path(AbsUsrSrc.Append("llvmorg"), false, source) + if len(patches) > 1 { + source = t.New( + "llvmorg-patched", nil, nil, nil, ` +cp -r /usr/src/llvmorg/. /work/. +chmod -R +w /work && cd /work +cat /usr/src/llvm-patches/* | patch -p 1 +`, patches..., + ) + } + + return t.NewViaCMake("llvm", version, variant, source, &CMakeAttr{ Cache: slices.Concat(cache, attr.cmake), Append: cmakeAppend, Extra: slices.Concat(attr.extra, extra),