aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/rosa.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-11-27 13:49:03 +0900
committerOphestra <cat@gensokyo.uk>2026-11-27 13:49:03 +0900
commit3a27514df88075d2f7c3b39fca02f9cd89e5e0d5 (patch)
tree667f12ebf775f7959c9d9e5cb300c87007fec055 /internal/rosa/rosa.go
parent1b108e0224e34f0d7af989d83f3ae3895e542a65 (diff)
internal/rosa: optionally reject cross-compilation
This provides a generic way for any package to reject cross-compilation without going through its helper. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/rosa.go')
-rw-r--r--internal/rosa/rosa.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go
index 3d4914f2..ac6648ab 100644
--- a/internal/rosa/rosa.go
+++ b/internal/rosa/rosa.go
@@ -375,6 +375,8 @@ type PackageAttr struct {
// Whether to create [pkg.KindExecNet] instead of [pkg.KindExec].
HostNet bool
+ // Whether cross-compilation is broken.
+ RejectCross bool
// Whether the [Helper] behaves identically across all architectures.
NoArch bool
// Whether libc can be omitted.
@@ -495,6 +497,10 @@ func (t Toolchain) New(
cross := t.cross()
var rootCross []pkg.Artifact
if cross {
+ if attr.RejectCross {
+ panic(CrossError(name))
+ }
+
rootCross = make([]pkg.Artifact, 0, 1+len(inputs)+len(attr.Cross))
}