From 9dfbf95db02054204defbe422099c02b790a19fc Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 22 Oct 2026 01:56:23 +0900 Subject: internal/rosa: initial cross-compilation support This successfully cross-compiles the toolchain. More work is needed to support cross-compilation on all native helpers and existing packages. Signed-off-by: Ophestra --- internal/rosa/make.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'internal/rosa/make.go') diff --git a/internal/rosa/make.go b/internal/rosa/make.go index a41db646..f46780f5 100644 --- a/internal/rosa/make.go +++ b/internal/rosa/make.go @@ -101,19 +101,31 @@ func (attr *MakeHelper) script(t Toolchain, name string) string { if attr == nil { attr = new(MakeHelper) } + cross := t.cross() var configure string target := t.triple() + if cross { + configure += ` +export CC='clang --target=` + target + ` --sysroot=/system/` + t.arch + `' +export CXX='clang++ --target=` + target + ` --sysroot=/system/` + t.arch + `' +` + } + if !attr.SkipConfigure { - configure += attr.ConfigureName - if configure == "" { + if attr.ConfigureName == "" { configure += `/usr/src/` + name + `/configure` + } else { + configure += attr.ConfigureName } if attr.ForceAutoconf || attr.ConfigureName == "" { configure += ` \ --prefix=/system` host := target build := host + if cross { + build = triple(t.native().Arch()) + } if attr.Host != "" { host = attr.Host -- cgit v1.3.1