From 3011bd38196d484a09e7565f5892c069938f1e6d Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 26 Sep 2024 10:50:22 +0200 Subject: [PATCH] mksysconf: allow to override GO{ARCH,OS} using GO{OS,ARCH}_TARGET env vars Makes it easier to test change. --- mksysconf.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mksysconf.go b/mksysconf.go index eae4fd8..c67922c 100644 --- a/mksysconf.go +++ b/mksysconf.go @@ -51,10 +51,18 @@ func gensysconf(in, out, goos, goarch string) error { } func main() { - goos, goarch := runtime.GOOS, runtime.GOARCH - if goos == "illumos" { - goos = "solaris" + goos := os.Getenv("GOOS_TARGET") + if goos == "" { + goos = runtime.GOOS + if goos == "illumos" { + goos = "solaris" + } + } + goarch := os.Getenv("GOARCH_TARGET") + if goarch == "" { + goarch = runtime.GOARCH } + defs := fmt.Sprintf("sysconf_defs_%s.go", goos) if err := gensysconf(defs, "z"+defs, goos, ""); err != nil { fmt.Fprintln(os.Stderr, err)