aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/rosa/git.go1
-rw-r--r--internal/rosa/meson.go4
-rw-r--r--internal/rosa/package/nss.az2
-rw-r--r--internal/rosa/perl.go6
-rw-r--r--internal/rosa/python.go4
-rw-r--r--internal/rosa/rosa.go35
-rw-r--r--internal/rosa/state.go7
7 files changed, 50 insertions, 9 deletions
diff --git a/internal/rosa/git.go b/internal/rosa/git.go
index 70d5b6f8..19fb6448 100644
--- a/internal/rosa/git.go
+++ b/internal/rosa/git.go
@@ -25,6 +25,7 @@ func (t Toolchain) NewViaGit(
HostNet: true,
Paths: []pkg.ExecPath{resolvconf()},
+ NoArch: true,
}, &GenericHelper{
Build: `
git \
diff --git a/internal/rosa/meson.go b/internal/rosa/meson.go
index 97262fbb..25291dd0 100644
--- a/internal/rosa/meson.go
+++ b/internal/rosa/meson.go
@@ -65,6 +65,10 @@ func (attr *MesonHelper) isPython() bool {
// script generates the cure script.
func (attr *MesonHelper) script(t Toolchain, name string) string {
+ if t.cross() {
+ panic(CrossError(name))
+ }
+
if attr == nil {
attr = new(MesonHelper)
}
diff --git a/internal/rosa/package/nss.az b/internal/rosa/package/nss.az
index 115e5667..a7e1b6f1 100644
--- a/internal/rosa/package/nss.az
+++ b/internal/rosa/package/nss.az
@@ -37,4 +37,6 @@ buildcatrust \
buildcatrust,
];
+
+ cross = nil;
}
diff --git a/internal/rosa/perl.go b/internal/rosa/perl.go
index 705b1b8d..55c17916 100644
--- a/internal/rosa/perl.go
+++ b/internal/rosa/perl.go
@@ -29,7 +29,11 @@ func (*MakeMakerHelper) scriptEarly() string { return "" }
func (*MakeMakerHelper) wantsDir() (string, bool) { return "", false }
// script generates Makefile.PL-based build and test commands.
-func (attr *MakeMakerHelper) script(t Toolchain, _ string) string {
+func (attr *MakeMakerHelper) script(t Toolchain, name string) string {
+ if t.cross() {
+ panic(CrossError(name))
+ }
+
if attr == nil {
attr = new(MakeMakerHelper)
}
diff --git a/internal/rosa/python.go b/internal/rosa/python.go
index 54022bd7..e97ded49 100644
--- a/internal/rosa/python.go
+++ b/internal/rosa/python.go
@@ -50,6 +50,10 @@ func (*PipHelper) wantsDir() (string, bool) { return `"$(mktemp -d)"`, false }
// script generates the pip3 install command.
func (attr *PipHelper) script(t Toolchain, name string) string {
+ if t.cross() {
+ panic(CrossError(name))
+ }
+
if attr == nil {
attr = new(PipHelper)
}
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go
index e83d7097..2241788f 100644
--- a/internal/rosa/rosa.go
+++ b/internal/rosa/rosa.go
@@ -267,8 +267,9 @@ function apply {
}
return t.New(name+"-src", Unversioned, nil, &PackageAttr{
- Paths: paths,
- Tools: P{_patch},
+ Paths: paths,
+ Tools: P{_patch},
+ NoArch: true,
}, &GenericHelper{
Build: buf.String(),
})
@@ -302,7 +303,7 @@ type Helper interface {
// PackageAttr holds build-system-agnostic attributes.
type PackageAttr struct {
- // Measure output if populated. Required by [THostNet].
+ // Measure output if populated. Required by HostNet.
KnownChecksum *pkg.Checksum
// Mount the source tree writable.
@@ -337,6 +338,8 @@ type PackageAttr struct {
// Whether to create [pkg.KindExecNet] instead of [pkg.KindExec].
HostNet bool
+ // Whether the [Helper] behaves identically across all architectures.
+ NoArch bool
// Inputs added only during cross-compilation.
Cross P
// Native utilities used by the build process.
@@ -405,6 +408,10 @@ func (t Toolchain) New(
attr = new(PackageAttr)
}
+ if attr.NoArch {
+ t = t.native()
+ }
+
if attr.Std && !t.stage.isStd() {
panic(BootstrapError(name))
}
@@ -640,6 +647,17 @@ ln -s ../bin /usr/`
)
}
+// A CrossError refers to a package that does not support cross-compilation and
+// is panicked by the helper implementation.
+type CrossError string
+
+func (e CrossError) Error() string {
+ return "package " + strconv.Quote(string(e)) +
+ " does not support cross-compilation"
+}
+
+var _ error = CrossError("")
+
// GenericHelper directly passes build script segments for invocations of
// one-off build scripts too specific to fit into any other [Helper]
// implementation, but can still benefit from [Toolchain.New].
@@ -677,14 +695,21 @@ func (attr *GenericHelper) wantsDir() (string, bool) {
}
// script concatenates specified segments.
-func (attr *GenericHelper) script(t Toolchain, _ string) string {
+func (attr *GenericHelper) script(t Toolchain, name string) string {
if attr == nil {
attr = new(GenericHelper)
}
script := attr.Build
if t.cross() {
- script = attr.Cross + script
+ if attr.Cross == "" {
+ panic(CrossError(name))
+ }
+ cross := attr.Cross
+ if cross == "\x00" {
+ cross = ""
+ }
+ script = cross + script
}
if t.opts&OptSkipCheck == 0 {
script += attr.Check
diff --git a/internal/rosa/state.go b/internal/rosa/state.go
index 18f9a6f3..bda8d32e 100644
--- a/internal/rosa/state.go
+++ b/internal/rosa/state.go
@@ -1100,10 +1100,10 @@ func (ctx *evalContext) pf(
overlay string
join bool
- tools, inputs, cross, extra azalea.Array
+ tools, inputs, extra azalea.Array
- runtimes = azalea.Array{}
- bootstrap = true
+ cross, runtimes = azalea.Array{}, azalea.Array{}
+ bootstrap = true
)
if err = args.Apply(map[unique.Handle[azalea.Ident]]any{
k("description"): &meta.Description,
@@ -1144,6 +1144,7 @@ func (ctx *evalContext) pf(
return
}
attr.Std = !bootstrap
+ attr.NoArch = cross == nil
var inputsH, extraH P
if inputsH, err = toHandles(inputs); err != nil {
return