diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-01-21 07:36:39 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-01-21 08:25:17 +0900 |
| commit | 7cd4aa838cd32ecac793d36768a49582dae27008 (patch) | |
| tree | 825f6bf2737ab31d11db18bcbb2cda4b249a5d76 /internal | |
| parent | 641942a4e3373559b69592918040320461684cc0 (diff) | |
internal/rosa/llvm: patch source tree
A few patches are required for disabling broken tests and changing default search paths.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/rosa/llvm.go | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/internal/rosa/llvm.go b/internal/rosa/llvm.go index 15fcdc26..e3cb1a11 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), |
