aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/mbf
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/mbf')
-rw-r--r--cmd/mbf/main.go85
1 files changed, 58 insertions, 27 deletions
diff --git a/cmd/mbf/main.go b/cmd/mbf/main.go
index dd5ee624..9c41e3ff 100644
--- a/cmd/mbf/main.go
+++ b/cmd/mbf/main.go
@@ -742,24 +742,39 @@ func main() {
)
}
- c.NewCommand(
- "all",
- command.UsageInternal,
- func([]string) error {
- all := rosa.CollectAll()
- a := make(pkg.Collect, len(all))
- for i, h := range all {
- _, a[i] = rosa.Load(h)
- }
- return cm.Do(func(cache *pkg.Cache) (err error) {
- _, _, err = cache.Cure(&a)
- if pkg.IsCollected(err) {
- err = nil
+ {
+ var flagCross string
+ c.NewCommand(
+ "all",
+ command.UsageInternal,
+ func([]string) error {
+ s := &builtin
+ if flagCross != "" {
+ s = s.NewCross(flagCross)
+ if !s.HasStageEarly() {
+ return pkg.UnsupportedArchError(flagCross)
+ }
}
- return
- })
- },
- )
+
+ all := s.CollectAll()
+ a := make(pkg.Collect, len(all))
+ for i, h := range all {
+ _, a[i] = rosa.Load(h)
+ }
+ return cm.Do(func(cache *pkg.Cache) (err error) {
+ _, _, err = cache.Cure(&a)
+ if pkg.IsCollected(err) {
+ err = nil
+ }
+ return
+ })
+ },
+ ).Flag(
+ &flagCross,
+ "cross", command.StringFlag(""),
+ "Target architecture (cross-compilation)",
+ )
+ }
{
var (
@@ -768,6 +783,7 @@ func main() {
flagExport string
flagRemote bool
flagNoReply bool
+ flagCross string
flagFaults bool
flagPop bool
flagRebuild bool
@@ -793,6 +809,14 @@ func main() {
t -= 1
}
+ s := &builtin
+ if flagCross != "" {
+ s = s.NewCross(flagCross)
+ if !s.HasStageEarly() {
+ return pkg.UnsupportedArchError(flagCross)
+ }
+ }
+
if flagGentoo != "" {
var checksum pkg.Checksum
if len(flagChecksum) != 0 {
@@ -800,12 +824,12 @@ func main() {
return err
}
}
- builtin.SetGentooStage3(flagGentoo, checksum)
+ s.SetGentooStage3(flagGentoo, checksum)
t -= 3 // magic number to discourage misuse
}
- _, a := rosa.LoadAt(t, rosa.ArtifactH(unique.Make(args[0])))
+ _, a := s.New(t).Load(rosa.ArtifactH(unique.Make(args[0])))
if a == nil {
return fmt.Errorf("unknown artifact %q", args[0])
}
@@ -964,6 +988,10 @@ func main() {
"no-reply", command.BoolFlag(false),
"Do not receive a reply from the daemon",
).Flag(
+ &flagCross,
+ "cross", command.StringFlag(""),
+ "Target architecture (cross-compilation)",
+ ).Flag(
&flagBoot,
"boot", command.BoolFlag(false),
"Build on the stage0 toolchain",
@@ -1111,20 +1139,23 @@ func main() {
"Remove identifiers not reachable by loaded packages",
func([]string) error {
return cm.Do(func(cache *pkg.Cache) error {
- t := rosa.New().Std()
- handles := t.CollectAll()
+ s := rosa.New()
+ s.DropCaches(runtime.GOARCH, s.Flags())
+ handles := s.Std().CollectAll()
- flags := t.Flags()
- a := t.Append(nil, handles...)
+ flags := s.Flags()
+ a := s.Std().Append(nil, handles...)
for arch := range rosa.Arches(nil) {
if arch == runtime.GOARCH {
continue
}
- t.DropCaches(arch, rosa.OptSkipCheck)
- a = t.Append(a, handles...)
- t.DropCaches(arch, flags)
- a = t.Append(a, handles...)
+ s.DropCaches(arch, rosa.OptSkipCheck)
+ a = s.Std().Append(a, handles...)
+ s.DropCaches(arch, flags)
+ a = s.Std().Append(a, handles...)
+ s.DropCaches(runtime.GOARCH, flags)
+ a = s.NewCross(arch).Std().Append(a, handles...)
}
ids, checksums, err := cache.Clean(