From f571dde5383fbf7a2ca72911814e767749b58f29 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sat, 26 Jul 2025 12:05:33 +1000 Subject: [PATCH] feat(build): integrate target configuration system into build pipeline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add Target field to build.Config struct - Update build system to use crosscompile.UseWithTarget() - Enable target-based cross-compilation in build pipeline - Maintain backward compatibility with existing GOOS/GOARCH workflow 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- internal/build/build.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/build/build.go b/internal/build/build.go index 0a698dc3..46a2da6d 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -70,6 +70,7 @@ const ( type Config struct { Goos string Goarch string + Target string // target name (e.g., "rp2040", "wasi") - takes precedence over Goos/Goarch BinPath string AppExt string // ".exe" on Windows, empty on Unix OutFile string // only valid for ModeBuild when len(pkgs) == 1 @@ -251,7 +252,7 @@ func Do(args []string, conf *Config) ([]Package, error) { os.Setenv("PATH", env.BinDir()+":"+os.Getenv("PATH")) // TODO(xsw): check windows output := conf.OutFile != "" - export, err := crosscompile.Use(conf.Goos, conf.Goarch, IsWasiThreadsEnabled()) + export, err := crosscompile.UseWithTarget(conf.Goos, conf.Goarch, IsWasiThreadsEnabled(), conf.Target) check(err) ctx := &context{env: env, conf: cfg, progSSA: progSSA, prog: prog, dedup: dedup, patches: patches, built: make(map[string]none), initial: initial, mode: mode,