From 5135ff73cbec3d8299d9e94c72a5fb1a7b88d8b8 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 9 May 2017 11:58:29 +0100 Subject: [PATCH] Compile 386 builds with "GO386=387" for maximum compatibility #437 --- bin/cross-compile.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bin/cross-compile.go b/bin/cross-compile.go index ae701ba46..57b2fa5de 100644 --- a/bin/cross-compile.go +++ b/bin/cross-compile.go @@ -49,6 +49,11 @@ var osarches = []string{ "solaris/amd64", } +// Special environment flags for a given arch +var archFlags = map[string][]string{ + "386": {"GO386=387"}, +} + // runEnv - run a shell command with env func runEnv(args, env []string) { if *debug { @@ -60,6 +65,9 @@ func runEnv(args, env []string) { if env != nil { cmd.Env = append(os.Environ(), env...) } + if *debug { + log.Printf("args = %v, env = %v\n", args, cmd.Env) + } err := cmd.Run() if err != nil { log.Fatalf("Failed to run %v: %v", args, err) @@ -94,6 +102,9 @@ func compileArch(version, goos, goarch, dir string) { "GOARCH=" + goarch, "CGO_ENABLED=0", } + if flags, ok := archFlags[goarch]; ok { + env = append(env, flags...) + } runEnv(args, env) // Now build the zip run("cp", "-a", "../MANUAL.txt", filepath.Join(dir, "README.txt"))