aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/make.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-10-22 01:56:23 +0900
committerOphestra <cat@gensokyo.uk>2026-10-22 11:10:01 +0900
commit9dfbf95db02054204defbe422099c02b790a19fc (patch)
treef8c318ebfc5c824b2eb5e7a8aac3b835ee05a4ed /internal/rosa/make.go
parent29f86b3446c9fe35d2a359df45471abdaa35cea4 (diff)
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 <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/make.go')
-rw-r--r--internal/rosa/make.go16
1 files changed, 14 insertions, 2 deletions
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